Date: Thu, 13 Nov 2014 13:05:32 +0000 (UTC) From: "Andrey V. Elsukov" <ae@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r274468 - stable/10/sys/netipsec Message-ID: <201411131305.sADD5WZu049867@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ae Date: Thu Nov 13 13:05:31 2014 New Revision: 274468 URL: https://svnweb.freebsd.org/changeset/base/274468 Log: MFC r273904: Use in_localip() instead of handmade implementation. Sponsored by: Yandex LLC Modified: stable/10/sys/netipsec/key.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netipsec/key.c ============================================================================== --- stable/10/sys/netipsec/key.c Thu Nov 13 12:58:33 2014 (r274467) +++ stable/10/sys/netipsec/key.c Thu Nov 13 13:05:31 2014 (r274468) @@ -3901,33 +3901,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?201411131305.sADD5WZu049867>