141edb306SCy Schubert 241edb306SCy Schubert /* 341edb306SCy Schubert * ipsend.h (C) 1997-1998 Darren Reed 441edb306SCy Schubert * 541edb306SCy Schubert * This was written to test what size TCP fragments would get through 641edb306SCy Schubert * various TCP/IP packet filters, as used in IP firewalls. In certain 741edb306SCy Schubert * conditions, enough of the TCP header is missing for unpredictable 841edb306SCy Schubert * results unless the filter is aware that this can happen. 941edb306SCy Schubert * 10*843fe489SElyes Haouas * The author provides this program as-is, with no guarantee for its 1141edb306SCy Schubert * suitability for any specific purpose. The author takes no responsibility 1241edb306SCy Schubert * for the misuse/abuse of this program and provides it for the sole purpose 1341edb306SCy Schubert * of testing packet filter policies. This file maybe distributed freely 1441edb306SCy Schubert * providing it is not modified and that this notice remains in tact. 1541edb306SCy Schubert * 1641edb306SCy Schubert */ 1741edb306SCy Schubert #ifndef __P 1841edb306SCy Schubert # define __P(x) x 1941edb306SCy Schubert #endif 2041edb306SCy Schubert 2141edb306SCy Schubert #include <net/if.h> 2241edb306SCy Schubert 2341edb306SCy Schubert #include "ipf.h" 2441edb306SCy Schubert /* XXX: The following is needed by tcpip.h */ 2541edb306SCy Schubert #include <netinet/ip_var.h> 2641edb306SCy Schubert #include "netinet/tcpip.h" 2741edb306SCy Schubert #include "ipt.h" 2841edb306SCy Schubert 2941edb306SCy Schubert extern int resolve(char *, char *); 3041edb306SCy Schubert extern int arp(char *, char *); 3141edb306SCy Schubert extern u_short chksum(u_short *, int); 3241edb306SCy Schubert extern int send_ether(int, char *, int, struct in_addr); 3341edb306SCy Schubert extern int send_ip(int, int, ip_t *, struct in_addr, int); 3441edb306SCy Schubert extern int send_tcp(int, int, ip_t *, struct in_addr); 3541edb306SCy Schubert extern int send_udp(int, int, ip_t *, struct in_addr); 3641edb306SCy Schubert extern int send_icmp(int, int, ip_t *, struct in_addr); 3741edb306SCy Schubert extern int send_packet(int, int, ip_t *, struct in_addr); 3841edb306SCy Schubert extern int send_packets(char *, int, ip_t *, struct in_addr); 3941edb306SCy Schubert extern u_short ipseclevel(char *); 4041edb306SCy Schubert extern u_32_t buildopts(char *, char *, int); 4141edb306SCy Schubert extern int addipopt(char *, struct ipopt_names *, int, char *); 4241edb306SCy Schubert extern int initdevice(char *, int); 4341edb306SCy Schubert extern int sendip(int, char *, int); 4441edb306SCy Schubert extern struct tcpcb *find_tcp(int, struct tcpiphdr *); 4541edb306SCy Schubert extern int ip_resend(char *, int, struct ipread *, struct in_addr, char *); 4641edb306SCy Schubert 4741edb306SCy Schubert extern void ip_test1(char *, int, ip_t *, struct in_addr, int); 4841edb306SCy Schubert extern void ip_test2(char *, int, ip_t *, struct in_addr, int); 4941edb306SCy Schubert extern void ip_test3(char *, int, ip_t *, struct in_addr, int); 5041edb306SCy Schubert extern void ip_test4(char *, int, ip_t *, struct in_addr, int); 5141edb306SCy Schubert extern void ip_test5(char *, int, ip_t *, struct in_addr, int); 5241edb306SCy Schubert extern void ip_test6(char *, int, ip_t *, struct in_addr, int); 5341edb306SCy Schubert extern void ip_test7(char *, int, ip_t *, struct in_addr, int); 5441edb306SCy Schubert extern int do_socket(char *, int, struct tcpiphdr *, struct in_addr); 5541edb306SCy Schubert extern int kmemcpy(char *, void *, int); 5641edb306SCy Schubert 5741edb306SCy Schubert #define KMCPY(a,b,c) kmemcpy((char *)(a), (void *)(b), (int)(c)) 5841edb306SCy Schubert 5941edb306SCy Schubert #ifndef OPT_RAW 6041edb306SCy Schubert #define OPT_RAW 0x80000 6141edb306SCy Schubert #endif 62