Commit ce212d0f authored by Jiri Benc's avatar Jiri Benc Committed by David S. Miller

vxlan: interpret IP headers for ECN correctly

When looking for outer IP header, use the actual socket address family, not
the address family of the default destination which is not set for metadata
based interfaces (and doesn't have to match the address family of the
received packet even if it was set).

Fix also the misleading comment.
Signed-off-by: default avatarJiri Benc <jbenc@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0c9cd7c4
...@@ -1158,7 +1158,6 @@ static void vxlan_rcv(struct vxlan_sock *vs, struct sk_buff *skb, ...@@ -1158,7 +1158,6 @@ static void vxlan_rcv(struct vxlan_sock *vs, struct sk_buff *skb,
struct pcpu_sw_netstats *stats; struct pcpu_sw_netstats *stats;
union vxlan_addr saddr; union vxlan_addr saddr;
int err = 0; int err = 0;
union vxlan_addr *remote_ip;
/* For flow based devices, map all packets to VNI 0 */ /* For flow based devices, map all packets to VNI 0 */
if (vs->flags & VXLAN_F_COLLECT_METADATA) if (vs->flags & VXLAN_F_COLLECT_METADATA)
...@@ -1169,7 +1168,6 @@ static void vxlan_rcv(struct vxlan_sock *vs, struct sk_buff *skb, ...@@ -1169,7 +1168,6 @@ static void vxlan_rcv(struct vxlan_sock *vs, struct sk_buff *skb,
if (!vxlan) if (!vxlan)
goto drop; goto drop;
remote_ip = &vxlan->default_dst.remote_ip;
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
skb_scrub_packet(skb, !net_eq(vxlan->net, dev_net(vxlan->dev))); skb_scrub_packet(skb, !net_eq(vxlan->net, dev_net(vxlan->dev)));
skb->protocol = eth_type_trans(skb, vxlan->dev); skb->protocol = eth_type_trans(skb, vxlan->dev);
...@@ -1179,8 +1177,8 @@ static void vxlan_rcv(struct vxlan_sock *vs, struct sk_buff *skb, ...@@ -1179,8 +1177,8 @@ static void vxlan_rcv(struct vxlan_sock *vs, struct sk_buff *skb,
if (ether_addr_equal(eth_hdr(skb)->h_source, vxlan->dev->dev_addr)) if (ether_addr_equal(eth_hdr(skb)->h_source, vxlan->dev->dev_addr))
goto drop; goto drop;
/* Re-examine inner Ethernet packet */ /* Get data from the outer IP header */
if (remote_ip->sa.sa_family == AF_INET) { if (vxlan_get_sk_family(vs) == AF_INET) {
oip = ip_hdr(skb); oip = ip_hdr(skb);
saddr.sin.sin_addr.s_addr = oip->saddr; saddr.sin.sin_addr.s_addr = oip->saddr;
saddr.sa.sa_family = AF_INET; saddr.sa.sa_family = AF_INET;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment