Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys rtsock: Route address message simplification



details:   https://anonhg.NetBSD.org/src/rev/1a9570a75800
branches:  trunk
changeset: 450910:1a9570a75800
user:      roy <roy%NetBSD.org@localhost>
date:      Mon Apr 29 11:57:22 2019 +0000

description:
rtsock: Route address message simplification

Rename rt_newaddrmsg to rt_addrmsg_rt.
Add rt_addrmsg which drops the error and route arguments which are only
needed by one caller.

diffstat:

 sys/compat/common/rtsock_50.c |  13 ++++++++-----
 sys/compat/net/route.h        |   5 +++--
 sys/kern/compat_stub.c        |   5 +++--
 sys/net/link_proto.c          |  10 +++++-----
 sys/net/route.c               |  12 ++++++------
 sys/net/route.h               |   5 +++--
 sys/net/rtsock_shared.c       |  15 +++++++++++----
 sys/netinet/if_arp.c          |  10 +++++-----
 sys/netinet/in.c              |  10 +++++-----
 sys/netinet6/in6.c            |  12 ++++++------
 sys/netinet6/nd6.c            |  10 ++++------
 sys/netinet6/nd6_nbr.c        |  10 +++++-----
 sys/netinet6/nd6_rtr.c        |   7 +++----
 sys/sys/compat_stub.h         |   5 +++--
 14 files changed, 70 insertions(+), 59 deletions(-)

diffs (truncated from 522 to 300 lines):

diff -r 3be2094c2ae3 -r 1a9570a75800 sys/compat/common/rtsock_50.c
--- a/sys/compat/common/rtsock_50.c     Mon Apr 29 08:31:29 2019 +0000
+++ b/sys/compat/common/rtsock_50.c     Mon Apr 29 11:57:22 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtsock_50.c,v 1.11 2019/04/29 08:31:29 pgoyette Exp $  */
+/*     $NetBSD: rtsock_50.c,v 1.12 2019/04/29 11:57:22 roy Exp $       */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsock_50.c,v 1.11 2019/04/29 08:31:29 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_50.c,v 1.12 2019/04/29 11:57:22 roy Exp $");
 
 #define        COMPAT_RTSOCK   /* Use the COMPATNAME/COMPATCALL macros and the
                         * various other compat definitions - see
@@ -160,8 +160,10 @@
        MODULE_HOOK_SET(rtsock_rt_missmsg_50_hook, "rts_50",
            compat_50_rt_missmsg);
        MODULE_HOOK_SET(rtsock_rt_ifmsg_50_hook, "rts_50", compat_50_rt_ifmsg);
-       MODULE_HOOK_SET(rtsock_rt_newaddrmsg_50_hook, "rts_50",
-           compat_50_rt_newaddrmsg);
+       MODULE_HOOK_SET(rtsock_rt_addrmsg_rt_50_hook, "rts_50",
+           compat_50_rt_addrmsg_rt);
+       MODULE_HOOK_SET(rtsock_rt_addrmsg_50_hook, "rts_50",
+           compat_50_rt_addrmsg);
        MODULE_HOOK_SET(rtsock_rt_ifannouncemsg_50_hook, "rts_50",
            compat_50_rt_ifannouncemsg);
        MODULE_HOOK_SET(rtsock_rt_ieee80211msg_50_hook, "rts_50",
@@ -178,7 +180,8 @@
        MODULE_HOOK_UNSET(rtsock_oifmsg_50_hook); 
        MODULE_HOOK_UNSET(rtsock_rt_missmsg_50_hook); 
        MODULE_HOOK_UNSET(rtsock_rt_ifmsg_50_hook); 
-       MODULE_HOOK_UNSET(rtsock_rt_newaddrmsg_50_hook); 
+       MODULE_HOOK_UNSET(rtsock_rt_addrmsg_rt_50_hook); 
+       MODULE_HOOK_UNSET(rtsock_rt_addrmsg_50_hook); 
        MODULE_HOOK_UNSET(rtsock_rt_ifannouncemsg_50_hook); 
        MODULE_HOOK_UNSET(rtsock_rt_ieee80211msg_50_hook); 
 }
