1*fef18fabSchristos /* $NetBSD: ipsend.h,v 1.2 2018/04/29 15:59:07 christos Exp $ */ 2bc4097aaSchristos 3bc4097aaSchristos /* 4bc4097aaSchristos * ipsend.h (C) 1997-1998 Darren Reed 5bc4097aaSchristos * 6bc4097aaSchristos * This was written to test what size TCP fragments would get through 7bc4097aaSchristos * various TCP/IP packet filters, as used in IP firewalls. In certain 8bc4097aaSchristos * conditions, enough of the TCP header is missing for unpredictable 9bc4097aaSchristos * results unless the filter is aware that this can happen. 10bc4097aaSchristos * 11bc4097aaSchristos * The author provides this program as-is, with no gaurantee for its 12bc4097aaSchristos * suitability for any specific purpose. The author takes no responsibility 13bc4097aaSchristos * for the misuse/abuse of this program and provides it for the sole purpose 14bc4097aaSchristos * of testing packet filter policies. This file maybe distributed freely 15bc4097aaSchristos * providing it is not modified and that this notice remains in tact. 16bc4097aaSchristos * 17bc4097aaSchristos */ 18bc4097aaSchristos #ifndef __P 19bc4097aaSchristos # ifdef __STDC__ 20bc4097aaSchristos # define __P(x) x 21bc4097aaSchristos # else 22bc4097aaSchristos # define __P(x) () 23bc4097aaSchristos # endif 24bc4097aaSchristos #endif 25bc4097aaSchristos 26bc4097aaSchristos #include <net/if.h> 27bc4097aaSchristos 28bc4097aaSchristos #include "ipf.h" 29bc4097aaSchristos #ifdef linux 30bc4097aaSchristos #include <linux/sockios.h> 31bc4097aaSchristos #endif 32*fef18fabSchristos #include <netinet/tcp_timer.h> 33*fef18fabSchristos #include <netinet/tcp_var.h> 34*fef18fabSchristos #include <netinet/tcpip.h> 35bc4097aaSchristos #include "ipt.h" 36bc4097aaSchristos 37bc4097aaSchristos extern int resolve __P((char *, char *)); 38bc4097aaSchristos extern int arp __P((char *, char *)); 39bc4097aaSchristos extern u_short chksum __P((u_short *, int)); 40bc4097aaSchristos extern int send_ether __P((int, char *, int, struct in_addr)); 41bc4097aaSchristos extern int send_ip __P((int, int, ip_t *, struct in_addr, int)); 42bc4097aaSchristos extern int send_tcp __P((int, int, ip_t *, struct in_addr)); 43bc4097aaSchristos extern int send_udp __P((int, int, ip_t *, struct in_addr)); 44bc4097aaSchristos extern int send_icmp __P((int, int, ip_t *, struct in_addr)); 45bc4097aaSchristos extern int send_packet __P((int, int, ip_t *, struct in_addr)); 46bc4097aaSchristos extern int send_packets __P((char *, int, ip_t *, struct in_addr)); 47bc4097aaSchristos extern u_short ipseclevel __P((char *)); 48bc4097aaSchristos extern u_32_t buildopts __P((char *, char *, int)); 49bc4097aaSchristos extern int addipopt __P((char *, struct ipopt_names *, int, char *)); 50bc4097aaSchristos extern int initdevice __P((char *, int)); 51bc4097aaSchristos extern int sendip __P((int, char *, int)); 52bc4097aaSchristos #ifdef linux 53bc4097aaSchristos extern struct sock *find_tcp __P((int, struct tcpiphdr *)); 54bc4097aaSchristos #else 55bc4097aaSchristos extern struct tcpcb *find_tcp __P((int, struct tcpiphdr *)); 56bc4097aaSchristos #endif 57bc4097aaSchristos extern int ip_resend __P((char *, int, struct ipread *, struct in_addr, char *)); 58bc4097aaSchristos 59bc4097aaSchristos extern void ip_test1 __P((char *, int, ip_t *, struct in_addr, int)); 60bc4097aaSchristos extern void ip_test2 __P((char *, int, ip_t *, struct in_addr, int)); 61bc4097aaSchristos extern void ip_test3 __P((char *, int, ip_t *, struct in_addr, int)); 62bc4097aaSchristos extern void ip_test4 __P((char *, int, ip_t *, struct in_addr, int)); 63bc4097aaSchristos extern void ip_test5 __P((char *, int, ip_t *, struct in_addr, int)); 64bc4097aaSchristos extern void ip_test6 __P((char *, int, ip_t *, struct in_addr, int)); 65bc4097aaSchristos extern void ip_test7 __P((char *, int, ip_t *, struct in_addr, int)); 66bc4097aaSchristos extern int do_socket __P((char *, int, struct tcpiphdr *, struct in_addr)); 67bc4097aaSchristos extern int kmemcpy __P((char *, void *, int)); 68bc4097aaSchristos 69bc4097aaSchristos #define KMCPY(a,b,c) kmemcpy((char *)(a), (void *)(b), (int)(c)) 70bc4097aaSchristos 71bc4097aaSchristos #ifndef OPT_RAW 72bc4097aaSchristos #define OPT_RAW 0x80000 73bc4097aaSchristos #endif 74