Date: Fri, 31 Oct 2014 12:19:23 +0000 (UTC) From: "Andrey V. Elsukov" <ae@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273904 - head/sys/netipsec Message-ID: <201410311219.s9VCJNAl089507@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ae Date: Fri Oct 31 12:19:22 2014 New Revision: 273904 URL: https://svnweb.freebsd.org/changeset/base/273904 Log: Use in_localip() instead of handmade implementation. MFC after: 1 week Sponsored by: Yandex LLC Modified: head/sys/netipsec/key.c Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Fri Oct 31 11:40:49 2014 (r273903) +++ head/sys/netipsec/key.c Fri Oct 31 12:19:22 2014 (r273904) @@ -3906,33 +3906,14 @@ key_dup_lifemsg(const struct sadb_lifeti * 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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410311219.s9VCJNAl089507>