1145519Sdarrenr/*	$FreeBSD$	*/
2145510Sdarrenr
324583Sdarrenr/*
453024Sguido * ipsend.h (C) 1997-1998 Darren Reed
524583Sdarrenr *
624583Sdarrenr * This was written to test what size TCP fragments would get through
724583Sdarrenr * various TCP/IP packet filters, as used in IP firewalls.  In certain
824583Sdarrenr * conditions, enough of the TCP header is missing for unpredictable
924583Sdarrenr * results unless the filter is aware that this can happen.
1024583Sdarrenr *
11145510Sdarrenr * The author provides this program as-is, with no gaurantee for its
12145510Sdarrenr * suitability for any specific purpose.  The author takes no responsibility
13145510Sdarrenr * for the misuse/abuse of this program and provides it for the sole purpose
14145510Sdarrenr * of testing packet filter policies.  This file maybe distributed freely
15145510Sdarrenr * providing it is not modified and that this notice remains in tact.
1624583Sdarrenr *
1724583Sdarrenr */
1824583Sdarrenr#ifndef	__P
1924583Sdarrenr# ifdef	__STDC__
2024583Sdarrenr#  define	__P(x)	x
2124583Sdarrenr# else
2224583Sdarrenr#  define	__P(x)	()
2324583Sdarrenr# endif
2424583Sdarrenr#endif
2524583Sdarrenr
26145510Sdarrenr#include <net/if.h>
27145510Sdarrenr
28145510Sdarrenr#include "ipf.h"
2924583Sdarrenr#ifdef	linux
3024583Sdarrenr#include <linux/sockios.h>
3124583Sdarrenr#endif
3224583Sdarrenr#include "tcpip.h"
3324583Sdarrenr#include "ipt.h"
3424583Sdarrenr
3524583Sdarrenrextern	int	resolve __P((char *, char *));
3624583Sdarrenrextern	int	arp __P((char *, char *));
3724583Sdarrenrextern	u_short	chksum __P((u_short *, int));
3824583Sdarrenrextern	int	send_ether __P((int, char *, int, struct in_addr));
3924583Sdarrenrextern	int	send_ip __P((int, int, ip_t *, struct in_addr, int));
4024583Sdarrenrextern	int	send_tcp __P((int, int, ip_t *, struct in_addr));
4124583Sdarrenrextern	int	send_udp __P((int, int, ip_t *, struct in_addr));
4224583Sdarrenrextern	int	send_icmp __P((int, int, ip_t *, struct in_addr));
4324583Sdarrenrextern	int	send_packet __P((int, int, ip_t *, struct in_addr));
4424583Sdarrenrextern	int	send_packets __P((char *, int, ip_t *, struct in_addr));
45145510Sdarrenrextern	u_short	ipseclevel __P((char *));
4631183Speterextern	u_32_t	buildopts __P((char *, char *, int));
4731183Speterextern	int	addipopt __P((char *, struct ipopt_names *, int, char *));
48145510Sdarrenrextern	int	initdevice __P((char *, int));
4924583Sdarrenrextern	int	sendip __P((int, char *, int));
5024583Sdarrenr#ifdef	linux
5124583Sdarrenrextern	struct	sock	*find_tcp __P((int, struct tcpiphdr *));
5224583Sdarrenr#else
5324583Sdarrenrextern	struct	tcpcb	*find_tcp __P((int, struct tcpiphdr *));
5424583Sdarrenr#endif
5524583Sdarrenrextern	int	ip_resend __P((char *, int, struct ipread *, struct in_addr, char *));
5624583Sdarrenr
5724583Sdarrenrextern	void	ip_test1 __P((char *, int, ip_t *, struct in_addr, int));
5824583Sdarrenrextern	void	ip_test2 __P((char *, int, ip_t *, struct in_addr, int));
5924583Sdarrenrextern	void	ip_test3 __P((char *, int, ip_t *, struct in_addr, int));
6024583Sdarrenrextern	void	ip_test4 __P((char *, int, ip_t *, struct in_addr, int));
6124583Sdarrenrextern	void	ip_test5 __P((char *, int, ip_t *, struct in_addr, int));
6224583Sdarrenrextern	void	ip_test6 __P((char *, int, ip_t *, struct in_addr, int));
6324583Sdarrenrextern	void	ip_test7 __P((char *, int, ip_t *, struct in_addr, int));
6424583Sdarrenrextern	int	do_socket __P((char *, int, struct tcpiphdr *, struct in_addr));
6524583Sdarrenrextern	int	kmemcpy __P((char *, void *, int));
6624583Sdarrenr
6724583Sdarrenr#define	KMCPY(a,b,c)	kmemcpy((char *)(a), (void *)(b), (int)(c))
6831183Speter
6953024Sguido#ifndef	OPT_RAW
7031183Speter#define	OPT_RAW	0x80000
7153024Sguido#endif
72