Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet6 Hook up the addrctl stuff that's already there.
details: https://anonhg.NetBSD.org/src/rev/0d3cd08c154e
branches: trunk
changeset: 342208:0d3cd08c154e
user: christos <christos%NetBSD.org@localhost>
date: Sat Dec 12 23:34:25 2015 +0000
description:
Hook up the addrctl stuff that's already there.
diffstat:
sys/netinet6/in6.c | 12 ++++++++++--
sys/netinet6/in6.h | 8 +++-----
sys/netinet6/in6_src.c | 7 ++++---
sys/netinet6/ip6_input.c | 32 +++++++++++++++++++++-----------
4 files changed, 38 insertions(+), 21 deletions(-)
diffs (165 lines):
diff -r 25ab52ccbee5 -r 0d3cd08c154e sys/netinet6/in6.c
--- a/sys/netinet6/in6.c Sat Dec 12 22:22:51 2015 +0000
+++ b/sys/netinet6/in6.c Sat Dec 12 23:34:25 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in6.c,v 1.193 2015/11/27 02:54:22 ozaki-r Exp $ */
+/* $NetBSD: in6.c,v 1.194 2015/12/12 23:34:25 christos Exp $ */
/* $KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.193 2015/11/27 02:54:22 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.194 2015/12/12 23:34:25 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -273,6 +273,10 @@
int error;
switch (cmd) {
+ case SIOCAADDRCTL_POLICY:
+ case SIOCDADDRCTL_POLICY:
+ /* Privileged. */
+ return in6_src_ioctl(cmd, data);
/*
* XXX: Fix me, once we fix SIOCSIFADDR, SIOCIFDSTADDR, etc.
*/
@@ -725,6 +729,10 @@
case OSIOCAIFADDR_IN6:
#endif
case SIOCAIFADDR_IN6:
+
+ case SIOCAADDRCTL_POLICY:
+ case SIOCDADDRCTL_POLICY:
+
if (kauth_authorize_network(curlwp->l_cred,
KAUTH_NETWORK_SOCKET,
KAUTH_REQ_NETWORK_SOCKET_SETPRIV,
diff -r 25ab52ccbee5 -r 0d3cd08c154e sys/netinet6/in6.h
--- a/sys/netinet6/in6.h Sat Dec 12 22:22:51 2015 +0000
+++ b/sys/netinet6/in6.h Sat Dec 12 23:34:25 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in6.h,v 1.85 2015/08/07 08:11:33 ozaki-r Exp $ */
+/* $NetBSD: in6.h,v 1.86 2015/12/12 23:34:25 christos Exp $ */
/* $KAME: in6.h,v 1.83 2001/03/29 02:55:07 jinmei Exp $ */
/*
@@ -576,7 +576,8 @@
#define IPV6CTL_LOWPORTMAX 31 /* maximum reserved port */
/* 32 to 34: reserved */
#define IPV6CTL_AUTO_LINKLOCAL 35 /* automatic link-local addr assign */
-/* 36 to 38: reserved */
+/* 36 to 37: reserved */
+#define IPV6CTL_ADDRCTLPOLICY 38 /* get/set address selection policy */
#define IPV6CTL_USE_DEFAULTZONE 39 /* use default scope zone */
/* 40: reserved */
#define IPV6CTL_MAXFRAGS 41 /* max fragments */
@@ -708,9 +709,6 @@
extern void in6_if_link_state_change(struct ifnet *, int);
extern void in6_if_up(struct ifnet *);
extern void in6_if_down(struct ifnet *);
-#ifndef __FreeBSD__
-extern int in6_src_sysctl(void *, size_t *, void *, size_t);
-#endif
extern void addrsel_policy_init(void);
extern u_char ip6_protox[];
diff -r 25ab52ccbee5 -r 0d3cd08c154e sys/netinet6/in6_src.c
--- a/sys/netinet6/in6_src.c Sat Dec 12 22:22:51 2015 +0000
+++ b/sys/netinet6/in6_src.c Sat Dec 12 23:34:25 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in6_src.c,v 1.58 2015/08/24 22:21:27 pooka Exp $ */
+/* $NetBSD: in6_src.c,v 1.59 2015/12/12 23:34:25 christos Exp $ */
/* $KAME: in6_src.c,v 1.159 2005/10/19 01:40:32 t-momose Exp $ */
/*
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.58 2015/08/24 22:21:27 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.59 2015/12/12 23:34:25 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -885,8 +885,9 @@
void *w_limit;
};
+int sysctl_net_inet6_addrctlpolicy(SYSCTLFN_ARGS);
int
-in6_src_sysctl(void *oldp, size_t *oldlenp, void *newp, size_t newlen)
+sysctl_net_inet6_addrctlpolicy(SYSCTLFN_ARGS)
{
int error = 0;
int s;
diff -r 25ab52ccbee5 -r 0d3cd08c154e sys/netinet6/ip6_input.c
--- a/sys/netinet6/ip6_input.c Sat Dec 12 22:22:51 2015 +0000
+++ b/sys/netinet6/ip6_input.c Sat Dec 12 23:34:25 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip6_input.c,v 1.152 2015/08/24 22:21:27 pooka Exp $ */
+/* $NetBSD: ip6_input.c,v 1.153 2015/12/12 23:34:25 christos Exp $ */
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.152 2015/08/24 22:21:27 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.153 2015/12/12 23:34:25 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_gateway.h"
@@ -1611,6 +1611,8 @@
ENOPROTOOPT
};
+extern int sysctl_net_inet6_addrctlpolicy(SYSCTLFN_ARGS);
+
static int
sysctl_net_inet6_ip6_stats(SYSCTLFN_ARGS)
{
@@ -1819,15 +1821,6 @@
IPV6CTL_V6ONLY, CTL_EOL);
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
- CTLTYPE_INT, "auto_linklocal",
- SYSCTL_DESCR("Default value of per-interface flag for "
- "adding an IPv6 link-local address to "
- "interfaces when attached"),
- NULL, 0, &ip6_auto_linklocal, 0,
- CTL_NET, PF_INET6, IPPROTO_IPV6,
- IPV6CTL_AUTO_LINKLOCAL, CTL_EOL);
- sysctl_createv(clog, 0, NULL, NULL,
- CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_INT, "anonportmin",
SYSCTL_DESCR("Lowest ephemeral port number to assign"),
sysctl_net_inet_ip_ports, 0, &ip6_anonportmin, 0,
@@ -1860,6 +1853,23 @@
#endif /* IPNOPRIVPORTS */
sysctl_createv(clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+ CTLTYPE_INT, "auto_linklocal",
+ SYSCTL_DESCR("Default value of per-interface flag for "
+ "adding an IPv6 link-local address to "
+ "interfaces when attached"),
+ NULL, 0, &ip6_auto_linklocal, 0,
+ CTL_NET, PF_INET6, IPPROTO_IPV6,
+ IPV6CTL_AUTO_LINKLOCAL, CTL_EOL);
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT|CTLFLAG_READONLY,
+ CTLTYPE_STRUCT, "addctlpolicy",
+ SYSCTL_DESCR("Return the current address control"
+ " policy"),
+ sysctl_net_inet6_addrctlpolicy, 0, NULL, 0,
+ CTL_NET, PF_INET6, IPPROTO_IPV6,
+ IPV6CTL_ADDRCTLPOLICY, CTL_EOL);
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_INT, "use_tempaddr",
SYSCTL_DESCR("Use temporary address"),
NULL, 0, &ip6_use_tempaddr, 0,
Home |
Main Index |
Thread Index |
Old Index