[PATCH RFC net-next] vxlan: always report local address

From: Gabriel Goller

Date: Wed Nov 04 2026 - 10:34:09 EST


When a VXLAN device has no local address, link dumps and notifications
contain neither IFLA_VXLAN_LOCAL nor IFLA_VXLAN_LOCAL6. If the device
also has no remote or group address, userspace can't tell whether it is
an IPv4 or IPv6 device, even though the kernel stores the family. FRR
runs into this when it finds existing VXLAN devices after a restart.

Report the local address even when it is unset, as IFLA_VXLAN_LOCAL
0.0.0.0 or IFLA_VXLAN_LOCAL6 ::, so the attribute type shows the
family.

Signed-off-by: Gabriel Goller <g.goller@xxxxxxxxxxx>
---
drivers/net/vxlan/vxlan_core.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c
index 223539099778..95dcdf610cd1 100644
--- a/drivers/net/vxlan/vxlan_core.c
+++ b/drivers/net/vxlan/vxlan_core.c
@@ -4773,18 +4773,17 @@ static int vxlan_fill_info(struct sk_buff *skb, const struct net_device *dev)
if (cfg->remote_ifindex && nla_put_u32(skb, IFLA_VXLAN_LINK, cfg->remote_ifindex))
goto nla_put_failure;

- if (!vxlan_addr_any(&cfg->saddr)) {
- if (cfg->saddr.sa.sa_family == AF_INET) {
- if (nla_put_in_addr(skb, IFLA_VXLAN_LOCAL,
- cfg->saddr.sin.sin_addr.s_addr))
- goto nla_put_failure;
+ /* Report the address family even when the local address is unspecified. */
+ if (cfg->saddr.sa.sa_family == AF_INET) {
+ if (nla_put_in_addr(skb, IFLA_VXLAN_LOCAL,
+ cfg->saddr.sin.sin_addr.s_addr))
+ goto nla_put_failure;
#if IS_ENABLED(CONFIG_IPV6)
- } else {
- if (nla_put_in6_addr(skb, IFLA_VXLAN_LOCAL6,
- &cfg->saddr.sin6.sin6_addr))
- goto nla_put_failure;
+ } else {
+ if (nla_put_in6_addr(skb, IFLA_VXLAN_LOCAL6,
+ &cfg->saddr.sin6.sin6_addr))
+ goto nla_put_failure;
#endif
- }
}

if (nla_put_u8(skb, IFLA_VXLAN_TTL, cfg->ttl) ||

---
base-commit: 7b6ab4dbc156e2f96419715130b3d5738a306c93
base-tree: git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git main
change-id: 20261104-vxlan_preserve_local-c3fa959e9715

Best regards,
--
Gabriel Goller <g.goller@xxxxxxxxxxx>