Lines 135-140
SYSCTL_BOOL(_net_inet_ip, OID_AUTO, source_address_validation,
Link Here
|
135 |
CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip_sav), true, |
135 |
CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip_sav), true, |
136 |
"Drop incoming packets with source address that is a local address"); |
136 |
"Drop incoming packets with source address that is a local address"); |
137 |
|
137 |
|
|
|
138 |
VNET_DEFINE_STATIC(bool, ip_filter_local_output) = false; |
139 |
#define V_ip_filter_local_output VNET(ip_filter_local_output) |
140 |
SYSCTL_BOOL(_net_inet_ip, OID_AUTO, filter_local_output, |
141 |
CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip_filter_local_output), false, |
142 |
"Generate filter output events for packets delivered for local processing"); |
143 |
|
138 |
VNET_DEFINE(pfil_head_t, inet_pfil_head); /* Packet filter hooks */ |
144 |
VNET_DEFINE(pfil_head_t, inet_pfil_head); /* Packet filter hooks */ |
139 |
|
145 |
|
140 |
static struct netisr_handler ip_nh = { |
146 |
static struct netisr_handler ip_nh = { |
Lines 810-815
ip_input(struct mbuf *m)
Link Here
|
810 |
return; |
816 |
return; |
811 |
#endif /* IPSTEALTH */ |
817 |
#endif /* IPSTEALTH */ |
812 |
|
818 |
|
|
|
819 |
/* |
820 |
* We are going to ship the packet to the local protocol stack. Call the |
821 |
* filter again for this 'output' action, allowing redirect-like rules |
822 |
* to adjust the source address. |
823 |
*/ |
824 |
if (PFIL_HOOKED_OUT(V_inet_pfil_head) && V_ip_filter_local_output) { |
825 |
if (pfil_mbuf_out(V_inet_pfil_head, &m, V_loif, NULL) != |
826 |
PFIL_PASS) |
827 |
return; |
828 |
if (m == NULL) /* consumed by filter */ |
829 |
return; |
830 |
ip = mtod(m, struct ip *); |
831 |
} |
832 |
|
813 |
/* |
833 |
/* |
814 |
* Attempt reassembly; if it succeeds, proceed. |
834 |
* Attempt reassembly; if it succeeds, proceed. |
815 |
* ip_reass() will return a different mbuf. |
835 |
* ip_reass() will return a different mbuf. |