diff -r 3be2094c2ae3 -r 1a9570a75800 sys/compat/net/route.h
--- a/sys/compat/net/route.h    Mon Apr 29 08:31:29 2019 +0000
+++ b/sys/compat/net/route.h    Mon Apr 29 11:57:22 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: route.h,v 1.2 2016/09/21 10:50:23 roy Exp $    */
+/*     $NetBSD: route.h,v 1.3 2019/04/29 11:57:22 roy Exp $    */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -87,7 +87,8 @@
 void   compat_50_rt_missmsg(int, const struct rt_addrinfo *, int, int);
 struct mbuf *
        compat_50_rt_msg1(int, struct rt_addrinfo *, void *, int);
-void   compat_50_rt_newaddrmsg(int, struct ifaddr *, int, struct rtentry *);
+void   compat_50_rt_addrmsg_rt(int, struct ifaddr *, int, struct rtentry *);
+void   compat_50_rt_addrmsg(int, struct ifaddr *);
 void   compat_70_rt_newaddrmsg1(int, struct ifaddr *);
 #endif
 
diff -r 3be2094c2ae3 -r 1a9570a75800 sys/kern/compat_stub.c
--- a/sys/kern/compat_stub.c    Mon Apr 29 08:31:29 2019 +0000
+++ b/sys/kern/compat_stub.c    Mon Apr 29 11:57:22 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.c,v 1.9 2019/04/15 02:07:11 pgoyette Exp $     */
+/* $NetBSD: compat_stub.c,v 1.10 2019/04/29 11:57:22 roy Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -203,7 +203,8 @@
 struct rtsock_rt_missmsg_50_hook_t rtsock_rt_missmsg_50_hook;
 struct rtsock_rt_ifmsg_50_hook_t rtsock_rt_ifmsg_50_hook;
 struct rtsock_rt_ifannouncemsg_50_hook_t rtsock_rt_ifannouncemsg_50_hook;
-struct rtsock_rt_newaddrmsg_50_hook_t rtsock_rt_newaddrmsg_50_hook;
+struct rtsock_rt_addrmsg_rt_50_hook_t rtsock_rt_addrmsg_rt_50_hook;
+struct rtsock_rt_addrmsg_50_hook_t rtsock_rt_addrmsg_50_hook;
 struct rtsock_rt_ieee80211msg_50_hook_t rtsock_rt_ieee80211msg_50_hook;
 
 /*
diff -r 3be2094c2ae3 -r 1a9570a75800 sys/net/link_proto.c
--- a/sys/net/link_proto.c      Mon Apr 29 08:31:29 2019 +0000
+++ b/sys/net/link_proto.c      Mon Apr 29 11:57:22 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: link_proto.c,v 1.37 2019/01/28 12:53:01 martin Exp $   */
+/*     $NetBSD: link_proto.c,v 1.38 2019/04/29 11:57:22 roy Exp $      */
 
 /*-
  * Copyright (c) 1982, 1986, 1993
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: link_proto.c,v 1.37 2019/01/28 12:53:01 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: link_proto.c,v 1.38 2019/04/29 11:57:22 roy Exp $");
 
 #include <sys/param.h>
 #include <sys/socket.h>
@@ -215,7 +215,7 @@
                                error = EBUSY;
                        else {
                                /* TBD routing socket */
-                               rt_newaddrmsg(RTM_DELETE, ifa, 0, NULL);
+                               rt_addrmsg(RTM_DELETE, ifa);
                                /* We need to release psref for ifa_remove */
                                ifaref(ifa);
                                ifa_release(ifa, &psref);
@@ -236,7 +236,7 @@
                                sockaddr_copy(ifa->ifa_addr,
                                    ifa->ifa_addr->sa_len, &u.sa);
                                ifa_insert(ifp, ifa);
-                               rt_newaddrmsg(RTM_ADD, ifa, 0, NULL);
+                               rt_addrmsg(RTM_ADD, ifa);
                        }
 
                        mkactive = (iflr->flags & IFLR_ACTIVE) != 0;
