svn commit: r273904 - head/sys/netipsec

Andrey V. Elsukov ae at FreeBSD.org
Fri Oct 31 12:19:23 UTC 2014


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:


More information about the svn-src-head mailing list