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

compat32 now.
This commit is contained in:
simonb 2021-01-17 10:50:01 +00:00
parent 63a30ad674
commit 9742d8845a
2 changed files with 48 additions and 3 deletions

View File

@ -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_ioctl.c,v 1.117 2021/01/14 23:30:50 simonb
#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>
@ -176,6 +179,20 @@ netbsd32_to_ifmediareq(struct netbsd32_ifmediareq *s32p,
p->ifm_ulist = (int *)NETBSD32PTR64(s32p->ifm_ulist);
}
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)
@ -697,6 +714,19 @@ netbsd32_from_ifmediareq(struct ifmediareq *p,
#endif
}
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:

View File

@ -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;