Add an in6_localip() helper function as in6_localaddr() is not doing what
people think: returning true for an address in any connected subnet, not necessarily on the local machine. Sponsored by: Sandvine Incorporated MFC after: 2 weeks Approved by: re (kib)
This commit is contained in:
parent
d840e1d248
commit
90bc35de38
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=225043
@ -2017,6 +2017,27 @@ in6_localaddr(struct in6_addr *in6)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return 1 if an internet address is for the local host and configured
|
||||||
|
* on one of its interfaces.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
in6_localip(struct in6_addr *in6)
|
||||||
|
{
|
||||||
|
struct in6_ifaddr *ia;
|
||||||
|
|
||||||
|
IN6_IFADDR_RLOCK();
|
||||||
|
TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) {
|
||||||
|
if (IN6_ARE_ADDR_EQUAL(in6, &ia->ia_addr.sin6_addr)) {
|
||||||
|
IN6_IFADDR_RUNLOCK();
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IN6_IFADDR_RUNLOCK();
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
in6_is_addr_deprecated(struct sockaddr_in6 *sa6)
|
in6_is_addr_deprecated(struct sockaddr_in6 *sa6)
|
||||||
{
|
{
|
||||||
|
@ -631,6 +631,7 @@ struct cmsghdr;
|
|||||||
|
|
||||||
int in6_cksum __P((struct mbuf *, u_int8_t, u_int32_t, u_int32_t));
|
int in6_cksum __P((struct mbuf *, u_int8_t, u_int32_t, u_int32_t));
|
||||||
int in6_localaddr __P((struct in6_addr *));
|
int in6_localaddr __P((struct in6_addr *));
|
||||||
|
int in6_localip(struct in6_addr *);
|
||||||
int in6_addrscope __P((struct in6_addr *));
|
int in6_addrscope __P((struct in6_addr *));
|
||||||
struct in6_ifaddr *in6_ifawithifp __P((struct ifnet *, struct in6_addr *));
|
struct in6_ifaddr *in6_ifawithifp __P((struct ifnet *, struct in6_addr *));
|
||||||
extern void in6_if_up __P((struct ifnet *));
|
extern void in6_if_up __P((struct ifnet *));
|
||||||
|
Loading…
Reference in New Issue
Block a user