From owner-svn-src-all@FreeBSD.ORG Sat Apr 26 16:06:22 2014 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D7D35F4A; Sat, 26 Apr 2014 16:06:22 +0000 (UTC) Received: from mho-01-ewr.mailhop.org (mho-03-ewr.mailhop.org [204.13.248.66]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 24CA21933; Sat, 26 Apr 2014 16:06:21 +0000 (UTC) Received: from c-24-8-230-52.hsd1.co.comcast.net ([24.8.230.52] helo=damnhippie.dyndns.org) by mho-01-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1We57G-000Eux-CY; Sat, 26 Apr 2014 16:06:14 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id s3QG6Be5012878; Sat, 26 Apr 2014 10:06:12 -0600 (MDT) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 24.8.230.52 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1/8gQ2RWzw81pnr+ldfga0h Subject: Re: svn commit: r264973 - in head/sys: net netinet6 From: Ian Lepore To: "Alexander V. Chernikov" In-Reply-To: <201404261452.s3QEq48b086947@svn.freebsd.org> References: <201404261452.s3QEq48b086947@svn.freebsd.org> Content-Type: text/plain; charset="us-ascii" Date: Sat, 26 Apr 2014 10:06:11 -0600 Message-ID: <1398528371.61646.147.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Apr 2014 16:06:22 -0000 On Sat, 2014-04-26 at 14:52 +0000, Alexander V. Chernikov wrote: > 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 > FYI, there's another #define sa_equal (and sa_dl_equal) in usr.sbin/ifmcstat/ifmcstat.c, which is now getting a redefined error. -- Ian > 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)) { >