diff options
author | Ido Schimmel <idosch@mellanox.com> | 2018-12-04 11:15:11 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-12-04 19:36:36 +0300 |
commit | f839a6c92504cff92a10f522cf686b51ff18dd35 (patch) | |
tree | 3e009acdcbadcf34c837d2018f52c9ab4374b3cc /net/ipv6/ip6_output.c | |
parent | 875e8939953483d856de226b72d14c6a000f9457 (diff) | |
download | linux-f839a6c92504cff92a10f522cf686b51ff18dd35.tar.xz |
net: Do not route unicast IP packets twice
Packets marked with 'offload_l3_fwd_mark' were already forwarded by a
capable device and should not be forwarded again by the kernel.
Therefore, have the kernel consume them.
The check is performed in ip{,6}_forward_finish() in order to allow the
kernel to process such packets in ip{,6}_forward() and generate required
exceptions. For example, ICMP redirects.
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ip6_output.c')
-rw-r--r-- | net/ipv6/ip6_output.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index ec8c235ea891..6592a39e5ec1 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -378,6 +378,13 @@ static inline int ip6_forward_finish(struct net *net, struct sock *sk, __IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_OUTFORWDATAGRAMS); __IP6_ADD_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_OUTOCTETS, skb->len); +#ifdef CONFIG_NET_SWITCHDEV + if (skb->offload_l3_fwd_mark) { + consume_skb(skb); + return 0; + } +#endif + return dst_output(net, sk, skb); } |