mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2025-08-15 02:41:32 +00:00
vxlan: use preferred address family when neither group or remote is specified
When neither group or remote is specified (or if they are specified with the any address), nothing is sent to the kernel. In this case, the kernel defaults to IPv4. This makes impossible to use IPv6 with unspecified unicast remote ("bridge fdb add" will return EAFNOTSUPPORT). If the user specifies a preferred address family (eg, "ip -6 link add"), then send either IFLA_VXLAN_GROUP or IFLA_VXLAN_GROUP6 to enforce the use of the appropriate family. Signed-off-by: Vincent Bernat <vincent@bernat.im>
This commit is contained in:
parent
3e14fd0411
commit
97d564b90c
@ -286,10 +286,14 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
|
|||||||
addattr_l(n, 1024, IFLA_VXLAN_GROUP, &gaddr, 4);
|
addattr_l(n, 1024, IFLA_VXLAN_GROUP, &gaddr, 4);
|
||||||
else if (daddr)
|
else if (daddr)
|
||||||
addattr_l(n, 1024, IFLA_VXLAN_GROUP, &daddr, 4);
|
addattr_l(n, 1024, IFLA_VXLAN_GROUP, &daddr, 4);
|
||||||
if (!IN6_IS_ADDR_UNSPECIFIED(&gaddr6))
|
else if (!IN6_IS_ADDR_UNSPECIFIED(&gaddr6))
|
||||||
addattr_l(n, 1024, IFLA_VXLAN_GROUP6, &gaddr6, sizeof(struct in6_addr));
|
addattr_l(n, 1024, IFLA_VXLAN_GROUP6, &gaddr6, sizeof(struct in6_addr));
|
||||||
else if (!IN6_IS_ADDR_UNSPECIFIED(&daddr6))
|
else if (!IN6_IS_ADDR_UNSPECIFIED(&daddr6))
|
||||||
addattr_l(n, 1024, IFLA_VXLAN_GROUP6, &daddr6, sizeof(struct in6_addr));
|
addattr_l(n, 1024, IFLA_VXLAN_GROUP6, &daddr6, sizeof(struct in6_addr));
|
||||||
|
else if (preferred_family == AF_INET)
|
||||||
|
addattr_l(n, 1024, IFLA_VXLAN_GROUP, &daddr, 4);
|
||||||
|
else if (preferred_family == AF_INET6)
|
||||||
|
addattr_l(n, 1024, IFLA_VXLAN_GROUP6, &daddr6, sizeof(struct in6_addr));
|
||||||
|
|
||||||
if (saddr)
|
if (saddr)
|
||||||
addattr_l(n, 1024, IFLA_VXLAN_LOCAL, &saddr, 4);
|
addattr_l(n, 1024, IFLA_VXLAN_LOCAL, &saddr, 4);
|
||||||
|
Loading…
Reference in New Issue
Block a user