Deleted Added
full compact
ip_nat6.c (254401) ip_nat6.c (255332)
1/*
2 * Copyright (C) 2012 by Darren Reed.
3 *
4 * See the IPFILTER.LICENCE file for details on licencing.
5 */
6#if defined(KERNEL) || defined(_KERNEL)
7# undef KERNEL
1/*
2 * Copyright (C) 2012 by Darren Reed.
3 *
4 * See the IPFILTER.LICENCE file for details on licencing.
5 */
6#if defined(KERNEL) || defined(_KERNEL)
7# undef KERNEL
8# undef ipf_nat6_KERNEL
8# undef _KERNEL
9# define KERNEL 1
9# define KERNEL 1
10# define ipf_nat6_KERNEL 1
10# define _KERNEL 1
11#endif
12#include <sys/errno.h>
13#include <sys/types.h>
14#include <sys/param.h>
15#include <sys/time.h>
16#include <sys/file.h>
17#if defined(_KERNEL) && defined(__NetBSD_Version__) && \
18 (__NetBSD_Version__ >= 399002000)
19# include <sys/kauth.h>
20#endif
21#if !defined(_KERNEL)
22# include <stdio.h>
23# include <string.h>
24# include <stdlib.h>
11#endif
12#include <sys/errno.h>
13#include <sys/types.h>
14#include <sys/param.h>
15#include <sys/time.h>
16#include <sys/file.h>
17#if defined(_KERNEL) && defined(__NetBSD_Version__) && \
18 (__NetBSD_Version__ >= 399002000)
19# include <sys/kauth.h>
20#endif
21#if !defined(_KERNEL)
22# include <stdio.h>
23# include <string.h>
24# include <stdlib.h>
25# define ipf_nat6_KERNEL
25# define _KERNEL
26# ifdef ipf_nat6__OpenBSD__
27struct file;
28# endif
29# include <sys/uio.h>
26# ifdef ipf_nat6__OpenBSD__
27struct file;
28# endif
29# include <sys/uio.h>
30# undef ipf_nat6_KERNEL
30# undef _KERNEL
31#endif
32#if defined(_KERNEL) && (__FreeBSD_version >= 220000)
33# include <sys/filio.h>
34# include <sys/fcntl.h>
35#else
36# include <sys/ioctl.h>
37#endif
38#if !defined(AIX)

--- 7 unchanged lines hidden (view full) ---

46# include <sys/systm.h>
47# if !defined(__SVR4) && !defined(__svr4__)
48# include <sys/mbuf.h>
49# endif
50#endif
51#if defined(__SVR4) || defined(__svr4__)
52# include <sys/filio.h>
53# include <sys/byteorder.h>
31#endif
32#if defined(_KERNEL) && (__FreeBSD_version >= 220000)
33# include <sys/filio.h>
34# include <sys/fcntl.h>
35#else
36# include <sys/ioctl.h>
37#endif
38#if !defined(AIX)

--- 7 unchanged lines hidden (view full) ---

46# include <sys/systm.h>
47# if !defined(__SVR4) && !defined(__svr4__)
48# include <sys/mbuf.h>
49# endif
50#endif
51#if defined(__SVR4) || defined(__svr4__)
52# include <sys/filio.h>
53# include <sys/byteorder.h>
54# ifdef ipf_nat6_KERNEL
54# ifdef _KERNEL
55# include <sys/dditypes.h>
56# endif
57# include <sys/stream.h>
58# include <sys/kmem.h>
59#endif
55# include <sys/dditypes.h>
56# endif
57# include <sys/stream.h>
58# include <sys/kmem.h>
59#endif
60#if ipf_nat6__FreeBSD_version >= 300000
60#if __FreeBSD_version >= 300000
61# include <sys/queue.h>
62#endif
63#include <net/if.h>
61# include <sys/queue.h>
62#endif
63#include <net/if.h>
64#if ipf_nat6__FreeBSD_version >= 300000
64#if __FreeBSD_version >= 300000
65# include <net/if_var.h>
66#endif
67#ifdef sun
68# include <net/af.h>
69#endif
70#include <net/route.h>
71#include <netinet/in.h>
72#include <netinet/in_systm.h>

--- 1357 unchanged lines hidden (view full) ---

1430 * Is the buffer big enough for all of it ? It's the size of the IP
1431 * header claimed in the encapsulated part which is of concern. It
1432 * may be too big to be in this buffer but not so big that it's
1433 * outside the ICMP packet, leading to TCP deref's causing problems.
1434 * This is possible because we don't know how big oip_hl is when we
1435 * do the pullup early in ipf_check() and thus can't gaurantee it is
1436 * all here now.
1437 */
65# include <net/if_var.h>
66#endif
67#ifdef sun
68# include <net/af.h>
69#endif
70#include <net/route.h>
71#include <netinet/in.h>
72#include <netinet/in_systm.h>

--- 1357 unchanged lines hidden (view full) ---

1430 * Is the buffer big enough for all of it ? It's the size of the IP
1431 * header claimed in the encapsulated part which is of concern. It
1432 * may be too big to be in this buffer but not so big that it's
1433 * outside the ICMP packet, leading to TCP deref's causing problems.
1434 * This is possible because we don't know how big oip_hl is when we
1435 * do the pullup early in ipf_check() and thus can't gaurantee it is
1436 * all here now.
1437 */
1438#ifdef ipf_nat6_KERNEL
1438#ifdef _KERNEL
1439 {
1440 mb_t *m;
1441
1442 m = fin->fin_m;
1443# if defined(MENTAT)
1444 if ((char *)oip6 + fin->fin_dlen - ICMPERR_ICMPHLEN >
1445 (char *)m->b_wptr) {
1446 ATOMIC_INCL(nside->ns_icmp_mbuf);

--- 2652 unchanged lines hidden ---
1439 {
1440 mb_t *m;
1441
1442 m = fin->fin_m;
1443# if defined(MENTAT)
1444 if ((char *)oip6 + fin->fin_dlen - ICMPERR_ICMPHLEN >
1445 (char *)m->b_wptr) {
1446 ATOMIC_INCL(nside->ns_icmp_mbuf);

--- 2652 unchanged lines hidden ---