Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 Jul 2012 11:31:12 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r238945 - in head/sys: net netinet netinet6
Message-ID:  <201207311131.q6VBVCRW022455@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Tue Jul 31 11:31:12 2012
New Revision: 238945
URL: http://svn.freebsd.org/changeset/base/238945

Log:
  Some style(9) and whitespace changes.
  
  Together with:	Andrey Zonov <andrey zonov.org>

Modified:
  head/sys/net/if_llatbl.c
  head/sys/net/if_llatbl.h
  head/sys/netinet/if_ether.c
  head/sys/netinet/in.c
  head/sys/netinet6/in6.c

Modified: head/sys/net/if_llatbl.c
==============================================================================
--- head/sys/net/if_llatbl.c	Tue Jul 31 11:16:19 2012	(r238944)
+++ head/sys/net/if_llatbl.c	Tue Jul 31 11:31:12 2012	(r238945)
@@ -118,8 +118,8 @@ llentry_free(struct llentry *lle)
 		pkts_dropped++;
 	}
 
-	KASSERT(lle->la_numheld == 0, 
-		("%s: la_numheld %d > 0, pkts_droped %zd", __func__, 
+	KASSERT(lle->la_numheld == 0,
+		("%s: la_numheld %d > 0, pkts_droped %zd", __func__,
 		 lle->la_numheld, pkts_dropped));
 
 	lle->la_flags &= ~LLE_VALID;
@@ -144,7 +144,7 @@ llentry_update(struct llentry **llep, st
 	la = lla_lookup(lt, LLE_EXCLUSIVE,
 	    (struct sockaddr *)dst);
 	IF_AFDATA_RUNLOCK(ifp);
-	if ((la == NULL) && 
+	if ((la == NULL) &&
 	    (ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) == 0) {
 		IF_AFDATA_WLOCK(ifp);
 		la = lla_lookup(lt,
@@ -182,7 +182,7 @@ lltable_free(struct lltable *llt)
 	SLIST_REMOVE(&V_lltables, llt, lltable, llt_link);
 	LLTABLE_WUNLOCK();
 
-	for (i=0; i < LLTBL_HASHTBL_SIZE; i++) {
+	for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) {
 		LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) {
 			int canceled;
 
@@ -227,7 +227,7 @@ lltable_drain(int af)
 
 void
 lltable_prefix_free(int af, struct sockaddr *prefix, struct sockaddr *mask,
-	    u_int flags)
+    u_int flags)
 {
 	struct lltable *llt;
 
@@ -297,7 +297,7 @@ lla_rt_output(struct rt_msghdr *rtm, str
 		if (rtm->rtm_flags & RTF_ANNOUNCE) {
 			flags |= LLE_PUB;
 #ifdef INET
-			if (dst->sa_family == AF_INET && 
+			if (dst->sa_family == AF_INET &&
 			    ((struct sockaddr_inarp *)dst)->sin_other != 0) {
 				struct rtentry *rt;
 				((struct sockaddr_inarp *)dst)->sin_other = 0;
@@ -378,7 +378,7 @@ lla_rt_output(struct rt_msghdr *rtm, str
 #ifdef INET
 			/*  gratuitous ARP */
 			if ((laflags & LLE_PUB) && dst->sa_family == AF_INET) {
-				arprequest(ifp, 
+				arprequest(ifp,
 				    &((struct sockaddr_in *)dst)->sin_addr,
 				    &((struct sockaddr_in *)dst)->sin_addr,
 				    ((laflags & LLE_PROXY) ?

Modified: head/sys/net/if_llatbl.h
==============================================================================
--- head/sys/net/if_llatbl.h	Tue Jul 31 11:16:19 2012	(r238944)
+++ head/sys/net/if_llatbl.h	Tue Jul 31 11:31:12 2012	(r238945)
@@ -61,17 +61,17 @@ struct llentry {
 	struct llentries	 *lle_head;
 	void			(*lle_free)(struct lltable *, struct llentry *);
 	struct mbuf		 *la_hold;
-	int     		 la_numheld;  /* # of packets currently held */
+	int			 la_numheld;  /* # of packets currently held */
 	time_t			 la_expire;
-	uint16_t		 la_flags;    
+	uint16_t		 la_flags;
 	uint16_t		 la_asked;
 	uint16_t		 la_preempt;
 	uint16_t		 ln_byhint;
 	int16_t			 ln_state;	/* IPv6 has ND6_LLINFO_NOSTATE == -2 */
-	uint16_t		 ln_router; 
+	uint16_t		 ln_router;
 	time_t			 ln_ntick;
 	int			 lle_refcnt;
-				 
+
 	union {
 		uint64_t	mac_aligned;
 		uint16_t	mac16[3];
@@ -106,6 +106,7 @@ struct llentry {
 		("negative refcnt %d", (lle)->lle_refcnt));	\
 	(lle)->lle_refcnt++;					\
 } while (0)
+
 #define	LLE_REMREF(lle)	do {					\
 	LLE_WLOCK_ASSERT(lle);					\
 	KASSERT((lle)->lle_refcnt > 1,				\
@@ -158,7 +159,7 @@ struct lltable {
 	struct llentry *	(*llt_lookup)(struct lltable *, u_int flags,
 				    const struct sockaddr *l3addr);
 	int			(*llt_dump)(struct lltable *,
-				     struct sysctl_req *);
+				    struct sysctl_req *);
 };
 MALLOC_DECLARE(M_LLTABLE);
 
@@ -171,17 +172,17 @@ MALLOC_DECLARE(M_LLTABLE);
 #define	LLE_VALID	0x0008	/* ll_addr is valid */
 #define	LLE_PROXY	0x0010	/* proxy entry ??? */
 #define	LLE_PUB		0x0020	/* publish entry ??? */
+#define	LLE_EXCLUSIVE	0x2000	/* return lle xlocked  */
 #define	LLE_DELETE	0x4000	/* delete on a lookup - match LLE_IFADDR */
 #define	LLE_CREATE	0x8000	/* create on a lookup miss */
-#define	LLE_EXCLUSIVE	0x2000	/* return lle xlocked  */
 
 #define LLATBL_HASH(key, mask) \
 	(((((((key >> 8) ^ key) >> 8) ^ key) >> 8) ^ key) & mask)
 
 struct lltable *lltable_init(struct ifnet *, int);
 void		lltable_free(struct lltable *);
-void		lltable_prefix_free(int, struct sockaddr *, 
-                       struct sockaddr *, u_int);
+void		lltable_prefix_free(int, struct sockaddr *,
+		    struct sockaddr *, u_int);
 #if 0
 void		lltable_drain(int);
 #endif
@@ -189,7 +190,7 @@ int		lltable_sysctl_dumparp(int, struct 
 
 size_t		llentry_free(struct llentry *);
 int		llentry_update(struct llentry **, struct lltable *,
-                       struct sockaddr_storage *, struct ifnet *);
+		    struct sockaddr_storage *, struct ifnet *);
 
 /*
  * Generic link layer address lookup function.

Modified: head/sys/netinet/if_ether.c
==============================================================================
--- head/sys/netinet/if_ether.c	Tue Jul 31 11:16:19 2012	(r238944)
+++ head/sys/netinet/if_ether.c	Tue Jul 31 11:31:12 2012	(r238945)
@@ -87,8 +87,8 @@ static VNET_DEFINE(int, arp_maxtries) = 
 VNET_DEFINE(int, useloopback) = 1;	/* use loopback interface for
 					 * local traffic */
 static VNET_DEFINE(int, arp_proxyall) = 0;
-static VNET_DEFINE(int, arpt_down) = 20;      /* keep incomplete entries for
-					       * 20 seconds */
+static VNET_DEFINE(int, arpt_down) = 20;	/* keep incomplete entries for
+						 * 20 seconds */
 VNET_DEFINE(struct arpstat, arpstat);  /* ARP statistics, see if_arp.h */
 
 static VNET_DEFINE(int, arp_maxhold) = 1;
@@ -119,7 +119,7 @@ SYSCTL_VNET_STRUCT(_net_link_ether_arp, 
 	&VNET_NAME(arpstat), arpstat,
 	"ARP statistics (struct arpstat, net/if_arp.h)");
 SYSCTL_VNET_INT(_net_link_ether_inet, OID_AUTO, maxhold, CTLFLAG_RW,
-	&VNET_NAME(arp_maxhold), 0, 
+	&VNET_NAME(arp_maxhold), 0,
 	"Number of packets to hold per ARP entry");
 
 static void	arp_init(void);
@@ -197,7 +197,7 @@ arptimer(void *arg)
 		} else {
 #ifdef DIAGNOSTIC
 			struct sockaddr *l3addr = L3_ADDR(lle);
-			log(LOG_INFO, 
+			log(LOG_INFO,
 			    "arptimer issue: %p, IPv4 address: \"%s\"\n", lle,
 			    inet_ntoa(
 			        ((const struct sockaddr_in *)l3addr)->sin_addr));
@@ -250,7 +250,7 @@ arprequest(struct ifnet *ifp, struct in_
 				break;  /* found it. */
 		}
 		IF_ADDR_RUNLOCK(ifp);
-		if (sip == NULL) {  
+		if (sip == NULL) {
 			printf("%s: cannot find matching address\n", __func__);
 			return;
 		}
@@ -339,7 +339,7 @@ retry:
 			    inet_ntoa(SIN(dst)->sin_addr));
 		m_freem(m);
 		return (EINVAL);
-	} 
+	}
 
 	if ((la->la_flags & LLE_VALID) &&
 	    ((la->la_flags & LLE_STATIC) || la->la_expire > time_uptime)) {
@@ -358,8 +358,8 @@ retry:
 		*lle = la;
 		error = 0;
 		goto done;
-	} 
-			    
+	}
+
 	if (la->la_flags & LLE_STATIC) {   /* should not happen! */
 		log(LOG_DEBUG, "arpresolve: ouch, empty static llinfo for %s\n",
 		    inet_ntoa(SIN(dst)->sin_addr));
@@ -389,13 +389,13 @@ retry:
 				la->la_numheld--;
 				ARPSTAT_INC(dropped);
 			}
-		} 
+		}
 		if (la->la_hold != NULL) {
 			curr = la->la_hold;
 			while (curr->m_nextpkt != NULL)
 				curr = curr->m_nextpkt;
 			curr->m_nextpkt = m;
-		} else 
+		} else
 			la->la_hold = m;
 		la->la_numheld++;
 		if (renew == 0 && (flags & LLE_EXCLUSIVE)) {
@@ -510,11 +510,11 @@ SYSCTL_INT(_net_link_ether_inet, OID_AUT
 	&log_arp_wrong_iface, 0,
 	"log arp packets arriving on the wrong interface");
 SYSCTL_INT(_net_link_ether_inet, OID_AUTO, log_arp_movements, CTLFLAG_RW,
-        &log_arp_movements, 0,
-        "log arp replies from MACs different than the one in the cache");
+	&log_arp_movements, 0,
+	"log arp replies from MACs different than the one in the cache");
 SYSCTL_INT(_net_link_ether_inet, OID_AUTO, log_arp_permanent_modify, CTLFLAG_RW,
-        &log_arp_permanent_modify, 0,
-        "log arp replies from MACs different than the one in the permanent arp entry");
+	&log_arp_permanent_modify, 0,
+	"log arp replies from MACs different than the one in the permanent arp entry");
 
 
 static void
@@ -550,7 +550,7 @@ in_arpinput(struct mbuf *m)
 	}
 
 	ah = mtod(m, struct arphdr *);
-	/* 
+	/*
 	 * ARP is only for IPv4 so we can reject packets with
 	 * a protocol length not equal to an IPv4 address.
 	 */
@@ -686,7 +686,7 @@ match:
 	sin.sin_addr = isaddr;
 	flags = (itaddr.s_addr == myaddr.s_addr) ? LLE_CREATE : 0;
 	flags |= LLE_EXCLUSIVE;
-	IF_AFDATA_LOCK(ifp); 
+	IF_AFDATA_LOCK(ifp);
 	la = lla_lookup(LLTABLE(ifp), flags, (struct sockaddr *)&sin);
 	IF_AFDATA_UNLOCK(ifp);
 	if (la != NULL) {
@@ -716,7 +716,7 @@ match:
 				goto reply;
 			}
 			if (log_arp_movements) {
-			        log(LOG_INFO, "arp: %s moved from %*D "
+				log(LOG_INFO, "arp: %s moved from %*D "
 				    "to %*D on %s\n",
 				    inet_ntoa(isaddr),
 				    ifp->if_addrlen,
@@ -725,7 +725,7 @@ match:
 				    ifp->if_xname);
 			}
 		}
-		    
+
 		if (ifp->if_addrlen != ah->ar_hln) {
 			LLE_WUNLOCK(la);
 			log(LOG_WARNING, "arp from %*D: addr len: new %d, "
@@ -751,7 +751,7 @@ match:
 		}
 		la->la_asked = 0;
 		la->la_preempt = V_arp_maxtries;
-		/* 
+		/*
 		 * The packets are all freed within the call to the output
 		 * routine.
 		 *
@@ -787,7 +787,7 @@ reply:
 		struct llentry *lle = NULL;
 
 		sin.sin_addr = itaddr;
-		IF_AFDATA_LOCK(ifp); 
+		IF_AFDATA_LOCK(ifp);
 		lle = lla_lookup(LLTABLE(ifp), 0, (struct sockaddr *)&sin);
 		IF_AFDATA_UNLOCK(ifp);
 
@@ -846,8 +846,7 @@ reply:
 			RTFREE_LOCKED(rt);
 
 #ifdef DEBUG_PROXY
-			printf("arp: proxying for %s\n",
-			       inet_ntoa(itaddr));
+			printf("arp: proxying for %s\n", inet_ntoa(itaddr));
 #endif
 		}
 	}
@@ -869,8 +868,8 @@ reply:
 	(void)memcpy(ar_spa(ah), &itaddr, ah->ar_pln);
 	ah->ar_op = htons(ARPOP_REPLY);
 	ah->ar_pro = htons(ETHERTYPE_IP); /* let's be sure! */
-	m->m_len = sizeof(*ah) + (2 * ah->ar_pln) + (2 * ah->ar_hln);   
-	m->m_pkthdr.len = m->m_len;   
+	m->m_len = sizeof(*ah) + (2 * ah->ar_pln) + (2 * ah->ar_hln);
+	m->m_pkthdr.len = m->m_len;
 	m->m_pkthdr.rcvif = NULL;
 	sa.sa_family = AF_ARP;
 	sa.sa_len = 2;
@@ -894,7 +893,7 @@ arp_ifinit(struct ifnet *ifp, struct ifa
 	if (ntohl(IA_SIN(ifa)->sin_addr.s_addr) != INADDR_ANY) {
 		arprequest(ifp, &IA_SIN(ifa)->sin_addr,
 				&IA_SIN(ifa)->sin_addr, IF_LLADDR(ifp));
-		/* 
+		/*
 		 * interface address is considered static entry
 		 * because the output of the arp utility shows
 		 * that L2 entry as permanent

Modified: head/sys/netinet/in.c
==============================================================================
--- head/sys/netinet/in.c	Tue Jul 31 11:16:19 2012	(r238944)
+++ head/sys/netinet/in.c	Tue Jul 31 11:31:12 2012	(r238945)
@@ -489,20 +489,20 @@ in_control(struct socket *so, u_long cmd
 			    ia->ia_addr.sin_addr.s_addr)
 			hostIsNew = 0;
 		if (ifra->ifra_mask.sin_len) {
-			/* 
+			/*
 			 * QL: XXX
 			 * Need to scrub the prefix here in case
 			 * the issued command is SIOCAIFADDR with
 			 * the same address, but with a different
 			 * prefix length. And if the prefix length
-			 * is the same as before, then the call is 
+			 * is the same as before, then the call is
 			 * un-necessarily executed here.
 			 */
 			in_ifscrub(ifp, ia, LLE_STATIC);
 			ia->ia_sockmask = ifra->ifra_mask;
 			ia->ia_sockmask.sin_family = AF_INET;
 			ia->ia_subnetmask =
-			     ntohl(ia->ia_sockmask.sin_addr.s_addr);
+			    ntohl(ia->ia_sockmask.sin_addr.s_addr);
 			maskIsNew = 1;
 		}
 		if ((ifp->if_flags & IFF_POINTOPOINT) &&
@@ -886,8 +886,8 @@ in_ifinit(struct ifnet *ifp, struct in_i
 			RT_ADDREF(ia_ro.ro_rt);
 			RTFREE_LOCKED(ia_ro.ro_rt);
 		} else
-			error = ifa_add_loopback_route((struct ifaddr *)ia, 
-				       (struct sockaddr *)&ia->ia_addr);
+			error = ifa_add_loopback_route((struct ifaddr *)ia,
+			    (struct sockaddr *)&ia->ia_addr);
 		if (error == 0)
 			ia->ia_flags |= IFA_RTSELF;
 		if (ia_ro.ro_rt != NULL)
@@ -902,10 +902,10 @@ in_ifinit(struct ifnet *ifp, struct in_i
 	    ? RTF_HOST : 0)
 
 /*
- * Generate a routing message when inserting or deleting 
+ * Generate a routing message when inserting or deleting
  * an interface address alias.
  */
-static void in_addralias_rtmsg(int cmd, struct in_addr *prefix, 
+static void in_addralias_rtmsg(int cmd, struct in_addr *prefix,
     struct in_ifaddr *target)
 {
 	struct route pfx_ro;
@@ -928,16 +928,13 @@ static void in_addralias_rtmsg(int cmd, 
 
 		/* QL: XXX
 		 * Point the gateway to the new interface
-		 * address as if a new prefix route entry has 
-		 * been added through the new address alias. 
-		 * All other parts of the rtentry is accurate, 
+		 * address as if a new prefix route entry has
+		 * been added through the new address alias.
+		 * All other parts of the rtentry is accurate,
 		 * e.g., rt_key, rt_mask, rt_ifp etc.
 		 */
-		msg_rt.rt_gateway = 
-			(struct sockaddr *)&target->ia_addr;
-		rt_newaddrmsg(cmd, 
-			      (struct ifaddr *)target,
-			      0, &msg_rt);
+		msg_rt.rt_gateway = (struct sockaddr *)&target->ia_addr;
+		rt_newaddrmsg(cmd, (struct ifaddr *)target, 0, &msg_rt);
 		RTFREE(pfx_ro.ro_rt);
 	}
 	return;
@@ -985,7 +982,7 @@ in_addprefix(struct in_ifaddr *target, i
 		 */
 		if (ia->ia_flags & IFA_ROUTE) {
 #ifdef RADIX_MPATH
-			if (ia->ia_addr.sin_addr.s_addr == 
+			if (ia->ia_addr.sin_addr.s_addr ==
 			    target->ia_addr.sin_addr.s_addr) {
 				IN_IFADDR_RUNLOCK();
 				return (EEXIST);
@@ -1058,7 +1055,7 @@ in_scrubprefix(struct in_ifaddr *target,
 		}
 		if (freeit && (flags & LLE_STATIC)) {
 			error = ifa_del_loopback_route((struct ifaddr *)target,
-				       (struct sockaddr *)&target->ia_addr);
+			    (struct sockaddr *)&target->ia_addr);
 			if (error == 0)
 				target->ia_flags &= ~IFA_RTSELF;
 		}
@@ -1141,8 +1138,8 @@ in_scrubprefix(struct in_ifaddr *target,
 	mask0.sin_len = sizeof(mask0);
 	mask0.sin_family = AF_INET;
 	mask0.sin_addr.s_addr = target->ia_subnetmask;
-	lltable_prefix_free(AF_INET, (struct sockaddr *)&prefix0, 
-			    (struct sockaddr *)&mask0, flags);
+	lltable_prefix_free(AF_INET, (struct sockaddr *)&prefix0,
+	    (struct sockaddr *)&mask0, flags);
 
 	/*
 	 * As no-one seem to have this prefix, we can remove the route.
@@ -1184,14 +1181,14 @@ in_broadcast(struct in_addr in, struct i
 		      * Check for old-style (host 0) broadcast, but
 		      * taking into account that RFC 3021 obsoletes it.
 		      */
-		     (ia->ia_subnetmask != IN_RFC3021_MASK &&
-		     t == ia->ia_subnet)) &&
+		    (ia->ia_subnetmask != IN_RFC3021_MASK &&
+		    t == ia->ia_subnet)) &&
 		     /*
 		      * Check for an all one subnetmask. These
 		      * only exist when an interface gets a secondary
 		      * address.
 		      */
-		     ia->ia_subnetmask != (u_long)0xffffffff)
+		    ia->ia_subnetmask != (u_long)0xffffffff)
 			    return (1);
 	return (0);
 #undef ia
@@ -1300,27 +1297,24 @@ in_lltable_new(const struct sockaddr *l3
 	    (((ntohl((d)->sin_addr.s_addr) ^ (a)->sin_addr.s_addr) & (m)->sin_addr.s_addr)) == 0 )
 
 static void
-in_lltable_prefix_free(struct lltable *llt, 
-		       const struct sockaddr *prefix,
-		       const struct sockaddr *mask,
-		       u_int flags)
+in_lltable_prefix_free(struct lltable *llt, const struct sockaddr *prefix,
+    const struct sockaddr *mask, u_int flags)
 {
 	const struct sockaddr_in *pfx = (const struct sockaddr_in *)prefix;
 	const struct sockaddr_in *msk = (const struct sockaddr_in *)mask;
 	struct llentry *lle, *next;
-	register int i;
+	int i;
 	size_t pkts_dropped;
 
-	for (i=0; i < LLTBL_HASHTBL_SIZE; i++) {
+	for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) {
 		LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) {
-
-		        /* 
+			/*
 			 * (flags & LLE_STATIC) means deleting all entries
-			 * including static ARP entries
+			 * including static ARP entries.
 			 */
-			if (IN_ARE_MASKED_ADDR_EQUAL((struct sockaddr_in *)L3_ADDR(lle), 
-						     pfx, msk) &&
-			    ((flags & LLE_STATIC) || !(lle->la_flags & LLE_STATIC))) {
+			if (IN_ARE_MASKED_ADDR_EQUAL(satosin(L3_ADDR(lle)),
+			    pfx, msk) && ((flags & LLE_STATIC) ||
+			    !(lle->la_flags & LLE_STATIC))) {
 				int canceled;
 
 				canceled = callout_drain(&lle->la_timer);
@@ -1357,19 +1351,18 @@ in_lltable_rtcheck(struct ifnet *ifp, u_
 	 */
 	if (rt->rt_flags & RTF_GATEWAY) {
 		if (!(rt->rt_flags & RTF_HOST) || !rt->rt_ifp ||
-			rt->rt_ifp->if_type != IFT_ETHER ||
-			  (rt->rt_ifp->if_flags & 
-			   (IFF_NOARP | IFF_STATICARP)) != 0 ||
-			  memcmp(rt->rt_gateway->sa_data, l3addr->sa_data,
-				 sizeof(in_addr_t)) != 0) {
+		    rt->rt_ifp->if_type != IFT_ETHER ||
+		    (rt->rt_ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) != 0 ||
+		    memcmp(rt->rt_gateway->sa_data, l3addr->sa_data,
+		    sizeof(in_addr_t)) != 0) {
 			RTFREE_LOCKED(rt);
 			return (EINVAL);
 		}
 	}
 
 	/*
-	 * Make sure that at least the destination address is covered 
-	 * by the route. This is for handling the case where 2 or more 
+	 * Make sure that at least the destination address is covered
+	 * by the route. This is for handling the case where 2 or more
 	 * interfaces have the same prefix. An incoming packet arrives
 	 * on one interface and the corresponding outgoing packet leaves
 	 * another interface.
@@ -1429,7 +1422,7 @@ in_lltable_lookup(struct lltable *llt, u
 	hashkey = sin->sin_addr.s_addr;
 	lleh = &llt->lle_head[LLATBL_HASH(hashkey, LLTBL_HASHMASK)];
 	LIST_FOREACH(lle, lleh, lle_next) {
-		struct sockaddr_in *sa2 = (struct sockaddr_in *)L3_ADDR(lle);
+		struct sockaddr_in *sa2 = satosin(L3_ADDR(lle));
 		if (lle->la_flags & LLE_DELETED)
 			continue;
 		if (sa2->sin_addr.s_addr == sin->sin_addr.s_addr)

Modified: head/sys/netinet6/in6.c
==============================================================================
--- head/sys/netinet6/in6.c	Tue Jul 31 11:16:19 2012	(r238944)
+++ head/sys/netinet6/in6.c	Tue Jul 31 11:31:12 2012	(r238945)
@@ -257,10 +257,10 @@ in6_mask2len(struct in6_addr *mask, u_ch
 
 #ifdef COMPAT_FREEBSD32
 struct in6_ndifreq32 {
-        char ifname[IFNAMSIZ];
-        uint32_t ifindex;
+	char ifname[IFNAMSIZ];
+	uint32_t ifindex;
 };
-#define	SIOCGDEFIFACE32_IN6     _IOWR('i', 86, struct in6_ndifreq32)
+#define	SIOCGDEFIFACE32_IN6	_IOWR('i', 86, struct in6_ndifreq32)
 #endif
 
 int
@@ -485,7 +485,7 @@ in6_control(struct socket *so, u_long cm
 		}
 
 		if (td != NULL) {
-			error = priv_check(td, (cmd == SIOCDIFADDR_IN6) ? 
+			error = priv_check(td, (cmd == SIOCDIFADDR_IN6) ?
 			    PRIV_NET_DELIFADDR : PRIV_NET_ADDIFADDR);
 			if (error)
 				goto out;
@@ -1365,7 +1365,7 @@ in6_purgeaddr_mc(struct ifnet *ifp, stru
 		bzero(&sin6, sizeof(sin6));
 		sin6.sin6_len = sizeof(sin6);
 		sin6.sin6_family = AF_INET6;
-		memcpy(&sin6.sin6_addr, &satosin6(ifa0->ifa_addr)->sin6_addr, 
+		memcpy(&sin6.sin6_addr, &satosin6(ifa0->ifa_addr)->sin6_addr,
 		    sizeof(sin6.sin6_addr));
 		error = in6_setscope(&sin6.sin6_addr, ifa0->ifa_ifp, NULL);
 		if (error != 0)
@@ -1374,16 +1374,17 @@ in6_purgeaddr_mc(struct ifnet *ifp, stru
 
 	rt = in6_rtalloc1((struct sockaddr *)&mltaddr, 0, 0UL, RT_DEFAULT_FIB);
 	if (rt != NULL && rt->rt_gateway != NULL &&
-	    (memcmp(&satosin6(rt->rt_gateway)->sin6_addr, 
+	    (memcmp(&satosin6(rt->rt_gateway)->sin6_addr,
 		    &ia->ia_addr.sin6_addr,
 		    sizeof(ia->ia_addr.sin6_addr)) == 0)) {
-		/* 
+		/*
 		 * If no more IPv6 address exists on this interface then
 		 * remove the multicast address route.
 		 */
 		if (ifa0 == NULL) {
-			memcpy(&mltaddr.sin6_addr, &satosin6(rt_key(rt))->sin6_addr, 
-			       sizeof(mltaddr.sin6_addr));
+			memcpy(&mltaddr.sin6_addr,
+			    &satosin6(rt_key(rt))->sin6_addr,
+			    sizeof(mltaddr.sin6_addr));
 			RTFREE_LOCKED(rt);
 			error = in6_rtrequest(RTM_DELETE,
 			    (struct sockaddr *)&mltaddr,
@@ -1415,16 +1416,17 @@ in6_purgeaddr_mc(struct ifnet *ifp, stru
 
 	rt = in6_rtalloc1((struct sockaddr *)&mltaddr, 0, 0UL, RT_DEFAULT_FIB);
 	if (rt != NULL && rt->rt_gateway != NULL &&
-	    (memcmp(&satosin6(rt->rt_gateway)->sin6_addr, 
+	    (memcmp(&satosin6(rt->rt_gateway)->sin6_addr,
 		    &ia->ia_addr.sin6_addr,
 		    sizeof(ia->ia_addr.sin6_addr)) == 0)) {
-		/* 
+		/*
 		 * If no more IPv6 address exists on this interface then
 		 * remove the multicast address route.
 		 */
 		if (ifa0 == NULL) {
-			memcpy(&mltaddr.sin6_addr, &satosin6(rt_key(rt))->sin6_addr, 
-			       sizeof(mltaddr.sin6_addr));
+			memcpy(&mltaddr.sin6_addr,
+			    &satosin6(rt_key(rt))->sin6_addr,
+			    sizeof(mltaddr.sin6_addr));
 
 			RTFREE_LOCKED(rt);
 			error = in6_rtrequest(RTM_DELETE,
@@ -1471,8 +1473,7 @@ in6_purgeaddr(struct ifaddr *ifa)
 	TAILQ_FOREACH(ifa0, &ifp->if_addrhead, ifa_link) {
 		if ((ifa0->ifa_addr->sa_family != AF_INET6) ||
 		    memcmp(&satosin6(ifa0->ifa_addr)->sin6_addr,
-			   &ia->ia_addr.sin6_addr, 
-			   sizeof(struct in6_addr)) == 0)
+		    &ia->ia_addr.sin6_addr, sizeof(struct in6_addr)) == 0)
 			continue;
 		else
 			break;
@@ -1483,12 +1484,12 @@ in6_purgeaddr(struct ifaddr *ifa)
 
 	/*
 	 * Remove the loopback route to the interface address.
-	 * The check for the current setting of "nd6_useloopback" 
+	 * The check for the current setting of "nd6_useloopback"
 	 * is not needed.
 	 */
 	if (ia->ia_flags & IFA_RTSELF) {
 		error = ifa_del_loopback_route((struct ifaddr *)ia,
-				       (struct sockaddr *)&ia->ia_addr);
+		    (struct sockaddr *)&ia->ia_addr);
 		if (error == 0)
 			ia->ia_flags &= ~IFA_RTSELF;
 	}
@@ -1890,7 +1891,7 @@ in6_ifinit(struct ifnet *ifp, struct in6
 	 * Special case:
 	 * If a new destination address is specified for a point-to-point
 	 * interface, install a route to the destination as an interface
-	 * direct route. 
+	 * direct route.
 	 * XXX: the logic below rejects assigning multiple addresses on a p2p
 	 * interface that share the same destination.
 	 */
@@ -1914,7 +1915,7 @@ in6_ifinit(struct ifnet *ifp, struct in6
 	 */
 	if (!(ia->ia_flags & IFA_RTSELF) && V_nd6_useloopback) {
 		error = ifa_add_loopback_route((struct ifaddr *)ia,
-				       (struct sockaddr *)&ia->ia_addr);
+		    (struct sockaddr *)&ia->ia_addr);
 		if (error == 0)
 			ia->ia_flags |= IFA_RTSELF;
 	}
@@ -1941,7 +1942,7 @@ in6ifa_ifpforlinklocal(struct ifnet *ifp
 			continue;
 		if (IN6_IS_ADDR_LINKLOCAL(IFA_IN6(ifa))) {
 			if ((((struct in6_ifaddr *)ifa)->ia6_flags &
-			     ignoreflags) != 0)
+			    ignoreflags) != 0)
 				continue;
 			ifa_ref(ifa);
 			break;
@@ -2108,7 +2109,7 @@ in6_is_addr_deprecated(struct sockaddr_i
 	IN6_IFADDR_RLOCK();
 	TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) {
 		if (IN6_ARE_ADDR_EQUAL(&ia->ia_addr.sin6_addr,
-				       &sa6->sin6_addr) &&
+		    &sa6->sin6_addr) &&
 		    (ia->ia6_flags & IN6_IFF_DEPRECATED) != 0) {
 			IN6_IFADDR_RUNLOCK();
 			return (1); /* true */
@@ -2379,7 +2380,7 @@ in6_setmaxmtu(void)
 			maxmtu = IN6_LINKMTU(ifp);
 	}
 	IFNET_RUNLOCK_NOSLEEP();
-	if (maxmtu)	     /* update only when maxmtu is positive */
+	if (maxmtu)	/* update only when maxmtu is positive */
 		V_in6_maxmtu = maxmtu;
 }
 
@@ -2469,8 +2470,7 @@ in6_lltable_new(const struct sockaddr *l
 {
 	struct in6_llentry *lle;
 
-	lle = malloc(sizeof(struct in6_llentry), M_LLTABLE,
-	    M_DONTWAIT | M_ZERO);
+	lle = malloc(sizeof(struct in6_llentry), M_LLTABLE, M_NOWAIT | M_ZERO);
 	if (lle == NULL)		/* NB: caller generates msg */
 		return NULL;
 
@@ -2481,29 +2481,27 @@ in6_lltable_new(const struct sockaddr *l
 	callout_init_rw(&lle->base.ln_timer_ch, &lle->base.lle_lock,
 	    CALLOUT_RETURNUNLOCKED);
 
-	return &lle->base;
+	return (&lle->base);
 }
 
 static void
-in6_lltable_prefix_free(struct lltable *llt, 
-			const struct sockaddr *prefix,
-			const struct sockaddr *mask,
-			u_int flags)
+in6_lltable_prefix_free(struct lltable *llt, const struct sockaddr *prefix,
+    const struct sockaddr *mask, u_int flags)
 {
 	const struct sockaddr_in6 *pfx = (const struct sockaddr_in6 *)prefix;
 	const struct sockaddr_in6 *msk = (const struct sockaddr_in6 *)mask;
 	struct llentry *lle, *next;
-	register int i;
+	int i;
 
 	/*
-	 * (flags & LLE_STATIC) means deleting all entries 
-	 * including static ND6 entries
+	 * (flags & LLE_STATIC) means deleting all entries
+	 * including static ND6 entries.
 	 */
-	for (i=0; i < LLTBL_HASHTBL_SIZE; i++) {
+	for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) {
 		LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) {
 			if (IN6_ARE_MASKED_ADDR_EQUAL(
-				    &((struct sockaddr_in6 *)L3_ADDR(lle))->sin6_addr, 
-				    &pfx->sin6_addr, 
+				    &((struct sockaddr_in6 *)L3_ADDR(lle))->sin6_addr,
+				    &pfx->sin6_addr,
 				    &msk->sin6_addr) &&
 			    ((flags & LLE_STATIC) || !(lle->la_flags & LLE_STATIC))) {
 				int canceled;
@@ -2519,8 +2517,8 @@ in6_lltable_prefix_free(struct lltable *
 }
 
 static int
-in6_lltable_rtcheck(struct ifnet *ifp, 
-		    u_int flags, 
+in6_lltable_rtcheck(struct ifnet *ifp,
+		    u_int flags,
 		    const struct sockaddr *l3addr)
 {
 	struct rtentry *rt;
@@ -2535,8 +2533,8 @@ in6_lltable_rtcheck(struct ifnet *ifp, 
 	    RT_DEFAULT_FIB);
 	if (rt == NULL || (rt->rt_flags & RTF_GATEWAY) || rt->rt_ifp != ifp) {
 		struct ifaddr *ifa;
-		/* 
-		 * Create an ND6 cache for an IPv6 neighbor 
+		/*
+		 * Create an ND6 cache for an IPv6 neighbor
 		 * that is not covered by our own prefix.
 		 */
 		/* XXX ifaof_ifpforaddr should take a const param */
@@ -2577,8 +2575,8 @@ in6_lltable_lookup(struct lltable *llt, 
 		struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *)L3_ADDR(lle);
 		if (lle->la_flags & LLE_DELETED)
 			continue;
-		if (bcmp(&sa6->sin6_addr, &sin6->sin6_addr, 
-			 sizeof(struct in6_addr)) == 0)
+		if (bcmp(&sa6->sin6_addr, &sin6->sin6_addr,
+		    sizeof(struct in6_addr)) == 0)
 			break;
 	}
 
@@ -2801,8 +2799,7 @@ in6_sin_2_v4mapsin6_in_sock(struct socka
 	struct sockaddr_in *sin_p;
 	struct sockaddr_in6 *sin6_p;
 
-	sin6_p = malloc(sizeof *sin6_p, M_SONAME,
-	       M_WAITOK);
+	sin6_p = malloc(sizeof *sin6_p, M_SONAME, M_WAITOK);
 	sin_p = (struct sockaddr_in *)*nam;
 	in6_sin_2_v4mapsin6(sin_p, sin6_p);
 	free(*nam, M_SONAME);



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