summaryrefslogtreecommitdiffstats
path: root/sys/netinet6/in6_ifattach.c
diff options
context:
space:
mode:
authormelifaro <melifaro@FreeBSD.org>2014-01-08 22:13:32 +0000
committermelifaro <melifaro@FreeBSD.org>2014-01-08 22:13:32 +0000
commitdb2be6a7935bbbcc9f166d7b77bae083a04ecf1c (patch)
treeea5e160cee2db974195dc357f1e2aba164510831 /sys/netinet6/in6_ifattach.c
parent35bc581adc0f17be939cfcfe671e9d5a5061b1a4 (diff)
downloadFreeBSD-src-db2be6a7935bbbcc9f166d7b77bae083a04ecf1c.zip
FreeBSD-src-db2be6a7935bbbcc9f166d7b77bae083a04ecf1c.tar.gz
Introduce IN6_MASK_ADDR() macro to unify various hand-rolled code
to do IPv6 addr & mask in different places. MFC after: 2 weeks
Diffstat (limited to 'sys/netinet6/in6_ifattach.c')
-rw-r--r--sys/netinet6/in6_ifattach.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c
index 2ee0cae..b1c5b23 100644
--- a/sys/netinet6/in6_ifattach.c
+++ b/sys/netinet6/in6_ifattach.c
@@ -455,7 +455,7 @@ in6_ifattach_linklocal(struct ifnet *ifp, struct ifnet *altifp)
struct in6_ifaddr *ia;
struct in6_aliasreq ifra;
struct nd_prefixctl pr0;
- int i, error;
+ int error;
/*
* configure link-local address.
@@ -532,10 +532,7 @@ in6_ifattach_linklocal(struct ifnet *ifp, struct ifnet *altifp)
pr0.ndpr_plen = in6_mask2len(&ifra.ifra_prefixmask.sin6_addr, NULL);
pr0.ndpr_prefix = ifra.ifra_addr;
/* apply the mask for safety. (nd6_prelist_add will apply it again) */
- for (i = 0; i < 4; i++) {
- pr0.ndpr_prefix.sin6_addr.s6_addr32[i] &=
- in6mask64.s6_addr32[i];
- }
+ IN6_MASK_ADDR(&pr0.ndpr_prefix.sin6_addr, &in6mask64);
/*
* Initialize parameters. The link-local prefix must always be
* on-link, and its lifetimes never expire.
OpenPOWER on IntegriCloud