Date: Thu, 17 Jan 2013 03:18:53 +0000 (UTC) From: "Andrey V. Elsukov" <ae@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r245531 - user/ae/inet6/sys/netinet6 Message-ID: <201301170318.r0H3IrA4072135@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ae Date: Thu Jan 17 03:18:53 2013 New Revision: 245531 URL: http://svnweb.freebsd.org/changeset/base/245531 Log: Add in6_getlinkzone() function. It returns zone id for the link-local scope (currently it is equal to the interface's if_index). Also, use M_ZERO flag in malloc(). Modified: user/ae/inet6/sys/netinet6/scope6.c user/ae/inet6/sys/netinet6/scope6_var.h Modified: user/ae/inet6/sys/netinet6/scope6.c ============================================================================== --- user/ae/inet6/sys/netinet6/scope6.c Thu Jan 17 02:42:08 2013 (r245530) +++ user/ae/inet6/sys/netinet6/scope6.c Thu Jan 17 03:18:53 2013 (r245531) @@ -95,8 +95,8 @@ scope6_ifattach(struct ifnet *ifp) { struct scope6_id *sid; - sid = (struct scope6_id *)malloc(sizeof(*sid), M_IFADDR, M_WAITOK); - bzero(sid, sizeof(*sid)); + sid = (struct scope6_id *)malloc(sizeof(*sid), M_IFADDR, + M_WAITOK | M_ZERO); /* * XXX: IPV6_ADDR_SCOPE_xxx macros are not standard. @@ -104,13 +104,8 @@ scope6_ifattach(struct ifnet *ifp) */ sid->s6id_list[IPV6_ADDR_SCOPE_INTFACELOCAL] = ifp->if_index; sid->s6id_list[IPV6_ADDR_SCOPE_LINKLOCAL] = ifp->if_index; -#ifdef MULTI_SCOPE - /* by default, we don't care about scope boundary for these scopes. */ - sid->s6id_list[IPV6_ADDR_SCOPE_SITELOCAL] = 1; - sid->s6id_list[IPV6_ADDR_SCOPE_ORGLOCAL] = 1; -#endif - return sid; + return (sid); } void @@ -477,3 +472,14 @@ in6_getscope(struct in6_addr *in6) return (0); } + +/* + * Return zone id for the link-local scope. + */ +uint32_t +in6_getlinkzone(const struct ifnet *ifp) +{ + + return (ifp->if_index); +} + Modified: user/ae/inet6/sys/netinet6/scope6_var.h ============================================================================== --- user/ae/inet6/sys/netinet6/scope6_var.h Thu Jan 17 02:42:08 2013 (r245530) +++ user/ae/inet6/sys/netinet6/scope6_var.h Thu Jan 17 03:18:53 2013 (r245531) @@ -60,6 +60,7 @@ int sa6_recoverscope(struct sockaddr_in6 int in6_setscope(struct in6_addr *, struct ifnet *, u_int32_t *); int in6_clearscope(struct in6_addr *); uint16_t in6_getscope(struct in6_addr *); +uint32_t in6_getlinkzone(const struct ifnet *); #endif /* _KERNEL */ #endif /* _NETINET6_SCOPE6_VAR_H_ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301170318.r0H3IrA4072135>