Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142457976
D10936.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
8 KB
Referenced Files
None
Subscribers
None
D10936.diff
View Options
Index: sys/netinet6/dest6.c
===================================================================
--- sys/netinet6/dest6.c
+++ sys/netinet6/dest6.c
@@ -91,7 +91,7 @@
opt = (u_int8_t *)dstopts + sizeof(struct ip6_dest);
/* search header for all options. */
- for (optlen = 0; dstoptlen > 0; dstoptlen -= optlen, opt += optlen) {
+ for (; dstoptlen > 0; dstoptlen -= optlen, opt += optlen) {
if (*opt != IP6OPT_PAD1 &&
(dstoptlen < IP6OPT_MINLEN || *(opt + 1) + 2 > dstoptlen)) {
IP6STAT_INC(ip6s_toosmall);
Index: sys/netinet6/icmp6.c
===================================================================
--- sys/netinet6/icmp6.c
+++ sys/netinet6/icmp6.c
@@ -592,14 +592,13 @@
n->m_pkthdr.len = n0len + (noff - off);
n->m_next = n0;
} else {
- nip6 = mtod(n, struct ip6_hdr *);
IP6_EXTHDR_GET(nicmp6, struct icmp6_hdr *, n, off,
sizeof(*nicmp6));
noff = off;
}
- nicmp6->icmp6_type = ICMP6_ECHO_REPLY;
- nicmp6->icmp6_code = 0;
if (n) {
+ nicmp6->icmp6_type = ICMP6_ECHO_REPLY;
+ nicmp6->icmp6_code = 0;
ICMP6STAT_INC(icp6s_reflect);
ICMP6STAT_INC(icp6s_outhist[ICMP6_ECHO_REPLY]);
icmp6_reflect(n, noff);
@@ -689,6 +688,7 @@
*/
m_free(n);
n = NULL;
+ break;
}
maxhlen = M_TRAILINGSPACE(n) -
(sizeof(*nip6) + sizeof(*nicmp6) + 4);
Index: sys/netinet6/ip6_id.c
===================================================================
--- sys/netinet6/ip6_id.c
+++ sys/netinet6/ip6_id.c
@@ -230,15 +230,12 @@
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);
Index: sys/netinet6/ip6_output.c
===================================================================
--- sys/netinet6/ip6_output.c
+++ sys/netinet6/ip6_output.c
@@ -1054,7 +1054,7 @@
m = m0->m_nextpkt;
m0->m_nextpkt = 0;
m_freem(m0);
- for (m0 = m; m; m = m0) {
+ for (; m; m = m0) {
m0 = m->m_nextpkt;
m->m_nextpkt = 0;
if (error == 0) {
@@ -2465,7 +2465,7 @@
if (src->type) {\
int hlen = (((struct ip6_ext *)src->type)->ip6e_len + 1) << 3;\
dst->type = malloc(hlen, M_IP6OPT, canwait);\
- if (dst->type == NULL && canwait == M_NOWAIT)\
+ if (dst->type == NULL)\
goto bad;\
bcopy(src->type, dst->type, hlen);\
}\
Index: sys/netinet6/mld6.c
===================================================================
--- sys/netinet6/mld6.c
+++ sys/netinet6/mld6.c
@@ -2284,7 +2284,7 @@
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;
@@ -2296,12 +2296,10 @@
IN6_MULTI_LOCK_ASSERT();
- error = 0;
ifp = inm->in6m_ifp;
is_filter_list_change = 0;
m = NULL;
m0 = NULL;
- m0srcs = 0;
msrcs = 0;
nbytes = 0;
nims = NULL;
@@ -2688,11 +2686,8 @@
mode = inm->in6m_st[1].iss_fmode; /* filter mode at t1 */
crt = REC_NONE; /* current group record type */
drt = REC_NONE; /* mask of completed group record types */
- nrt = REC_NONE; /* record type for current node */
- m0srcs = 0; /* # source which will fit in current mbuf chain */
npbytes = 0; /* # of bytes appended this packet */
nbytes = 0; /* # of bytes appended to group's state-change queue */
- rsrcs = 0; /* # sources encoded in current record */
schanged = 0; /* # nodes encoded in overall filter change */
nallow = 0; /* # of source entries in ALLOW_NEW */
nblock = 0; /* # of source entries in BLOCK_OLD */
@@ -2875,7 +2870,6 @@
u_int recslen;
docopy = 0;
- domerge = 0;
recslen = 0;
IN6_MULTI_LOCK_ASSERT();
Index: sys/netinet6/nd6.c
===================================================================
--- sys/netinet6/nd6.c
+++ sys/netinet6/nd6.c
@@ -2504,15 +2504,9 @@
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;
Index: sys/netinet6/nd6_nbr.c
===================================================================
--- sys/netinet6/nd6_nbr.c
+++ sys/netinet6/nd6_nbr.c
@@ -1110,6 +1110,7 @@
#define ND_OPT_NONCE_LEN32 \
((ND_OPT_NONCE_LEN + sizeof(uint32_t) - 1)/sizeof(uint32_t))
uint32_t dad_nonce[ND_OPT_NONCE_LEN32];
+ bool dad_ondadq; /* on dadq? Protected by DADQ_WLOCK. */
};
static VNET_DEFINE(TAILQ_HEAD(, dadq), dadq);
@@ -1128,6 +1129,7 @@
DADQ_WLOCK();
TAILQ_INSERT_TAIL(&V_dadq, dp, dad_list);
+ dp->dad_ondadq = true;
DADQ_WUNLOCK();
}
@@ -1136,9 +1138,17 @@
{
DADQ_WLOCK();
- TAILQ_REMOVE(&V_dadq, dp, dad_list);
- DADQ_WUNLOCK();
- nd6_dad_rele(dp);
+ if (dp->dad_ondadq) {
+ /*
+ * Remove dp from the dadq and release the dadq's
+ * reference.
+ */
+ TAILQ_REMOVE(&V_dadq, dp, dad_list);
+ dp->dad_ondadq = false;
+ DADQ_WUNLOCK();
+ nd6_dad_rele(dp);
+ } else
+ DADQ_WUNLOCK();
}
static struct dadq *
@@ -1271,6 +1281,8 @@
dp->dad_ns_icount = dp->dad_na_icount = 0;
dp->dad_ns_ocount = dp->dad_ns_tcount = 0;
dp->dad_ns_lcount = dp->dad_loopbackprobe = 0;
+
+ /* Add this to the dadq and add a reference for the dadq. */
refcount_init(&dp->dad_refcnt, 1);
nd6_dad_add(dp);
nd6_dad_starttimer(dp, delay, 0);
@@ -1291,15 +1303,6 @@
}
nd6_dad_stoptimer(dp);
-
- /*
- * The DAD queue entry may have been removed by nd6_dad_timer() while
- * we were waiting for it to stop, so re-do the lookup.
- */
- nd6_dad_rele(dp);
- if (nd6_dad_find(ifa, NULL) == NULL)
- return;
-
nd6_dad_del(dp);
nd6_dad_rele(dp);
}
@@ -1504,17 +1507,11 @@
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;
Index: sys/netinet6/raw_ip6.c
===================================================================
--- sys/netinet6/raw_ip6.c
+++ sys/netinet6/raw_ip6.c
@@ -337,9 +337,6 @@
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;
@@ -363,14 +360,9 @@
*/
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;
}
@@ -389,7 +381,6 @@
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;
@@ -411,7 +402,6 @@
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,
Index: sys/netinet6/udp6_usrreq.c
===================================================================
--- sys/netinet6/udp6_usrreq.c
+++ sys/netinet6/udp6_usrreq.c
@@ -220,7 +220,6 @@
uint8_t nxt;
ifp = m->m_pkthdr.rcvif;
- ip6 = mtod(m, struct ip6_hdr *);
#ifndef PULLDOWN_TEST
IP6_EXTHDR_CHECK(m, off, sizeof(struct udphdr), IPPROTO_DONE);
@@ -230,6 +229,7 @@
IP6_EXTHDR_GET(uh, struct udphdr *, m, off, sizeof(*uh));
if (!uh)
return (IPPROTO_DONE);
+ ip6 = mtod(m, struct ip6_hdr *);
#endif
UDPSTAT_INC(udps_ipackets);
@@ -1192,7 +1192,6 @@
{
struct inpcb *inp;
struct inpcbinfo *pcbinfo;
- int error;
pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol);
inp = sotoinpcb(so);
@@ -1213,10 +1212,8 @@
}
#endif
- if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) {
- error = ENOTCONN;
+ if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr))
goto out;
- }
INP_HASH_WLOCK(pcbinfo);
in6_pcbdisconnect(inp);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 21, 4:26 AM (7 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27789551
Default Alt Text
D10936.diff (8 KB)
Attached To
Mode
D10936: Fix static analysis errors in IPv6 code
Attached
Detach File
Event Timeline
Log In to Comment