summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/netinet6/scope6.c
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/sys/netinet6/scope6.c')
-rw-r--r--freebsd/sys/netinet6/scope6.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/freebsd/sys/netinet6/scope6.c b/freebsd/sys/netinet6/scope6.c
index f891c9ce..2ccd2f7a 100644
--- a/freebsd/sys/netinet6/scope6.c
+++ b/freebsd/sys/netinet6/scope6.c
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
+#include <sys/sockio.h>
#include <sys/systm.h>
#include <sys/queue.h>
#include <sys/syslog.h>
@@ -74,6 +75,9 @@ static VNET_DEFINE(struct scope6_id, sid_default);
#define SID(ifp) \
(((struct in6_ifextra *)(ifp)->if_afdata[AF_INET6])->scope6_id)
+static int scope6_get(struct ifnet *, struct scope6_id *);
+static int scope6_set(struct ifnet *, struct scope6_id *);
+
void
scope6_init(void)
{
@@ -117,6 +121,30 @@ scope6_ifdetach(struct scope6_id *sid)
}
int
+scope6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp)
+{
+ struct in6_ifreq *ifr;
+
+ if (ifp->if_afdata[AF_INET6] == NULL)
+ return (EPFNOSUPPORT);
+
+ ifr = (struct in6_ifreq *)data;
+ switch (cmd) {
+ case SIOCSSCOPE6:
+ return (scope6_set(ifp,
+ (struct scope6_id *)ifr->ifr_ifru.ifru_scope_id));
+ case SIOCGSCOPE6:
+ return (scope6_get(ifp,
+ (struct scope6_id *)ifr->ifr_ifru.ifru_scope_id));
+ case SIOCGSCOPE6DEF:
+ return (scope6_get_default(
+ (struct scope6_id *)ifr->ifr_ifru.ifru_scope_id));
+ default:
+ return (EOPNOTSUPP);
+ }
+}
+
+static int
scope6_set(struct ifnet *ifp, struct scope6_id *idlist)
{
int i;
@@ -179,7 +207,7 @@ scope6_set(struct ifnet *ifp, struct scope6_id *idlist)
return (error);
}
-int
+static int
scope6_get(struct ifnet *ifp, struct scope6_id *idlist)
{
struct scope6_id *sid;
@@ -198,7 +226,6 @@ scope6_get(struct ifnet *ifp, struct scope6_id *idlist)
return (0);
}
-
/*
* Get a scope of the address. Node-local, link-local, site-local or global.
*/