Time goes by and things must be cleaned.  Thanks to claudio@'s work
to support multiple connected routes carp(4) now have its own default
priority.  So I audited the remaining iterations on "&finet" and I
couldn't find any good reason to force carp(4) interfaces at a special
position in the list of interfaces.

OpenBSD's network stack changed in the past years and ifa_ifwithnet()
is now only used in a few places that should not matter.  Maybe a
brave soul (anyone?) will even get rid of this function completely.

The other place where this order could matter is in6_ifawithscope().
But stsp@ added an explicit check for carp(4) interfaces last October. 

Remember also that since 5.7 the ``carpdev'' argument is mandatory. So
you're rather unlikely to have a carp(4) interface inserted in "&ifnet"
before its parent interface.

Finally I sleep better with fewer "#if PSEUDOFROG" in the stack :)

Ok?

Index: net/if.c
===================================================================
RCS file: /cvs/src/sys/net/if.c,v
retrieving revision 1.333
diff -u -p -r1.333 if.c
--- net/if.c    20 May 2015 08:28:54 -0000      1.333
+++ net/if.c    26 May 2015 08:45:51 -0000
@@ -373,24 +373,8 @@ if_attachhead(struct ifnet *ifp)
 void
 if_attach(struct ifnet *ifp)
 {
-#if NCARP > 0
-       struct ifnet *before = NULL;
-#endif
-
        if_attach_common(ifp);
-
-#if NCARP > 0
-       if (ifp->if_type != IFT_CARP)
-               TAILQ_FOREACH(before, &ifnet, if_list)
-                       if (before->if_type == IFT_CARP)
-                               break;
-       if (before == NULL)
-               TAILQ_INSERT_TAIL(&ifnet, ifp, if_list);
-       else
-               TAILQ_INSERT_BEFORE(before, ifp, if_list);
-#else
        TAILQ_INSERT_TAIL(&ifnet, ifp, if_list);
-#endif
        if_attachsetup(ifp);
 }
 

Reply via email to