* [PATCH net-next v2] vxlan: always report local address
@ 2026-11-23 15:10 Gabriel Goller
2026-11-24 6:47 ` Hangbin Liu
0 siblings, 1 reply; 2+ messages in thread
From: Gabriel Goller @ 2026-11-23 15:10 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: Ido Schimmel, netdev, linux-kernel, Gabriel Goller
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@proxmox.com>
---
Changes in v2:
- rebase
- Link to v1: https://lore.kernel.org/20261104-vxlan_preserve_local-v1-1-e9b51f2132b4@proxmox.com
---
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@proxmox.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH net-next v2] vxlan: always report local address
2026-11-23 15:10 [PATCH net-next v2] vxlan: always report local address Gabriel Goller
@ 2026-11-24 6:47 ` Hangbin Liu
0 siblings, 0 replies; 2+ messages in thread
From: Hangbin Liu @ 2026-11-24 6:47 UTC (permalink / raw)
To: Gabriel Goller
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Ido Schimmel, netdev, linux-kernel
On Mon, Nov 23, 2026 at 04:10:06PM +0100, Gabriel Goller wrote:
> 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@proxmox.com>
> ---
> Changes in v2:
> - rebase
> - Link to v1: https://lore.kernel.org/20261104-vxlan_preserve_local-v1-1-e9b51f2132b4@proxmox.com
> ---
> 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@proxmox.com>
>
>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-24 6:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-23 15:10 [PATCH net-next v2] vxlan: always report local address Gabriel Goller
2026-11-24 6:47 ` Hangbin Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®