diff options
author | melifaro <melifaro@FreeBSD.org> | 2014-08-23 14:58:31 +0000 |
---|---|---|
committer | melifaro <melifaro@FreeBSD.org> | 2014-08-23 14:58:31 +0000 |
commit | cf94663e69b2c927e4a44dcb922c93483f11bc29 (patch) | |
tree | f43a461c97f3db054606f6367939a61652f0db97 /sys/netinet6/scope6.c | |
parent | 2e65f120c886a9d09b274b1953783df2b995e799 (diff) | |
parent | 19be009a4f8eb0d239ec3e465b0a9b2a2947dcf8 (diff) | |
download | FreeBSD-src-cf94663e69b2c927e4a44dcb922c93483f11bc29.zip FreeBSD-src-cf94663e69b2c927e4a44dcb922c93483f11bc29.tar.gz |
Sync to HEAD@r270409.
Diffstat (limited to 'sys/netinet6/scope6.c')
-rw-r--r-- | sys/netinet6/scope6.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/sys/netinet6/scope6.c b/sys/netinet6/scope6.c index 3284a7d..d0c6655 100644 --- a/sys/netinet6/scope6.c +++ b/sys/netinet6/scope6.c @@ -36,6 +36,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/sysctl.h> @@ -79,6 +80,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) { @@ -122,6 +126,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; @@ -184,7 +212,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; @@ -203,7 +231,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. */ |