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

From: Gabriel Goller

Date: Mon Nov 23 2026 - 10:12:00 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>
---
Changes in v2:
- rebase
- Link to v1: https://lore.kernel.org/20261104-vxlan_preserve_local-v1-1-e9b51f2132b4@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 d11028b37472..b7ad60cb5d12 100644
--- a/drivers/net/vxlan/vxlan_core.c
+++ b/drivers/net/vxlan/vxlan_core.c
@@ -4765,18 +4765,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: 2388bb763e323442f4dd8189238ac0c5f334c4a0
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>