From owner-svn-src-head@FreeBSD.ORG Sat Apr 26 14:52:05 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 26471F12; Sat, 26 Apr 2014 14:52:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 125231396; Sat, 26 Apr 2014 14:52:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s3QEq4Ne086952; Sat, 26 Apr 2014 14:52:04 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s3QEq48b086947; Sat, 26 Apr 2014 14:52:04 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201404261452.s3QEq48b086947@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Sat, 26 Apr 2014 14:52:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r264973 - in head/sys: net netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Apr 2014 14:52:05 -0000 Author: melifaro Date: Sat Apr 26 14:52:03 2014 New Revision: 264973 URL: http://svnweb.freebsd.org/changeset/base/264973 Log: Unify sa_equal() macro usage. MFC after: 2 weeks Modified: head/sys/net/if.c head/sys/net/route.c head/sys/net/route.h head/sys/net/rtsock.c head/sys/netinet6/ip6_input.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Sat Apr 26 14:39:58 2014 (r264972) +++ head/sys/net/if.c Sat Apr 26 14:52:03 2014 (r264973) @@ -1550,9 +1550,6 @@ ifa_switch_loopback_route(struct ifaddr * to perform a different comparison. */ -#define sa_equal(a1, a2) \ - (bcmp((a1), (a2), ((a1))->sa_len) == 0) - #define sa_dl_equal(a1, a2) \ ((((struct sockaddr_dl *)(a1))->sdl_len == \ ((struct sockaddr_dl *)(a2))->sdl_len) && \ Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Sat Apr 26 14:39:58 2014 (r264972) +++ head/sys/net/route.c Sat Apr 26 14:52:03 2014 (r264973) @@ -125,10 +125,6 @@ VNET_DEFINE(int, rttrash); /* routes no #define V_rttrash VNET(rttrash) -/* compare two sockaddr structures */ -#define sa_equal(a1, a2) (((a1)->sa_len == (a2)->sa_len) && \ - (bcmp((a1), (a2), (a1)->sa_len) == 0)) - /* * Convert a 'struct radix_node *' to a 'struct rtentry *'. * The operation can be done safely (in this code) because a Modified: head/sys/net/route.h ============================================================================== --- head/sys/net/route.h Sat Apr 26 14:39:58 2014 (r264972) +++ head/sys/net/route.h Sat Apr 26 14:52:03 2014 (r264973) @@ -275,6 +275,10 @@ struct rt_addrinfo { sizeof(long) : \ 1 + ( (((struct sockaddr *)(sa))->sa_len - 1) | (sizeof(long) - 1) ) ) +#define sa_equal(a, b) ( \ + (((struct sockaddr *)(a))->sa_len == ((struct sockaddr *)(b))->sa_len) && \ + (bcmp((a), (b), ((struct sockaddr *)(b))->sa_len) == 0)) + #ifdef _KERNEL #define RT_LINK_IS_UP(ifp) (!((ifp)->if_capabilities & IFCAP_LINKSTATE) \ Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Sat Apr 26 14:39:58 2014 (r264972) +++ head/sys/net/rtsock.c Sat Apr 26 14:52:03 2014 (r264973) @@ -517,7 +517,6 @@ rtm_get_jailed(struct rt_addrinfo *info, static int route_output(struct mbuf *m, struct socket *so) { -#define sa_equal(a1, a2) (bcmp((a1), (a2), (a1)->sa_len) == 0) struct rt_msghdr *rtm = NULL; struct rtentry *rt = NULL; struct radix_node_head *rnh; @@ -960,7 +959,6 @@ flush: Free(rtm); } return (error); -#undef sa_equal } static void Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Sat Apr 26 14:39:58 2014 (r264972) +++ head/sys/netinet6/ip6_input.c Sat Apr 26 14:52:03 2014 (r264973) @@ -695,8 +695,6 @@ passin: int bad; bad = 1; -#define sa_equal(a1, a2) \ - (bcmp((a1), (a2), ((a1))->sin6_len) == 0) IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != dst6.sin6_family) @@ -706,7 +704,6 @@ passin: } KASSERT(ifa != NULL, ("%s: ifa not found for lle %p", __func__, lle)); -#undef sa_equal ia6 = (struct in6_ifaddr *)ifa; if (!(ia6->ia6_flags & IN6_IFF_NOTREADY)) {