ip.h revision c005246ed03de874fdc432073ba8e5e8ebfed922
18cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd/*
28cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * Copyright (c) 1982, 1986, 1993
38cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd *	The Regents of the University of California.  All rights reserved.
48cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd *
58cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * Redistribution and use in source and binary forms, with or without
68cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * modification, are permitted provided that the following conditions
78cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * are met:
88cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * 1. Redistributions of source code must retain the above copyright
98cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd *    notice, this list of conditions and the following disclaimer.
108cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * 2. Redistributions in binary form must reproduce the above copyright
118cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd *    notice, this list of conditions and the following disclaimer in the
128cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd *    documentation and/or other materials provided with the distribution.
138cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * 3. Neither the name of the University nor the names of its contributors
148cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd *    may be used to endorse or promote products derived from this software
158cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd *    without specific prior written permission.
168cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd *
178cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
188cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
198cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
208cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
218cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
228cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
238cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
248cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
258cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
268cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
278cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * SUCH DAMAGE.
288cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd *
298cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd *	@(#)ip.h	8.1 (Berkeley) 6/10/93
308cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * ip.h,v 1.3 1994/08/21 05:27:30 paul Exp
318cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd */
328cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd
338cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#ifndef _IP_H_
348cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define _IP_H_
358cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd
368cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#include "helper.h"
378cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd
388cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#ifdef HOST_WORDS_BIGENDIAN
398cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd# ifndef NTOHL
408cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#  define NTOHL(d)
418cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd# endif
428cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd# ifndef NTOHS
438cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#  define NTOHS(d)
448cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd# endif
458cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd# ifndef HTONL
468cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#  define HTONL(d)
478cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd# endif
488cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd# ifndef HTONS
498cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#  define HTONS(d)
508cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd# endif
518cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#else
528cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd# ifndef NTOHL
538cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#  define NTOHL(d) ((d) = ntohl((d)))
548cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd# endif
558cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd# ifndef NTOHS
568cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#  define NTOHS(d) ((d) = ntohs((u_int16_t)(d)))
578cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd# endif
588cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd# ifndef HTONL
598cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#  define HTONL(d) ((d) = htonl((d)))
608cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd# endif
618cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd# ifndef HTONS
628cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#  define HTONS(d) ((d) = htons((u_int16_t)(d)))
638cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd# endif
648cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#endif
658cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd
668cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Doddtypedef u_int32_t n_long;                 /* long as received from the net */
678cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd
688cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd/*
698cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * Definitions for internet protocol version 4.
708cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * Per RFC 791, September 1981.
718cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd */
728cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IPVERSION	4
738cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd
748cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd/*
758cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * Structure of an internet header, naked of options.
768cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd */
778cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Doddstruct ip {
788cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#ifdef HOST_WORDS_BIGENDIAN
798cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	u_int ip_v:4;		/* version */
808cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	u_int ip_hl:4;		/* header length */
818cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#else
828cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	u_int ip_hl:4;		/* header length */
838cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	u_int ip_v:4;		/* version */
848cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#endif
858cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	u_int8_t  ip_tos;			/* type of service */
868cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	u_int16_t	ip_len;			/* total length */
878cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	u_int16_t	ip_id;			/* identification */
888cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	u_int16_t	ip_off;			/* fragment offset field */
898cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IP_DF 0x4000			/* don't fragment flag */
908cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IP_MF 0x2000			/* more fragments flag */
918cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IP_OFFMASK 0x1fff		/* mask for fragmenting bits */
928cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	u_int8_t ip_ttl;			/* time to live */
938cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	u_int8_t ip_p;			/* protocol */
948cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	u_int16_t	ip_sum;			/* checksum */
958cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd    ipaddr_t        ip_src, ip_dst; /* source and dest address */
968cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd};
978cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd
988cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IP_MAXPACKET	65535		/* maximum packet size */
998cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd
1008cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd/*
1018cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * Definitions for IP type of service (ip_tos)
1028cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd */
1038cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IPTOS_LOWDELAY		0x10
1048cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IPTOS_THROUGHPUT	0x08
1058cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IPTOS_RELIABILITY	0x04
1068cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd
1078cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd/*
1088cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * Definitions for options.
1098cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd */
1108cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IPOPT_COPIED(o)		((o)&0x80)
1118cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IPOPT_CLASS(o)		((o)&0x60)
1128cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IPOPT_NUMBER(o)		((o)&0x1f)
1138cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd
1148cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IPOPT_CONTROL		0x00
1158cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IPOPT_RESERVED1		0x20
1168cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IPOPT_DEBMEAS		0x40
1178cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IPOPT_RESERVED2		0x60
1188cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd
1198cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IPOPT_EOL		0		/* end of option list */
1208cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IPOPT_NOP		1		/* no operation */
1218cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd
1228cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IPOPT_RR		7		/* record packet route */
1238cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IPOPT_TS		68		/* timestamp */
1248cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IPOPT_SECURITY		130		/* provide s,c,h,tcc */
1258cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IPOPT_LSRR		131		/* loose source route */
1268cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IPOPT_SATID		136		/* satnet id */
1278cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IPOPT_SSRR		137		/* strict source route */
1288cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd
1298cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd/*
1308cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * Offsets to fields in options other than EOL and NOP.
1318cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd */
1328cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IPOPT_OPTVAL		0		/* option ID */
1338cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IPOPT_OLEN		1		/* option length */
1348cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define IPOPT_OFFSET		2		/* offset within option */
1358cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IPOPT_MINOFF		4		/* min value of above */
1368cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd
1378cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd/*
1388cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd * Time stamp option structure.
1398cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd */
1408cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Doddstruct	ip_timestamp {
1418cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	u_int8_t	ipt_code;		/* IPOPT_TS */
1428cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	u_int8_t	ipt_len;		/* size of structure (variable) */
1438cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	u_int8_t	ipt_ptr;		/* index of current entry */
1448cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#ifdef HOST_WORDS_BIGENDIAN
1458cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	u_int	ipt_oflw:4,		/* overflow counter */
1468cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd		ipt_flg:4;		/* flags, see below */
1478cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#else
1488cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	u_int	ipt_flg:4,		/* flags, see below */
1498cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd		ipt_oflw:4;		/* overflow counter */
1508cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#endif
1518cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	union ipt_timestamp {
1528cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd		n_long	ipt_time[1];
1538cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd		struct	ipt_ta {
1548cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd			ipaddr_t ipt_addr;
1558cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd			n_long   ipt_time;
1568cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd		} ipt_ta[1];
1578cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd	} ipt_timestamp;
1588cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd};
1598cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd
1608cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd/* flag bits for ipt_flg */
1618cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IPOPT_TS_TSONLY		0		/* timestamps only */
1628cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IPOPT_TS_TSANDADDR	1		/* timestamps and addresses */
1638cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd#define	IPOPT_TS_PRESPEC	3		/* specified modules only */
1648cfa702f803c5ef6a2b062a489a1b2cf66b45b5eMike Dodd
165/* bits for security (not byte swapped) */
166#define	IPOPT_SECUR_UNCLASS	0x0000
167#define	IPOPT_SECUR_CONFID	0xf135
168#define	IPOPT_SECUR_EFTO	0x789a
169#define	IPOPT_SECUR_MMMM	0xbc4d
170#define	IPOPT_SECUR_RESTR	0xaf13
171#define	IPOPT_SECUR_SECRET	0xd788
172#define	IPOPT_SECUR_TOPSECRET	0x6bc5
173
174/*
175 * Internet implementation parameters.
176 */
177#define	MAXTTL		255		/* maximum time to live (seconds) */
178#define	IPDEFTTL	64		/* default ttl, from RFC 1340 */
179#define	IPFRAGTTL	60		/* time to live for frags, slowhz */
180#define	IPTTLDEC	1		/* subtracted when forwarding */
181
182#define	IP_MSS		576		/* default maximum segment size */
183
184#if SIZEOF_CHAR_P == 4
185struct mbuf_ptr {
186	struct mbuf *mptr;
187	uint32_t dummy;
188};
189#else
190struct mbuf_ptr {
191	struct mbuf *mptr;
192};
193#endif
194struct qlink {
195	void *next, *prev;
196};
197
198/*
199 * Overlay for ip header used by other protocols (tcp, udp).
200 */
201struct ipovly {
202	struct mbuf_ptr ih_mbuf;	/* backpointer to mbuf */
203	u_int8_t	ih_x1;			/* (unused) */
204	u_int8_t	ih_pr;			/* protocol */
205	u_int16_t	ih_len;			/* protocol length */
206	ipaddr_t        ih_src;		/* source internet address */
207	ipaddr_t        ih_dst;		/* destination internet address */
208} __attribute__((packed));
209
210/*
211 * Ip reassembly queue structure.  Each fragment
212 * being reassembled is attached to one of these structures.
213 * They are timed out after ipq_ttl drops to 0, and may also
214 * be reclaimed if memory becomes tight.
215 * size 28 bytes
216 */
217struct ipq {
218        struct qlink frag_link;			/* to ip headers of fragments */
219	struct qlink ip_link;				/* to other reass headers */
220	u_int8_t	ipq_ttl;		/* time for reass q to live */
221	u_int8_t	ipq_p;			/* protocol of this fragment */
222	u_int16_t	ipq_id;			/* sequence id for reassembly */
223	ipaddr_t        ipq_src,ipq_dst;
224};
225
226/*
227 * Ip header, when holding a fragment.
228 *
229 * Note: ipf_link must be at same offset as frag_link above
230 */
231struct	ipasfrag {
232	struct qlink ipf_link;
233	struct ip ipf_ip;
234};
235
236#define ipf_off      ipf_ip.ip_off
237#define ipf_tos      ipf_ip.ip_tos
238#define ipf_len      ipf_ip.ip_len
239#define ipf_next     ipf_link.next
240#define ipf_prev     ipf_link.prev
241
242/*
243 * Structure stored in mbuf in inpcb.ip_options
244 * and passed to ip_output when ip options are in use.
245 * The actual length of the options (including ipopt_dst)
246 * is in m_len.
247 */
248#define MAX_IPOPTLEN	40
249
250struct ipoption {
251	u_int32_t ipopt_dst;	/* first-hop dst if source routed */
252	int8_t	  ipopt_list[MAX_IPOPTLEN];	/* options proper */
253};
254
255#ifdef LOG_ENABLED
256/*
257 * Structure attached to inpcb.ip_moptions and
258 * passed to ip_output when IP multicast options are in use.
259 */
260
261struct	ipstat {
262	u_long	ips_total;		/* total packets received */
263	u_long	ips_badsum;		/* checksum bad */
264	u_long	ips_tooshort;		/* packet too short */
265	u_long	ips_toosmall;		/* not enough data */
266	u_long	ips_badhlen;		/* ip header length < data size */
267	u_long	ips_badlen;		/* ip length < ip header length */
268	u_long	ips_fragments;		/* fragments received */
269	u_long	ips_fragdropped;	/* frags dropped (dups, out of space) */
270	u_long	ips_fragtimeout;	/* fragments timed out */
271	u_long	ips_forward;		/* packets forwarded */
272	u_long	ips_cantforward;	/* packets rcvd for unreachable dest */
273	u_long	ips_redirectsent;	/* packets forwarded on same net */
274	u_long	ips_noproto;		/* unknown or unsupported protocol */
275	u_long	ips_delivered;		/* datagrams delivered to upper level*/
276	u_long	ips_localout;		/* total ip packets generated here */
277	u_long	ips_odropped;		/* lost packets due to nobufs, etc. */
278	u_long	ips_reassembled;	/* total packets reassembled ok */
279	u_long	ips_fragmented;		/* datagrams successfully fragmented */
280	u_long	ips_ofragments;		/* output fragments created */
281	u_long	ips_cantfrag;		/* don't fragment flag was set, etc. */
282	u_long	ips_badoptions;		/* error in option processing */
283	u_long	ips_noroute;		/* packets discarded due to no route */
284	u_long	ips_badvers;		/* ip version != 4 */
285	u_long	ips_rawout;		/* total raw ip packets generated */
286	u_long	ips_unaligned;		/* times the ip packet was not aligned */
287};
288
289extern struct	ipstat	ipstat;
290#endif
291
292extern struct	ipq	ipq;			/* ip reass. queue */
293extern u_int16_t	ip_id;				/* ip packet ctr, for ids */
294
295#endif
296