@@ -244,7 +244,7 @@
 
                        if (!isactive && mkactive) {
                                if_activate_sadl(ifp, ifa, nsdl);
-                               rt_newaddrmsg(RTM_CHANGE, ifa, 0, NULL);
+                               rt_addrmsg(RTM_CHANGE, ifa);
                                error = ENETRESET;
                        }
                        break;
diff -r 3be2094c2ae3 -r 1a9570a75800 sys/net/route.c
--- a/sys/net/route.c   Mon Apr 29 08:31:29 2019 +0000
+++ b/sys/net/route.c   Mon Apr 29 11:57:22 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: route.c,v 1.217 2019/03/11 03:00:41 ozaki-r Exp $      */
+/*     $NetBSD: route.c,v 1.218 2019/04/29 11:57:22 roy Exp $  */
 
 /*-
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.217 2019/03/11 03:00:41 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.218 2019/04/29 11:57:22 roy Exp $");
 
 #include <sys/param.h>
 #ifdef RTFLUSH_DEBUG
@@ -1678,7 +1678,7 @@
                info.rti_ifa = ifa;
                nrt = NULL;
                e = rtrequest1(RTM_ADD, &info, &nrt);
-               rt_newaddrmsg(RTM_ADD, ifa, e, nrt);
+               rt_addrmsg_rt(RTM_ADD, ifa, e, nrt);
                if (nrt != NULL) {
                        KASSERT(nrt->rt_ifa == ifa);
 #ifdef RT_DEBUG
@@ -1689,7 +1689,7 @@
                }
        } else {
                e = 0;
-               rt_newaddrmsg(RTM_NEWADDR, ifa, 0, NULL);
+               rt_addrmsg(RTM_NEWADDR, ifa);
        }
        if (rt != NULL)
                rt_unref(rt);
@@ -1731,7 +1731,7 @@
                                rt_free(rt);
                                rt = NULL;
                        }
-                       rt_newaddrmsg(RTM_DELADDR, ifa, 0, NULL);
+                       rt_addrmsg(RTM_DELADDR, ifa);
                } else {
 #ifdef NET_MPSAFE
                        int error = rt_update_prepare(rt);
@@ -1751,7 +1751,7 @@
                        rt_newmsg(RTM_CHANGE, rt);
                }
        } else
-               rt_newaddrmsg(RTM_DELADDR, ifa, 0, NULL);
+               rt_addrmsg(RTM_DELADDR, ifa);
        if (rt != NULL)
                rt_unref(rt);
        return e;
diff -r 3be2094c2ae3 -r 1a9570a75800 sys/net/route.h
--- a/sys/net/route.h   Mon Apr 29 08:31:29 2019 +0000
+++ b/sys/net/route.h   Mon Apr 29 11:57:22 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: route.h,v 1.121 2019/04/29 05:42:09 pgoyette Exp $     */
+/*     $NetBSD: route.h,v 1.122 2019/04/29 11:57:22 roy Exp $  */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -515,7 +515,8 @@
 struct mbuf *
        rt_msg1(int, struct rt_addrinfo *, void *, int);
 int    rt_msg3(int, struct rt_addrinfo *, void *, struct rt_walkarg *, int *);
-void   rt_newaddrmsg(int, struct ifaddr *, int, struct rtentry *);
+void   rt_addrmsg(int, struct ifaddr *);
+void   rt_addrmsg_rt(int, struct ifaddr *, int, struct rtentry *);
 void   route_enqueue(struct mbuf *, int);
 
 struct llentry;
diff -r 3be2094c2ae3 -r 1a9570a75800 sys/net/rtsock_shared.c
--- a/sys/net/rtsock_shared.c   Mon Apr 29 08:31:29 2019 +0000
+++ b/sys/net/rtsock_shared.c   Mon Apr 29 11:57:22 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtsock_shared.c,v 1.6 2019/04/29 05:42:09 pgoyette Exp $       */
+/*     $NetBSD: rtsock_shared.c,v 1.7 2019/04/29 11:57:22 roy Exp $    */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsock_shared.c,v 1.6 2019/04/29 05:42:09 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_shared.c,v 1.7 2019/04/29 11:57:22 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1365,7 +1365,7 @@
  * copies of it.
  */
 void
