ip.h revision 61295d7d43bad84b52068f08d8d2339d0ae9fe06
af062818b47340eef15700d2f0211576ba3506eevboxsync/*
af062818b47340eef15700d2f0211576ba3506eevboxsync * Copyright (c) 1982, 1986, 1993
af062818b47340eef15700d2f0211576ba3506eevboxsync * The Regents of the University of California. All rights reserved.
af062818b47340eef15700d2f0211576ba3506eevboxsync *
af062818b47340eef15700d2f0211576ba3506eevboxsync * Redistribution and use in source and binary forms, with or without
af062818b47340eef15700d2f0211576ba3506eevboxsync * modification, are permitted provided that the following conditions
af062818b47340eef15700d2f0211576ba3506eevboxsync * are met:
af062818b47340eef15700d2f0211576ba3506eevboxsync * 1. Redistributions of source code must retain the above copyright
af062818b47340eef15700d2f0211576ba3506eevboxsync * notice, this list of conditions and the following disclaimer.
af062818b47340eef15700d2f0211576ba3506eevboxsync * 2. Redistributions in binary form must reproduce the above copyright
af062818b47340eef15700d2f0211576ba3506eevboxsync * notice, this list of conditions and the following disclaimer in the
af062818b47340eef15700d2f0211576ba3506eevboxsync * documentation and/or other materials provided with the distribution.
af062818b47340eef15700d2f0211576ba3506eevboxsync * 3. All advertising materials mentioning features or use of this software
af062818b47340eef15700d2f0211576ba3506eevboxsync * must display the following acknowledgement:
af062818b47340eef15700d2f0211576ba3506eevboxsync * This product includes software developed by the University of
af062818b47340eef15700d2f0211576ba3506eevboxsync * California, Berkeley and its contributors.
af062818b47340eef15700d2f0211576ba3506eevboxsync * 4. Neither the name of the University nor the names of its contributors
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * may be used to endorse or promote products derived from this software
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * without specific prior written permission.
4b9d6701570cb98fd36e209314239d104ec584d3vboxsync *
4b9d6701570cb98fd36e209314239d104ec584d3vboxsync * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
ee6bcfc59fe3b0230aad85e2ef63d0402b7719b2vboxsync * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
af062818b47340eef15700d2f0211576ba3506eevboxsync * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
af062818b47340eef15700d2f0211576ba3506eevboxsync * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
af062818b47340eef15700d2f0211576ba3506eevboxsync * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
af062818b47340eef15700d2f0211576ba3506eevboxsync * SUCH DAMAGE.
af062818b47340eef15700d2f0211576ba3506eevboxsync *
af062818b47340eef15700d2f0211576ba3506eevboxsync * @(#)ip.h 8.1 (Berkeley) 6/10/93
af062818b47340eef15700d2f0211576ba3506eevboxsync * ip.h,v 1.3 1994/08/21 05:27:30 paul Exp
af062818b47340eef15700d2f0211576ba3506eevboxsync */
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifndef _IP_H_
af062818b47340eef15700d2f0211576ba3506eevboxsync#define _IP_H_
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifdef VBOX_WITH_BSD_REASS
af062818b47340eef15700d2f0211576ba3506eevboxsync# include "queue.h"
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifdef WORDS_BIGENDIAN
af062818b47340eef15700d2f0211576ba3506eevboxsync# ifndef NTOHL
af062818b47340eef15700d2f0211576ba3506eevboxsync# define NTOHL(d)
af062818b47340eef15700d2f0211576ba3506eevboxsync# endif
af062818b47340eef15700d2f0211576ba3506eevboxsync# ifndef NTOHS
af062818b47340eef15700d2f0211576ba3506eevboxsync# define NTOHS(d)
af062818b47340eef15700d2f0211576ba3506eevboxsync# endif
af062818b47340eef15700d2f0211576ba3506eevboxsync# ifndef HTONL
af062818b47340eef15700d2f0211576ba3506eevboxsync# define HTONL(d)
af062818b47340eef15700d2f0211576ba3506eevboxsync# endif
af062818b47340eef15700d2f0211576ba3506eevboxsync# ifndef HTONS
af062818b47340eef15700d2f0211576ba3506eevboxsync# define HTONS(d)
af062818b47340eef15700d2f0211576ba3506eevboxsync# endif
af062818b47340eef15700d2f0211576ba3506eevboxsync#else
af062818b47340eef15700d2f0211576ba3506eevboxsync# ifndef NTOHL
af062818b47340eef15700d2f0211576ba3506eevboxsync# define NTOHL(d) ((d) = ntohl((d)))
af062818b47340eef15700d2f0211576ba3506eevboxsync# endif
af062818b47340eef15700d2f0211576ba3506eevboxsync# ifndef NTOHS
af062818b47340eef15700d2f0211576ba3506eevboxsync# define NTOHS(d) ((d) = ntohs((u_int16_t)(d)))
af062818b47340eef15700d2f0211576ba3506eevboxsync# endif
af062818b47340eef15700d2f0211576ba3506eevboxsync# ifndef HTONL
af062818b47340eef15700d2f0211576ba3506eevboxsync# define HTONL(d) ((d) = htonl((d)))
af062818b47340eef15700d2f0211576ba3506eevboxsync# endif
af062818b47340eef15700d2f0211576ba3506eevboxsync# ifndef HTONS
af062818b47340eef15700d2f0211576ba3506eevboxsync# define HTONS(d) ((d) = htons((u_int16_t)(d)))
af062818b47340eef15700d2f0211576ba3506eevboxsync# endif
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync/*
af062818b47340eef15700d2f0211576ba3506eevboxsync * Definitions for internet protocol version 4.
af062818b47340eef15700d2f0211576ba3506eevboxsync * Per RFC 791, September 1981.
af062818b47340eef15700d2f0211576ba3506eevboxsync */
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPVERSION 4
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync/*
af062818b47340eef15700d2f0211576ba3506eevboxsync * Structure of an internet header, naked of options.
af062818b47340eef15700d2f0211576ba3506eevboxsync */
af062818b47340eef15700d2f0211576ba3506eevboxsyncstruct ip
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifdef WORDS_BIGENDIAN
af062818b47340eef15700d2f0211576ba3506eevboxsync# ifdef _MSC_VER
af062818b47340eef15700d2f0211576ba3506eevboxsync uint8_t ip_v:4; /* version */
af062818b47340eef15700d2f0211576ba3506eevboxsync uint8_t ip_hl:4; /* header length */
af062818b47340eef15700d2f0211576ba3506eevboxsync# else
af062818b47340eef15700d2f0211576ba3506eevboxsync unsigned ip_v:4; /* version */
af062818b47340eef15700d2f0211576ba3506eevboxsync unsigned ip_hl:4; /* header length */
af062818b47340eef15700d2f0211576ba3506eevboxsync# endif
af062818b47340eef15700d2f0211576ba3506eevboxsync#else
af062818b47340eef15700d2f0211576ba3506eevboxsync# ifdef _MSC_VER
af062818b47340eef15700d2f0211576ba3506eevboxsync uint8_t ip_hl:4; /* header length */
af062818b47340eef15700d2f0211576ba3506eevboxsync uint8_t ip_v:4; /* version */
af062818b47340eef15700d2f0211576ba3506eevboxsync# else
af062818b47340eef15700d2f0211576ba3506eevboxsync unsigned ip_hl:4; /* header length */
af062818b47340eef15700d2f0211576ba3506eevboxsync unsigned ip_v:4; /* version */
af062818b47340eef15700d2f0211576ba3506eevboxsync# endif
af062818b47340eef15700d2f0211576ba3506eevboxsync#endif
af062818b47340eef15700d2f0211576ba3506eevboxsync uint8_t ip_tos; /* type of service */
af062818b47340eef15700d2f0211576ba3506eevboxsync uint16_t ip_len; /* total length */
af062818b47340eef15700d2f0211576ba3506eevboxsync uint16_t ip_id; /* identification */
af062818b47340eef15700d2f0211576ba3506eevboxsync uint16_t ip_off; /* fragment offset field */
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IP_DF 0x4000 /* don't fragment flag */
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IP_MF 0x2000 /* more fragments flag */
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
af062818b47340eef15700d2f0211576ba3506eevboxsync uint8_t ip_ttl; /* time to live */
af062818b47340eef15700d2f0211576ba3506eevboxsync uint8_t ip_p; /* protocol */
af062818b47340eef15700d2f0211576ba3506eevboxsync uint16_t ip_sum; /* checksum */
af062818b47340eef15700d2f0211576ba3506eevboxsync struct in_addr ip_src; /* source address */
af062818b47340eef15700d2f0211576ba3506eevboxsync struct in_addr ip_dst; /* destination address */
af062818b47340eef15700d2f0211576ba3506eevboxsync};
af062818b47340eef15700d2f0211576ba3506eevboxsyncAssertCompileSize(struct ip, 20);
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IP_MAXPACKET 65535 /* maximum packet size */
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync/*
af062818b47340eef15700d2f0211576ba3506eevboxsync * Definitions for IP type of service (ip_tos)
af062818b47340eef15700d2f0211576ba3506eevboxsync */
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPTOS_LOWDELAY 0x10
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPTOS_THROUGHPUT 0x08
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPTOS_RELIABILITY 0x04
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync/*
af062818b47340eef15700d2f0211576ba3506eevboxsync * Definitions for options.
af062818b47340eef15700d2f0211576ba3506eevboxsync */
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_COPIED(o) ((o)&0x80)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_CLASS(o) ((o)&0x60)
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_NUMBER(o) ((o)&0x1f)
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_CONTROL 0x00
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_RESERVED1 0x20
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_DEBMEAS 0x40
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_RESERVED2 0x60
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_EOL 0 /* end of option list */
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_NOP 1 /* no operation */
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_RR 7 /* record packet route */
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_TS 68 /* timestamp */
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_LSRR 131 /* loose source route */
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_SATID 136 /* satnet id */
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_SSRR 137 /* strict source route */
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync/*
af062818b47340eef15700d2f0211576ba3506eevboxsync * Offsets to fields in options other than EOL and NOP.
af062818b47340eef15700d2f0211576ba3506eevboxsync */
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_OPTVAL 0 /* option ID */
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_OLEN 1 /* option length */
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_OFFSET 2 /* offset within option */
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_MINOFF 4 /* min value of above */
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync/*
af062818b47340eef15700d2f0211576ba3506eevboxsync * Time stamp option structure.
af062818b47340eef15700d2f0211576ba3506eevboxsync */
af062818b47340eef15700d2f0211576ba3506eevboxsyncstruct ip_timestamp
af062818b47340eef15700d2f0211576ba3506eevboxsync{
af062818b47340eef15700d2f0211576ba3506eevboxsync uint8_t ipt_code; /* IPOPT_TS */
af062818b47340eef15700d2f0211576ba3506eevboxsync uint8_t ipt_len; /* size of structure (variable) */
af062818b47340eef15700d2f0211576ba3506eevboxsync uint8_t ipt_ptr; /* index of current entry */
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifdef WORDS_BIGENDIAN
af062818b47340eef15700d2f0211576ba3506eevboxsync# ifdef _MSC_VER
af062818b47340eef15700d2f0211576ba3506eevboxsync uint8_t ipt_oflw:4; /* overflow counter */
af062818b47340eef15700d2f0211576ba3506eevboxsync uint8_t ipt_flg:4; /* flags, see below */
af062818b47340eef15700d2f0211576ba3506eevboxsync# else
af062818b47340eef15700d2f0211576ba3506eevboxsync unsigned ipt_oflw:4; /* overflow counter */
af062818b47340eef15700d2f0211576ba3506eevboxsync unsigned ipt_flg:4; /* flags, see below */
af062818b47340eef15700d2f0211576ba3506eevboxsync# endif
af062818b47340eef15700d2f0211576ba3506eevboxsync#else
af062818b47340eef15700d2f0211576ba3506eevboxsync# ifdef _MSC_VER
af062818b47340eef15700d2f0211576ba3506eevboxsync uint8_t ipt_flg:4; /* flags, see below */
af062818b47340eef15700d2f0211576ba3506eevboxsync uint8_t ipt_oflw:4; /* overflow counter */
af062818b47340eef15700d2f0211576ba3506eevboxsync# else
af062818b47340eef15700d2f0211576ba3506eevboxsync unsigned ipt_flg:4; /* flags, see below */
554f00fe75489f3f3ce7fbb6d126ce1d2c5c922cvboxsync unsigned ipt_oflw:4; /* overflow counter */
af062818b47340eef15700d2f0211576ba3506eevboxsync# endif
554f00fe75489f3f3ce7fbb6d126ce1d2c5c922cvboxsync#endif
af062818b47340eef15700d2f0211576ba3506eevboxsync union ipt_timestamp
af062818b47340eef15700d2f0211576ba3506eevboxsync {
af062818b47340eef15700d2f0211576ba3506eevboxsync uint32_t ipt_time[1];
af062818b47340eef15700d2f0211576ba3506eevboxsync struct ipt_ta
af062818b47340eef15700d2f0211576ba3506eevboxsync {
af062818b47340eef15700d2f0211576ba3506eevboxsync struct in_addr ipt_addr;
af062818b47340eef15700d2f0211576ba3506eevboxsync uint32_t ipt_time;
af062818b47340eef15700d2f0211576ba3506eevboxsync } ipt_ta[1];
af062818b47340eef15700d2f0211576ba3506eevboxsync } ipt_timestamp;
af062818b47340eef15700d2f0211576ba3506eevboxsync};
af062818b47340eef15700d2f0211576ba3506eevboxsyncAssertCompileSize(struct ip_timestamp, 12);
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync/* flag bits for ipt_flg */
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_TS_TSONLY 0 /* timestamps only */
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_TS_PRESPEC 3 /* specified modules only */
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync/* bits for security (not byte swapped) */
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_SECUR_UNCLASS 0x0000
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_SECUR_CONFID 0xf135
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_SECUR_EFTO 0x789a
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_SECUR_MMMM 0xbc4d
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_SECUR_RESTR 0xaf13
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_SECUR_SECRET 0xd788
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPOPT_SECUR_TOPSECRET 0x6bc5
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync/*
af062818b47340eef15700d2f0211576ba3506eevboxsync * Internet implementation parameters.
af062818b47340eef15700d2f0211576ba3506eevboxsync */
af062818b47340eef15700d2f0211576ba3506eevboxsync#define MAXTTL 255 /* maximum time to live (seconds) */
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPDEFTTL 64 /* default ttl, from RFC 1340 */
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPFRAGTTL 60 /* time to live for frags, slowhz */
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IPTTLDEC 1 /* subtracted when forwarding */
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#define IP_MSS 576 /* default maximum segment size */
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync#ifdef HAVE_SYS_TYPES32_H /* Overcome some Solaris 2.x junk */
# include <sys/types32.h>
#else
# if SIZEOF_CHAR_P == 4
typedef caddr_t caddr32_t;
# else
# if !defined(VBOX_WITH_BSD_REASS)
typedef u_int32_t caddr32_t;
# else /* VBOX_WITH_BSD_REASS */
typedef caddr_t caddr32_t;
# endif /* VBOX_WITH_BSD_REASS */
# endif
#endif
#if SIZEOF_CHAR_P == 4
typedef struct ipq_t *ipqp_32;
typedef struct ipasfrag *ipasfragp_32;
#else
typedef caddr32_t ipqp_32;
typedef caddr32_t ipasfragp_32;
#endif
/*
* Overlay for ip header used by other protocols (tcp, udp).
*/
struct ipovly
{
#if !defined(VBOX_WITH_BSD_REASS)
caddr32_t ih_next;
caddr32_t ih_prev; /* for protocol sequence q's */
u_int8_t ih_x1; /* (unused) */
#else /* VBOX_WITH_BSD_REASS */
u_int8_t ih_x1[9]; /* (unused) */
#endif /* VBOX_WITH_BSD_REASS */
u_int8_t ih_pr; /* protocol */
u_int16_t ih_len; /* protocol length */
struct in_addr ih_src; /* source internet address */
struct in_addr ih_dst; /* destination internet address */
};
AssertCompileSize(struct ipovly, 20);
/*
* Ip reassembly queue structure. Each fragment being reassembled is
* attached to one of these structures. They are timed out after ipq_ttl
* drops to 0, and may also be reclaimed if memory becomes tight.
* size 28 bytes
*/
struct ipq_t
{
#ifndef VBOX_WITH_BSD_REASS
ipqp_32 next;
ipqp_32 prev; /* to other reass headers */
#else /* VBOX_WITH_BSD_REASS */
TAILQ_ENTRY(ipq_t) ipq_list;
#endif /* VBOX_WITH_BSD_REASS */
u_int8_t ipq_ttl; /* time for reass q to live */
u_int8_t ipq_p; /* protocol of this fragment */
u_int16_t ipq_id; /* sequence id for reassembly */
#ifndef VBOX_WITH_BSD_REASS
ipasfragp_32 ipq_next;
ipasfragp_32 ipq_prev; /* to ip headers of fragments */
#else /* VBOX_WITH_BSD_REASS */
struct mbuf *ipq_frags; /* to ip headers of fragments */
uint8_t ipq_nfrags; /* # of fragments in this packet */
#endif /* VBOX_WITH_BSD_REASS */
struct in_addr ipq_src;
struct in_addr ipq_dst;
};
#ifdef VBOX_WITH_BSD_REASS
/*
* IP datagram reassembly.
*/
#define IPREASS_NHASH_LOG2 6
#define IPREASS_NHASH (1 << IPREASS_NHASH_LOG2)
#define IPREASS_HMASK (IPREASS_NHASH - 1)
#define IPREASS_HASH(x,y) \
(((((x) & 0xF) | ((((x) >> 8) & 0xF) << 4)) ^ (y)) & IPREASS_HMASK)
TAILQ_HEAD(ipqhead,ipq_t);
#endif /* VBOX_WITH_BSD_REASS */
/*
* Ip header, when holding a fragment.
*
* Note: ipf_next must be at same offset as ipq_next above
*/
struct ipasfrag
{
#ifdef WORDS_BIGENDIAN
# ifdef _MSC_VER
uint8_t ip_v:4;
uint8_t ip_hl:4;
# else
unsigned ip_v:4;
unsigned ip_hl:4;
# endif
#else
# ifdef _MSC_VER
uint8_t ip_hl:4;
uint8_t ip_v:4;
# else
unsigned ip_hl:4;
unsigned ip_v:4;
# endif
#endif
u_int8_t ipf_mff; /* XXX overlays ip_tos: use low bit
* to avoid destroying tos (PPPDTRuu);
* copied from (ip_off & IP_MF) */
u_int16_t ip_len;
u_int16_t ip_id;
u_int16_t ip_off;
u_int8_t ip_ttl;
u_int8_t ip_p;
u_int16_t ip_sum;
ipasfragp_32 ipf_next; /* next fragment */
ipasfragp_32 ipf_prev; /* previous fragment */
};
AssertCompileSize(struct ipasfrag, 20);
/*
* Structure stored in mbuf in inpcb.ip_options
* and passed to ip_output when ip options are in use.
* The actual length of the options (including ipopt_dst)
* is in m_len.
*/
#define MAX_IPOPTLEN 40
struct ipoption
{
struct in_addr ipopt_dst; /* first-hop dst if source routed */
int8_t ipopt_list[MAX_IPOPTLEN]; /* options proper */
};
/*
* Structure attached to inpcb.ip_moptions and
* passed to ip_output when IP multicast options are in use.
*/
struct ipstat_t
{
u_long ips_total; /* total packets received */
u_long ips_badsum; /* checksum bad */
u_long ips_tooshort; /* packet too short */
u_long ips_toosmall; /* not enough data */
u_long ips_badhlen; /* ip header length < data size */
u_long ips_badlen; /* ip length < ip header length */
u_long ips_fragments; /* fragments received */
u_long ips_fragdropped; /* frags dropped (dups, out of space) */
u_long ips_fragtimeout; /* fragments timed out */
u_long ips_forward; /* packets forwarded */
u_long ips_cantforward; /* packets rcvd for unreachable dest */
u_long ips_redirectsent; /* packets forwarded on same net */
u_long ips_noproto; /* unknown or unsupported protocol */
u_long ips_delivered; /* datagrams delivered to upper level*/
u_long ips_localout; /* total ip packets generated here */
u_long ips_odropped; /* lost packets due to nobufs, etc. */
u_long ips_reassembled; /* total packets reassembled ok */
u_long ips_fragmented; /* datagrams successfully fragmented */
u_long ips_ofragments; /* output fragments created */
u_long ips_cantfrag; /* don't fragment flag was set, etc. */
u_long ips_badoptions; /* error in option processing */
u_long ips_noroute; /* packets discarded due to no route */
u_long ips_badvers; /* ip version != 4 */
u_long ips_rawout; /* total raw ip packets generated */
u_long ips_unaligned; /* times the ip packet was not aligned */
};
#endif