Module Name:    src
Committed By:   simonb
Date:           Sun Jan 17 10:50:01 UTC 2021

Modified Files:
        src/sys/compat/netbsd32: netbsd32_ioctl.c netbsd32_ioctl.h

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


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/compat/netbsd32/netbsd32_ioctl.c
cvs rdiff -u -r1.76 -r1.77 src/sys/compat/netbsd32/netbsd32_ioctl.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/netbsd32/netbsd32_ioctl.c
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.c:1.117 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.118
--- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.117	Thu Jan 14 23:30:50 2021
+++ src/sys/compat/netbsd32/netbsd32_ioctl.c	Sun Jan 17 10:50:01 2021
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_ioc
 #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 @@ netbsd32_to_ifmediareq(struct netbsd32_i
 }
 
 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 @@ netbsd32_from_ifmediareq(struct ifmediar
 }
 
 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 @@ netbsd32_ioctl(struct lwp *l,
 	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:

Index: src/sys/compat/netbsd32/netbsd32_ioctl.h
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.h:1.76 src/sys/compat/netbsd32/netbsd32_ioctl.h:1.77
--- src/sys/compat/netbsd32/netbsd32_ioctl.h:1.76	Thu Jan 14 08:22:51 2021
+++ src/sys/compat/netbsd32/netbsd32_ioctl.h	Sun Jan 17 10:50:01 2021
@@ -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 @@ struct netbsd32_sioc_vif_req {
 /* 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;

Reply via email to