Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/netbsd32 Handle the SIOCGNBRINFO_IN6 ioctl for co...



details:   https://anonhg.NetBSD.org/src/rev/c9b8a171cc32
branches:  trunk
changeset: 949801:c9b8a171cc32
user:      simonb <simonb%NetBSD.org@localhost>
date:      Sun Jan 17 10:50:01 2021 +0000

description:
Handle the SIOCGNBRINFO_IN6 ioctl for compat32.  ndp -a works with
compat32 now.

diffstat:

 sys/compat/netbsd32/netbsd32_ioctl.c |  37 ++++++++++++++++++++++++++++++++++-
 sys/compat/netbsd32/netbsd32_ioctl.h |  14 ++++++++++++-
 2 files changed, 48 insertions(+), 3 deletions(-)

diffs (107 lines):

diff -r b0e48c1fb88c -r c9b8a171cc32 sys/compat/netbsd32/netbsd32_ioctl.c
--- a/sys/compat/netbsd32/netbsd32_ioctl.c      Sun Jan 17 01:54:37 2021 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.c      Sun Jan 17 10:50:01 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_ioctl.c,v 1.117 2021/01/14 23:30:50 simonb Exp $      */
+/*     $NetBSD: netbsd32_ioctl.c,v 1.118 2021/01/17 10:50:01 simonb Exp $      */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.117 2021/01/14 23:30:50 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.118 2021/01/17 10:50:01 simonb Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ntp.h"
@@ -86,6 +86,9 @@
 #include <netinet/igmp_var.h>
 #include <netinet/ip_mroute.h>
 
+#include <netinet6/nd6.h>
+#include <netinet6/in6_var.h>
+
 #include <compat/sys/sockio.h>
 
 #include <compat/netbsd32/netbsd32.h>
@@ -177,6 +180,20 @@
 }
 
 static inline void
+netbsd32_to_in6_nbrinfo(struct netbsd32_in6_nbrinfo *s32p, struct in6_nbrinfo *p,
+    u_long cmd)
+{
+
+       memcpy(p->ifname, s32p->ifname, sizeof p->ifname);
+       memcpy(&p->addr, &s32p->addr, sizeof p->addr);
+       p->asked = s32p->asked;
+       p->isrouter = s32p->isrouter;
+       p->state = s32p->state;
+       p->expire = s32p->expire;
+       
+}
+
+static inline void
 netbsd32_to_pppoediscparms(struct netbsd32_pppoediscparms *s32p,
     struct pppoediscparms *p, u_long cmd)
 {
@@ -698,6 +715,19 @@
 }
 
 static inline void
+netbsd32_from_in6_nbrinfo(struct in6_nbrinfo *p, struct netbsd32_in6_nbrinfo *s32p,
+    u_long cmd)
+{
+
+       memcpy(s32p->ifname, p->ifname, sizeof s32p->ifname);
+       memcpy(&s32p->addr, &p->addr, sizeof s32p->addr);
+       s32p->asked = p->asked;
+       s32p->isrouter = p->isrouter;
+       s32p->state = p->state;
+       s32p->expire = p->expire;
+}
+
+static inline void
 netbsd32_from_pppoediscparms(struct pppoediscparms *p,
     struct netbsd32_pppoediscparms *s32p, u_long cmd)
 {
@@ -1495,6 +1525,9 @@
        case SIOCGIFMEDIA32:
                IOCTL_STRUCT_CONV_TO(SIOCGIFMEDIA, ifmediareq);
 
+       case SIOCGNBRINFO_IN632:
+               IOCTL_STRUCT_CONV_TO(SIOCGNBRINFO_IN6, in6_nbrinfo);
+
        case SIOCGIFGENERIC32:
                IOCTL_STRUCT_CONV_TO(SIOCGIFGENERIC, ifreq);
        case SIOCSIFGENERIC32:
diff -r b0e48c1fb88c -r c9b8a171cc32 sys/compat/netbsd32/netbsd32_ioctl.h
--- a/sys/compat/netbsd32/netbsd32_ioctl.h      Sun Jan 17 01:54:37 2021 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.h      Sun Jan 17 10:50:01 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_ioctl.h,v 1.76 2021/01/14 08:22:51 simonb Exp $       */
+/*     $NetBSD: netbsd32_ioctl.h,v 1.77 2021/01/17 10:50:01 simonb Exp $       */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -480,6 +480,18 @@
 /* from <sys/sockio.h> */
 #define        SIOCGETVIFCNT32 _IOWR('u', 51, struct netbsd32_sioc_vif_req)/* vif pkt cnt */
 
+/* from <netinet6/nd6.h> */
+struct netbsd32_in6_nbrinfo {
+       char ifname[IFNAMSIZ];  /* if name, e.g. "en0" */
+       struct in6_addr addr;   /* IPv6 address of the neighbor */
+       netbsd32_long   asked;  /* number of queries already sent for this addr */
+       int     isrouter;       /* if it acts as a router */
+       int     state;          /* reachability state */
+       int     expire;         /* lifetime for NDP state transition */
+};
+/* from <netinet6/in6_var.h> */
+#define SIOCGNBRINFO_IN632     _IOWR('i', 78, struct netbsd32_in6_nbrinfo)
+
 struct netbsd32_sioc_sg_req {
        struct  in_addr src;
        struct  in_addr grp;



Home | Main Index | Thread Index | Old Index