netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2] iplink_vxlan: take into account preferred_family creating vxlan device
       [not found] <cover.1537536423.git.lorenzo.bianconi@redhat.com>
@ 2018-09-21 13:34 ` Lorenzo Bianconi
  2018-09-21 15:58   ` Stephen Hemminger
  2018-09-25  8:12   ` Stephen Hemminger
  0 siblings, 2 replies; 4+ messages in thread
From: Lorenzo Bianconi @ 2018-09-21 13:34 UTC (permalink / raw)
  To: netdev; +Cc: stephen

Take into account the configured preferred_family if neither saddr or
daddr are provided since otherwise vxlan kernel module will use IPv4 as
default remote inet family neglecting the one provided by userspace.
This behaviour was originally in commit 97d564b90ccb ("vxlan: use
preferred address family when neither group or remote is specified").
The issue can be triggered with the following reproducer:

$ip -6 link add vxlan1 type vxlan id 42 dev enp0s2 \
     proxy nolearning l2miss l3miss
$bridge fdb add 46:47:1f:a7:1c:25 dev vxlan1 dst 2000::2
RTNETLINK answers: Address family not supported by protocol

Fixes: 1e9b8072de2c ("iplink_vxlan: Get rid of inet_get_addr()")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
 ip/iplink_vxlan.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/ip/iplink_vxlan.c b/ip/iplink_vxlan.c
index 2bc253fc..831f39a2 100644
--- a/ip/iplink_vxlan.c
+++ b/ip/iplink_vxlan.c
@@ -82,6 +82,7 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
 	__u64 attrs = 0;
 	bool set_op = (n->nlmsg_type == RTM_NEWLINK &&
 		       !(n->nlmsg_flags & NLM_F_CREATE));
+	bool selected_family = false;
 
 	saddr.family = daddr.family = AF_UNSPEC;
 
@@ -356,12 +357,26 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
 		int type = (saddr.family == AF_INET) ? IFLA_VXLAN_LOCAL
 						     : IFLA_VXLAN_LOCAL6;
 		addattr_l(n, 1024, type, saddr.data, saddr.bytelen);
+		selected_family = true;
 	}
 
 	if (is_addrtype_inet(&daddr)) {
 		int type = (daddr.family == AF_INET) ? IFLA_VXLAN_GROUP
 						     : IFLA_VXLAN_GROUP6;
 		addattr_l(n, 1024, type, daddr.data, daddr.bytelen);
+		selected_family = true;
+	}
+
+	if (!selected_family) {
+		if (preferred_family == AF_INET) {
+			get_addr(&daddr, "default", AF_INET);
+			addattr_l(n, 1024, IFLA_VXLAN_GROUP,
+				  daddr.data, daddr.bytelen);
+		} else if (preferred_family == AF_INET6) {
+			get_addr(&daddr, "default", AF_INET6);
+			addattr_l(n, 1024, IFLA_VXLAN_GROUP6,
+				  daddr.data, daddr.bytelen);
+		}
 	}
 
 	if (!set_op || VXLAN_ATTRSET(attrs, IFLA_VXLAN_LEARNING))
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH iproute2] iplink_vxlan: take into account preferred_family creating vxlan device
  2018-09-21 13:34 ` [PATCH iproute2] iplink_vxlan: take into account preferred_family creating vxlan device Lorenzo Bianconi
