On Tue, Jan 03, 2017 at 11:42:21AM +0100, Martin Pieuchot wrote:
> On 02/01/17(Mon) 21:51, Mike Belopuhov wrote:
> > On Fri, Dec 30, 2016 at 18:57 +0100, Mike Belopuhov wrote:
> > > On Thu, Dec 29, 2016 at 09:30 +0100, Martin Pieuchot wrote:
> > > > On 29/12/16(Thu) 01:15, Alexander Bluhm wrote:
> > > > > On Fri, Dec 23, 2016 at 12:09:32AM +0100, Martin Pieuchot wrote:
> > > > > > On 22/12/16(Thu) 20:45, Mike Belopuhov wrote:
> > > > > > > I think this is what is required here.  Works here, but YMMV.
> > > > > > 
> > > > > > splnet() in a pseudo-driver seems completely wrong, you could get 
> > > > > > rid of
> > > > > > it.
> > > > > 
> > > > > Yes, but that is another issue.  Can we get the netlock splasserts
> > > > > fixed first?  This diff looks good to me.
> > > > 
> > > > Sure I'm ok with the diff.
> > > > 
> > > 
> > > I agree with Martin and have cooked a diff but couldn't test it yet.
> > > This is it for the reference.
> > > 
> > 
> > I got to test the diff and I had to make another adjustment:
> > vxlan_if_change is setup as a detach hook, however dohooks is
> > called very early in if_detach before we remove IP addresses
> > from the interface.  It makes vxlan_config find these IP
> > addresses just fine and re-add its own detach hook again.
> 
> Why not fix vxlan_if_change()?
> 
> >                                                           This
> > repeats ad infinitum hogging the machine.  I couldn't think of
> > anything better than deferring an operation via a task.  Seems
> > to do the trick.
> 
> That's ugly.  Why would you re-add anything in a detach hook?  This
> is obviously broken.
> 

It is used for the multicast address (only) and it made sense when the
source address wasn't mandatory, eg. 0.0.0.0 -> 239.1.1.100 would find
the next interface that points to the group after detaching the
current one.

The source is mandatory now, so the diff below should work as well.

Reyk

Index: sys/net/if_vxlan.c
===================================================================
RCS file: /cvs/src/sys/net/if_vxlan.c,v
retrieving revision 1.54
diff -u -p -u -p -r1.54 if_vxlan.c
--- sys/net/if_vxlan.c  13 Dec 2016 06:51:11 -0000      1.54
+++ sys/net/if_vxlan.c  3 Jan 2017 11:05:36 -0000
@@ -947,17 +947,16 @@ vxlan_if_change(void *arg)
 {
        struct vxlan_softc      *sc = arg;
        struct ifnet            *ifp = &sc->sc_ac.ac_if;
-       int                      s, error;
+       int                      s;
 
        /*
         * Reset the configuration after the parent interface disappeared.
         */
        s = splnet();
-       if ((error = vxlan_config(ifp, NULL, NULL)) != 0) {
-               /* The configured tunnel addresses are invalid, remove them */
-               bzero(&sc->sc_src, sizeof(sc->sc_src));
-               bzero(&sc->sc_dst, sizeof(sc->sc_dst));
-       }
+       vxlan_multicast_cleanup(ifp);
+       memset(&sc->sc_src, 0, sizeof(sc->sc_src));
+       memset(&sc->sc_dst, 0, sizeof(sc->sc_dst));
+       sc->sc_dstport = htons(VXLAN_PORT);
        splx(s);
 }
 

Reply via email to