Skip to content

Commit ccd27f0

Browse files
NicolasDichteldavem330
authored andcommitted
ipv6: fix 'disable_policy' for fwd packets
The goal of commit df789fe ("ipv6: Provide ipv6 version of "disable_policy" sysctl") was to have the disable_policy from ipv4 available on ipv6. However, it's not exactly the same mechanism. On IPv4, all packets coming from an interface, which has disable_policy set, bypass the policy check. For ipv6, this is done only for local packets, ie for packets destinated to an address configured on the incoming interface. Let's align ipv6 with ipv4 so that the 'disable_policy' sysctl has the same effect for both protocols. My first approach was to create a new kind of route cache entries, to be able to set DST_NOPOLICY without modifying routes. This would have added a lot of code. Because the local delivery path is already handled, I choose to focus on the forwarding path to minimize code churn. Fixes: df789fe ("ipv6: Provide ipv6 version of "disable_policy" sysctl") Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent ad1f379 commit ccd27f0

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎net/ipv6/ip6_output.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,9 @@ int ip6_forward(struct sk_buff *skb)
479479
if (skb_warn_if_lro(skb))
480480
goto drop;
481481

482-
if (!xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) {
482+
if (!net->ipv6.devconf_all->disable_policy &&
483+
!idev->cnf.disable_policy &&
484+
!xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) {
483485
__IP6_INC_STATS(net, idev, IPSTATS_MIB_INDISCARDS);
484486
goto drop;
485487
}

0 commit comments

Comments
 (0)