reset nf before xmit vxlan encapsulated packet
PATCH 1/1 reset nf before xmit vxlan encapsulated packet
We should reset nf settings bond to the skb as ipip/ipgre do.
If not, the conntrack/nat info bond to the origin packet may continually redirect the packet to vxlan interface causing a routing loop.
this is the scenario:
VETP VXLAN Gateway
/----\ /---------------\
| | | |
| vx+--+vx --NAT-> eth0+--> Internet
| | | |
\----/ \---------------/
when there are any packet coming from internet to the vetp, there will be lots of garbage packets coming out the gateway's vxlan interface, but none actually sent to the physical interface, because they are redirected back to the vxlan interface in the postrouting chain of NAT rule, and dmesg complains:
Mar 1 21:52:53 debian kernel: [ 8802.997699] Dead loop on virtual device vxlan0, fix it urgently!
Mar 1 21:52:54 debian kernel: [ 8804.004907] Dead loop on virtual device vxlan0, fix it urgently!
Mar 1 21:52:55 debian kernel: [ 8805.012189] Dead loop on virtual device vxlan0, fix it urgently!
Mar 1 21:52:56 debian kernel: [ 8806.020593] Dead loop on virtual device vxlan0, fix it urgently!the patch should fix the problem
--- drivers/net/vxlan.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/vxlan.c +2 -0
@@ -961,6 +961,8 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev) iph->ttl = ttl ? :ip4_dst_hoplimit (&rt->dst);tunnel_ip_select_ident (skb, old_iph, &rt->dst); +nf_reset (skb); +vxlan_set_owner (dev, skb);/* See iptunnel_xmit() */
Signature · 1 line
1.7.10.4
Quoted 36 lines · Zang MingJie
We should reset nf settings bond to the skb as ipip/ipgre do.
If not, the conntrack/nat info bond to the origin packet may continually redirect the packet to vxlan interface causing a routing loop.
this is the scenario:
VETP VXLAN Gateway
/----\ /---------------\
| | | |
| vx+--+vx --NAT-> eth0+--> Internet
| | | |
\----/ \---------------/when there are any packet coming from internet to the vetp, there will be lots of garbage packets coming out the gateway's vxlan interface, but none actually sent to the physical interface, because they are redirected back to the vxlan interface in the postrouting chain of NAT rule, and dmesg complains:
Mar 1 21:52:53 debian kernel: [ 8802.997699] Dead loop on virtual device vxlan0, fix it urgently! Mar 1 21:52:54 debian kernel: [ 8804.004907] Dead loop on virtual device vxlan0, fix it urgently! Mar 1 21:52:55 debian kernel: [ 8805.012189] Dead loop on virtual device vxlan0, fix it urgently! Mar 1 21:52:56 debian kernel: [ 8806.020593] Dead loop on virtual device vxlan0, fix it urgently!the patch should fix the problem
Signed-off-by Zang MingJie <[email protected]>--- drivers/net/vxlan.c | 2 ++ 1 file changed, 2 insertions(+)drivers/net/vxlan.c +0
-0
drivers/net/vxlan.c static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev) · line 968
Quoted 8 lines
drivers/net/vxlan.c +2
-0@@ -961,6 +961,8 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev) iph->ttl = ttl ? :ip4_dst_hoplimit (&rt->dst);tunnel_ip_select_ident (skb, old_iph, &rt->dst); +nf_reset (skb); +vxlan_set_owner (dev, skb);/* See iptunnel_xmit() */
As mentioned in MAINTAINERS file, networking patches should be sent to :
M: "David S. Miller" <[email protected]> L: [email protected]
Thanks !