提交 a45e92a5 编写于 作者: G Gerhard Stenzel 提交者: David S. Miller

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: NGerhard Stenzel <gerhard.stenzel@de.ibm.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 451fd722
...@@ -1327,7 +1327,7 @@ static int arp_reduce(struct net_device *dev, struct sk_buff *skb) ...@@ -1327,7 +1327,7 @@ static int arp_reduce(struct net_device *dev, struct sk_buff *skb)
} else if (vxlan->flags & VXLAN_F_L3MISS) { } else if (vxlan->flags & VXLAN_F_L3MISS) {
union vxlan_addr ipa = { union vxlan_addr ipa = {
.sin.sin_addr.s_addr = tip, .sin.sin_addr.s_addr = tip,
.sa.sa_family = AF_INET, .sin.sin_family = AF_INET,
}; };
vxlan_ip_miss(dev, &ipa); vxlan_ip_miss(dev, &ipa);
...@@ -1488,7 +1488,7 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb) ...@@ -1488,7 +1488,7 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb)
} else if (vxlan->flags & VXLAN_F_L3MISS) { } else if (vxlan->flags & VXLAN_F_L3MISS) {
union vxlan_addr ipa = { union vxlan_addr ipa = {
.sin6.sin6_addr = msg->target, .sin6.sin6_addr = msg->target,
.sa.sa_family = AF_INET6, .sin6.sin6_family = AF_INET6,
}; };
vxlan_ip_miss(dev, &ipa); vxlan_ip_miss(dev, &ipa);
...@@ -1521,7 +1521,7 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb) ...@@ -1521,7 +1521,7 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb)
if (!n && (vxlan->flags & VXLAN_F_L3MISS)) { if (!n && (vxlan->flags & VXLAN_F_L3MISS)) {
union vxlan_addr ipa = { union vxlan_addr ipa = {
.sin.sin_addr.s_addr = pip->daddr, .sin.sin_addr.s_addr = pip->daddr,
.sa.sa_family = AF_INET, .sin.sin_family = AF_INET,
}; };
vxlan_ip_miss(dev, &ipa); vxlan_ip_miss(dev, &ipa);
...@@ -1542,7 +1542,7 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb) ...@@ -1542,7 +1542,7 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb)
if (!n && (vxlan->flags & VXLAN_F_L3MISS)) { if (!n && (vxlan->flags & VXLAN_F_L3MISS)) {
union vxlan_addr ipa = { union vxlan_addr ipa = {
.sin6.sin6_addr = pip6->daddr, .sin6.sin6_addr = pip6->daddr,
.sa.sa_family = AF_INET6, .sin6.sin6_family = AF_INET6,
}; };
vxlan_ip_miss(dev, &ipa); vxlan_ip_miss(dev, &ipa);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册