Source-Changes-HG archive

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

[src/trunk]: src/sys/net For the rtsock compat code, make sure we create the ...



details:   https://anonhg.NetBSD.org/src/rev/c683b4698355
branches:  trunk
changeset: 998741:c683b4698355
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Mon Apr 29 05:42:09 2019 +0000

description:
For the rtsock compat code, make sure we create the "oroute" sysctl
tree.  Otherwise a 5.2 version of getifaddrs(2) gets errors.

This makes the 5.2 version of ifconfig(8) behave the same on both
NetBSD-8 and -current.  HOWEVER, both of them print nothing (for
``ifconfig -l'' command) so there's still a bug somewhere.

As reported originally by der Mouse.

diffstat:

 sys/compat/common/rtsock_70.c |   8 ++++++--
 sys/net/route.h               |   4 +++-
 sys/net/rtsock.c              |  15 +++++++--------
 sys/net/rtsock_shared.c       |   6 +++---
 4 files changed, 19 insertions(+), 14 deletions(-)

diffs (143 lines):

diff -r 89bf3f4c86b8 -r c683b4698355 sys/compat/common/rtsock_70.c
--- a/sys/compat/common/rtsock_70.c     Mon Apr 29 02:49:35 2019 +0000
+++ b/sys/compat/common/rtsock_70.c     Mon Apr 29 05:42:09 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtsock_70.c,v 1.5 2019/03/01 11:06:56 pgoyette Exp $   */
+/*     $NetBSD: rtsock_70.c,v 1.6 2019/04/29 05:42:09 pgoyette Exp $   */
 
 /*
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsock_70.c,v 1.5 2019/03/01 11:06:56 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_70.c,v 1.6 2019/04/29 05:42:09 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -46,6 +46,8 @@
 #include <compat/net/route.h>
 #include <compat/net/route_70.h>
 
+struct sysctllog *clog;
+
 void
 compat_70_rt_newaddrmsg1(int cmd, struct ifaddr *ifa)
 {
@@ -122,12 +124,14 @@
        MODULE_HOOK_SET(rtsock_newaddr_70_hook, "rts_70",
            compat_70_rt_newaddrmsg1);
        MODULE_HOOK_SET(rtsock_iflist_70_hook, "rts_70", compat_70_iflist_addr);
+       sysctl_net_route_setup(&clog, PF_OROUTE, "ortable");
 }
 
 void
 rtsock_70_fini(void)
 {
 
+       sysctl_teardown(&clog);
        MODULE_HOOK_UNSET(rtsock_newaddr_70_hook);
        MODULE_HOOK_UNSET(rtsock_iflist_70_hook);
 }
diff -r 89bf3f4c86b8 -r c683b4698355 sys/net/route.h
--- a/sys/net/route.h   Mon Apr 29 02:49:35 2019 +0000
+++ b/sys/net/route.h   Mon Apr 29 05:42:09 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: route.h,v 1.120 2018/10/30 05:54:42 ozaki-r Exp $      */
+/*     $NetBSD: route.h,v 1.121 2019/04/29 05:42:09 pgoyette Exp $     */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -544,6 +544,8 @@
            int (*)(struct rtentry *, void *), void *);
 void   rtbl_init(void);
 
+void sysctl_net_route_setup(struct sysctllog **, int, const char *);
+
 #endif /* _KERNEL */
 
 #endif /* !_NET_ROUTE_H_ */
diff -r 89bf3f4c86b8 -r c683b4698355 sys/net/rtsock.c
--- a/sys/net/rtsock.c  Mon Apr 29 02:49:35 2019 +0000
+++ b/sys/net/rtsock.c  Mon Apr 29 05:42:09 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtsock.c,v 1.248 2019/03/01 11:06:57 pgoyette Exp $    */
+/*     $NetBSD: rtsock.c,v 1.249 2019/04/29 05:42:09 pgoyette Exp $    */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.248 2019/03/01 11:06:57 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.249 2019/04/29 05:42:09 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -101,7 +101,6 @@
 #endif
 
 static int if_addrflags(struct ifaddr *);
-static void sysctl_net_route_setup(struct sysctllog **);
 
 #include <net/rtsock_shared.c>
 
@@ -498,24 +497,24 @@
        return error;
 }
 
-static void
-sysctl_net_route_setup(struct sysctllog **clog)
+void
+sysctl_net_route_setup(struct sysctllog **clog, int pf, const char *name)
 {
        const struct sysctlnode *rnode = NULL;
 
        sysctl_createv(clog, 0, NULL, &rnode,
                       CTLFLAG_PERMANENT,
-                      CTLTYPE_NODE, DOMAINNAME,
+                      CTLTYPE_NODE, name,
                       SYSCTL_DESCR("PF_ROUTE information"),
                       NULL, 0, NULL, 0,
-                      CTL_NET, PF_XROUTE, CTL_EOL);
+                      CTL_NET, pf, CTL_EOL);
 
        sysctl_createv(clog, 0, NULL, NULL,
                       CTLFLAG_PERMANENT,
                       CTLTYPE_NODE, "rtable",
                       SYSCTL_DESCR("Routing table information"),
                       sysctl_rtable, 0, NULL, 0,
-                      CTL_NET, PF_XROUTE, 0 /* any protocol */, CTL_EOL);
+                      CTL_NET, pf, 0 /* any protocol */, CTL_EOL);
 
        sysctl_createv(clog, 0, &rnode, NULL,
                       CTLFLAG_PERMANENT,
diff -r 89bf3f4c86b8 -r c683b4698355 sys/net/rtsock_shared.c
--- a/sys/net/rtsock_shared.c   Mon Apr 29 02:49:35 2019 +0000
+++ b/sys/net/rtsock_shared.c   Mon Apr 29 05:42:09 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtsock_shared.c,v 1.5 2019/04/10 04:06:52 thorpej Exp $        */
+/*     $NetBSD: rtsock_shared.c,v 1.6 2019/04/29 05:42:09 pgoyette 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.5 2019/04/10 04:06:52 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_shared.c,v 1.6 2019/04/29 05:42:09 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1618,7 +1618,7 @@
 #endif
 
 #ifndef COMPAT_RTSOCK
-       sysctl_net_route_setup(NULL);
+       sysctl_net_route_setup(NULL, PF_ROUTE, "rtable");
 #endif
        ri->ri_intrq.ifq_maxlen = ri->ri_maxqlen;
        ri->ri_sih = softint_establish(SOFTINT_NET | SOFTINT_MPSAFE,



Home | Main Index | Thread Index | Old Index