On Thu, Dec 03, 2015 at 10:04:39AM +0100, Martin Pieuchot wrote:
> Now that we're good, we can get rid of this pointer.  Thanks to
> everybody involved in the process of replacing rt_ifp usages with
> if_get()/if_put().
> 
> ok?
> 
> Index: net/route.c
> ===================================================================
> RCS file: /cvs/src/sys/net/route.c,v
> retrieving revision 1.283
> diff -u -p -r1.283 route.c
> --- net/route.c       2 Dec 2015 16:49:58 -0000       1.283
> +++ net/route.c       3 Dec 2015 08:56:11 -0000
> @@ -1009,7 +1009,7 @@ rtrequest(int req, struct rt_addrinfo *i
>  
>               ifa->ifa_refcnt++;
>               rt->rt_ifa = ifa;
> -             rt->rt_ifp = ifp;
> +             rt->rt_ifidx = ifp->if_index;
>               if (rt->rt_flags & RTF_CLONED) {
>                       /*
>                        * If the ifa of the cloning route was stale, a
> @@ -1031,7 +1031,7 @@ rtrequest(int req, struct rt_addrinfo *i
>  
>                               ifa->ifa_refcnt++;
>                               (*ret_nrt)->rt_ifa = ifa;
> -                             (*ret_nrt)->rt_ifp = ifp;
> +                             (*ret_nrt)->rt_ifidx = ifp->if_index;
>                               ifp->if_rtrequest(ifp, RTM_ADD, *ret_nrt);
>                       }
>                       /*
> Index: net/route.h
> ===================================================================
> RCS file: /cvs/src/sys/net/route.h,v
> retrieving revision 1.126
> diff -u -p -r1.126 route.h
> --- net/route.h       2 Dec 2015 16:35:53 -0000       1.126
> +++ net/route.h       3 Dec 2015 08:58:02 -0000
> @@ -102,13 +102,12 @@ struct rtentry {
>       struct srpl_entry rt_next;      /* Next multipath entry to our dst. */
>  #endif
>       struct sockaddr *rt_gateway;    /* value */
> -     struct ifnet    *rt_ifp;        /* the answer: interface to use */
> -#define rt_ifidx rt_ifp->if_index
>       struct ifaddr   *rt_ifa;        /* the answer: interface addr to use */
>       caddr_t          rt_llinfo;     /* pointer to link level info cache or
>                                          to an MPLS structure */ 
>       struct rtentry  *rt_gwroute;    /* implied entry for gatewayed routes */
>       struct rtentry  *rt_parent;     /* If cloned, parent of this route. */
> +     unsigned int     rt_ifidx;      /* the answer: interface to use */
>       LIST_HEAD(, rttimer) rt_timer;  /* queue of timeouts for misc funcs */
>       struct rt_kmetrics rt_rmx;      /* metrics used by rx'ing protocols */

You should move the rt_ifidx down here to pack the struct better.
Apart from that OK.

>       unsigned int     rt_flags;      /* up/down?, host/net */
> @@ -345,10 +344,11 @@ void             rtlabel_unref(u_int16_t);
>  extern struct rtstat rtstat;
>  extern const struct sockaddr_rtin rt_defmask4;
>  
> -struct       mbuf;
> -struct       socket;
> -void  route_init(void);
> +struct mbuf;
> +struct socket;
> +struct ifnet;
>  
> +void  route_init(void);
>  int   route_output(struct mbuf *, ...);
>  int   route_usrreq(struct socket *, int, struct mbuf *,
>                          struct mbuf *, struct mbuf *, struct proc *);
> Index: net/rtsock.c
> ===================================================================
> RCS file: /cvs/src/sys/net/rtsock.c,v
> retrieving revision 1.183
> diff -u -p -r1.183 rtsock.c
> --- net/rtsock.c      18 Nov 2015 14:13:52 -0000      1.183
> +++ net/rtsock.c      3 Dec 2015 08:57:05 -0000
> @@ -758,7 +758,7 @@ report:
>  
>                                       ifa->ifa_refcnt++;
>                                       rt->rt_ifa = ifa;
> -                                     rt->rt_ifp = ifa->ifa_ifp;
> +                                     rt->rt_ifidx = ifa->ifa_ifp->if_index;
>  #ifndef SMALL_KERNEL
>                                       /* recheck link state after ifp change*/
>                                       rt_if_linkstate_change(rt, ifa->ifa_ifp,
> 

-- 
:wq Claudio

  • Kill rt_ifp Martin Pieuchot
    • Re: Kill rt_ifp Claudio Jeker

Reply via email to