svn commit: r274468 - stable/10/sys/netipsec

Andrey V. Elsukov ae at FreeBSD.org
Thu Nov 13 13:05:32 UTC 2014


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:


More information about the svn-src-stable-10 mailing list