|
|
7e752c |
From f08a8608335d46bea1b2cb122823a4c538ce6e46 Mon Sep 17 00:00:00 2001
|
|
|
7e752c |
From: Phil Sutter <psutter@redhat.com>
|
|
|
7e752c |
Date: Thu, 18 Oct 2018 10:53:57 +0200
|
|
|
7e752c |
Subject: [PATCH] iplink_vxlan: take into account preferred_family creating
|
|
|
7e752c |
vxlan device
|
|
|
7e752c |
|
|
|
7e752c |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1626321
|
|
|
7e752c |
Upstream Status: iproute2.git commit c1360e3b483e5
|
|
|
7e752c |
|
|
|
7e752c |
commit c1360e3b483e54a61a36bd2fdb3bfb91a4d2b32a
|
|
|
7e752c |
Author: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
|
|
|
7e752c |
Date: Fri Sep 21 15:34:25 2018 +0200
|
|
|
7e752c |
|
|
|
7e752c |
iplink_vxlan: take into account preferred_family creating vxlan device
|
|
|
7e752c |
|
|
|
7e752c |
Take into account the configured preferred_family if neither saddr or
|
|
|
7e752c |
daddr are provided since otherwise vxlan kernel module will use IPv4 as
|
|
|
7e752c |
default remote inet family neglecting the one provided by userspace.
|
|
|
7e752c |
This behaviour was originally in commit 97d564b90ccb ("vxlan: use
|
|
|
7e752c |
preferred address family when neither group or remote is specified").
|
|
|
7e752c |
The issue can be triggered with the following reproducer:
|
|
|
7e752c |
|
|
|
7e752c |
$ip -6 link add vxlan1 type vxlan id 42 dev enp0s2 \
|
|
|
7e752c |
proxy nolearning l2miss l3miss
|
|
|
7e752c |
$bridge fdb add 46:47:1f:a7:1c:25 dev vxlan1 dst 2000::2
|
|
|
7e752c |
RTNETLINK answers: Address family not supported by protocol
|
|
|
7e752c |
|
|
|
7e752c |
Fixes: 1e9b8072de2c ("iplink_vxlan: Get rid of inet_get_addr()")
|
|
|
7e752c |
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
|
|
|
7e752c |
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
|
|
|
7e752c |
---
|
|
|
7e752c |
ip/iplink_vxlan.c | 15 +++++++++++++++
|
|
|
7e752c |
1 file changed, 15 insertions(+)
|
|
|
7e752c |
|
|
|
7e752c |
diff --git a/ip/iplink_vxlan.c b/ip/iplink_vxlan.c
|
|
|
7e752c |
index 2bc253f..831f39a 100644
|
|
|
7e752c |
--- a/ip/iplink_vxlan.c
|
|
|
7e752c |
+++ b/ip/iplink_vxlan.c
|
|
|
7e752c |
@@ -82,6 +82,7 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
|
|
|
7e752c |
__u64 attrs = 0;
|
|
|
7e752c |
bool set_op = (n->nlmsg_type == RTM_NEWLINK &&
|
|
|
7e752c |
!(n->nlmsg_flags & NLM_F_CREATE));
|
|
|
7e752c |
+ bool selected_family = false;
|
|
|
7e752c |
|
|
|
7e752c |
saddr.family = daddr.family = AF_UNSPEC;
|
|
|
7e752c |
|
|
|
7e752c |
@@ -356,12 +357,26 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
|
|
|
7e752c |
int type = (saddr.family == AF_INET) ? IFLA_VXLAN_LOCAL
|
|
|
7e752c |
: IFLA_VXLAN_LOCAL6;
|
|
|
7e752c |
addattr_l(n, 1024, type, saddr.data, saddr.bytelen);
|
|
|
7e752c |
+ selected_family = true;
|
|
|
7e752c |
}
|
|
|
7e752c |
|
|
|
7e752c |
if (is_addrtype_inet(&daddr)) {
|
|
|
7e752c |
int type = (daddr.family == AF_INET) ? IFLA_VXLAN_GROUP
|
|
|
7e752c |
: IFLA_VXLAN_GROUP6;
|
|
|
7e752c |
addattr_l(n, 1024, type, daddr.data, daddr.bytelen);
|
|
|
7e752c |
+ selected_family = true;
|
|
|
7e752c |
+ }
|
|
|
7e752c |
+
|
|
|
7e752c |
+ if (!selected_family) {
|
|
|
7e752c |
+ if (preferred_family == AF_INET) {
|
|
|
7e752c |
+ get_addr(&daddr, "default", AF_INET);
|
|
|
7e752c |
+ addattr_l(n, 1024, IFLA_VXLAN_GROUP,
|
|
|
7e752c |
+ daddr.data, daddr.bytelen);
|
|
|
7e752c |
+ } else if (preferred_family == AF_INET6) {
|
|
|
7e752c |
+ get_addr(&daddr, "default", AF_INET6);
|
|
|
7e752c |
+ addattr_l(n, 1024, IFLA_VXLAN_GROUP6,
|
|
|
7e752c |
+ daddr.data, daddr.bytelen);
|
|
|
7e752c |
+ }
|
|
|
7e752c |
}
|
|
|
7e752c |
|
|
|
7e752c |
if (!set_op || VXLAN_ATTRSET(attrs, IFLA_VXLAN_LEARNING))
|
|
|
7e752c |
--
|
|
|
7e752c |
1.8.3.1
|
|
|
7e752c |
|