ip_fw_pfil.c (225518) | ip_fw_pfil.c (225793) |
---|---|
1/*- 2 * Copyright (c) 2004 Andre Oppermann, Internet Business Solutions AG 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2004 Andre Oppermann, Internet Business Solutions AG 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/netinet/ipfw/ip_fw_pfil.c 225518 2011-09-12 21:09:56Z jhb $"); | 28__FBSDID("$FreeBSD: head/sys/netinet/ipfw/ip_fw_pfil.c 225793 2011-09-27 13:27:17Z bz $"); |
29 30#include "opt_ipfw.h" 31#if !defined(KLD_MODULE) 32#include "opt_ipdn.h" 33#include "opt_inet.h" | 29 30#include "opt_ipfw.h" 31#if !defined(KLD_MODULE) 32#include "opt_ipdn.h" 33#include "opt_inet.h" |
34#include "opt_inet6.h" |
|
34#ifndef INET 35#error IPFIREWALL requires INET. 36#endif /* INET */ 37#endif /* KLD_MODULE */ | 35#ifndef INET 36#error IPFIREWALL requires INET. 37#endif /* INET */ 38#endif /* KLD_MODULE */ |
38#include "opt_inet6.h" | |
39 40#include <sys/param.h> 41#include <sys/systm.h> 42#include <sys/malloc.h> 43#include <sys/mbuf.h> 44#include <sys/module.h> 45#include <sys/kernel.h> 46#include <sys/lock.h> --- 102 unchanged lines hidden (view full) --- 149 150 /* breaking out of the switch means drop */ 151 ret = 0; /* default return value for pass */ 152 switch (ipfw) { 153 case IP_FW_PASS: 154 /* next_hop may be set by ipfw_chk */ 155 if (args.next_hop == NULL && args.next_hop6 == NULL) 156 break; /* pass */ | 39 40#include <sys/param.h> 41#include <sys/systm.h> 42#include <sys/malloc.h> 43#include <sys/mbuf.h> 44#include <sys/module.h> 45#include <sys/kernel.h> 46#include <sys/lock.h> --- 102 unchanged lines hidden (view full) --- 149 150 /* breaking out of the switch means drop */ 151 ret = 0; /* default return value for pass */ 152 switch (ipfw) { 153 case IP_FW_PASS: 154 /* next_hop may be set by ipfw_chk */ 155 if (args.next_hop == NULL && args.next_hop6 == NULL) 156 break; /* pass */ |
157#ifndef IPFIREWALL_FORWARD | 157#if !defined(IPFIREWALL_FORWARD) || (!defined(INET6) && !defined(INET)) |
158 ret = EACCES; 159#else 160 { 161 struct m_tag *fwd_tag; 162 size_t len; 163 164 KASSERT(args.next_hop == NULL || args.next_hop6 == NULL, 165 ("%s: both next_hop=%p and next_hop6=%p not NULL", __func__, --- 34 unchanged lines hidden (view full) --- 200 if (args.next_hop != NULL) { 201 bcopy(args.next_hop, (fwd_tag+1), len); 202 if (in_localip(args.next_hop->sin_addr)) 203 (*m0)->m_flags |= M_FASTFWD_OURS; 204 } 205#endif 206 m_tag_prepend(*m0, fwd_tag); 207 } | 158 ret = EACCES; 159#else 160 { 161 struct m_tag *fwd_tag; 162 size_t len; 163 164 KASSERT(args.next_hop == NULL || args.next_hop6 == NULL, 165 ("%s: both next_hop=%p and next_hop6=%p not NULL", __func__, --- 34 unchanged lines hidden (view full) --- 200 if (args.next_hop != NULL) { 201 bcopy(args.next_hop, (fwd_tag+1), len); 202 if (in_localip(args.next_hop->sin_addr)) 203 (*m0)->m_flags |= M_FASTFWD_OURS; 204 } 205#endif 206 m_tag_prepend(*m0, fwd_tag); 207 } |
208#endif | 208#endif /* IPFIREWALL_FORWARD */ |
209 break; 210 211 case IP_FW_DENY: 212 ret = EACCES; 213 break; /* i.e. drop */ 214 215 case IP_FW_DUMMYNET: 216 ret = EACCES; --- 247 unchanged lines hidden --- | 209 break; 210 211 case IP_FW_DENY: 212 ret = EACCES; 213 break; /* i.e. drop */ 214 215 case IP_FW_DUMMYNET: 216 ret = EACCES; --- 247 unchanged lines hidden --- |