* [PATCH net] vxlan: fix incorrect initializer in union vxlan_addr [not found] <53EDCC19.70702@linux.vnet.ibm.com> @ 2014-08-15 9:03 ` Gerhard Stenzel 2014-08-16 22:48 ` Cong Wang 2014-08-18 17:11 ` David Miller 0 siblings, 2 replies; 5+ messages in thread From: Gerhard Stenzel @ 2014-08-15 9:03 UTC (permalink / raw) To: netdev 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> --- diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 1fb7b37..beb377b 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) } else if (vxlan->flags & VXLAN_F_L3MISS) { union vxlan_addr ipa = { .sin.sin_addr.s_addr = tip, - .sa.sa_family = AF_INET, + .sin.sin_family = AF_INET, }; vxlan_ip_miss(dev, &ipa); @@ -1488,7 +1488,7 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb) } else if (vxlan->flags & VXLAN_F_L3MISS) { union vxlan_addr ipa = { .sin6.sin6_addr = msg->target, - .sa.sa_family = AF_INET6, + .sin6.sin6_family = AF_INET6, }; vxlan_ip_miss(dev, &ipa); @@ -1521,7 +1521,7 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb) if (!n && (vxlan->flags & VXLAN_F_L3MISS)) { union vxlan_addr ipa = { .sin.sin_addr.s_addr = pip->daddr, - .sa.sa_family = AF_INET, + .sin.sin_family = AF_INET, }; vxlan_ip_miss(dev, &ipa); @@ -1542,7 +1542,7 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb) if (!n && (vxlan->flags & VXLAN_F_L3MISS)) { union vxlan_addr ipa = { .sin6.sin6_addr = pip6->daddr, - .sa.sa_family = AF_INET6, + .sin6.sin6_family = AF_INET6, }; vxlan_ip_miss(dev, &ipa); ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net] vxlan: fix incorrect initializer in union vxlan_addr 2014-08-15 9:03 ` [PATCH net] vxlan: fix incorrect initializer in union vxlan_addr Gerhard Stenzel @ 2014-08-16 22:48 ` Cong Wang 2014-08-18 17:11 ` David Miller 1 sibling, 0 replies; 5+ messages in thread From: Cong Wang @ 2014-08-16 22:48 UTC (permalink / raw) To: Gerhard Stenzel; +Cc: netdev On Fri, Aug 15, 2014 at 2:03 AM, Gerhard Stenzel <gstenzel@linux.vnet.ibm.com> wrote: > > 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. So GCC can't figure out we are initializing different parts of this union through different members... Or maybe we should not use initializer at all. Anyway, Acked-by: Cong Wang <cwang@twopensource.com> ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] vxlan: fix incorrect initializer in union vxlan_addr 2014-08-15 9:03 ` [PATCH net] vxlan: fix incorrect initializer in union vxlan_addr Gerhard Stenzel 2014-08-16 22:48 ` Cong Wang @ 2014-08-18 17:11 ` David Miller 2014-08-19 20:36 ` Gerhard Stenzel 1 sibling, 1 reply; 5+ messages in thread From: David Miller @ 2014-08-18 17:11 UTC (permalink / raw) To: gstenzel; +Cc: netdev From: Gerhard Stenzel <gstenzel@linux.vnet.ibm.com> Date: Fri, 15 Aug 2014 11:03:58 +0200 > > 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> Your patch was corrupted by your email client, also please do not indent your signoff. THanks. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] vxlan: fix incorrect initializer in union vxlan_addr 2014-08-18 17:11 ` David Miller @ 2014-08-19 20:36 ` Gerhard Stenzel 2014-08-22 4:27 ` David Miller 0 siblings, 1 reply; 5+ messages in thread From: Gerhard Stenzel @ 2014-08-19 20:36 UTC (permalink / raw) To: David Miller; +Cc: netdev Trying again ... On 08/18/2014 07:11 PM, David Miller wrote: ... > > Your patch was corrupted by your email client, also please do not > indent your signoff. > > THanks. > 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> --- diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 1fb7b37..beb377b 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) } else if (vxlan->flags & VXLAN_F_L3MISS) { union vxlan_addr ipa = { .sin.sin_addr.s_addr = tip, - .sa.sa_family = AF_INET, + .sin.sin_family = AF_INET, }; vxlan_ip_miss(dev, &ipa); @@ -1488,7 +1488,7 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb) } else if (vxlan->flags & VXLAN_F_L3MISS) { union vxlan_addr ipa = { .sin6.sin6_addr = msg->target, - .sa.sa_family = AF_INET6, + .sin6.sin6_family = AF_INET6, }; vxlan_ip_miss(dev, &ipa); @@ -1521,7 +1521,7 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb) if (!n && (vxlan->flags & VXLAN_F_L3MISS)) { union vxlan_addr ipa = { .sin.sin_addr.s_addr = pip->daddr, - .sa.sa_family = AF_INET, + .sin.sin_family = AF_INET, }; vxlan_ip_miss(dev, &ipa); @@ -1542,7 +1542,7 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb) if (!n && (vxlan->flags & VXLAN_F_L3MISS)) { union vxlan_addr ipa = { .sin6.sin6_addr = pip6->daddr, - .sa.sa_family = AF_INET6, + .sin6.sin6_family = AF_INET6, }; vxlan_ip_miss(dev, &ipa); ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net] vxlan: fix incorrect initializer in union vxlan_addr 2014-08-19 20:36 ` Gerhard Stenzel @ 2014-08-22 4:27 ` David Miller 0 siblings, 0 replies; 5+ messages in thread From: David Miller @ 2014-08-22 4:27 UTC (permalink / raw) To: gstenzel; +Cc: netdev From: Gerhard Stenzel <gstenzel@linux.vnet.ibm.com> Date: Tue, 19 Aug 2014 22:36:43 +0200 > Trying again ... This is not the correct way to resubmit a patch properly. Do not ever submit a new copy of a patch as a reply to a discussion thread, quoting unrelated material, etc. Instead, make a new, fresh, mailing list posting as if you were posting the patch for the first time. Except you add "[PATCH v2 net]" or similar to indicate this is a new submission of the patch. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-08-22 4:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <53EDCC19.70702@linux.vnet.ibm.com>
2014-08-15 9:03 ` [PATCH net] vxlan: fix incorrect initializer in union vxlan_addr Gerhard Stenzel
2014-08-16 22:48 ` Cong Wang
2014-08-18 17:11 ` David Miller
2014-08-19 20:36 ` Gerhard Stenzel
2014-08-22 4:27 ` David Miller
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).