On Tue, Aug 27, 2013 at 03:58:51PM +0200, Martin Pieuchot wrote:
> In order to define a proper API for our routine table, I'd like to turn
> the "struct rt_addrinfo" into a private type (ie: only used in route.c
> and rtsock.c).
>
> This type is used by a lost of code in our network stack to add or delete
> a route but also in the various *rtrequest() functions. However in
> these functions the argument is never used! So the diff below kills it.
>
> ok?
Less is more. ok krw@.
.... Ken
>
> Index: net/if.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/net/if.c,v
> retrieving revision 1.262
> diff -u -p -r1.262 if.c
> --- net/if.c 20 Aug 2013 09:14:22 -0000 1.262
> +++ net/if.c 27 Aug 2013 13:50:50 -0000
> @@ -985,7 +985,7 @@ ifaof_ifpforaddr(struct sockaddr *addr,
> * This should be moved to /sys/net/link.c eventually.
> */
> void
> -link_rtrequest(int cmd, struct rtentry *rt, struct rt_addrinfo *info)
> +link_rtrequest(int cmd, struct rtentry *rt)
> {
> struct ifaddr *ifa;
> struct sockaddr *dst;
> @@ -999,7 +999,7 @@ link_rtrequest(int cmd, struct rtentry *
> ifafree(rt->rt_ifa);
> rt->rt_ifa = ifa;
> if (ifa->ifa_rtrequest && ifa->ifa_rtrequest != link_rtrequest)
> - ifa->ifa_rtrequest(cmd, rt, info);
> + ifa->ifa_rtrequest(cmd, rt);
> }
> }
>
> Index: net/if.h
> ===================================================================
> RCS file: /home/ncvs/src/sys/net/if.h,v
> retrieving revision 1.144
> diff -u -p -r1.144 if.h
> --- net/if.h 20 Jun 2013 12:03:40 -0000 1.144
> +++ net/if.h 27 Aug 2013 13:50:50 -0000
> @@ -494,7 +494,7 @@ struct ifaddr {
> 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 *, struct rt_addrinfo *);
> + void (*ifa_rtrequest)(int, struct rtentry *);
> u_int ifa_flags; /* mostly rt_flags for cloning */
> u_int ifa_refcnt; /* count of references */
> int ifa_metric; /* cost of going out this interface */
> @@ -842,7 +842,7 @@ struct ifaddr *ifa_ifwithroute(int, stru
> struct sockaddr *, u_int);
> struct ifaddr *ifaof_ifpforaddr(struct sockaddr *, struct ifnet *);
> void ifafree(struct ifaddr *);
> -void link_rtrequest(int, struct rtentry *, struct rt_addrinfo *);
> +void link_rtrequest(int, struct rtentry *);
>
> void if_clone_attach(struct if_clone *);
> void if_clone_detach(struct if_clone *);
> @@ -858,7 +858,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 *, struct rt_addrinfo *);
> +void lortrequest(int, struct rtentry *);
> void ifa_add(struct ifnet *, struct ifaddr *);
> void ifa_del(struct ifnet *, struct ifaddr *);
> void ifa_update_broadaddr(struct ifnet *, struct ifaddr *,
> Index: net/if_loop.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/net/if_loop.c,v
> retrieving revision 1.49
> diff -u -p -r1.49 if_loop.c
> --- net/if_loop.c 28 Mar 2013 16:55:27 -0000 1.49
> +++ net/if_loop.c 27 Aug 2013 13:50:50 -0000
> @@ -373,7 +373,7 @@ lo_altqstart(struct ifnet *ifp)
>
> /* ARGSUSED */
> void
> -lortrequest(int cmd, struct rtentry *rt, struct rt_addrinfo *info)
> +lortrequest(int cmd, struct rtentry *rt)
> {
> if (rt)
> rt->rt_rmx.rmx_mtu = LOMTU;
> Index: net/route.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/net/route.c,v
> retrieving revision 1.144
> diff -u -p -r1.144 route.c
> --- net/route.c 28 Mar 2013 23:10:05 -0000 1.144
> +++ net/route.c 27 Aug 2013 13:50:50 -0000
> @@ -781,7 +781,7 @@ rtrequest1(int req, struct rt_addrinfo *
>
> rt->rt_flags &= ~RTF_UP;
> if ((ifa = rt->rt_ifa) && ifa->ifa_rtrequest)
> - ifa->ifa_rtrequest(RTM_DELETE, rt, info);
> + ifa->ifa_rtrequest(RTM_DELETE, rt);
> rttrash++;
>
> if (ret_nrt)
> @@ -925,14 +925,13 @@ rtrequest1(int req, struct rt_addrinfo *
> "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, NULL);
> + 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,
> - NULL);
> + ifa->ifa_rtrequest(RTM_ADD, *ret_nrt);
> }
> /*
> * Copy both metrics and a back pointer to the cloned
> @@ -980,7 +979,7 @@ rtrequest1(int req, struct rt_addrinfo *
> #endif
>
> if (ifa->ifa_rtrequest)
> - ifa->ifa_rtrequest(req, rt, info);
> + ifa->ifa_rtrequest(req, rt);
> if (ret_nrt) {
> *ret_nrt = rt;
> rt->rt_refcnt++;
> @@ -1138,13 +1137,13 @@ rtinit(struct ifaddr *ifa, int cmd, int
> printf("rtinit: wrong ifa (%p) was (%p)\n",
> ifa, rt->rt_ifa);
> if (rt->rt_ifa->ifa_rtrequest)
> - rt->rt_ifa->ifa_rtrequest(RTM_DELETE, rt, NULL);
> + rt->rt_ifa->ifa_rtrequest(RTM_DELETE, rt);
> ifafree(rt->rt_ifa);
> rt->rt_ifa = ifa;
> rt->rt_ifp = ifa->ifa_ifp;
> ifa->ifa_refcnt++;
> if (ifa->ifa_rtrequest)
> - ifa->ifa_rtrequest(RTM_ADD, rt, NULL);
> + ifa->ifa_rtrequest(RTM_ADD, rt);
> }
> rt_newaddrmsg(cmd, ifa, error, nrt);
> }
> Index: net/rtsock.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/net/rtsock.c,v
> retrieving revision 1.126
> diff -u -p -r1.126 rtsock.c
> --- net/rtsock.c 17 May 2013 11:13:37 -0000 1.126
> +++ net/rtsock.c 27 Aug 2013 13:50:50 -0000
> @@ -783,8 +783,7 @@ report:
> struct ifaddr *oifa = rt->rt_ifa;
> if (oifa != ifa) {
> if (oifa && oifa->ifa_rtrequest)
> - oifa->ifa_rtrequest(RTM_DELETE, rt,
> - &info);
> + oifa->ifa_rtrequest(RTM_DELETE, rt);
> ifafree(rt->rt_ifa);
> rt->rt_ifa = ifa;
> ifa->ifa_refcnt++;
> @@ -849,7 +848,7 @@ report:
> 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, &info);
> + rt->rt_ifa->ifa_rtrequest(RTM_ADD, rt);
> if (genmask)
> rt->rt_genmask = genmask;
> if (info.rti_info[RTAX_LABEL] != NULL) {
> Index: netinet/if_ether.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/netinet/if_ether.c,v
> retrieving revision 1.104
> diff -u -p -r1.104 if_ether.c
> --- netinet/if_ether.c 9 Aug 2013 06:01:52 -0000 1.104
> +++ netinet/if_ether.c 27 Aug 2013 13:50:50 -0000
> @@ -141,7 +141,7 @@ arptimer(void *arg)
> * Parallel to llc_rtrequest.
> */
> void
> -arp_rtrequest(int req, struct rtentry *rt, struct rt_addrinfo *info)
> +arp_rtrequest(int req, struct rtentry *rt)
> {
> struct sockaddr *gate = rt->rt_gateway;
> struct llinfo_arp *la = (struct llinfo_arp *)rt->rt_llinfo;
> Index: netinet/if_ether.h
> ===================================================================
> RCS file: /home/ncvs/src/sys/netinet/if_ether.h,v
> retrieving revision 1.50
> diff -u -p -r1.50 if_ether.h
> --- netinet/if_ether.h 4 Jul 2013 08:22:19 -0000 1.50
> +++ netinet/if_ether.h 27 Aug 2013 13:50:50 -0000
> @@ -201,7 +201,7 @@ void arpintr(void);
> int arpresolve(struct arpcom *,
> struct rtentry *, struct mbuf *, struct sockaddr *, u_char *);
> void arp_ifinit(struct arpcom *, struct ifaddr *);
> -void arp_rtrequest(int, struct rtentry *, struct rt_addrinfo *);
> +void arp_rtrequest(int, struct rtentry *);
>
> int ether_addmulti(struct ifreq *, struct arpcom *);
> int ether_delmulti(struct ifreq *, struct arpcom *);
> Index: netinet6/nd6.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/netinet6/nd6.c,v
> retrieving revision 1.101
> diff -u -p -r1.101 nd6.c
> --- netinet6/nd6.c 26 Aug 2013 07:15:58 -0000 1.101
> +++ netinet6/nd6.c 27 Aug 2013 13:50:50 -0000
> @@ -953,7 +953,7 @@ nd6_nud_hint(struct rtentry *rt, struct
> */
>
> void
> -nd6_rtrequest(int req, struct rtentry *rt, struct rt_addrinfo *info)
> +nd6_rtrequest(int req, struct rtentry *rt)
> {
> struct sockaddr *gate = rt->rt_gateway;
> struct llinfo_nd6 *ln = (struct llinfo_nd6 *)rt->rt_llinfo;
> Index: netinet6/nd6.h
> ===================================================================
> RCS file: /home/ncvs/src/sys/netinet6/nd6.h,v
> retrieving revision 1.33
> diff -u -p -r1.33 nd6.h
> --- netinet6/nd6.h 26 Aug 2013 07:15:58 -0000 1.33
> +++ netinet6/nd6.h 27 Aug 2013 13:50:50 -0000
> @@ -277,7 +277,7 @@ void nd6_purge(struct ifnet *);
> void nd6_nud_hint(struct rtentry *, struct in6_addr *, int);
> int nd6_resolve(struct ifnet *, struct rtentry *,
> struct mbuf *, struct sockaddr *, u_char *);
> -void nd6_rtrequest(int, struct rtentry *, struct rt_addrinfo *);
> +void nd6_rtrequest(int, struct rtentry *);
> int nd6_ioctl(u_long, caddr_t, struct ifnet *);
> struct rtentry *nd6_cache_lladdr(struct ifnet *, struct in6_addr *,
> char *, int, int, int);
>