Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/netbsd32 Add support for NPF ioctls.
details: https://anonhg.NetBSD.org/src/rev/390b1854a642
branches: trunk
changeset: 338617:390b1854a642
user: roy <roy%NetBSD.org@localhost>
date: Mon Jun 01 16:07:27 2015 +0000
description:
Add support for NPF ioctls.
diffstat:
sys/compat/netbsd32/netbsd32_ioctl.c | 80 +++++++++++++++++++++++++++++++++++-
sys/compat/netbsd32/netbsd32_ioctl.h | 32 +++++++++++++-
2 files changed, 109 insertions(+), 3 deletions(-)
diffs (179 lines):
diff -r dd44a8445f53 -r 390b1854a642 sys/compat/netbsd32/netbsd32_ioctl.c
--- a/sys/compat/netbsd32/netbsd32_ioctl.c Mon Jun 01 10:10:56 2015 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.c Mon Jun 01 16:07:27 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_ioctl.c,v 1.80 2015/06/01 00:15:08 roy Exp $ */
+/* $NetBSD: netbsd32_ioctl.c,v 1.81 2015/06/01 16:07:27 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.80 2015/06/01 00:15:08 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.81 2015/06/01 16:07:27 roy Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -68,6 +68,8 @@
#include <net/if_pppoe.h>
#include <net/if_sppp.h>
+#include <net/npf/npf.h>
+
#include <net/bpf.h>
#include <netinet/in.h>
#include <netinet/in_var.h>
@@ -290,6 +292,13 @@
}
static inline void
+netbsd32_to_voidp(netbsd32_voidp *s32p, voidp *p, u_long cmd)
+{
+
+ *p = (void *)NETBSD32PTR64(*s32p);
+}
+
+static inline void
netbsd32_to_wdog_conf(struct netbsd32_wdog_conf *s32p, struct wdog_conf *p, u_long cmd)
{
@@ -450,6 +459,30 @@
p->kv_name = NETBSD32PTR64(s32p->kv_name);
}
+static inline void
+netbsd32_to_npf_ioctl_table(
+ const struct netbsd32_npf_ioctl_table *s32p,
+ struct npf_ioctl_table *p,
+ u_long cmd)
+{
+
+ p->nct_cmd = s32p->nct_cmd;
+ p->nct_name = NETBSD32PTR64(s32p->nct_name);
+ switch (s32p->nct_cmd) {
+ case NPF_CMD_TABLE_LOOKUP:
+ case NPF_CMD_TABLE_ADD:
+ case NPF_CMD_TABLE_REMOVE:
+ p->nct_data.ent.alen = s32p->nct_data.ent.alen;
+ p->nct_data.ent.addr = s32p->nct_data.ent.addr;
+ p->nct_data.ent.mask = s32p->nct_data.ent.mask;
+ break;
+ case NPF_CMD_TABLE_LIST:
+ p->nct_data.buf.buf = NETBSD32PTR64(s32p->nct_data.buf.buf);
+ p->nct_data.buf.len = s32p->nct_data.buf.len;
+ break;
+ }
+}
+
/*
* handle ioctl conversions from 64-bit kernel -> netbsd32
*/
@@ -760,6 +793,14 @@
}
static inline void
+netbsd32_from_voidp(voidp *p, netbsd32_voidp *s32p, u_long cmd)
+{
+
+ NETBSD32PTR32(*s32p, *p);
+}
+
+
+static inline void
netbsd32_from_clockctl_settimeofday(
const struct clockctl_settimeofday *p,
struct netbsd32_clockctl_settimeofday *s32p,
@@ -825,6 +866,30 @@
s32p->kv_value = p->kv_value;
}
+static inline void
+netbsd32_from_npf_ioctl_table(
+ const struct npf_ioctl_table *p,
+ struct netbsd32_npf_ioctl_table *s32p,
+ u_long cmd)
+{
+
+ s32p->nct_cmd = p->nct_cmd;
+ NETBSD32PTR32(s32p->nct_name, p->nct_name);
+ switch (p->nct_cmd) {
+ case NPF_CMD_TABLE_LOOKUP:
+ case NPF_CMD_TABLE_ADD:
+ case NPF_CMD_TABLE_REMOVE:
+ s32p->nct_data.ent.alen = p->nct_data.ent.alen;
+ s32p->nct_data.ent.addr = p->nct_data.ent.addr;
+ s32p->nct_data.ent.mask = p->nct_data.ent.mask;
+ break;
+ case NPF_CMD_TABLE_LIST:
+ NETBSD32PTR32(s32p->nct_data.buf.buf, p->nct_data.buf.buf);
+ s32p->nct_data.buf.len = p->nct_data.buf.len;
+ break;
+ }
+}
+
/*
* main ioctl syscall.
*
@@ -1205,6 +1270,17 @@
case KIOCGVALUE32:
IOCTL_STRUCT_CONV_TO(KIOCGVALUE, ksyms_gvalue);
+ case IOC_NPF_LOAD32:
+ IOCTL_STRUCT_CONV_TO(IOC_NPF_LOAD, plistref);
+ case IOC_NPF_TABLE32:
+ IOCTL_STRUCT_CONV_TO(IOC_NPF_TABLE, npf_ioctl_table);
+ case IOC_NPF_STATS32:
+ IOCTL_CONV_TO(IOC_NPF_STATS, voidp);
+ case IOC_NPF_SAVE32:
+ IOCTL_STRUCT_CONV_TO(IOC_NPF_SAVE, plistref);
+ case IOC_NPF_RULE32:
+ IOCTL_STRUCT_CONV_TO(IOC_NPF_RULE, plistref);
+
default:
#ifdef NETBSD32_MD_IOCTL
error = netbsd32_md_ioctl(fp, com, data32, l);
diff -r dd44a8445f53 -r 390b1854a642 sys/compat/netbsd32/netbsd32_ioctl.h
--- a/sys/compat/netbsd32/netbsd32_ioctl.h Mon Jun 01 10:10:56 2015 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.h Mon Jun 01 16:07:27 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_ioctl.h,v 1.51 2015/05/31 22:19:41 roy Exp $ */
+/* $NetBSD: netbsd32_ioctl.h,v 1.52 2015/06/01 16:07:27 roy Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -581,3 +581,33 @@
#define KIOCGVALUE32 _IOWR('l', 4, struct netbsd32_ksyms_gvalue)
#define KIOCGSYMBOL32 _IOWR('l', 5, struct netbsd32_ksyms_gsymbol)
#endif /* KIOCGSYMBOL */
+
+/* From net/npf/npf.h */
+typedef struct in6_addr netbsd32_npf_addr_t;
+typedef uint8_t netbsd32_npf_netmask_t;
+
+typedef struct netbsd32_npf_ioctl_ent {
+ int alen;
+ netbsd32_npf_addr_t addr;
+ netbsd32_npf_netmask_t mask;
+} netbsd32_npf_ioctl_ent_t;
+
+typedef struct netbsd32_npf_ioctl_buf {
+ netbsd32_voidp buf;
+ netbsd32_size_t len;
+} netbsd32_npf_ioctl_buf_t;
+
+typedef struct netbsd32_npf_ioctl_table {
+ int nct_cmd;
+ netbsd32_charp nct_name;
+ union {
+ netbsd32_npf_ioctl_ent_t ent;
+ netbsd32_npf_ioctl_buf_t buf;
+ } nct_data;
+} netbsd32_npf_ioctl_table_t;
+
+#define IOC_NPF_LOAD32 _IOWR('N', 102, struct netbsd32_plistref)
+#define IOC_NPF_TABLE32 _IOW('N', 103, struct netbsd32_npf_ioctl_table)
+#define IOC_NPF_STATS32 _IOW('N', 104, netbsd32_voidp)
+#define IOC_NPF_SAVE32 _IOR('N', 105, struct netbsd32_plistref)
+#define IOC_NPF_RULE32 _IOWR('N', 107, struct netbsd32_plistref)
Home |
Main Index |
Thread Index |
Old Index