Module Name: src Committed By: roy Date: Wed Dec 22 00:21:32 UTC 2021
Modified Files: src/sys/compat/netbsd32: netbsd32_ioctl.c netbsd32_ioctl.h Log Message: Handle the SIOCGNBRINFO ioctl for compat32. arp -a works with compat32 now. Credit to simonb@ for the ndp fix from which this is cribbed. To generate a diff of this commit: cvs rdiff -u -r1.119 -r1.120 src/sys/compat/netbsd32/netbsd32_ioctl.c cvs rdiff -u -r1.78 -r1.79 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.119 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.120 --- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.119 Wed Apr 14 16:26:23 2021 +++ src/sys/compat/netbsd32/netbsd32_ioctl.c Wed Dec 22 00:21:32 2021 @@ -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 @@ netbsd32_to_ifmediareq(struct netbsd32_i } 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 @@ netbsd32_to_in6_nbrinfo(struct netbsd32_ p->isrouter = s32p->isrouter; p->state = s32p->state; p->expire = s32p->expire; - } static inline void @@ -715,6 +726,18 @@ netbsd32_from_ifmediareq(struct ifmediar } 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 @@ netbsd32_ioctl(struct lwp *l, 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); Index: src/sys/compat/netbsd32/netbsd32_ioctl.h diff -u src/sys/compat/netbsd32/netbsd32_ioctl.h:1.78 src/sys/compat/netbsd32/netbsd32_ioctl.h:1.79 --- src/sys/compat/netbsd32/netbsd32_ioctl.h:1.78 Wed Apr 14 16:26:23 2021 +++ src/sys/compat/netbsd32/netbsd32_ioctl.h Wed Dec 22 00:21:32 2021 @@ -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 @@ struct netbsd32_sioc_vif_req { /* 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" */