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 ioctl for compat32.
details: https://anonhg.NetBSD.org/src/rev/d1ca4d367b6f
branches: trunk
changeset: 1029116:d1ca4d367b6f
user: roy <roy%NetBSD.org@localhost>
date: Wed Dec 22 00:21:32 2021 +0000
description:
Handle the SIOCGNBRINFO ioctl for compat32.
arp -a works with compat32 now.
Credit to simonb@ for the ndp fix from which this is cribbed.
diffstat:
sys/compat/netbsd32/netbsd32_ioctl.c | 31 ++++++++++++++++++++++++++++---
sys/compat/netbsd32/netbsd32_ioctl.h | 13 ++++++++++++-
2 files changed, 40 insertions(+), 4 deletions(-)
diffs (100 lines):
diff -r f3000faa93b4 -r d1ca4d367b6f sys/compat/netbsd32/netbsd32_ioctl.c
--- a/sys/compat/netbsd32/netbsd32_ioctl.c Tue Dec 21 23:40:03 2021 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.c Wed Dec 22 00:21:32 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_ioctl.c,v 1.119 2021/04/14 16:26:23 mlelstv Exp $ */
+/* $NetBSD: netbsd32_ioctl.c,v 1.120 2021/12/22 00:21:32 roy 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.119 2021/04/14 16:26:23 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.120 2021/12/22 00:21:32 roy Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ntp.h"
@@ -180,6 +180,18 @@
}
static inline void
+netbsd32_to_in_nbrinfo(struct netbsd32_in_nbrinfo *s32p, struct in_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->state = s32p->state;
+ p->expire = s32p->expire;
+}
+
+static inline void
netbsd32_to_in6_nbrinfo(struct netbsd32_in6_nbrinfo *s32p, struct in6_nbrinfo *p,
u_long cmd)
{
@@ -190,7 +202,6 @@
p->isrouter = s32p->isrouter;
p->state = s32p->state;
p->expire = s32p->expire;
-
}
static inline void
@@ -715,6 +726,18 @@
}
static inline void
+netbsd32_from_in_nbrinfo(struct in_nbrinfo *p, struct netbsd32_in_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->state = p->state;
+ s32p->expire = p->expire;
+}
+
+static inline void
netbsd32_from_in6_nbrinfo(struct in6_nbrinfo *p, struct netbsd32_in6_nbrinfo *s32p,
u_long cmd)
{
@@ -1525,6 +1548,8 @@
case SIOCGIFMEDIA32:
IOCTL_STRUCT_CONV_TO(SIOCGIFMEDIA, ifmediareq);
+ case SIOCGNBRINFO32:
+ IOCTL_STRUCT_CONV_TO(SIOCGNBRINFO, in_nbrinfo);
case SIOCGNBRINFO_IN632:
IOCTL_STRUCT_CONV_TO(SIOCGNBRINFO_IN6, in6_nbrinfo);
diff -r f3000faa93b4 -r d1ca4d367b6f sys/compat/netbsd32/netbsd32_ioctl.h
--- a/sys/compat/netbsd32/netbsd32_ioctl.h Tue Dec 21 23:40:03 2021 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.h Wed Dec 22 00:21:32 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_ioctl.h,v 1.78 2021/04/14 16:26:23 mlelstv Exp $ */
+/* $NetBSD: netbsd32_ioctl.h,v 1.79 2021/12/22 00:21:32 roy Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -480,6 +480,17 @@
/* from <sys/sockio.h> */
#define SIOCGETVIFCNT32 _IOWR('u', 51, struct netbsd32_sioc_vif_req)/* vif pkt cnt */
+/* from <netinet/if_arp.h> */
+struct netbsd32_in_nbrinfo {
+ char ifname[IFNAMSIZ]; /* if name, e.g. "en0" */
+ struct in_addr addr; /* IPv4 address of the neighbor */
+ netbsd32_long asked; /* number of queries already sent for this addr */
+ int state; /* reachability state */
+ int expire; /* lifetime for NDP state transition */
+};
+/* from <sys/sockio.h> */
+#define SIOCGNBRINFO32 _IOWR('i', 249, struct netbsd32_in_nbrinfo)
+
/* from <netinet6/nd6.h> */
struct netbsd32_in6_nbrinfo {
char ifname[IFNAMSIZ]; /* if name, e.g. "en0" */
Home |
Main Index |
Thread Index |
Old Index