2 * Copyright (C) 2012 by Darren Reed.
4 * See the IPFILTER.LICENCE file for details on licencing.
6 * @(#)ip_compat.h 1.8 1/14/96
8 * Id: ip_compat.h,v 2.142.2.57 2007/10/10 09:51:42 darrenr Exp $
11 #ifndef __IP_COMPAT_H__
12 #define __IP_COMPAT_H__
26 #if defined(_KERNEL) || defined(KERNEL) || defined(__KERNEL__)
36 # if defined(sun) && (defined(__svr4__) || defined(__SVR4))
44 #if defined(__SVR4) || defined(__svr4__) || defined(__sgi)
46 # if !defined(_KERNEL)
47 # define bzero(a,b) memset(a,0,b)
49 # define bcopy(a,b,c) memmove(b,a,c)
55 # define LIFNAMSIZ IF_NAMESIZE
58 # define LIFNAMSIZ IFNAMSIZ
65 #if defined(__sgi) || defined(bsdi) || defined(__hpux) || defined(hpux)
67 u_char ether_addr_octet[6];
72 # define IPL_EXTERN(ep) ipl##ep
74 # define IPL_EXTERN(ep) ipl/**/ep
78 * This is a workaround for <sys/uio.h> troubles on FreeBSD and OpenBSD.
91 #define NETBSD_GE_REV(x) (defined(__NetBSD_Version__) && \
92 (__NetBSD_Version__ >= (x)))
93 #define NETBSD_GT_REV(x) (defined(__NetBSD_Version__) && \
94 (__NetBSD_Version__ > (x)))
95 #define NETBSD_LT_REV(x) (defined(__NetBSD_Version__) && \
96 (__NetBSD_Version__ < (x)))
97 #define FREEBSD_GE_REV(x) (defined(__FreeBSD_version) && \
98 (__FreeBSD_version >= (x)))
99 #define FREEBSD_GT_REV(x) (defined(__FreeBSD_version) && \
100 (__FreeBSD_version > (x)))
101 #define FREEBSD_LT_REV(x) (defined(__FreeBSD_version) && \
102 (__FreeBSD_version < (x)))
103 #define BSDOS_GE_REV(x) (defined(_BSDI_VERSION) && \
104 (_BSDI_VERSION >= (x)))
105 #define BSDOS_GT_REV(x) (defined(_BSDI_VERSION) && \
106 (_BSDI_VERSION > (x)))
107 #define BSDOS_LT_REV(x) (defined(_BSDI_VERSION) && \
108 (_BSDI_VERSION < (x)))
109 #define OPENBSD_GE_REV(x) (defined(OpenBSD) && (OpenBSD >= (x)))
110 #define OPENBSD_GT_REV(x) (defined(OpenBSD) && (OpenBSD > (x)))
111 #define OPENBSD_LT_REV(x) (defined(OpenBSD) && (OpenBSD < (x)))
112 #define BSD_GE_YEAR(x) (defined(BSD) && (BSD >= (x)))
113 #define BSD_GT_YEAR(x) (defined(BSD) && (BSD > (x)))
114 #define BSD_LT_YEAR(x) (defined(BSD) && (BSD < (x)))
117 /* ----------------------------------------------------------------------- */
119 /* ----------------------------------------------------------------------- */
120 # define HAS_SYS_MD5_H 1
121 # if defined(_KERNEL)
122 # include "opt_bpf.h"
123 # include "opt_inet6.h"
124 # if defined(INET6) && !defined(USE_INET6)
128 # if !defined(USE_INET6) && !defined(NOINET6)
133 # if defined(_KERNEL)
134 # include <netinet/ip_var.h>
135 # define p_cred td_ucred
136 # define p_uid td_ucred->cr_ruid
139 * When #define'd, the 5.2.1 kernel panics when used with the ftp proxy.
140 * There may be other, safe, kernels but this is not extensively tested yet.
142 # define HAVE_M_PULLDOWN
143 # if !defined(IPFILTER_LKM) && (__FreeBSD_version >= 300000)
144 # include "opt_ipfilter.h"
146 # define COPYIN(a,b,c) copyin((caddr_t)(a), (caddr_t)(b), (c))
147 # define COPYOUT(a,b,c) copyout((caddr_t)(a), (caddr_t)(b), (c))
150 # include <inttypes.h>
151 # endif /* _KERNEL */
153 # include <sys/selinfo.h>
154 # include <sys/lock.h>
155 # include <sys/malloc.h>
156 # include <sys/mutex.h>
157 # define KRWLOCK_FILL_SZ 56
158 # define KMUTEX_FILL_SZ 56
159 # include <sys/rwlock.h>
160 # define KMUTEX_T struct mtx
161 # define KRWLOCK_T struct rwlock
164 # define READ_ENTER(x) rw_rlock(&(x)->ipf_lk)
165 # define WRITE_ENTER(x) rw_wlock(&(x)->ipf_lk)
166 # define MUTEX_DOWNGRADE(x) rw_downgrade(&(x)->ipf_lk)
167 # define MUTEX_TRY_UPGRADE(x) rw_try_upgrade(&(x)->ipf_lk)
168 # define RWLOCK_INIT(x,y) rw_init(&(x)->ipf_lk, (y))
169 # define RW_DESTROY(x) rw_destroy(&(x)->ipf_lk)
170 # define RWLOCK_EXIT(x) do { \
171 if (rw_wowned(&(x)->ipf_lk)) \
172 rw_wunlock(&(x)->ipf_lk); \
174 rw_runlock(&(x)->ipf_lk); \
176 # include <net/if_var.h>
177 # define GETKTIME(x) microtime((struct timeval *)x)
178 # define if_addrlist if_addrhead
180 # include <netinet/in_systm.h>
181 # include <netinet/ip.h>
182 # include <machine/in_cksum.h>
185 # define MUTEX_ENTER(x) mtx_lock(&(x)->ipf_lk)
186 # define MUTEX_EXIT(x) mtx_unlock(&(x)->ipf_lk)
187 # define MUTEX_INIT(x,y) mtx_init(&(x)->ipf_lk, (y), NULL,\
189 # define MUTEX_DESTROY(x) mtx_destroy(&(x)->ipf_lk)
190 # define MUTEX_NUKE(x) bzero((x), sizeof(*(x)))
192 * Whilst the sx(9) locks on FreeBSD have the right semantics and interface
193 * for what we want to use them for, despite testing showing they work -
194 * with a WITNESS kernel, it generates LOR messages.
196 # include <machine/atomic.h>
197 # define ATOMIC_INC(x) { mtx_lock(&softc->ipf_rw.ipf_lk); (x)++; \
198 mtx_unlock(&softc->ipf_rw.ipf_lk); }
199 # define ATOMIC_DEC(x) { mtx_lock(&softc->ipf_rw.ipf_lk); (x)--; \
200 mtx_unlock(&softc->ipf_rw.ipf_lk); }
201 # define ATOMIC_INCL(x) atomic_add_long(&(x), 1)
202 # define ATOMIC_INC64(x) ATOMIC_INC(x)
203 # define ATOMIC_INC32(x) atomic_add_32((u_int *)&(x), 1)
204 # define ATOMIC_DECL(x) atomic_add_long(&(x), -1)
205 # define ATOMIC_DEC64(x) ATOMIC_DEC(x)
206 # define ATOMIC_DEC32(x) atomic_add_32((u_int *)&(x), -1)
208 # define SPL_NET(x) ;
209 # define SPL_IMP(x) ;
210 # define SPL_SCHED(x) ;
211 # define GET_MINOR dev2unit
212 # define MSGDSIZE(m) mbufchainlen(m)
213 # define M_LEN(m) (m)->m_len
214 # define M_ADJ(m,x) m_adj(m, x)
215 # define M_COPY(x) m_copym((x), 0, M_COPYALL, M_NOWAIT)
216 # define M_DUP(m) m_dup(m, M_NOWAIT)
217 # define IPF_PANIC(x,y) if (x) { printf y; panic("ipf_panic"); }
218 typedef struct mbuf mb_t;
221 #ifndef _NET_IF_VAR_H_
223 * Userland emulation of struct ifnet.
228 char if_xname[IFNAMSIZ];
229 STAILQ_HEAD(, ifaddr) if_addrlist;
230 int (*if_output)(struct ifnet *, struct mbuf *,
231 const struct sockaddr *, struct route *);
233 #endif /* _NET_IF_VAR_H_ */
236 # define IFNAME(x) ((struct ifnet *)x)->if_xname
237 # define COPYIFNAME(v, x, b) \
239 ((struct ifnet *)x)->if_xname, \
242 typedef u_long ioctlcmd_t;
243 typedef struct uio uio_t;
245 typedef u_int32_t u_32_t;
249 /* ----------------------------------------------------------------------- */
251 /* ----------------------------------------------------------------------- */
254 * For BSD kernels, if bpf is in the kernel, enable ipfilter to use bpf in
257 #if !defined(IPFILTER_BPF)
258 # if (defined(NBPF) && (NBPF > 0)) || (defined(DEV_BPF) && (DEV_BPF > 0)) || \
259 (defined(NBPFILTER) && (NBPFILTER > 0))
260 # define IPFILTER_BPF
265 * Userland locking primitives
268 #if !defined(KMUTEX_FILL_SZ)
269 # define KMUTEX_FILL_SZ 1
271 #if !defined(KRWLOCK_FILL_SZ)
272 # define KRWLOCK_FILL_SZ 1
294 char _fill[KMUTEX_FILL_SZ];
298 const char *ipf_lname;
305 char _fill[KRWLOCK_FILL_SZ];
309 const char *ipf_lname;
318 #define ipf_lk ipf_lkun_s.ipf_slk
319 #define ipf_lname ipf_lkun_s.ipf_lname
320 #define ipf_isr ipf_lkun_s.ipf_sr
321 #define ipf_isw ipf_lkun_s.ipf_sw
322 #define ipf_magic ipf_lkun_s.ipf_magic
324 #if !defined(__GNUC__) || \
325 (defined(__FreeBSD_version) && (__FreeBSD_version >= 503000))
330 # define INLINE __inline__
333 #if defined(__FreeBSD_version) && defined(_KERNEL)
334 CTASSERT(sizeof(ipfrwlock_t) == KRWLOCK_FILL_SZ);
335 CTASSERT(sizeof(ipfmutex_t) == KMUTEX_FILL_SZ);
340 * In a non-kernel environment, there are a lot of macros that need to be
341 * filled in to be null-ops or to point to some compatibility function,
342 * somewhere in userland.
345 typedef struct mb_s {
346 struct mb_s *mb_next;
354 # define m_next mb_next
356 # define m_len mb_len
358 # define m_flags mb_flags
360 # define m_data mb_data
362 # define M_MCAST 0x01
364 # define M_BCAST 0x02
366 # define M_MBCAST 0x04
367 # define MSGDSIZE(m) msgdsize(m)
368 # define M_LEN(m) (m)->mb_len
369 # define M_ADJ(m,x) (m)->mb_len += x
370 # define M_COPY(m) dupmbt(m)
371 # define M_DUP(m) dupmbt(m)
372 # define GETKTIME(x) gettimeofday((struct timeval *)(x), NULL)
373 # define MTOD(m, t) ((t)(m)->mb_data)
374 # define FREE_MB_T(m) freembt(m)
375 # define ALLOC_MB_T(m,l) (m) = allocmbt(l)
376 # define PREP_MB_T(f, m) do { \
377 (m)->mb_next = *(f)->fin_mp; \
378 *(fin)->fin_mp = (m); \
381 # define SLEEP(x,y) 1;
382 # define WAKEUP(x,y) ;
383 # define POLLWAKEUP(y) ;
384 # define IPF_PANIC(x,y) ;
385 # define PANIC(x,y) ;
386 # define SPL_SCHED(x) ;
387 # define SPL_NET(x) ;
388 # define SPL_IMP(x) ;
390 # define KMALLOC(a,b) (a) = (b)malloc(sizeof(*a))
391 # define KMALLOCS(a,b,c) (a) = (b)malloc(c)
392 # define KFREE(x) free(x)
393 # define KFREES(x,s) free(x)
394 # define GETIFP(x, v) get_unit(x,v)
395 # define GETIFMTU_4(x) 2048
396 # define GETIFMTU_6(x) 2048
397 # define COPYIN(a,b,c) bcopywrap((a), (b), (c))
398 # define COPYOUT(a,b,c) bcopywrap((a), (b), (c))
399 # define COPYDATA(m, o, l, b) bcopy(MTOD((mb_t *)m, char *) + (o), \
401 # define COPYBACK(m, o, l, b) bcopy((b), \
402 MTOD((mb_t *)m, char *) + (o), \
404 # define UIOMOVE(a,b,c,d) ipfuiomove((caddr_t)a,b,c,d)
405 extern void m_copydata __P((mb_t *, int, int, caddr_t));
406 extern int ipfuiomove __P((caddr_t, int, int, struct uio *));
407 extern int bcopywrap __P((void *, void *, size_t));
408 extern mb_t *allocmbt __P((size_t));
409 extern mb_t *dupmbt __P((mb_t *));
410 extern void freembt __P((mb_t *));
412 # define MUTEX_DESTROY(x) eMmutex_destroy(&(x)->ipf_emu, \
414 # define MUTEX_ENTER(x) eMmutex_enter(&(x)->ipf_emu, \
416 # define MUTEX_EXIT(x) eMmutex_exit(&(x)->ipf_emu, \
418 # define MUTEX_INIT(x,y) eMmutex_init(&(x)->ipf_emu, y, \
420 # define MUTEX_NUKE(x) bzero((x), sizeof(*(x)))
422 # define MUTEX_DOWNGRADE(x) eMrwlock_downgrade(&(x)->ipf_emu, \
424 # define MUTEX_TRY_UPGRADE(x) eMrwlock_try_upgrade(&(x)->ipf_emu, \
426 # define READ_ENTER(x) eMrwlock_read_enter(&(x)->ipf_emu, \
428 # define RWLOCK_INIT(x, y) eMrwlock_init(&(x)->ipf_emu, y)
429 # define RWLOCK_EXIT(x) eMrwlock_exit(&(x)->ipf_emu)
430 # define RW_DESTROY(x) eMrwlock_destroy(&(x)->ipf_emu)
431 # define WRITE_ENTER(x) eMrwlock_write_enter(&(x)->ipf_emu, \
435 # define USE_MUTEXES 1
437 extern void eMmutex_destroy __P((eMmutex_t *, char *, int));
438 extern void eMmutex_enter __P((eMmutex_t *, char *, int));
439 extern void eMmutex_exit __P((eMmutex_t *, char *, int));
440 extern void eMmutex_init __P((eMmutex_t *, char *, char *, int));
441 extern void eMrwlock_destroy __P((eMrwlock_t *));
442 extern void eMrwlock_exit __P((eMrwlock_t *));
443 extern void eMrwlock_init __P((eMrwlock_t *, char *));
444 extern void eMrwlock_read_enter __P((eMrwlock_t *, char *, int));
445 extern void eMrwlock_write_enter __P((eMrwlock_t *, char *, int));
446 extern void eMrwlock_downgrade __P((eMrwlock_t *, char *, int));
450 extern mb_t *allocmbt(size_t);
452 #define MAX_IPV4HDR ((0xf << 2) + sizeof(struct icmp) + sizeof(ip_t) + 8)
455 # define IP_OFFMASK 0x1fff
460 * On BSD's use quad_t as a guarantee for getting at least a 64bit sized
463 #if !defined(__amd64__) && BSD_GT_YEAR(199306)
465 # define U_QUAD_T unsigned long long
466 # define QUAD_T long long
467 #else /* BSD > 199306 */
468 # if !defined(U_QUAD_T)
469 # define U_QUAD_T u_long
472 #endif /* BSD > 199306 */
476 # if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || \
477 defined(__osf__) || defined(linux)
478 # include <netinet/ip6.h>
479 # include <netinet/icmp6.h>
480 # if defined(_KERNEL) && !defined(__osf__)
481 # include <netinet6/ip6_var.h>
483 typedef struct ip6_hdr ip6_t;
488 # define MAX(a,b) (((a) > (b)) ? (a) : (b))
492 # if defined(MENTAT) && !defined(INSTANCES)
493 # define COPYDATA mb_copydata
494 # define COPYBACK mb_copyback
496 # define COPYDATA m_copydata
497 # define COPYBACK m_copyback
499 # if (defined(__NetBSD_Version__) && (__NetBSD_Version__ < 105180000)) || \
500 defined(__FreeBSD__) || (defined(OpenBSD) && (OpenBSD < 200206)) || \
501 defined(_BSDI_VERSION)
504 # if !defined(__FreeBSD__) || FREEBSD_GE_REV(300000)
505 # if NETBSD_GE_REV(105180000) || OPENBSD_GE_REV(200111)
506 # include <uvm/uvm_extern.h>
508 # include <vm/vm_extern.h>
509 extern vm_map_t kmem_map;
511 # include <sys/proc.h>
512 # else /* !__FreeBSD__ || (__FreeBSD__ && __FreeBSD_version >= 300000) */
513 # include <vm/vm_kern.h>
514 # endif /* !__FreeBSD__ || (__FreeBSD__ && __FreeBSD_version >= 300000) */
516 # ifdef IPFILTER_M_IPFILTER
517 # include <sys/malloc.h>
518 MALLOC_DECLARE(M_IPFILTER);
519 # define _M_IPF M_IPFILTER
520 # else /* IPFILTER_M_IPFILTER */
522 # define _M_IPF M_PFIL
525 # define _M_IPF M_IPFILTER
527 # define _M_IPF M_TEMP
528 # endif /* M_IPFILTER */
530 # endif /* IPFILTER_M_IPFILTER */
531 # if !defined(KMALLOC)
532 # define KMALLOC(a, b) (a) = (b)malloc(sizeof(*(a)), _M_IPF, M_NOWAIT)
534 # if !defined(KMALLOCS)
535 # define KMALLOCS(a, b, c) (a) = (b)malloc((c), _M_IPF, M_NOWAIT)
538 # define KFREE(x) free((x), _M_IPF)
540 # if !defined(KFREES)
541 # define KFREES(x,s) free((x), _M_IPF)
543 # define UIOMOVE(a,b,c,d) uiomove((caddr_t)a,b,d)
544 # define SLEEP(id, n) tsleep((id), PPAUSE|PCATCH, n, 0)
545 # define WAKEUP(id,x) wakeup(id+x)
546 # if !defined(POLLWAKEUP)
547 # define POLLWAKEUP(x) selwakeup(softc->ipf_selwait+x)
549 # define GETIFP(n, v) ifunit(n)
550 # define GETIFMTU_4(x) ((struct ifnet *)x)->if_mtu
551 # define GETIFMTU_6(x) ((struct ifnet *)x)->if_mtu
553 # if !defined(USE_MUTEXES) && !defined(SPL_NET)
554 # define SPL_IMP(x) x = splimp()
555 # define SPL_NET(x) x = splnet()
556 # if !defined(SPL_SCHED)
557 # define SPL_SCHED(x) x = splsched()
559 # define SPL_X(x) (void) splx(x)
560 # endif /* !USE_MUTEXES */
563 # define FREE_MB_T(m) m_freem(m)
567 # define ALLOC_MB_T(m,l) do { \
568 MGETHDR((m), M_NOWAIT, MT_HEADER); \
571 (m)->m_pkthdr.len = (l); \
575 # define ALLOC_MB_T(m,l) do { \
576 MGET((m), M_NOWAIT, MT_HEADER); \
579 (m)->m_pkthdr.len = (l); \
585 # define PREP_MB_T(f, m) do { \
586 mb_t *_o = *(f)->fin_mp; \
588 *(fin)->fin_mp = (m); \
589 if (_o->m_flags & M_PKTHDR) { \
590 (m)->m_pkthdr.len += \
592 (m)->m_pkthdr.rcvif = \
593 _o->m_pkthdr.rcvif; \
599 # define M_DUP(m) m_dup(m, 0, M_COPYALL, 0)
601 # define M_DUP(m) m_dup(m)
606 # define MTOD(m,t) mtod(m,t)
610 # define COPYIN(a,b,c) (bcopy((caddr_t)(a), (caddr_t)(b), (c)), 0)
611 # define COPYOUT(a,b,c) (bcopy((caddr_t)(a), (caddr_t)(b), (c)), 0)
615 # define KMALLOC(a,b) (a) = (b)new_kmem_alloc(sizeof(*(a)), \
617 # define KMALLOCS(a,b,c) (a) = (b)new_kmem_alloc((c), KMEM_NOSLEEP)
621 # define GET_MINOR(x) dev2unit(x)
623 # define PANIC(x,y) if (x) panic y
626 #if !defined(IFNAME) && !defined(_KERNEL)
627 # define IFNAME(x) get_ifname((struct ifnet *)x)
630 # define NEED_FRGETIFNAME
631 extern char *ipf_getifname __P((struct ifnet *, char *));
632 # define COPYIFNAME(v, x, b) \
633 ipf_getifname((struct ifnet *)x, b)
640 # define ASSERT(x) do { if (!(x)) abort(); } while (0)
645 # define BCOPYIN(a,b,c) (bcopy((caddr_t)(a), (caddr_t)(b), (c)), 0)
646 # define BCOPYOUT(a,b,c) (bcopy((caddr_t)(a), (caddr_t)(b), (c)), 0)
650 * Because the ctype(3) posix definition, if used "safely" in code everywhere,
651 * would mean all normal code that walks through strings needed casts. Yuck.
653 #define ISALNUM(x) isalnum((u_char)(x))
654 #define ISALPHA(x) isalpha((u_char)(x))
655 #define ISDIGIT(x) isdigit((u_char)(x))
656 #define ISSPACE(x) isspace((u_char)(x))
657 #define ISUPPER(x) isupper((u_char)(x))
658 #define ISXDIGIT(x) isxdigit((u_char)(x))
659 #define ISLOWER(x) islower((u_char)(x))
660 #define TOUPPER(x) toupper((u_char)(x))
661 #define TOLOWER(x) tolower((u_char)(x))
664 * If mutexes aren't being used, turn all the mutex functions into null-ops.
666 #if !defined(USE_MUTEXES)
671 # undef MUTEX_DESTROY
672 # define MUTEX_ENTER(x) ;
673 # define READ_ENTER(x) ;
674 # define WRITE_ENTER(x) ;
675 # define MUTEX_DOWNGRADE(x) ;
676 # define MUTEX_TRY_UPGRADE(x) ;
677 # define RWLOCK_INIT(x, y) ;
678 # define RWLOCK_EXIT(x) ;
679 # define RW_DESTROY(x) ;
680 # define MUTEX_EXIT(x) ;
681 # define MUTEX_INIT(x,y) ;
682 # define MUTEX_DESTROY(x) ;
683 # define MUTEX_NUKE(x) ;
684 #endif /* !USE_MUTEXES */
686 # define ATOMIC_INC(x) (x)++
687 # define ATOMIC_DEC(x) (x)--
690 #if defined(USE_SPL) && defined(_KERNEL)
691 # define SPL_INT(x) int x
697 * If there are no atomic operations for bit sizes defined, define them to all
698 * use a generic one that works for all sizes.
701 # define ATOMIC_INCL ATOMIC_INC
702 # define ATOMIC_INC64 ATOMIC_INC
703 # define ATOMIC_INC32 ATOMIC_INC
704 # define ATOMIC_DECL ATOMIC_DEC
705 # define ATOMIC_DEC64 ATOMIC_DEC
706 # define ATOMIC_DEC32 ATOMIC_DEC
709 #ifndef HDR_T_PRIVATE
710 typedef struct tcphdr tcphdr_t;
711 typedef struct udphdr udphdr_t;
713 typedef struct icmp icmphdr_t;
714 typedef struct ip ip_t;
715 typedef struct ether_header ether_header_t;
716 typedef struct tcpiphdr tcpiphdr_t;
719 # define FR_GROUPLEN 16
723 # define offsetof(t,m) (size_t)((&((t *)0L)->m))
726 # define stsizeof(t,m) sizeof(((t *)0L)->m)
730 * This set of macros has been brought about because on Tru64 it is not
731 * possible to easily assign or examine values in a structure that are
735 # define IP_V(x) (x)->ip_v
738 # define IP_V_A(x,y) (x)->ip_v = (y)
741 # define IP_HL(x) (x)->ip_hl
744 # define IP_HL_A(x,y) (x)->ip_hl = ((y) & 0xf)
747 # define TCP_X2(x) (x)->th_x2
750 # define TCP_X2_A(x,y) (x)->th_x2 = (y)
753 # define TCP_OFF(x) (x)->th_off
756 # define TCP_OFF_A(x,y) (x)->th_off = (y)
758 #define IPMINLEN(i, h) ((i)->ip_len >= (IP_HL(i) * 4 + sizeof(struct h)))
760 #define TCPF_ALL (TH_FIN|TH_SYN|TH_RST|TH_PUSH|TH_ACK|TH_URG|\
763 #if BSD_GE_YEAR(199306) && !defined(m_act)
764 # define m_act m_nextpkt
768 * Security Options for Intenet Protocol (IPSO) as defined in RFC 1108.
772 * 00000001 - (Reserved 4)
773 * 00111101 - Top Secret
775 * 10010110 - Confidential
776 * 01100110 - (Reserved 3)
777 * 11001100 - (Reserved 2)
778 * 10101011 - Unclassified
779 * 11110001 - (Reserved 1)
781 #define IPSO_CLASS_RES4 0x01
782 #define IPSO_CLASS_TOPS 0x3d
783 #define IPSO_CLASS_SECR 0x5a
784 #define IPSO_CLASS_CONF 0x96
785 #define IPSO_CLASS_RES3 0x66
786 #define IPSO_CLASS_RES2 0xcc
787 #define IPSO_CLASS_UNCL 0xab
788 #define IPSO_CLASS_RES1 0xf1
790 #define IPSO_AUTH_GENSER 0x80
791 #define IPSO_AUTH_ESI 0x40
792 #define IPSO_AUTH_SCI 0x20
793 #define IPSO_AUTH_NSA 0x10
794 #define IPSO_AUTH_DOE 0x08
795 #define IPSO_AUTH_UN 0x06
796 #define IPSO_AUTH_FTE 0x01
804 #define IPOPT_ZSU 10 /* ZSU */
806 #define IPOPT_MTUP 11 /* MTUP */
808 #define IPOPT_MTUR 12 /* MTUR */
810 #define IPOPT_ENCODE 15 /* ENCODE */
814 #define IPOPT_TR 82 /* TR */
815 #undef IPOPT_SECURITY
816 #define IPOPT_SECURITY 130
818 #define IPOPT_LSRR 131
820 #define IPOPT_E_SEC 133 /* E-SEC */
822 #define IPOPT_CIPSO 134 /* CIPSO */
824 #define IPOPT_SATID 136
826 # define IPOPT_SID IPOPT_SATID
829 #define IPOPT_SSRR 137
831 #define IPOPT_ADDEXT 147 /* ADDEXT */
833 #define IPOPT_VISA 142 /* VISA */
835 #define IPOPT_IMITD 144 /* IMITD */
837 #define IPOPT_EIP 145 /* EIP */
839 #define IPOPT_RTRALRT 148 /* RTRALRT */
841 #define IPOPT_SDB 149
843 #define IPOPT_NSAPA 150
845 #define IPOPT_DPS 151
847 #define IPOPT_UMP 152
849 #define IPOPT_FINN 205 /* FINN */
851 #define IPOPT_AH 256+IPPROTO_AH
854 # define TCPOPT_EOL 0
857 # define TCPOPT_NOP 1
859 #ifndef TCPOPT_MAXSEG
860 # define TCPOPT_MAXSEG 2
862 #ifndef TCPOLEN_MAXSEG
863 # define TCPOLEN_MAXSEG 4
865 #ifndef TCPOPT_WINDOW
866 # define TCPOPT_WINDOW 3
868 #ifndef TCPOLEN_WINDOW
869 # define TCPOLEN_WINDOW 3
871 #ifndef TCPOPT_SACK_PERMITTED
872 # define TCPOPT_SACK_PERMITTED 4
874 #ifndef TCPOLEN_SACK_PERMITTED
875 # define TCPOLEN_SACK_PERMITTED 2
878 # define TCPOPT_SACK 5
880 #ifndef TCPOPT_TIMESTAMP
881 # define TCPOPT_TIMESTAMP 8
885 # define ICMP_MINLEN 8
887 #ifndef ICMP_ECHOREPLY
888 # define ICMP_ECHOREPLY 0
891 # define ICMP_UNREACH 3
893 #ifndef ICMP_UNREACH_NET
894 # define ICMP_UNREACH_NET 0
896 #ifndef ICMP_UNREACH_HOST
897 # define ICMP_UNREACH_HOST 1
899 #ifndef ICMP_UNREACH_PROTOCOL
900 # define ICMP_UNREACH_PROTOCOL 2
902 #ifndef ICMP_UNREACH_PORT
903 # define ICMP_UNREACH_PORT 3
905 #ifndef ICMP_UNREACH_NEEDFRAG
906 # define ICMP_UNREACH_NEEDFRAG 4
908 #ifndef ICMP_UNREACH_SRCFAIL
909 # define ICMP_UNREACH_SRCFAIL 5
911 #ifndef ICMP_UNREACH_NET_UNKNOWN
912 # define ICMP_UNREACH_NET_UNKNOWN 6
914 #ifndef ICMP_UNREACH_HOST_UNKNOWN
915 # define ICMP_UNREACH_HOST_UNKNOWN 7
917 #ifndef ICMP_UNREACH_ISOLATED
918 # define ICMP_UNREACH_ISOLATED 8
920 #ifndef ICMP_UNREACH_NET_PROHIB
921 # define ICMP_UNREACH_NET_PROHIB 9
923 #ifndef ICMP_UNREACH_HOST_PROHIB
924 # define ICMP_UNREACH_HOST_PROHIB 10
926 #ifndef ICMP_UNREACH_TOSNET
927 # define ICMP_UNREACH_TOSNET 11
929 #ifndef ICMP_UNREACH_TOSHOST
930 # define ICMP_UNREACH_TOSHOST 12
932 #ifndef ICMP_UNREACH_ADMIN_PROHIBIT
933 # define ICMP_UNREACH_ADMIN_PROHIBIT 13
935 #ifndef ICMP_UNREACH_FILTER
936 # define ICMP_UNREACH_FILTER 13
938 #ifndef ICMP_UNREACH_HOST_PRECEDENCE
939 # define ICMP_UNREACH_HOST_PRECEDENCE 14
941 #ifndef ICMP_UNREACH_PRECEDENCE_CUTOFF
942 # define ICMP_UNREACH_PRECEDENCE_CUTOFF 15
944 #ifndef ICMP_SOURCEQUENCH
945 # define ICMP_SOURCEQUENCH 4
947 #ifndef ICMP_REDIRECT_NET
948 # define ICMP_REDIRECT_NET 0
950 #ifndef ICMP_REDIRECT_HOST
951 # define ICMP_REDIRECT_HOST 1
953 #ifndef ICMP_REDIRECT_TOSNET
954 # define ICMP_REDIRECT_TOSNET 2
956 #ifndef ICMP_REDIRECT_TOSHOST
957 # define ICMP_REDIRECT_TOSHOST 3
959 #ifndef ICMP_ALTHOSTADDR
960 # define ICMP_ALTHOSTADDR 6
962 #ifndef ICMP_TIMXCEED
963 # define ICMP_TIMXCEED 11
965 #ifndef ICMP_TIMXCEED_INTRANS
966 # define ICMP_TIMXCEED_INTRANS 0
968 #ifndef ICMP_TIMXCEED_REASS
969 # define ICMP_TIMXCEED_REASS 1
971 #ifndef ICMP_PARAMPROB
972 # define ICMP_PARAMPROB 12
974 #ifndef ICMP_PARAMPROB_ERRATPTR
975 # define ICMP_PARAMPROB_ERRATPTR 0
977 #ifndef ICMP_PARAMPROB_OPTABSENT
978 # define ICMP_PARAMPROB_OPTABSENT 1
980 #ifndef ICMP_PARAMPROB_LENGTH
981 # define ICMP_PARAMPROB_LENGTH 2
984 # define ICMP_TSTAMP 13
986 #ifndef ICMP_TSTAMPREPLY
987 # define ICMP_TSTAMPREPLY 14
990 # define ICMP_IREQ 15
992 #ifndef ICMP_IREQREPLY
993 # define ICMP_IREQREPLY 16
996 # define ICMP_MASKREQ 17
998 #ifndef ICMP_MASKREPLY
999 # define ICMP_MASKREPLY 18
1001 #ifndef ICMP_TRACEROUTE
1002 # define ICMP_TRACEROUTE 30
1004 #ifndef ICMP_DATACONVERR
1005 # define ICMP_DATACONVERR 31
1007 #ifndef ICMP_MOBILE_REDIRECT
1008 # define ICMP_MOBILE_REDIRECT 32
1010 #ifndef ICMP_IPV6_WHEREAREYOU
1011 # define ICMP_IPV6_WHEREAREYOU 33
1013 #ifndef ICMP_IPV6_IAMHERE
1014 # define ICMP_IPV6_IAMHERE 34
1016 #ifndef ICMP_MOBILE_REGREQUEST
1017 # define ICMP_MOBILE_REGREQUEST 35
1019 #ifndef ICMP_MOBILE_REGREPLY
1020 # define ICMP_MOBILE_REGREPLY 36
1023 # define ICMP_SKIP 39
1025 #ifndef ICMP_PHOTURIS
1026 # define ICMP_PHOTURIS 40
1028 #ifndef ICMP_PHOTURIS_UNKNOWN_INDEX
1029 # define ICMP_PHOTURIS_UNKNOWN_INDEX 1
1031 #ifndef ICMP_PHOTURIS_AUTH_FAILED
1032 # define ICMP_PHOTURIS_AUTH_FAILED 2
1034 #ifndef ICMP_PHOTURIS_DECRYPT_FAILED
1035 # define ICMP_PHOTURIS_DECRYPT_FAILED 3
1038 # define IPVERSION 4
1040 #ifndef IPOPT_MINOFF
1041 # define IPOPT_MINOFF 4
1043 #ifndef IPOPT_COPIED
1044 # define IPOPT_COPIED(x) ((x)&0x80)
1047 # define IPOPT_EOL 0
1050 # define IPOPT_NOP 1
1053 # define IP_MF ((u_short)0x2000)
1055 #ifndef ETHERTYPE_IP
1056 # define ETHERTYPE_IP ((u_short)0x0800)
1059 # define TH_FIN 0x01
1062 # define TH_SYN 0x02
1065 # define TH_RST 0x04
1068 # define TH_PUSH 0x08
1071 # define TH_ACK 0x10
1074 # define TH_URG 0x20
1077 #define TH_ACKMASK (TH_FIN|TH_SYN|TH_RST|TH_ACK)
1080 # define IPOPT_EOL 0
1083 # define IPOPT_NOP 1
1089 # define IPOPT_TS 68
1091 #ifndef IPOPT_SECURITY
1092 # define IPOPT_SECURITY 130
1095 # define IPOPT_LSRR 131
1098 # define IPOPT_SATID 136
1101 # define IPOPT_SSRR 137
1103 #ifndef IPOPT_SECUR_UNCLASS
1104 # define IPOPT_SECUR_UNCLASS ((u_short)0x0000)
1106 #ifndef IPOPT_SECUR_CONFID
1107 # define IPOPT_SECUR_CONFID ((u_short)0xf135)
1109 #ifndef IPOPT_SECUR_EFTO
1110 # define IPOPT_SECUR_EFTO ((u_short)0x789a)
1112 #ifndef IPOPT_SECUR_MMMM
1113 # define IPOPT_SECUR_MMMM ((u_short)0xbc4d)
1115 #ifndef IPOPT_SECUR_RESTR
1116 # define IPOPT_SECUR_RESTR ((u_short)0xaf13)
1118 #ifndef IPOPT_SECUR_SECRET
1119 # define IPOPT_SECUR_SECRET ((u_short)0xd788)
1121 #ifndef IPOPT_SECUR_TOPSECRET
1122 # define IPOPT_SECUR_TOPSECRET ((u_short)0x6bc5)
1125 # define IPOPT_OLEN 1
1127 #ifndef IPPROTO_HOPOPTS
1128 # define IPPROTO_HOPOPTS 0
1130 #ifndef IPPROTO_IPIP
1131 # define IPPROTO_IPIP 4
1133 #ifndef IPPROTO_ENCAP
1134 # define IPPROTO_ENCAP 98
1136 #ifndef IPPROTO_IPV6
1137 # define IPPROTO_IPV6 41
1139 #ifndef IPPROTO_ROUTING
1140 # define IPPROTO_ROUTING 43
1142 #ifndef IPPROTO_FRAGMENT
1143 # define IPPROTO_FRAGMENT 44
1146 # define IPPROTO_GRE 47 /* GRE encaps RFC 1701 */
1149 # define IPPROTO_ESP 50
1152 # define IPPROTO_AH 51
1154 #ifndef IPPROTO_ICMPV6
1155 # define IPPROTO_ICMPV6 58
1157 #ifndef IPPROTO_NONE
1158 # define IPPROTO_NONE 59
1160 #ifndef IPPROTO_DSTOPTS
1161 # define IPPROTO_DSTOPTS 60
1163 #ifndef IPPROTO_MOBILITY
1164 # define IPPROTO_MOBILITY 135
1167 #ifndef ICMP_ROUTERADVERT
1168 # define ICMP_ROUTERADVERT 9
1170 #ifndef ICMP_ROUTERSOLICIT
1171 # define ICMP_ROUTERSOLICIT 10
1173 #ifndef ICMP6_DST_UNREACH
1174 # define ICMP6_DST_UNREACH 1
1176 #ifndef ICMP6_PACKET_TOO_BIG
1177 # define ICMP6_PACKET_TOO_BIG 2
1179 #ifndef ICMP6_TIME_EXCEEDED
1180 # define ICMP6_TIME_EXCEEDED 3
1182 #ifndef ICMP6_PARAM_PROB
1183 # define ICMP6_PARAM_PROB 4
1186 #ifndef ICMP6_ECHO_REQUEST
1187 # define ICMP6_ECHO_REQUEST 128
1189 #ifndef ICMP6_ECHO_REPLY
1190 # define ICMP6_ECHO_REPLY 129
1192 #ifndef ICMP6_MEMBERSHIP_QUERY
1193 # define ICMP6_MEMBERSHIP_QUERY 130
1195 #ifndef MLD6_LISTENER_QUERY
1196 # define MLD6_LISTENER_QUERY 130
1198 #ifndef ICMP6_MEMBERSHIP_REPORT
1199 # define ICMP6_MEMBERSHIP_REPORT 131
1201 #ifndef MLD6_LISTENER_REPORT
1202 # define MLD6_LISTENER_REPORT 131
1204 #ifndef ICMP6_MEMBERSHIP_REDUCTION
1205 # define ICMP6_MEMBERSHIP_REDUCTION 132
1207 #ifndef MLD6_LISTENER_DONE
1208 # define MLD6_LISTENER_DONE 132
1210 #ifndef ND_ROUTER_SOLICIT
1211 # define ND_ROUTER_SOLICIT 133
1213 #ifndef ND_ROUTER_ADVERT
1214 # define ND_ROUTER_ADVERT 134
1216 #ifndef ND_NEIGHBOR_SOLICIT
1217 # define ND_NEIGHBOR_SOLICIT 135
1219 #ifndef ND_NEIGHBOR_ADVERT
1220 # define ND_NEIGHBOR_ADVERT 136
1223 # define ND_REDIRECT 137
1225 #ifndef ICMP6_ROUTER_RENUMBERING
1226 # define ICMP6_ROUTER_RENUMBERING 138
1228 #ifndef ICMP6_WRUREQUEST
1229 # define ICMP6_WRUREQUEST 139
1231 #ifndef ICMP6_WRUREPLY
1232 # define ICMP6_WRUREPLY 140
1234 #ifndef ICMP6_FQDN_QUERY
1235 # define ICMP6_FQDN_QUERY 139
1237 #ifndef ICMP6_FQDN_REPLY
1238 # define ICMP6_FQDN_REPLY 140
1240 #ifndef ICMP6_NI_QUERY
1241 # define ICMP6_NI_QUERY 139
1243 #ifndef ICMP6_NI_REPLY
1244 # define ICMP6_NI_REPLY 140
1246 #ifndef MLD6_MTRACE_RESP
1247 # define MLD6_MTRACE_RESP 200
1250 # define MLD6_MTRACE 201
1252 #ifndef ICMP6_HADISCOV_REQUEST
1253 # define ICMP6_HADISCOV_REQUEST 202
1255 #ifndef ICMP6_HADISCOV_REPLY
1256 # define ICMP6_HADISCOV_REPLY 203
1258 #ifndef ICMP6_MOBILEPREFIX_SOLICIT
1259 # define ICMP6_MOBILEPREFIX_SOLICIT 204
1261 #ifndef ICMP6_MOBILEPREFIX_ADVERT
1262 # define ICMP6_MOBILEPREFIX_ADVERT 205
1264 #ifndef ICMP6_MAXTYPE
1265 # define ICMP6_MAXTYPE 205
1268 #ifndef ICMP6_DST_UNREACH_NOROUTE
1269 # define ICMP6_DST_UNREACH_NOROUTE 0
1271 #ifndef ICMP6_DST_UNREACH_ADMIN
1272 # define ICMP6_DST_UNREACH_ADMIN 1
1274 #ifndef ICMP6_DST_UNREACH_NOTNEIGHBOR
1275 # define ICMP6_DST_UNREACH_NOTNEIGHBOR 2
1277 #ifndef ICMP6_DST_UNREACH_BEYONDSCOPE
1278 # define ICMP6_DST_UNREACH_BEYONDSCOPE 2
1280 #ifndef ICMP6_DST_UNREACH_ADDR
1281 # define ICMP6_DST_UNREACH_ADDR 3
1283 #ifndef ICMP6_DST_UNREACH_NOPORT
1284 # define ICMP6_DST_UNREACH_NOPORT 4
1286 #ifndef ICMP6_TIME_EXCEED_TRANSIT
1287 # define ICMP6_TIME_EXCEED_TRANSIT 0
1289 #ifndef ICMP6_TIME_EXCEED_REASSEMBLY
1290 # define ICMP6_TIME_EXCEED_REASSEMBLY 1
1293 #ifndef ICMP6_NI_SUCCESS
1294 # define ICMP6_NI_SUCCESS 0
1296 #ifndef ICMP6_NI_REFUSED
1297 # define ICMP6_NI_REFUSED 1
1299 #ifndef ICMP6_NI_UNKNOWN
1300 # define ICMP6_NI_UNKNOWN 2
1303 #ifndef ICMP6_ROUTER_RENUMBERING_COMMAND
1304 # define ICMP6_ROUTER_RENUMBERING_COMMAND 0
1306 #ifndef ICMP6_ROUTER_RENUMBERING_RESULT
1307 # define ICMP6_ROUTER_RENUMBERING_RESULT 1
1309 #ifndef ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET
1310 # define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET 255
1313 #ifndef ICMP6_PARAMPROB_HEADER
1314 # define ICMP6_PARAMPROB_HEADER 0
1316 #ifndef ICMP6_PARAMPROB_NEXTHEADER
1317 # define ICMP6_PARAMPROB_NEXTHEADER 1
1319 #ifndef ICMP6_PARAMPROB_OPTION
1320 # define ICMP6_PARAMPROB_OPTION 2
1323 #ifndef ICMP6_NI_SUBJ_IPV6
1324 # define ICMP6_NI_SUBJ_IPV6 0
1326 #ifndef ICMP6_NI_SUBJ_FQDN
1327 # define ICMP6_NI_SUBJ_FQDN 1
1329 #ifndef ICMP6_NI_SUBJ_IPV4
1330 # define ICMP6_NI_SUBJ_IPV4 2
1333 #ifndef MLD_MTRACE_RESP
1334 # define MLD_MTRACE_RESP 200
1337 # define MLD_MTRACE 201
1339 #ifndef MLD6_MTRACE_RESP
1340 # define MLD6_MTRACE_RESP MLD_MTRACE_RESP
1343 # define MLD6_MTRACE MLD_MTRACE
1346 #if !defined(IPV6_FLOWINFO_MASK)
1347 # if (BYTE_ORDER == BIG_ENDIAN) || defined(_BIG_ENDIAN)
1348 # define IPV6_FLOWINFO_MASK 0x0fffffff /* flow info (28 bits) */
1350 # if(BYTE_ORDER == LITTLE_ENDIAN) || !defined(_BIG_ENDIAN)
1351 # define IPV6_FLOWINFO_MASK 0xffffff0f /* flow info (28 bits) */
1352 # endif /* LITTLE_ENDIAN */
1355 #if !defined(IPV6_FLOWLABEL_MASK)
1356 # if (BYTE_ORDER == BIG_ENDIAN) || defined(_BIG_ENDIAN)
1357 # define IPV6_FLOWLABEL_MASK 0x000fffff /* flow label (20 bits) */
1359 # if (BYTE_ORDER == LITTLE_ENDIAN) || !defined(_BIG_ENDIAN)
1360 # define IPV6_FLOWLABEL_MASK 0xffff0f00 /* flow label (20 bits) */
1361 # endif /* LITTLE_ENDIAN */
1366 * ECN is a new addition to TCP - RFC 2481
1369 # define TH_ECN 0x40
1372 # define TH_CWR 0x80
1374 #define TH_ECNALL (TH_ECN|TH_CWR)
1379 #define IPF_TCPS_LISTEN 0 /* listening for connection */
1380 #define IPF_TCPS_SYN_SENT 1 /* active, have sent syn */
1381 #define IPF_TCPS_SYN_RECEIVED 2 /* have send and received syn */
1382 #define IPF_TCPS_HALF_ESTAB 3 /* for connections not fully "up" */
1383 /* states < IPF_TCPS_ESTABLISHED are those where connections not established */
1384 #define IPF_TCPS_ESTABLISHED 4 /* established */
1385 #define IPF_TCPS_CLOSE_WAIT 5 /* rcvd fin, waiting for close */
1386 /* states > IPF_TCPS_CLOSE_WAIT are those where user has closed */
1387 #define IPF_TCPS_FIN_WAIT_1 6 /* have closed, sent fin */
1388 #define IPF_TCPS_CLOSING 7 /* closed xchd FIN; await FIN ACK */
1389 #define IPF_TCPS_LAST_ACK 8 /* had fin and close; await FIN ACK */
1390 /* states > IPF_TCPS_CLOSE_WAIT && < IPF_TCPS_FIN_WAIT_2 await ACK of FIN */
1391 #define IPF_TCPS_FIN_WAIT_2 9 /* have closed, fin is acked */
1392 #define IPF_TCPS_TIME_WAIT 10 /* in 2*msl quiet wait after close */
1393 #define IPF_TCPS_CLOSED 11 /* closed */
1394 #define IPF_TCP_NSTATES 12
1398 #undef ICMP_MAX_UNREACH
1399 #define ICMP_MAX_UNREACH 14
1401 #define ICMP_MAXTYPE 18
1404 # define LOG_FTP (11<<3)
1406 #ifndef LOG_AUTHPRIV
1407 # define LOG_AUTHPRIV (10<<3)
1410 # define LOG_AUDIT (13<<3)
1413 # define LOG_NTP (12<<3)
1415 #ifndef LOG_SECURITY
1416 # define LOG_SECURITY (13<<3)
1419 # define LOG_LFMT (14<<3)
1422 # define LOG_CONSOLE (14<<3)
1426 * ICMP error replies have an IP header (20 bytes), 8 bytes of ICMP data,
1427 * another IP header and then 64 bits of data, totalling 56. Of course,
1428 * the last 64 bits is dependent on that being available.
1430 #define ICMPERR_ICMPHLEN 8
1431 #define ICMPERR_IPICMPHLEN (20 + 8)
1432 #define ICMPERR_MINPKTLEN (20 + 8 + 20)
1433 #define ICMPERR_MAXPKTLEN (20 + 8 + 20 + 8)
1434 #define ICMP6ERR_MINPKTLEN (40 + 8)
1435 #define ICMP6ERR_IPICMPHLEN (40 + 8 + 40)
1438 # define MIN(a,b) (((a)<(b))?(a):(b))
1442 # undef IPFILTER_BPF
1446 # define DPRINT(x) printf x
1453 # define DT(_n) DTRACE_PROBE(_n)
1454 # define DT1(_n,_a,_b) DTRACE_PROBE1(_n,_a,_b)
1455 # define DT2(_n,_a,_b,_c,_d) DTRACE_PROBE2(_n,_a,_b,_c,_d)
1456 # define DT3(_n,_a,_b,_c,_d,_e,_f) \
1457 DTRACE_PROBE3(_n,_a,_b,_c,_d,_e,_f)
1458 # define DT4(_n,_a,_b,_c,_d,_e,_f,_g,_h) \
1459 DTRACE_PROBE4(_n,_a,_b,_c,_d,_e,_f,_g,_h)
1462 # define DT1(_n,_a,_b)
1463 # define DT2(_n,_a,_b,_c,_d)
1464 # define DT3(_n,_a,_b,_c,_d,_e,_f)
1465 # define DT4(_n,_a,_b,_c,_d,_e,_f,_g,_h)
1469 # define DT1(_n,_a,_b)
1470 # define DT2(_n,_a,_b,_c,_d)
1471 # define DT3(_n,_a,_b,_c,_d,_e,_f)
1472 # define DT4(_n,_a,_b,_c,_d,_e,_f,_g,_h)
1475 struct ip6_routing {
1476 u_char ip6r_nxt; /* next header */
1477 u_char ip6r_len; /* length in units of 8 octets */
1478 u_char ip6r_type; /* always zero */
1479 u_char ip6r_segleft; /* segments left */
1480 u_32_t ip6r_reserved; /* reserved field */
1483 #endif /* __IP_COMPAT_H__ */