Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Apr 2014 10:06:11 -0600
From:      Ian Lepore <ian@FreeBSD.org>
To:        "Alexander V. Chernikov" <melifaro@FreeBSD.org>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
Subject:   Re: svn commit: r264973 - in head/sys: net netinet6
Message-ID:  <1398528371.61646.147.camel@revolution.hippie.lan>
In-Reply-To: <201404261452.s3QEq48b086947@svn.freebsd.org>
References:  <201404261452.s3QEq48b086947@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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)) {
> 





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1398528371.61646.147.camel>