@ 2018-09-21 15:58   ` Stephen Hemminger
  2018-09-21 16:35     ` Lorenzo Bianconi
  2018-09-25  8:12   ` Stephen Hemminger
  1 sibling, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2018-09-21 15:58 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: netdev

On Fri, 21 Sep 2018 15:34:25 +0200
Lorenzo Bianconi <lorenzo.bianconi@redhat.com> wrote:

> Take into account the configured preferred_family if neither saddr or
> daddr are provided since otherwise vxlan kernel module will use IPv4 as
> default remote inet family neglecting the one provided by userspace.
> This behaviour was originally in commit 97d564b90ccb ("vxlan: use
> preferred address family when neither group or remote is specified").
> The issue can be triggered with the following reproducer:
> 
> $ip -6 link add vxlan1 type vxlan id 42 dev enp0s2 \
>      proxy nolearning l2miss l3miss
> $bridge fdb add 46:47:1f:a7:1c:25 dev vxlan1 dst 2000::2
> RTNETLINK answers: Address family not supported by protocol
> 
> Fixes: 1e9b8072de2c ("iplink_vxlan: Get rid of inet_get_addr()")
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

This patch was already in the queue. Is this a new version (if so please mark it as v2).

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH iproute2] iplink_vxlan: take into account preferred_family creating vxlan device
  2018-09-21 15:58   ` Stephen Hemminger
@ 2018-09-21 16:35     ` Lorenzo Bianconi
  0 siblings, 0 replies; 4+ messages in thread
From: Lorenzo Bianconi @ 2018-09-21 16:35 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

> On Fri, 21 Sep 2018 15:34:25 +0200
> Lorenzo Bianconi <lorenzo.bianconi@redhat.com> wrote:
> 
> > Take into account the configured preferred_family if neither saddr or
> > daddr are provided since otherwise vxlan kernel module will use IPv4 as
> > default remote inet family neglecting the one provided by userspace.
> > This behaviour was originally in commit 97d564b90ccb ("vxlan: use
> > preferred address family when neither group or remote is specified").
> > The issue can be triggered with the following reproducer:
> > 
> > $ip -6 link add vxlan1 type vxlan id 42 dev enp0s2 \
> >      proxy nolearning l2miss l3miss
> > $bridge fdb add 46:47:1f:a7:1c:25 dev vxlan1 dst 2000::2
> > RTNETLINK answers: Address family not supported by protocol
> > 
> > Fixes: 1e9b8072de2c ("iplink_vxlan: Get rid of inet_get_addr()")
> > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
> 
> This patch was already in the queue. Is this a new version (if so please mark it as v2).

Hi Stephen,

yes, this is a v2. I missed v2 in the subject and changes respect to v1
(I have just modified the commit log actually). Please drop v1 and sorry for
the noise.

Regards,
Lorenzo

> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH iproute2] iplink_vxlan: take into account preferred_family creating vxlan device
  2018-09-21 13:34 ` [PATCH iproute2] iplink_vxlan: take into account preferred_family creating vxlan device Lorenzo Bianconi
  2018-09-21 15:58   ` Stephen Hemminger
@ 2018-09-25  8:12   ` Stephen Hemminger
  1 sibling, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2018-09-25  8:12 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: netdev

On Fri, 21 Sep 2018 15:34:25 +0200
Lorenzo Bianconi <lorenzo.bianconi@redhat.com> wrote:

> Take into account the configured preferred_family if neither saddr or
> daddr are provided since otherwise vxlan kernel module will use IPv4 as
> default remote inet family neglecting the one provided by userspace.
> This behaviour was originally in commit 97d564b90ccb ("vxlan: use
> preferred address family when neither group or remote is specified").
> The issue can be triggered with the following reproducer:
> 
> $ip -6 link add vxlan1 type vxlan id 42 dev enp0s2 \
>      proxy nolearning l2miss l3miss
> $bridge fdb add 46:47:1f:a7:1c:25 dev vxlan1 dst 2000::2
> RTNETLINK answers: Address family not supported by protocol
> 
> Fixes: 1e9b8072de2c ("iplink_vxlan: Get rid of inet_get_addr()")
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-09-25 14:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1537536423.git.lorenzo.bianconi@redhat.com>
2018-09-21 13:34 ` [PATCH iproute2] iplink_vxlan: take into account preferred_family creating vxlan device Lorenzo Bianconi
2018-09-21 15:58   ` Stephen Hemminger
2018-09-21 16:35     ` Lorenzo Bianconi
2018-09-25  8:12   ` Stephen Hemminger

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).