-COMPATNAME(rt_newaddrmsg)(int cmd, struct ifaddr *ifa, int error,
+COMPATNAME(rt_addrmsg_rt)(int cmd, struct ifaddr *ifa, int error,
     struct rtentry *rt)
 {
 #define        cmdpass(__cmd, __pass)  (((__cmd) << 2) | (__pass))
@@ -1387,7 +1387,7 @@
                (*vec_sctp_delete_ip_address)(ifa);
        }
 
-       COMPATCALL(rt_newaddrmsg, (cmd, ifa, error, rt));
+       COMPATCALL(rt_addrmsg_rt, (cmd, ifa, error, rt));
        if (COMPATNAME(route_info).ri_cb.any_count == 0)
                return;
        for (pass = 1; pass < 3; pass++) {
@@ -1469,6 +1469,13 @@
 #undef cmdpass
 }
 
+void
+COMPATNAME(rt_addrmsg)(int cmd, struct ifaddr *ifa)
+{
+
+       COMPATNAME(rt_addrmsg_rt)(cmd, ifa, 0, NULL);
+}
+
 static struct mbuf *
 rt_makeifannouncemsg(struct ifnet *ifp, int type, int what,
     struct rt_addrinfo *info)
diff -r 3be2094c2ae3 -r 1a9570a75800 sys/netinet/if_arp.c
--- a/sys/netinet/if_arp.c      Mon Apr 29 08:31:29 2019 +0000
+++ b/sys/netinet/if_arp.c      Mon Apr 29 11:57:22 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_arp.c,v 1.279 2019/04/24 10:20:36 roy Exp $ */
+/*     $NetBSD: if_arp.c,v 1.280 2019/04/29 11:57:22 roy Exp $ */
 
 /*
  * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.279 2019/04/24 10:20:36 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.280 2019/04/29 11:57:22 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1607,7 +1607,7 @@
        }
        if (!ip_dad_enabled()) {
                ia->ia4_flags &= ~IN_IFF_TENTATIVE;
-               rt_newaddrmsg(RTM_NEWADDR, ifa, 0, NULL);
+               rt_addrmsg(RTM_NEWADDR, ifa);
                arpannounce1(ifa);
                return;
        }
@@ -1745,7 +1745,7 @@
                 * No duplicate address found.
                 */
                ia->ia4_flags &= ~IN_IFF_TENTATIVE;
-               rt_newaddrmsg(RTM_NEWADDR, ifa, 0, NULL);
+               rt_addrmsg(RTM_NEWADDR, ifa);
                ARPLOG(LOG_DEBUG,
                    "%s: DAD complete for %s - no duplicates found\n",
                    if_name(ifa->ifa_ifp), ARPLOGADDR(&ia->ia_addr.sin_addr));
@@ -1822,7 +1822,7 @@
        if ((ia->ia4_flags & IN_IFF_DUPLICATED) == 0) {
                ia->ia4_flags |= IN_IFF_DUPLICATED;
                /* Inform the routing socket of the duplicate address */
-               rt_newaddrmsg(RTM_NEWADDR, ifa, 0, NULL);
+               rt_addrmsg(RTM_NEWADDR, ifa);
        }
 }
 
diff -r 3be2094c2ae3 -r 1a9570a75800 sys/netinet/in.c
--- a/sys/netinet/in.c  Mon Apr 29 08:31:29 2019 +0000
+++ b/sys/netinet/in.c  Mon Apr 29 11:57:22 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in.c,v 1.233 2018/11/29 09:54:22 ozaki-r Exp $ */
+/*     $NetBSD: in.c,v 1.234 2019/04/29 11:57:22 roy Exp $     */
 
 /*



Home | Main Index | Thread Index | Old Index