mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-11-07 04:36:52 -10:00
pfil: set PFIL_FWD for IPv4 forwarding
Just like we already do for IPv6 set the PFIL_FWD flag when we're forwarding
IPv4 traffic. This allows firewalls to make more precise decisions.
Reviewed by: glebius
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D48824
This commit is contained in:
1 parent
b7f2a457a8
commit
1f4c3887e3
2 files changed
+8
-2
No files matched your search
@@ -401,7 +401,7 @@ passin:
|
||||
if (!PFIL_HOOKED_OUT(V_inet_pfil_head))
|
||||
goto passout;
|
||||
|
||||
if (pfil_mbuf_out(V_inet_pfil_head, &m, nh->nh_ifp,
|
||||
if (pfil_mbuf_fwd(V_inet_pfil_head, &m, nh->nh_ifp,
|
||||
NULL) != PFIL_PASS)
|
||||
goto drop;
|
||||
|
||||
|
||||
@@ -112,13 +112,19 @@ ip_output_pfil(struct mbuf **mp, struct ifnet *ifp, int flags,
|
||||
struct mbuf *m;
|
||||
struct in_addr odst;
|
||||
struct ip *ip;
|
||||
int ret;
|
||||
|
||||
m = *mp;
|
||||
ip = mtod(m, struct ip *);
|
||||
|
||||
/* Run through list of hooks for output packets. */
|
||||
odst.s_addr = ip->ip_dst.s_addr;
|
||||
switch (pfil_mbuf_out(V_inet_pfil_head, mp, ifp, inp)) {
|
||||
if (flags & IP_FORWARDING)
|
||||
ret = pfil_mbuf_fwd(V_inet_pfil_head, mp, ifp, inp);
|
||||
else
|
||||
ret = pfil_mbuf_out(V_inet_pfil_head, mp, ifp, inp);
|
||||
|
||||
switch (ret) {
|
||||
case PFIL_DROPPED:
|
||||
*error = EACCES;
|
||||
/* FALLTHROUGH */
|
||||
|
||||
Reference in new issue
Block a user