Message ID | 6986ccd18ece80d1c1adb028972a2bca603b9c11.1738949252.git.petrm@nvidia.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | vxlan: Join / leave MC group when reconfigured | expand |
On 2/7/25 6:34 PM, Petr Machata wrote: > @@ -3899,6 +3904,11 @@ static void vxlan_config_apply(struct net_device *dev, > dev->mtu = conf->mtu; > > vxlan->net = src_net; > + > + } else if (vxlan->dev->flags & IFF_UP) { > + if (vxlan_addr_multicast(&vxlan->default_dst.remote_ip) && > + rem_changed) > + vxlan_multicast_leave(vxlan); AFAICS vxlan_vni_update_group() is not completely ignore vxlan_multicast_{leave,join} errors. Instead is bailing out as soon as any error happens. For consistency's sake I think it would be better do the same here. Also I have the feeling that ending-up in an inconsistent status with no group joined would be less troublesome than the opposite. /P
Paolo Abeni <pabeni@redhat.com> writes: > On 2/7/25 6:34 PM, Petr Machata wrote: >> @@ -3899,6 +3904,11 @@ static void vxlan_config_apply(struct net_device *dev, >> dev->mtu = conf->mtu; >> >> vxlan->net = src_net; >> + >> + } else if (vxlan->dev->flags & IFF_UP) { >> + if (vxlan_addr_multicast(&vxlan->default_dst.remote_ip) && >> + rem_changed) >> + vxlan_multicast_leave(vxlan); > > AFAICS vxlan_vni_update_group() is not completely ignore > vxlan_multicast_{leave,join} errors. Instead is bailing out as soon as > any error happens. For consistency's sake I think it would be better do > the same here. > > Also I have the feeling that ending-up in an inconsistent status with no > group joined would be less troublesome than the opposite. This can already happen FWIW. If you currently want to change the remote group address in a way that doesn't break things, you take the netdevice down, then change it, then bring it back up. The leave during downing can fail and will not be diagnosed. (Nor can it really be, you can't veto downing.) I can add the bail-outs that you ask for, but I don't know that there is a way to resolve these issues for real.
On 2/11/25 3:56 PM, Petr Machata wrote: > Paolo Abeni <pabeni@redhat.com> writes: >> On 2/7/25 6:34 PM, Petr Machata wrote: >>> @@ -3899,6 +3904,11 @@ static void vxlan_config_apply(struct net_device *dev, >>> dev->mtu = conf->mtu; >>> >>> vxlan->net = src_net; >>> + >>> + } else if (vxlan->dev->flags & IFF_UP) { >>> + if (vxlan_addr_multicast(&vxlan->default_dst.remote_ip) && >>> + rem_changed) >>> + vxlan_multicast_leave(vxlan); >> >> AFAICS vxlan_vni_update_group() is not completely ignore >> vxlan_multicast_{leave,join} errors. Instead is bailing out as soon as >> any error happens. For consistency's sake I think it would be better do >> the same here. >> >> Also I have the feeling that ending-up in an inconsistent status with no >> group joined would be less troublesome than the opposite. > > This can already happen FWIW. If you currently want to change the remote > group address in a way that doesn't break things, you take the netdevice > down, then change it, then bring it back up. The leave during downing > can fail and will not be diagnosed. (Nor can it really be, you can't > veto downing.) I see. > I can add the bail-outs that you ask for, but I don't know that there is > a way to resolve these issues for real. The main point I made was about consistency: making the vxlan_config_apply() behavior as close as possible to vxlan_vni_update_group() as stated in the commit message. Cheers, Paolo
Paolo Abeni <pabeni@redhat.com> writes: > On 2/11/25 3:56 PM, Petr Machata wrote: >> Paolo Abeni <pabeni@redhat.com> writes: >>> On 2/7/25 6:34 PM, Petr Machata wrote: >>>> @@ -3899,6 +3904,11 @@ static void vxlan_config_apply(struct net_device *dev, >>>> dev->mtu = conf->mtu; >>>> >>>> vxlan->net = src_net; >>>> + >>>> + } else if (vxlan->dev->flags & IFF_UP) { >>>> + if (vxlan_addr_multicast(&vxlan->default_dst.remote_ip) && >>>> + rem_changed) >>>> + vxlan_multicast_leave(vxlan); >>> >>> AFAICS vxlan_vni_update_group() is not completely ignore >>> vxlan_multicast_{leave,join} errors. Instead is bailing out as soon as >>> any error happens. For consistency's sake I think it would be better do >>> the same here. >>> >>> Also I have the feeling that ending-up in an inconsistent status with no >>> group joined would be less troublesome than the opposite. >> >> This can already happen FWIW. If you currently want to change the remote >> group address in a way that doesn't break things, you take the netdevice >> down, then change it, then bring it back up. The leave during downing >> can fail and will not be diagnosed. (Nor can it really be, you can't >> veto downing.) > > I see. > >> I can add the bail-outs that you ask for, but I don't know that there is >> a way to resolve these issues for real. > > The main point I made was about consistency: making the > vxlan_config_apply() behavior as close as possible to > vxlan_vni_update_group() as stated in the commit message. No problem, I'll send a v2.
diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c index 69579425107f..7eba0ee7f602 100644 --- a/drivers/net/vxlan/vxlan_core.c +++ b/drivers/net/vxlan/vxlan_core.c @@ -3888,6 +3888,11 @@ static void vxlan_config_apply(struct net_device *dev, unsigned short needed_headroom = ETH_HLEN; int max_mtu = ETH_MAX_MTU; u32 flags = conf->flags; + bool rem_changed; + + rem_changed = !vxlan_addr_equal(&vxlan->default_dst.remote_ip, + &conf->remote_ip) || + vxlan->default_dst.remote_ifindex != conf->remote_ifindex; if (!changelink) { if (flags & VXLAN_F_GPE) @@ -3899,6 +3904,11 @@ static void vxlan_config_apply(struct net_device *dev, dev->mtu = conf->mtu; vxlan->net = src_net; + + } else if (vxlan->dev->flags & IFF_UP) { + if (vxlan_addr_multicast(&vxlan->default_dst.remote_ip) && + rem_changed) + vxlan_multicast_leave(vxlan); } dst->remote_vni = conf->vni; @@ -3932,6 +3942,11 @@ static void vxlan_config_apply(struct net_device *dev, dev->needed_headroom = needed_headroom; memcpy(&vxlan->cfg, conf, sizeof(*conf)); + + if (changelink && vxlan->dev->flags & IFF_UP && + vxlan_addr_multicast(&vxlan->default_dst.remote_ip) && + rem_changed) + vxlan_multicast_join(vxlan); } static int vxlan_dev_configure(struct net *src_net, struct net_device *dev,