summaryrefslogtreecommitdiffstats
path: root/sys/netipsec
diff options
context:
space:
mode:
authorae <ae@FreeBSD.org>2014-10-31 12:19:22 +0000
committerae <ae@FreeBSD.org>2014-10-31 12:19:22 +0000
commit2495e4b948471df01338932bff6123b06aee4063 (patch)
treeaaea5c4d5cf5ba91ac3b70f1b62b2ed39ba4a437 /sys/netipsec
parent79db23a4c91f058dda33cca53c3f5df31064df2a (diff)
downloadFreeBSD-src-2495e4b948471df01338932bff6123b06aee4063.zip
FreeBSD-src-2495e4b948471df01338932bff6123b06aee4063.tar.gz
Use in_localip() instead of handmade implementation.
MFC after: 1 week Sponsored by: Yandex LLC
Diffstat (limited to 'sys/netipsec')
-rw-r--r--sys/netipsec/key.c23
1 files changed, 2 insertions, 21 deletions
diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c
index 47802a8..8b189d4 100644
--- a/sys/netipsec/key.c
+++ b/sys/netipsec/key.c
@@ -3906,33 +3906,14 @@ key_dup_lifemsg(const struct sadb_lifetime *src,
* 0: false
*/
int
-key_ismyaddr(sa)
- struct sockaddr *sa;
+key_ismyaddr(struct sockaddr *sa)
{
-#ifdef INET
- struct sockaddr_in *sin;
- struct in_ifaddr *ia;
-#endif
IPSEC_ASSERT(sa != NULL, ("null sockaddr"));
-
switch (sa->sa_family) {
#ifdef INET
case AF_INET:
- sin = (struct sockaddr_in *)sa;
- IN_IFADDR_RLOCK();
- TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link)
- {
- if (sin->sin_family == ia->ia_addr.sin_family &&
- sin->sin_len == ia->ia_addr.sin_len &&
- sin->sin_addr.s_addr == ia->ia_addr.sin_addr.s_addr)
- {
- IN_IFADDR_RUNLOCK();
- return 1;
- }
- }
- IN_IFADDR_RUNLOCK();
- break;
+ return (in_localip(satosin(sa)->sin_addr));
#endif
#ifdef INET6
case AF_INET6:
OpenPOWER on IntegriCloud