On 24/10/15(Sat) 18:01, Martin Pieuchot wrote:
> Revamping the network stack design continue here at u2k15... 
> 
> This times it's about the L2 resolution mechanism plugged into the
> routing table.  While discussing with Alexander we figured out that
> the actual ifa_rtrequest() is always called with a valid ``ifp''...
> 
> So this diff change this function into a per-ifp one an pass an ifp
> pointer as first argument.  This makes obvious that if_get/if_put is
> not needed there.
> 
> As a side effect arp_ifinit() can now die since every Ethernet driver
> initialize if_rtrequest in ether_ifattach().

Now with a dummy function as suggested by Claudio.

ok?

Index: net/if.c
===================================================================
RCS file: /cvs/src/sys/net/if.c,v
retrieving revision 1.394
diff -u -p -r1.394 if.c
--- net/if.c    24 Oct 2015 10:52:05 -0000      1.394
+++ net/if.c    24 Oct 2015 16:19:49 -0000
@@ -520,6 +520,7 @@ if_attach_common(struct ifnet *ifp)
            M_TEMP, M_WAITOK);
        TAILQ_INIT(ifp->if_detachhooks);
 
+       ifp->if_rtrequest = if_rtrequest_dummy;
        ifp->if_slowtimo = malloc(sizeof(*ifp->if_slowtimo), M_TEMP,
            M_WAITOK|M_ZERO);
        ifp->if_watchdogtask = malloc(sizeof(*ifp->if_watchdogtask),
@@ -1273,14 +1274,18 @@ ifaof_ifpforaddr(struct sockaddr *addr, 
        return (ifa_maybe);
 }
 
+void
+if_rtrequest_dummy(struct ifnet *ifp, int req, struct rtentry *rt)
+{
+}
+
 /*
  * Default action when installing a local route on a point-to-point
  * interface.
  */
 void
-p2p_rtrequest(int req, struct rtentry *rt)
+p2p_rtrequest(struct ifnet *ifp, int req, struct rtentry *rt)
 {
-       struct ifnet *ifp = rt->rt_ifp;
        struct ifaddr *ifa, *lo0ifa;
 
        switch (req) {
Index: net/if_ethersubr.c
===================================================================
RCS file: /cvs/src/sys/net/if_ethersubr.c,v
retrieving revision 1.229
diff -u -p -r1.229 if_ethersubr.c
--- net/if_ethersubr.c  22 Oct 2015 15:37:47 -0000      1.229
+++ net/if_ethersubr.c  24 Oct 2015 16:19:49 -0000
@@ -161,6 +161,23 @@ ether_ioctl(struct ifnet *ifp, struct ar
        return (error);
 }
 
+
+void
+ether_rtrequest(struct ifnet *ifp, int req, struct rtentry *rt)
+{
+       switch (rt_key(rt)->sa_family) {
+       case AF_INET:
+               arp_rtrequest(ifp, req, rt);
+               break;
+#ifdef INET6
+       case AF_INET6:
+               nd6_rtrequest(ifp, req, rt);
+               break;
+#endif
+       default:
+               break;
+       }
+}
 /*
  * Ethernet output routine.
  * Encapsulate a packet of type family for the local net.
@@ -505,6 +522,7 @@ ether_ifattach(struct ifnet *ifp)
        ifp->if_hdrlen = ETHER_HDR_LEN;
        ifp->if_mtu = ETHERMTU;
        ifp->if_output = ether_output;
+       ifp->if_rtrequest = ether_rtrequest;
 
        if_ih_insert(ifp, ether_input, NULL);
 
Index: net/if_gif.c
===================================================================
RCS file: /cvs/src/sys/net/if_gif.c,v
retrieving revision 1.80
diff -u -p -r1.80 if_gif.c
--- net/if_gif.c        28 Sep 2015 08:32:05 -0000      1.80
+++ net/if_gif.c        24 Oct 2015 16:19:49 -0000
@@ -120,6 +120,7 @@ gif_clone_create(struct if_clone *ifc, i
        sc->gif_if.if_ioctl  = gif_ioctl;
        sc->gif_if.if_start  = gif_start;
        sc->gif_if.if_output = gif_output;
+       sc->gif_if.if_rtrequest = p2p_rtrequest;
        sc->gif_if.if_type   = IFT_GIF;
        IFQ_SET_MAXLEN(&sc->gif_if.if_snd, IFQ_MAXLEN);
        IFQ_SET_READY(&sc->gif_if.if_snd);
@@ -326,7 +327,6 @@ gif_ioctl(struct ifnet *ifp, u_long cmd,
 {
        struct gif_softc *sc  = (struct gif_softc*)ifp;
        struct ifreq     *ifr = (struct ifreq *)data;
-       struct ifaddr    *ifa = (struct ifaddr *)data;
        int error = 0, size;
        struct sockaddr *dst, *src;
        struct sockaddr *sa;
@@ -335,7 +335,6 @@ gif_ioctl(struct ifnet *ifp, u_long cmd,
 
        switch (cmd) {
        case SIOCSIFADDR:
-               ifa->ifa_rtrequest = p2p_rtrequest;
                break;
 
        case SIOCSIFDSTADDR:
Index: net/if_gre.c
===================================================================
RCS file: /cvs/src/sys/net/if_gre.c,v
retrieving revision 1.75
diff -u -p -r1.75 if_gre.c
--- net/if_gre.c        16 Jul 2015 16:12:15 -0000      1.75
+++ net/if_gre.c        24 Oct 2015 16:19:49 -0000
@@ -132,6 +132,7 @@ gre_clone_create(struct if_clone *ifc, i
        sc->sc_if.if_flags = IFF_POINTOPOINT|IFF_MULTICAST;
        sc->sc_if.if_output = gre_output;
        sc->sc_if.if_ioctl = gre_ioctl;
+       sc->sc_if.if_rtrequest = p2p_rtrequest;
        sc->sc_if.if_collisions = 0;
        sc->sc_if.if_ierrors = 0;
        sc->sc_if.if_oerrors = 0;
@@ -436,7 +437,6 @@ gre_ioctl(struct ifnet *ifp, u_long cmd,
 {
 
        struct ifreq *ifr = (struct ifreq *)data;
-       struct ifaddr *ifa = (struct ifaddr *)data;
        struct if_laddrreq *lifr = (struct if_laddrreq *)data;
        struct ifkalivereq *ikar = (struct ifkalivereq *)data;
        struct gre_softc *sc = ifp->if_softc;
@@ -450,7 +450,6 @@ gre_ioctl(struct ifnet *ifp, u_long cmd,
        switch(cmd) {
        case SIOCSIFADDR:
                ifp->if_flags |= IFF_UP;
-               ifa->ifa_rtrequest = p2p_rtrequest;
                break;
        case SIOCSIFDSTADDR:
                break;
Index: net/if_loop.c
===================================================================
RCS file: /cvs/src/sys/net/if_loop.c,v
retrieving revision 1.71
diff -u -p -r1.71 if_loop.c
--- net/if_loop.c       12 Sep 2015 13:34:12 -0000      1.71
+++ net/if_loop.c       24 Oct 2015 16:19:50 -0000
@@ -168,6 +168,7 @@ loop_clone_create(struct if_clone *ifc, 
        ifp->if_softc = NULL;
        ifp->if_mtu = LOMTU;
        ifp->if_flags = IFF_LOOPBACK | IFF_MULTICAST;
+       ifp->if_rtrequest = lortrequest;
        ifp->if_ioctl = loioctl;
        ifp->if_output = looutput;
        ifp->if_type = IFT_LOOP;
@@ -217,7 +218,7 @@ looutput(struct ifnet *ifp, struct mbuf 
 
 /* ARGSUSED */
 void
-lortrequest(int cmd, struct rtentry *rt)
+lortrequest(struct ifnet *ifp, int cmd, struct rtentry *rt)
 {
        if (rt && rt->rt_rmx.rmx_mtu == 0)
                rt->rt_rmx.rmx_mtu = LOMTU;
@@ -230,7 +231,6 @@ lortrequest(int cmd, struct rtentry *rt)
 int
 loioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
 {
-       struct ifaddr *ifa;
        struct ifreq *ifr;
        int error = 0;
 
@@ -239,10 +239,6 @@ loioctl(struct ifnet *ifp, u_long cmd, c
        case SIOCSIFADDR:
                ifp->if_flags |= IFF_RUNNING;
                if_up(ifp);             /* send up RTM_IFINFO */
-
-               ifa = (struct ifaddr *)data;
-               if (ifa != 0)
-                       ifa->ifa_rtrequest = lortrequest;
                /*
                 * Everything else is done at a higher level.
                 */
Index: net/if_ppp.c
===================================================================
RCS file: /cvs/src/sys/net/if_ppp.c,v
retrieving revision 1.90
diff -u -p -r1.90 if_ppp.c
--- net/if_ppp.c        12 Oct 2015 13:17:58 -0000      1.90
+++ net/if_ppp.c        24 Oct 2015 16:19:50 -0000
@@ -223,6 +223,7 @@ ppp_clone_create(struct if_clone *ifc, i
     sc->sc_if.if_ioctl = pppsioctl;
     sc->sc_if.if_output = pppoutput;
     sc->sc_if.if_start = ppp_ifstart;
+    sc->sc_if.if_rtrequest = p2p_rtrequest;
     IFQ_SET_MAXLEN(&sc->sc_if.if_snd, IFQ_MAXLEN);
     mq_init(&sc->sc_inq, IFQ_MAXLEN, IPL_NET);
     IFQ_SET_MAXLEN(&sc->sc_fastq, IFQ_MAXLEN);
@@ -593,7 +594,6 @@ pppsioctl(struct ifnet *ifp, u_long cmd,
     case SIOCSIFADDR:
        if (ifa->ifa_addr->sa_family != AF_INET)
            error = EAFNOSUPPORT;
-       ifa->ifa_rtrequest = p2p_rtrequest;
        break;
 
     case SIOCSIFDSTADDR:
Index: net/if_pppoe.c
===================================================================
RCS file: /cvs/src/sys/net/if_pppoe.c,v
retrieving revision 1.48
diff -u -p -r1.48 if_pppoe.c
--- net/if_pppoe.c      13 Sep 2015 17:53:44 -0000      1.48
+++ net/if_pppoe.c      24 Oct 2015 16:19:50 -0000
@@ -228,6 +228,7 @@ pppoe_clone_create(struct if_clone *ifc,
        sc->sc_sppp.pp_framebytes = PPPOE_HEADERLEN;    /* framing added to ppp 
packets */
        sc->sc_sppp.pp_if.if_ioctl = pppoe_ioctl;
        sc->sc_sppp.pp_if.if_start = pppoe_start;
+       sc->sc_sppp.pp_if.if_rtrequest = p2p_rtrequest;
        sc->sc_sppp.pp_tls = pppoe_tls;
        sc->sc_sppp.pp_tlf = pppoe_tlf;
        IFQ_SET_MAXLEN(&sc->sc_sppp.pp_if.if_snd, IFQ_MAXLEN);
Index: net/if_pppx.c
===================================================================
RCS file: /cvs/src/sys/net/if_pppx.c,v
retrieving revision 1.43
diff -u -p -r1.43 if_pppx.c
--- net/if_pppx.c       6 Sep 2015 12:59:20 -0000       1.43
+++ net/if_pppx.c       24 Oct 2015 16:19:50 -0000
@@ -832,6 +832,7 @@ pppx_add_session(struct pppx_dev *pxd, s
        ifp->if_start = pppx_if_start;
        ifp->if_output = pppx_if_output;
        ifp->if_ioctl = pppx_if_ioctl;
+       ifp->if_rtrequest = p2p_rtrequest;
        ifp->if_type = IFT_PPP;
        IFQ_SET_MAXLEN(&ifp->if_snd, 1);
        IFQ_SET_READY(&ifp->if_snd);
@@ -1069,12 +1070,10 @@ pppx_if_ioctl(struct ifnet *ifp, u_long 
 {
        struct pppx_if *pxi = (struct pppx_if *)ifp->if_softc;
        struct ifreq *ifr = (struct ifreq *)addr;
-       struct ifaddr *ifa = (struct ifaddr *)addr;
        int error = 0;
 
        switch (cmd) {
        case SIOCSIFADDR:
-               ifa->ifa_rtrequest = p2p_rtrequest;
                break;
 
        case SIOCSIFFLAGS:
Index: net/if_spppsubr.c
===================================================================
RCS file: /cvs/src/sys/net/if_spppsubr.c,v
retrieving revision 1.142
diff -u -p -r1.142 if_spppsubr.c
--- net/if_spppsubr.c   24 Oct 2015 11:58:46 -0000      1.142
+++ net/if_spppsubr.c   24 Oct 2015 16:19:51 -0000
@@ -871,7 +871,6 @@ int
 sppp_ioctl(struct ifnet *ifp, u_long cmd, void *data)
 {
        struct ifreq *ifr = data;
-       struct ifaddr *ifa = data;
        struct sppp *sp = (struct sppp*) ifp;
        int s, rv, going_up, going_down, newmode;
 
@@ -884,7 +883,6 @@ sppp_ioctl(struct ifnet *ifp, u_long cmd
 
        case SIOCSIFADDR:
                if_up(ifp);
-               ifa->ifa_rtrequest = p2p_rtrequest;
                /* FALLTHROUGH */
 
        case SIOCSIFFLAGS:
Index: net/if_tun.c
===================================================================
RCS file: /cvs/src/sys/net/if_tun.c,v
retrieving revision 1.157
diff -u -p -r1.157 if_tun.c
--- net/if_tun.c        24 Oct 2015 04:12:24 -0000      1.157
+++ net/if_tun.c        24 Oct 2015 16:19:51 -0000
@@ -219,6 +219,7 @@ tun_create(struct if_clone *ifc, int uni
                ifp->if_flags = IFF_POINTOPOINT;
                ifp->if_type = IFT_TUNNEL;
                ifp->if_hdrlen = sizeof(u_int32_t);
+               ifp->if_rtrequest = p2p_rtrequest;
 
                if_attach(ifp);
                if_alloc_sadl(ifp);
@@ -506,8 +507,6 @@ tun_ioctl(struct ifnet *ifp, u_long cmd,
                        default:
                                break;
                        }
-               } else {
-                       ifa->ifa_rtrequest = p2p_rtrequest;
                }
                break;
        case SIOCSIFDSTADDR:
Index: net/if_var.h
===================================================================
RCS file: /cvs/src/sys/net/if_var.h,v
retrieving revision 1.50
diff -u -p -r1.50 if_var.h
--- net/if_var.h        24 Oct 2015 10:52:05 -0000      1.50
+++ net/if_var.h        24 Oct 2015 16:19:51 -0000
@@ -129,6 +129,8 @@ struct ifnet {                              /* and the 
entries */
        struct hook_desc_head *if_addrhooks; /* address change callbacks */
        struct hook_desc_head *if_linkstatehooks; /* link change callbacks */
        struct hook_desc_head *if_detachhooks; /* detach callbacks */
+                                       /* check or clean routes (+ or -)'d */
+       void    (*if_rtrequest)(struct ifnet *, int, struct rtentry *);
        char    if_xname[IFNAMSIZ];     /* external name (name + unit) */
        int     if_pcount;              /* number of promiscuous listeners */
        caddr_t if_bpf;                 /* packet filter structure */
@@ -213,8 +215,6 @@ struct ifaddr {
        struct  sockaddr *ifa_netmask;  /* used to determine subnet */
        struct  ifnet *ifa_ifp;         /* back-pointer to interface */
        TAILQ_ENTRY(ifaddr) ifa_list;   /* list of addresses for interface */
-                                       /* check or clean routes (+ or -)'d */
-       void    (*ifa_rtrequest)(int, struct rtentry *);
        u_int   ifa_flags;              /* interface flags, see below */
        u_int   ifa_refcnt;             /* number of `rt_ifa` references */
        int     ifa_metric;             /* cost of going out this interface */
@@ -408,6 +408,8 @@ void        if_start(struct ifnet *);
 int    if_enqueue(struct ifnet *, struct mbuf *);
 void   if_input(struct ifnet *, struct mbuf_list *);
 int    if_input_local(struct ifnet *, struct mbuf *, sa_family_t);
+void   if_rtrequest_dummy(struct ifnet *, int, struct rtentry *);
+void   p2p_rtrequest(struct ifnet *, int, struct rtentry *);
 
 void   ether_ifattach(struct ifnet *);
 void   ether_ifdetach(struct ifnet *);
@@ -415,6 +417,7 @@ int ether_ioctl(struct ifnet *, struct a
 int    ether_input(struct ifnet *, struct mbuf *, void *);
 int    ether_output(struct ifnet *,
            struct mbuf *, struct sockaddr *, struct rtentry *);
+void   ether_rtrequest(struct ifnet *, int, struct rtentry *);
 char   *ether_sprintf(u_char *);
 
 struct ifaddr *ifa_ifwithaddr(struct sockaddr *, u_int);
@@ -422,7 +425,6 @@ struct      ifaddr *ifa_ifwithdstaddr(struct 
 struct ifaddr *ifa_ifwithnet(struct sockaddr *, u_int);
 struct ifaddr *ifaof_ifpforaddr(struct sockaddr *, struct ifnet *);
 void   ifafree(struct ifaddr *);
-void   p2p_rtrequest(int, struct rtentry *);
 
 void   if_clone_attach(struct if_clone *);
 void   if_clone_detach(struct if_clone *);
@@ -440,7 +442,7 @@ int loioctl(struct ifnet *, u_long, cadd
 void   loopattach(int);
 int    looutput(struct ifnet *,
            struct mbuf *, struct sockaddr *, struct rtentry *);
-void   lortrequest(int, struct rtentry *);
+void   lortrequest(struct ifnet *, int, struct rtentry *);
 
 void   ifa_add(struct ifnet *, struct ifaddr *);
 void   ifa_del(struct ifnet *, struct ifaddr *);
Index: net/route.c
===================================================================
RCS file: /cvs/src/sys/net/route.c,v
retrieving revision 1.260
diff -u -p -r1.260 route.c
--- net/route.c 24 Oct 2015 11:58:46 -0000      1.260
+++ net/route.c 24 Oct 2015 16:19:51 -0000
@@ -783,8 +783,7 @@ rtrequest1(int req, struct rt_addrinfo *
                rt->rt_parent = NULL;
 
                rt->rt_flags &= ~RTF_UP;
-               if ((ifa = rt->rt_ifa) && ifa->ifa_rtrequest)
-                       ifa->ifa_rtrequest(RTM_DELETE, rt);
+               rt->rt_ifp->if_rtrequest(rt->rt_ifp, RTM_DELETE, rt);
                atomic_inc_int(&rttrash);
 
                if (ret_nrt != NULL)
@@ -923,15 +922,14 @@ rtrequest1(int req, struct rt_addrinfo *
                        if ((*ret_nrt)->rt_ifa->ifa_ifp == NULL) {
                                printf("rtrequest1 RTM_RESOLVE: wrong ifa (%p) "
                                    "was (%p)\n", ifa, (*ret_nrt)->rt_ifa);
-                               if ((*ret_nrt)->rt_ifa->ifa_rtrequest)
-                                       (*ret_nrt)->rt_ifa->ifa_rtrequest(
-                                           RTM_DELETE, *ret_nrt);
+                               (*ret_nrt)->rt_ifp->if_rtrequest(rt->rt_ifp,
+                                   RTM_DELETE, *ret_nrt);
                                ifafree((*ret_nrt)->rt_ifa);
                                (*ret_nrt)->rt_ifa = ifa;
                                (*ret_nrt)->rt_ifp = ifa->ifa_ifp;
                                ifa->ifa_refcnt++;
-                               if (ifa->ifa_rtrequest)
-                                       ifa->ifa_rtrequest(RTM_ADD, *ret_nrt);
+                               (*ret_nrt)->rt_ifp->if_rtrequest(rt->rt_ifp,
+                                   RTM_ADD, *ret_nrt);
                        }
                        /*
                         * Copy both metrics and a back pointer to the cloned
@@ -979,9 +977,7 @@ rtrequest1(int req, struct rt_addrinfo *
                        pool_put(&rtentry_pool, rt);
                        return (EEXIST);
                }
-
-               if (ifa->ifa_rtrequest)
-                       ifa->ifa_rtrequest(req, rt);
+               rt->rt_ifp->if_rtrequest(rt->rt_ifp, req, rt);
 
                if ((rt->rt_flags & RTF_CLONING) != 0) {
                        /* clean up any cloned children */
Index: net/rtsock.c
===================================================================
RCS file: /cvs/src/sys/net/rtsock.c,v
retrieving revision 1.176
diff -u -p -r1.176 rtsock.c
--- net/rtsock.c        24 Oct 2015 11:58:47 -0000      1.176
+++ net/rtsock.c        24 Oct 2015 16:19:51 -0000
@@ -766,9 +766,8 @@ report:
                                goto flush;
                        if (ifa) {
                                if (rt->rt_ifa != ifa) {
-                                       if (rt->rt_ifa->ifa_rtrequest)
-                                               rt->rt_ifa->ifa_rtrequest(
-                                                   RTM_DELETE, rt);
+                                       rt->rt_ifp->if_rtrequest(
+                                           rt->rt_ifp, RTM_DELETE, rt);
                                        ifafree(rt->rt_ifa);
                                        rt->rt_ifa = ifa;
                                        ifa->ifa_refcnt++;
@@ -832,8 +831,7 @@ report:
                        rtm->rtm_index = rt->rt_ifidx;
                        rtm->rtm_priority = rt->rt_priority & RTP_MASK;
                        rtm->rtm_flags = rt->rt_flags;
-                       if (rt->rt_ifa && rt->rt_ifa->ifa_rtrequest)
-                               rt->rt_ifa->ifa_rtrequest(RTM_ADD, rt);
+                       rt->rt_ifp->if_rtrequest(rt->rt_ifp, RTM_ADD, rt);
                        if (info.rti_info[RTAX_LABEL] != NULL) {
                                char *rtlabel = ((struct sockaddr_rtlabel *)
                                    info.rti_info[RTAX_LABEL])->sr_label;
Index: netinet/if_ether.c
===================================================================
RCS file: /cvs/src/sys/netinet/if_ether.c,v
retrieving revision 1.176
diff -u -p -r1.176 if_ether.c
--- netinet/if_ether.c  22 Oct 2015 18:14:53 -0000      1.176
+++ netinet/if_ether.c  24 Oct 2015 16:19:51 -0000
@@ -137,11 +137,10 @@ arptimer(void *arg)
 }
 
 void
-arp_rtrequest(int req, struct rtentry *rt)
+arp_rtrequest(struct ifnet *ifp, int req, struct rtentry *rt)
 {
        struct sockaddr *gate = rt->rt_gateway;
        struct llinfo_arp *la = (struct llinfo_arp *)rt->rt_llinfo;
-       struct ifnet *ifp = rt->rt_ifp;
        struct ifaddr *ifa;
        struct mbuf *m;
 
@@ -821,7 +820,6 @@ arpproxy(struct in_addr in, unsigned int
 void
 arp_ifinit(struct arpcom *ac, struct ifaddr *ifa)
 {
-       ifa->ifa_rtrequest = arp_rtrequest;
 }
 
 /*
Index: netinet/if_ether.h
===================================================================
RCS file: /cvs/src/sys/netinet/if_ether.h,v
retrieving revision 1.60
diff -u -p -r1.60 if_ether.h
--- netinet/if_ether.h  27 Sep 2015 16:50:40 -0000      1.60
+++ netinet/if_ether.h  24 Oct 2015 16:19:51 -0000
@@ -197,7 +197,7 @@ void        arpintr(void);
 int    arpresolve(struct ifnet *,
            struct rtentry *, struct mbuf *, struct sockaddr *, u_char *);
 void   arp_ifinit(struct arpcom *, struct ifaddr *);
-void   arp_rtrequest(int, struct rtentry *);
+void   arp_rtrequest(struct ifnet *, int, struct rtentry *);
 
 int    ether_addmulti(struct ifreq *, struct arpcom *);
 int    ether_delmulti(struct ifreq *, struct arpcom *);
Index: netinet/ip_carp.c
===================================================================
RCS file: /cvs/src/sys/netinet/ip_carp.c,v
retrieving revision 1.277
diff -u -p -r1.277 ip_carp.c
--- netinet/ip_carp.c   22 Oct 2015 13:30:29 -0000      1.277
+++ netinet/ip_carp.c   24 Oct 2015 16:19:51 -0000
@@ -2097,7 +2097,6 @@ carp_ioctl(struct ifnet *ifp, u_long cmd
                switch (ifa->ifa_addr->sa_family) {
                case AF_INET:
                        sc->sc_if.if_flags |= IFF_UP;
-                       ifa->ifa_rtrequest = arp_rtrequest;
                        error = carp_set_addr(sc, satosin(ifa->ifa_addr));
                        break;
 #ifdef INET6
Index: netinet6/in6.c
===================================================================
RCS file: /cvs/src/sys/netinet6/in6.c,v
retrieving revision 1.175
diff -u -p -r1.175 in6.c
--- netinet6/in6.c      12 Sep 2015 20:50:17 -0000      1.175
+++ netinet6/in6.c      24 Oct 2015 16:19:51 -0000
@@ -1263,10 +1263,6 @@ in6_ifinit(struct ifnet *ifp, struct in6
 
        /* Add ownaddr as loopback rtentry, if necessary (ex. on p2p link). */
        if (newhost) {
-               /* set the rtrequest function to create llinfo */
-               if ((ifp->if_flags & (IFF_LOOPBACK | IFF_POINTOPOINT)) == 0)
-                       ia6->ia_ifa.ifa_rtrequest = nd6_rtrequest;
-
                rt_ifa_addlocal(&(ia6->ia_ifa));
        }
 
Index: netinet6/nd6.c
===================================================================
RCS file: /cvs/src/sys/netinet6/nd6.c,v
retrieving revision 1.159
diff -u -p -r1.159 nd6.c
--- netinet6/nd6.c      24 Oct 2015 16:08:48 -0000      1.159
+++ netinet6/nd6.c      24 Oct 2015 16:19:51 -0000
@@ -661,7 +661,7 @@ nd6_lookup(struct in6_addr *addr6, int c
                         * Create a new route.  RTF_LLINFO is necessary
                         * to create a Neighbor Cache entry for the
                         * destination in nd6_rtrequest which will be
-                        * called in rtrequest1 via ifa->ifa_rtrequest.
+                        * called in rtrequest1.
                         */
                        bzero(&info, sizeof(info));
                        info.rti_flags = RTF_HOST | RTF_LLINFO;
@@ -917,11 +917,10 @@ nd6_nud_hint(struct rtentry *rt, u_int r
 }
 
 void
-nd6_rtrequest(int req, struct rtentry *rt)
+nd6_rtrequest(struct ifnet *ifp, int req, struct rtentry *rt)
 {
        struct sockaddr *gate = rt->rt_gateway;
        struct llinfo_nd6 *ln = (struct llinfo_nd6 *)rt->rt_llinfo;
-       struct ifnet *ifp = rt->rt_ifp;
        struct ifaddr *ifa;
        struct nd_defrouter *dr;
 
Index: netinet6/nd6.h
===================================================================
RCS file: /cvs/src/sys/netinet6/nd6.h,v
retrieving revision 1.50
diff -u -p -r1.50 nd6.h
--- netinet6/nd6.h      24 Oct 2015 16:08:48 -0000      1.50
+++ netinet6/nd6.h      24 Oct 2015 16:19:51 -0000
@@ -272,7 +272,7 @@ void nd6_purge(struct ifnet *);
 void nd6_nud_hint(struct rtentry *, u_int);
 int nd6_resolve(struct ifnet *, struct rtentry *,
        struct mbuf *, struct sockaddr *, u_char *);
-void nd6_rtrequest(int, struct rtentry *);
+void nd6_rtrequest(struct ifnet *, int, struct rtentry *);
 int nd6_ioctl(u_long, caddr_t, struct ifnet *);
 void nd6_cache_lladdr(struct ifnet *, struct in6_addr *, char *, int, int, 
int);
 int nd6_output(struct ifnet *, struct mbuf *, struct sockaddr_in6 *,
Index: netinet6/nd6_rtr.c
===================================================================
RCS file: /cvs/src/sys/netinet6/nd6_rtr.c,v
retrieving revision 1.127
diff -u -p -r1.127 nd6_rtr.c
--- netinet6/nd6_rtr.c  24 Oct 2015 16:08:48 -0000      1.127
+++ netinet6/nd6_rtr.c  24 Oct 2015 16:19:52 -0000
@@ -1789,10 +1789,6 @@ nd6_prefix_onlink(struct nd_prefix *pr)
                return (0);
        }
 
-       /*
-        * in6_ifinit() sets nd6_rtrequest to ifa_rtrequest for all ifaddrs.
-        * ifa->ifa_rtrequest = nd6_rtrequest;
-        */
        bzero(&mask6, sizeof(mask6));
        mask6.sin6_len = sizeof(mask6);
        mask6.sin6_addr = pr->ndpr_mask;

Reply via email to