aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorGerhard Stenzel <gstenzel@linux.vnet.ibm.com>2014-08-22 15:34:16 -0400
committerDavid S. Miller <davem@davemloft.net>2014-08-22 22:54:56 -0400
commita45e92a599e77ee6a850eabdd0141633fde03915 (patch)
tree36329f9c70cdf5195169fed20ba811293a56a913 /drivers/net
parent451fd72219dd6f3355e2d036c598544c760ee532 (diff)
vxlan: fix incorrect initializer in union vxlan_addr
The first initializer in the following union vxlan_addr ipa = { .sin.sin_addr.s_addr = tip, .sa.sa_family = AF_INET, }; is optimised away by the compiler, due to the second initializer, therefore initialising .sin.sin_addr.s_addr always to 0. This results in netlink messages indicating a L3 miss never contain the missed IP address. This was observed with GCC 4.8 and 4.9. I do not know about previous versions. The problem affects user space programs relying on an IP address being sent as part of a netlink message indicating a L3 miss. Changing .sa.sa_family = AF_INET, to .sin.sin_family = AF_INET, fixes the problem. Signed-off-by: Gerhard Stenzel <gerhard.stenzel@de.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/vxlan.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 1fb7b37d1402..beb377b2d4b7 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1327,7 +1327,7 @@ static int arp_reduce(struct net_device *dev, struct sk_buff *skb)
1327 } else if (vxlan->flags & VXLAN_F_L3MISS) { 1327 } else if (vxlan->flags & VXLAN_F_L3MISS) {
1328 union vxlan_addr ipa = { 1328 union vxlan_addr ipa = {
1329 .sin.sin_addr.s_addr = tip, 1329 .sin.sin_addr.s_addr = tip,
1330 .sa.sa_family = AF_INET, 1330 .sin.sin_family = AF_INET,
1331 }; 1331 };
1332 1332
1333 vxlan_ip_miss(dev, &ipa); 1333 vxlan_ip_miss(dev, &ipa);
@@ -1488,7 +1488,7 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb)
1488 } else if (vxlan->flags & VXLAN_F_L3MISS) { 1488 } else if (vxlan->flags & VXLAN_F_L3MISS) {
1489 union vxlan_addr ipa = { 1489 union vxlan_addr ipa = {
1490 .sin6.sin6_addr = msg->target, 1490 .sin6.sin6_addr = msg->target,
1491 .sa.sa_family = AF_INET6, 1491 .sin6.sin6_family = AF_INET6,
1492 }; 1492 };
1493 1493
1494 vxlan_ip_miss(dev, &ipa); 1494 vxlan_ip_miss(dev, &ipa);
@@ -1521,7 +1521,7 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb)
1521 if (!n && (vxlan->flags & VXLAN_F_L3MISS)) { 1521 if (!n && (vxlan->flags & VXLAN_F_L3MISS)) {
1522 union vxlan_addr ipa = { 1522 union vxlan_addr ipa = {
1523 .sin.sin_addr.s_addr = pip->daddr, 1523 .sin.sin_addr.s_addr = pip->daddr,
1524 .sa.sa_family = AF_INET, 1524 .sin.sin_family = AF_INET,
1525 }; 1525 };
1526 1526
1527 vxlan_ip_miss(dev, &ipa); 1527 vxlan_ip_miss(dev, &ipa);
@@ -1542,7 +1542,7 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb)
1542 if (!n && (vxlan->flags & VXLAN_F_L3MISS)) { 1542 if (!n && (vxlan->flags & VXLAN_F_L3MISS)) {
1543 union vxlan_addr ipa = { 1543 union vxlan_addr ipa = {
1544 .sin6.sin6_addr = pip6->daddr, 1544 .sin6.sin6_addr = pip6->daddr,
1545 .sa.sa_family = AF_INET6, 1545 .sin6.sin6_family = AF_INET6,
1546 }; 1546 };
1547 1547
1548 vxlan_ip_miss(dev, &ipa); 1548 vxlan_ip_miss(dev, &ipa);