summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/netinet6
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-08-20 15:53:03 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-09-21 10:29:39 +0200
commit18fa92c2dcc6c52e0bf27d214d80f0c25a89b47d (patch)
treea3020ac5b1f366f2f0920941b589808e435dbcee /freebsd/sys/netinet6
parentUpdate to FreeBSD head 2017-12-01 (diff)
downloadrtems-libbsd-18fa92c2dcc6c52e0bf27d214d80f0c25a89b47d.tar.bz2
Update to FreeBSD head 2018-02-01
Git mirror commit d079ae0442af8fa3cfd6d7ede190d04e64a2c0d4. Update #3472.
Diffstat (limited to 'freebsd/sys/netinet6')
-rw-r--r--freebsd/sys/netinet6/frag6.c3
-rw-r--r--freebsd/sys/netinet6/icmp6.c4
-rw-r--r--freebsd/sys/netinet6/in6.c2
-rw-r--r--freebsd/sys/netinet6/in6_ifattach.c33
-rw-r--r--freebsd/sys/netinet6/in6_mcast.c3
-rw-r--r--freebsd/sys/netinet6/in6_src.c5
-rw-r--r--freebsd/sys/netinet6/ip6_id.c22
-rw-r--r--freebsd/sys/netinet6/ip6_input.c21
-rw-r--r--freebsd/sys/netinet6/mld6.c3
-rw-r--r--freebsd/sys/netinet6/nd6.c20
-rw-r--r--freebsd/sys/netinet6/nd6.h2
-rw-r--r--freebsd/sys/netinet6/nd6_nbr.c19
-rw-r--r--freebsd/sys/netinet6/nd6_rtr.c8
-rw-r--r--freebsd/sys/netinet6/raw_ip6.c10
-rw-r--r--freebsd/sys/netinet6/scope6.c2
-rw-r--r--freebsd/sys/netinet6/sctp6_usrreq.c8
-rw-r--r--freebsd/sys/netinet6/udp6_usrreq.c6
17 files changed, 67 insertions, 104 deletions
diff --git a/freebsd/sys/netinet6/frag6.c b/freebsd/sys/netinet6/frag6.c
index 1224aeaa..5b405ebb 100644
--- a/freebsd/sys/netinet6/frag6.c
+++ b/freebsd/sys/netinet6/frag6.c
@@ -229,6 +229,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
IP6STAT_INC(ip6s_reassembled);
in6_ifstat_inc(dstifp, ifs6_reass_ok);
*offp = offset;
+ m->m_flags |= M_FRAGMENTED;
return (ip6f->ip6f_nxt);
}
@@ -542,6 +543,7 @@ insert:
while (t->m_next)
t = t->m_next;
m_adj(IP6_REASS_MBUF(af6), af6->ip6af_offset);
+ m_demote_pkthdr(IP6_REASS_MBUF(af6));
m_cat(t, IP6_REASS_MBUF(af6));
free(af6, M_FTABLE);
af6 = af6dwn;
@@ -829,5 +831,6 @@ ip6_deletefraghdr(struct mbuf *m, int offset, int wait)
m_cat(m, t);
}
+ m->m_flags |= M_FRAGMENTED;
return (0);
}
diff --git a/freebsd/sys/netinet6/icmp6.c b/freebsd/sys/netinet6/icmp6.c
index fb537170..38f14461 100644
--- a/freebsd/sys/netinet6/icmp6.c
+++ b/freebsd/sys/netinet6/icmp6.c
@@ -2266,6 +2266,10 @@ icmp6_redirect_input(struct mbuf *m, int off)
if (!V_icmp6_rediraccept)
goto freeit;
+ /* RFC 6980: Nodes MUST silently ignore fragments */
+ if(m->m_flags & M_FRAGMENTED)
+ goto freeit;
+
#ifndef PULLDOWN_TEST
IP6_EXTHDR_CHECK(m, off, icmp6len,);
nd_rd = (struct nd_redirect *)((caddr_t)ip6 + off);
diff --git a/freebsd/sys/netinet6/in6.c b/freebsd/sys/netinet6/in6.c
index 2046043d..6fc29892 100644
--- a/freebsd/sys/netinet6/in6.c
+++ b/freebsd/sys/netinet6/in6.c
@@ -1458,7 +1458,7 @@ in6ifa_ifpforlinklocal(struct ifnet *ifp, int ignoreflags)
/*
- * find the internet address corresponding to a given address.
+ * find the interface address corresponding to a given IPv6 address.
* ifaddr is returned referenced.
*/
struct in6_ifaddr *
diff --git a/freebsd/sys/netinet6/in6_ifattach.c b/freebsd/sys/netinet6/in6_ifattach.c
index d89581e4..26a682ad 100644
--- a/freebsd/sys/netinet6/in6_ifattach.c
+++ b/freebsd/sys/netinet6/in6_ifattach.c
@@ -700,7 +700,6 @@ void
in6_ifattach(struct ifnet *ifp, struct ifnet *altifp)
{
struct in6_ifaddr *ia;
- struct in6_addr in6;
if (ifp->if_afdata[AF_INET6] == NULL)
return;
@@ -733,18 +732,16 @@ in6_ifattach(struct ifnet *ifp, struct ifnet *altifp)
/*
* assign loopback address for loopback interface.
- * XXX multiple loopback interface case.
*/
if ((ifp->if_flags & IFF_LOOPBACK) != 0) {
- struct ifaddr *ifa;
-
- in6 = in6addr_loopback;
- ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, &in6);
- if (ifa == NULL) {
- if (in6_ifattach_loopback(ifp) != 0)
- return;
- } else
- ifa_free(ifa);
+ /*
+ * check that loopback address doesn't exist yet.
+ */
+ ia = in6ifa_ifwithaddr(&in6addr_loopback, 0);
+ if (ia == NULL)
+ in6_ifattach_loopback(ifp);
+ else
+ ifa_free(&ia->ia_ifa);
}
/*
@@ -752,18 +749,10 @@ in6_ifattach(struct ifnet *ifp, struct ifnet *altifp)
*/
if (!(ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) &&
ND_IFINFO(ifp)->flags & ND6_IFF_AUTO_LINKLOCAL) {
- int error;
-
ia = in6ifa_ifpforlinklocal(ifp, 0);
- if (ia == NULL) {
- error = in6_ifattach_linklocal(ifp, altifp);
-#if 0
- if (error)
- log(LOG_NOTICE, "in6_ifattach_linklocal: "
- "failed to add a link-local addr to %s\n",
- if_name(ifp));
-#endif
- } else
+ if (ia == NULL)
+ in6_ifattach_linklocal(ifp, altifp);
+ else
ifa_free(&ia->ia_ifa);
}
diff --git a/freebsd/sys/netinet6/in6_mcast.c b/freebsd/sys/netinet6/in6_mcast.c
index 4119d1d9..a634b18b 100644
--- a/freebsd/sys/netinet6/in6_mcast.c
+++ b/freebsd/sys/netinet6/in6_mcast.c
@@ -1240,11 +1240,8 @@ out_in6m_release:
int
in6_mc_leave(struct in6_multi *inm, /*const*/ struct in6_mfilter *imf)
{
- struct ifnet *ifp;
int error;
- ifp = inm->in6m_ifp;
-
IN6_MULTI_LOCK();
error = in6_mc_leave_locked(inm, imf);
IN6_MULTI_UNLOCK();
diff --git a/freebsd/sys/netinet6/in6_src.c b/freebsd/sys/netinet6/in6_src.c
index a13c1a06..5b110274 100644
--- a/freebsd/sys/netinet6/in6_src.c
+++ b/freebsd/sys/netinet6/in6_src.c
@@ -162,7 +162,6 @@ static struct in6_addrpolicy *match_addrsel_policy(struct sockaddr_in6 *);
*/
#define REPLACE(r) do {\
IP6STAT_INC(ip6s_sources_rule[(r)]); \
- rule = (r); \
/* { \
char ip6buf[INET6_ADDRSTRLEN], ip6b[INET6_ADDRSTRLEN]; \
printf("in6_selectsrc: replace %s with %s by %d\n", ia_best ? ip6_sprintf(ip6buf, &ia_best->ia_addr.sin6_addr) : "none", ip6_sprintf(ip6b, &ia->ia_addr.sin6_addr), (r)); \
@@ -178,7 +177,6 @@ static struct in6_addrpolicy *match_addrsel_policy(struct sockaddr_in6 *);
} while(0)
#define BREAK(r) do { \
IP6STAT_INC(ip6s_sources_rule[(r)]); \
- rule = (r); \
goto out; /* XXX: we can't use 'break' here */ \
} while(0)
@@ -196,7 +194,7 @@ in6_selectsrc(uint32_t fibnum, struct sockaddr_in6 *dstsock,
struct in6_addrpolicy *dst_policy = NULL, *best_policy = NULL;
u_int32_t odstzone;
int prefer_tempaddr;
- int error, rule;
+ int error;
struct ip6_moptions *mopts;
KASSERT(srcp != NULL, ("%s: srcp is NULL", __func__));
@@ -312,7 +310,6 @@ in6_selectsrc(uint32_t fibnum, struct sockaddr_in6 *dstsock,
if (error)
return (error);
- rule = 0;
IN6_IFADDR_RLOCK(&in6_ifa_tracker);
TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) {
int new_scope = -1, new_matchlen = -1;
diff --git a/freebsd/sys/netinet6/ip6_id.c b/freebsd/sys/netinet6/ip6_id.c
index cf0f3a4c..0905ab3f 100644
--- a/freebsd/sys/netinet6/ip6_id.c
+++ b/freebsd/sys/netinet6/ip6_id.c
@@ -1,6 +1,8 @@
#include <machine/rtems-bsd-kernel-space.h>
/*-
+ * SPDX-License-Identifier: (BSD-3-Clause AND BSD-2-Clause)
+ *
* Copyright (C) 2003 WIDE Project.
* All rights reserved.
*
@@ -32,8 +34,6 @@
*/
/*-
- * SPDX-License-Identifier: BSD-4-Clause AND BSD-3-Clause
- *
* Copyright 1998 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
*
@@ -50,11 +50,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Niels Provos.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@@ -67,7 +62,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $OpenBSD: ip_id.c,v 1.6 2002/03/15 18:19:52 millert Exp $
+ * $OpenBSD: ip6_id.c,v 1.3 2003/12/12 06:57:12 itojun Exp $
*/
#include <sys/cdefs.h>
@@ -88,7 +83,7 @@ __FBSDID("$FreeBSD$");
* The transaction id is determined by:
* id[n] = seed xor (g^X[n] mod n)
*
- * Effectivly the id is restricted to the lower (bits - 1) bits, thus
+ * Effectively the id is restricted to the lower (bits - 1) bits, thus
* yielding two different cycles by toggling the msb on and off.
* This avoids reuse issues caused by reseeding.
*/
@@ -179,7 +174,7 @@ pmod(u_int32_t gen, u_int32_t expo, u_int32_t mod)
}
/*
- * Initalizes the seed and chooses a suitable generator. Also toggles
+ * Initializes the seed and chooses a suitable generator. Also toggles
* the msb flag. The msb flag is used to generate two distinct
* cycles of random numbers and thus avoiding reuse of ids.
*
@@ -234,15 +229,12 @@ static u_int32_t
randomid(struct randomtab *p)
{
int i, n;
- u_int32_t tmp;
if (p->ru_counter >= p->ru_max || time_uptime > p->ru_reseed)
initid(p);
- tmp = arc4random();
-
/* Skip a random number of ids */
- n = tmp & 0x3; tmp = tmp >> 2;
+ n = arc4random() & 0x3;
if (p->ru_counter + n >= p->ru_max)
initid(p);
@@ -253,7 +245,7 @@ randomid(struct randomtab *p)
p->ru_counter += i;
- return (p->ru_seed ^ pmod(p->ru_g, p->ru_seed2 ^ p->ru_x, p->ru_n)) |
+ return (p->ru_seed ^ pmod(p->ru_g, p->ru_seed2 + p->ru_x, p->ru_n)) |
p->ru_msb;
}
diff --git a/freebsd/sys/netinet6/ip6_input.c b/freebsd/sys/netinet6/ip6_input.c
index c22f2015..78d941ae 100644
--- a/freebsd/sys/netinet6/ip6_input.c
+++ b/freebsd/sys/netinet6/ip6_input.c
@@ -575,10 +575,8 @@ ip6_input(struct mbuf *m)
/*
* Firewall changed destination to local.
*/
- m->m_flags &= ~M_FASTFWD_OURS;
- ours = 1;
ip6 = mtod(m, struct ip6_hdr *);
- goto hbhcheck;
+ goto passin;
}
/*
@@ -739,10 +737,8 @@ ip6_input(struct mbuf *m)
if ((m = ip6_tryforward(m)) == NULL)
return;
if (m->m_flags & M_FASTFWD_OURS) {
- m->m_flags &= ~M_FASTFWD_OURS;
- ours = 1;
ip6 = mtod(m, struct ip6_hdr *);
- goto hbhcheck;
+ goto passin;
}
}
#if defined(IPSEC) || defined(IPSEC_SUPPORT)
@@ -773,13 +769,7 @@ ip6_input(struct mbuf *m)
return;
ip6 = mtod(m, struct ip6_hdr *);
srcrt = !IN6_ARE_ADDR_EQUAL(&odst, &ip6->ip6_dst);
-
- if (m->m_flags & M_FASTFWD_OURS) {
- m->m_flags &= ~M_FASTFWD_OURS;
- ours = 1;
- goto hbhcheck;
- }
- if ((m->m_flags & M_IP6_NEXTHOP) &&
+ if ((m->m_flags & (M_IP6_NEXTHOP | M_FASTFWD_OURS)) == M_IP6_NEXTHOP &&
m_tag_find(m, PACKET_TAG_IPFORWARD, NULL) != NULL) {
/*
* Directly ship the packet on. This allows forwarding
@@ -810,6 +800,11 @@ passin:
IP6STAT_INC(ip6s_badscope);
goto bad;
}
+ if (m->m_flags & M_FASTFWD_OURS) {
+ m->m_flags &= ~M_FASTFWD_OURS;
+ ours = 1;
+ goto hbhcheck;
+ }
/*
* Multicast check. Assume packet is for us to avoid
* prematurely taking locks.
diff --git a/freebsd/sys/netinet6/mld6.c b/freebsd/sys/netinet6/mld6.c
index 26fb21f7..c1dff0c3 100644
--- a/freebsd/sys/netinet6/mld6.c
+++ b/freebsd/sys/netinet6/mld6.c
@@ -2288,7 +2288,7 @@ mld_v2_enqueue_group_record(struct mbufq *mq, struct in6_multi *inm,
struct ifnet *ifp;
struct ip6_msource *ims, *nims;
struct mbuf *m0, *m, *md;
- int error, is_filter_list_change;
+ int is_filter_list_change;
int minrec0len, m0srcs, msrcs, nbytes, off;
int record_has_sources;
int now;
@@ -2300,7 +2300,6 @@ mld_v2_enqueue_group_record(struct mbufq *mq, struct in6_multi *inm,
IN6_MULTI_LOCK_ASSERT();
- error = 0;
ifp = inm->in6m_ifp;
is_filter_list_change = 0;
m = NULL;
diff --git a/freebsd/sys/netinet6/nd6.c b/freebsd/sys/netinet6/nd6.c
index 30672e23..6235b808 100644
--- a/freebsd/sys/netinet6/nd6.c
+++ b/freebsd/sys/netinet6/nd6.c
@@ -2034,10 +2034,11 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr,
if (ln_tmp == NULL) {
/* No existing lle, mark as new entry (6,7) */
is_newentry = 1;
- nd6_llinfo_setstate(ln, ND6_LLINFO_STALE);
- if (lladdr != NULL) /* (7) */
+ if (lladdr != NULL) { /* (7) */
+ nd6_llinfo_setstate(ln, ND6_LLINFO_STALE);
EVENTHANDLER_INVOKE(lle_event, ln,
LLENTRY_RESOLVED);
+ }
} else {
lltable_free_entry(LLTABLE6(ifp), ln);
ln = ln_tmp;
@@ -2115,7 +2116,7 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr,
LLE_RUNLOCK(ln);
if (chain != NULL)
- nd6_flush_holdchain(ifp, ifp, chain, &sin6);
+ nd6_flush_holdchain(ifp, chain, &sin6);
/*
* When the link-layer address of a router changes, select the
@@ -2504,23 +2505,18 @@ nd6_resolve_addr(struct ifnet *ifp, int flags, const struct sockaddr *dst,
}
int
-nd6_flush_holdchain(struct ifnet *ifp, struct ifnet *origifp, struct mbuf *chain,
+nd6_flush_holdchain(struct ifnet *ifp, struct mbuf *chain,
struct sockaddr_in6 *dst)
{
struct mbuf *m, *m_head;
- struct ifnet *outifp;
int error = 0;
m_head = chain;
- if ((ifp->if_flags & IFF_LOOPBACK) != 0)
- outifp = origifp;
- else
- outifp = ifp;
-
+
while (m_head) {
m = m_head;
m_head = m_head->m_nextpkt;
- error = nd6_output_ifp(ifp, origifp, m, dst, NULL);
+ error = nd6_output_ifp(ifp, ifp, m, dst, NULL);
}
/*
@@ -2528,7 +2524,7 @@ nd6_flush_holdchain(struct ifnet *ifp, struct ifnet *origifp, struct mbuf *chain
* note that intermediate errors are blindly ignored
*/
return (error);
-}
+}
static int
nd6_need_cache(struct ifnet *ifp)
diff --git a/freebsd/sys/netinet6/nd6.h b/freebsd/sys/netinet6/nd6.h
index 30990637..cabfeec0 100644
--- a/freebsd/sys/netinet6/nd6.h
+++ b/freebsd/sys/netinet6/nd6.h
@@ -448,7 +448,7 @@ void nd6_cache_lladdr(struct ifnet *, struct in6_addr *,
char *, int, int, int);
void nd6_grab_holdchain(struct llentry *, struct mbuf **,
struct sockaddr_in6 *);
-int nd6_flush_holdchain(struct ifnet *, struct ifnet *, struct mbuf *,
+int nd6_flush_holdchain(struct ifnet *, struct mbuf *,
struct sockaddr_in6 *);
int nd6_add_ifa_lle(struct in6_ifaddr *);
void nd6_rem_ifa_lle(struct in6_ifaddr *, int);
diff --git a/freebsd/sys/netinet6/nd6_nbr.c b/freebsd/sys/netinet6/nd6_nbr.c
index 5e55fc2b..0c875324 100644
--- a/freebsd/sys/netinet6/nd6_nbr.c
+++ b/freebsd/sys/netinet6/nd6_nbr.c
@@ -139,6 +139,10 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len)
struct sockaddr_dl proxydl;
char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN];
+ /* RFC 6980: Nodes MUST silently ignore fragments */
+ if(m->m_flags & M_FRAGMENTED)
+ goto freeit;
+
rflag = (V_ip6_forwarding) ? ND_NA_FLAG_ROUTER : 0;
if (ND_IFINFO(ifp)->flags & ND6_IFF_ACCEPT_RTADV && V_ip6_norbit_raif)
rflag = 0;
@@ -633,6 +637,10 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len)
int lladdr_off;
char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN];
+ /* RFC 6980: Nodes MUST silently ignore fragments */
+ if(m->m_flags & M_FRAGMENTED)
+ goto freeit;
+
if (ip6->ip6_hlim != 255) {
nd6log((LOG_ERR,
"nd6_na_input: invalid hlim (%d) from %s to %s on %s\n",
@@ -888,7 +896,7 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len)
LLE_WUNLOCK(ln);
if (chain != NULL)
- nd6_flush_holdchain(ifp, ifp, chain, &sin6);
+ nd6_flush_holdchain(ifp, chain, &sin6);
if (checklink)
pfxlist_onlink_check();
@@ -1301,7 +1309,8 @@ nd6_dad_stop(struct ifaddr *ifa)
* we were waiting for it to stop, so re-do the lookup.
*/
nd6_dad_rele(dp);
- if (nd6_dad_find(ifa, NULL) == NULL)
+ dp = nd6_dad_find(ifa, NULL);
+ if (dp == NULL)
return;
nd6_dad_del(dp);
@@ -1508,17 +1517,11 @@ nd6_dad_ns_output(struct dadq *dp)
static void
nd6_dad_ns_input(struct ifaddr *ifa, struct nd_opt_nonce *ndopt_nonce)
{
- struct in6_ifaddr *ia;
- struct ifnet *ifp;
- const struct in6_addr *taddr6;
struct dadq *dp;
if (ifa == NULL)
panic("ifa == NULL in nd6_dad_ns_input");
- ia = (struct in6_ifaddr *)ifa;
- ifp = ifa->ifa_ifp;
- taddr6 = &ia->ia_addr.sin6_addr;
/* Ignore Nonce option when Enhanced DAD is disabled. */
if (V_dad_enhanced == 0)
ndopt_nonce = NULL;
diff --git a/freebsd/sys/netinet6/nd6_rtr.c b/freebsd/sys/netinet6/nd6_rtr.c
index 47fc497e..2affacbf 100644
--- a/freebsd/sys/netinet6/nd6_rtr.c
+++ b/freebsd/sys/netinet6/nd6_rtr.c
@@ -141,6 +141,10 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len)
if (!V_ip6_forwarding || ND_IFINFO(ifp)->flags & ND6_IFF_ACCEPT_RTADV)
goto freeit;
+ /* RFC 6980: Nodes MUST silently ignore fragments */
+ if(m->m_flags & M_FRAGMENTED)
+ goto freeit;
+
/* Sanity checks */
if (ip6->ip6_hlim != 255) {
nd6log((LOG_ERR,
@@ -231,6 +235,10 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len)
if (!(ndi->flags & ND6_IFF_ACCEPT_RTADV))
goto freeit;
+ /* RFC 6980: Nodes MUST silently ignore fragments */
+ if(m->m_flags & M_FRAGMENTED)
+ goto freeit;
+
if (ip6->ip6_hlim != 255) {
nd6log((LOG_ERR,
"nd6_ra_input: invalid hlim (%d) from %s to %s on %s\n",
diff --git a/freebsd/sys/netinet6/raw_ip6.c b/freebsd/sys/netinet6/raw_ip6.c
index 743fe787..b68077ef 100644
--- a/freebsd/sys/netinet6/raw_ip6.c
+++ b/freebsd/sys/netinet6/raw_ip6.c
@@ -341,9 +341,6 @@ rip6_input(struct mbuf **mp, int *offp, int proto)
void
rip6_ctlinput(int cmd, struct sockaddr *sa, void *d)
{
- struct ip6_hdr *ip6;
- struct mbuf *m;
- int off = 0;
struct ip6ctlparam *ip6cp = NULL;
const struct sockaddr_in6 *sa6_src = NULL;
void *cmdarg;
@@ -367,14 +364,9 @@ rip6_ctlinput(int cmd, struct sockaddr *sa, void *d)
*/
if (d != NULL) {
ip6cp = (struct ip6ctlparam *)d;
- m = ip6cp->ip6c_m;
- ip6 = ip6cp->ip6c_ip6;
- off = ip6cp->ip6c_off;
cmdarg = ip6cp->ip6c_cmdarg;
sa6_src = ip6cp->ip6c_src;
} else {
- m = NULL;
- ip6 = NULL;
cmdarg = NULL;
sa6_src = &sa6_any;
}
@@ -393,7 +385,6 @@ rip6_output(struct mbuf *m, struct socket *so, ...)
struct mbuf *control;
struct m_tag *mtag;
struct sockaddr_in6 *dstsock;
- struct in6_addr *dst;
struct ip6_hdr *ip6;
struct inpcb *in6p;
u_int plen = m->m_pkthdr.len;
@@ -415,7 +406,6 @@ rip6_output(struct mbuf *m, struct socket *so, ...)
in6p = sotoinpcb(so);
INP_WLOCK(in6p);
- dst = &dstsock->sin6_addr;
if (control != NULL) {
if ((error = ip6_setpktopts(control, &opt,
in6p->in6p_outputopts, so->so_cred,
diff --git a/freebsd/sys/netinet6/scope6.c b/freebsd/sys/netinet6/scope6.c
index a4c56769..40218287 100644
--- a/freebsd/sys/netinet6/scope6.c
+++ b/freebsd/sys/netinet6/scope6.c
@@ -413,7 +413,7 @@ in6_setscope(struct in6_addr *in6, struct ifnet *ifp, u_int32_t *ret_id)
if (scope == IPV6_ADDR_SCOPE_INTFACELOCAL ||
scope == IPV6_ADDR_SCOPE_LINKLOCAL) {
/*
- * Currently we use interface indeces as the
+ * Currently we use interface indices as the
* zone IDs for interface-local and link-local
* scopes.
*/
diff --git a/freebsd/sys/netinet6/sctp6_usrreq.c b/freebsd/sys/netinet6/sctp6_usrreq.c
index 619a30dc..a79e6f53 100644
--- a/freebsd/sys/netinet6/sctp6_usrreq.c
+++ b/freebsd/sys/netinet6/sctp6_usrreq.c
@@ -73,9 +73,7 @@ sctp6_input_with_port(struct mbuf **i_pak, int *offp, uint16_t port)
struct sctphdr *sh;
struct sctp_chunkhdr *ch;
int length, offset;
-#if !defined(SCTP_WITH_NO_CSUM)
uint8_t compute_crc;
-#endif
uint32_t mflowid;
uint8_t mflowtype;
uint16_t fibnum;
@@ -146,9 +144,6 @@ sctp6_input_with_port(struct mbuf **i_pak, int *offp, uint16_t port)
goto out;
}
ecn_bits = ((ntohl(ip6->ip6_flow) >> 20) & 0x000000ff);
-#if defined(SCTP_WITH_NO_CSUM)
- SCTP_STAT_INCR(sctps_recvnocrc);
-#else
if (m->m_pkthdr.csum_flags & CSUM_SCTP_VALID) {
SCTP_STAT_INCR(sctps_recvhwcrc);
compute_crc = 0;
@@ -156,14 +151,11 @@ sctp6_input_with_port(struct mbuf **i_pak, int *offp, uint16_t port)
SCTP_STAT_INCR(sctps_recvswcrc);
compute_crc = 1;
}
-#endif
sctp_common_input_processing(&m, iphlen, offset, length,
(struct sockaddr *)&src,
(struct sockaddr *)&dst,
sh, ch,
-#if !defined(SCTP_WITH_NO_CSUM)
compute_crc,
-#endif
ecn_bits,
mflowtype, mflowid, fibnum,
vrf_id, port);
diff --git a/freebsd/sys/netinet6/udp6_usrreq.c b/freebsd/sys/netinet6/udp6_usrreq.c
index ae57ac79..98d097f7 100644
--- a/freebsd/sys/netinet6/udp6_usrreq.c
+++ b/freebsd/sys/netinet6/udp6_usrreq.c
@@ -1192,7 +1192,6 @@ udp6_disconnect(struct socket *so)
{
struct inpcb *inp;
struct inpcbinfo *pcbinfo;
- int error;
pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol);
inp = sotoinpcb(so);
@@ -1214,8 +1213,8 @@ udp6_disconnect(struct socket *so)
#endif
if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) {
- error = ENOTCONN;
- goto out;
+ INP_WUNLOCK(inp);
+ return (ENOTCONN);
}
INP_HASH_WLOCK(pcbinfo);
@@ -1225,7 +1224,6 @@ udp6_disconnect(struct socket *so)
SOCK_LOCK(so);
so->so_state &= ~SS_ISCONNECTED; /* XXX */
SOCK_UNLOCK(so);
-out:
INP_WUNLOCK(inp);
return (0);
}