From 1d6a38a97f73f28c22dd26b496cb7d61901fdee2 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Sat, 5 Jan 2013 13:27:50 +0100 Subject: [PATCH] kernel/netinet6: Remove some unused variables. --- sys/netinet6/dest6.c | 4 ---- sys/netinet6/esp_aesctr.c | 3 +-- sys/netinet6/esp_core.c | 4 ---- sys/netinet6/esp_input.c | 6 ------ sys/netinet6/esp_output.c | 12 ------------ sys/netinet6/icmp6.c | 4 ++++ sys/netinet6/ip6_input.c | 7 +------ sys/netinet6/ipcomp_input.c | 7 ------- sys/netinet6/ipcomp_output.c | 12 ------------ sys/netinet6/nd6.c | 2 -- sys/netinet6/nd6_nbr.c | 2 -- sys/netinet6/nd6_rtr.c | 3 --- sys/netinet6/raw_ip6.c | 8 -------- sys/netinet6/sctp6_usrreq.c | 2 -- 14 files changed, 6 insertions(+), 70 deletions(-) diff --git a/sys/netinet6/dest6.c b/sys/netinet6/dest6.c index 2457270e79..5fb6c81d17 100644 --- a/sys/netinet6/dest6.c +++ b/sys/netinet6/dest6.c @@ -1,5 +1,4 @@ /* $FreeBSD: src/sys/netinet6/dest6.c,v 1.1.2.4 2002/04/28 05:40:26 suz Exp $ */ -/* $DragonFly: src/sys/netinet6/dest6.c,v 1.4 2006/10/24 06:18:42 hsu Exp $ */ /* $KAME: dest6.c,v 1.34 2002/01/08 02:40:55 k-sugyou Exp $ */ /* @@ -64,9 +63,6 @@ dest6_input(struct mbuf **mp, int *offp, int proto) int off = *offp, dstoptlen, optlen; struct ip6_dest *dstopts; u_int8_t *opt; - struct ip6_hdr *ip6; - - ip6 = mtod(m, struct ip6_hdr *); /* validation of the length of the header */ #ifndef PULLDOWN_TEST diff --git a/sys/netinet6/esp_aesctr.c b/sys/netinet6/esp_aesctr.c index 22af314fc9..ddeda1764b 100644 --- a/sys/netinet6/esp_aesctr.c +++ b/sys/netinet6/esp_aesctr.c @@ -136,7 +136,6 @@ esp_aesctr_decrypt(struct mbuf *m, size_t off, struct secasvar *sav, union cblock cblock; u_int8_t keystream[AES_BLOCKSIZE], *nonce; u_int32_t ctr; - u_int8_t *ivp; u_int8_t sbuf[AES_BLOCKSIZE], *sp, *dst; struct mbuf *scut; int scutoff; @@ -177,7 +176,7 @@ esp_aesctr_decrypt(struct mbuf *m, size_t off, struct secasvar *sav, s = m; d = d0 = dp = NULL; soff = doff = sn = dn = 0; - ivp = sp = NULL; + sp = NULL; /* skip bodyoff */ while (soff < bodyoff) { diff --git a/sys/netinet6/esp_core.c b/sys/netinet6/esp_core.c index a52016fb4c..4fd712b77a 100644 --- a/sys/netinet6/esp_core.c +++ b/sys/netinet6/esp_core.c @@ -591,7 +591,6 @@ esp_cbc_decrypt(struct mbuf *m, size_t off, struct secasvar *sav, int scutoff; int i; int blocklen; - int derived; if (ivlen != sav->ivlen || ivlen > sizeof(iv)) { ipseclog((LOG_ERR, "esp_cbc_decrypt %s: " @@ -616,7 +615,6 @@ esp_cbc_decrypt(struct mbuf *m, size_t off, struct secasvar *sav, /* RFC 1827 */ ivoff = off + sizeof(struct esp); bodyoff = off + sizeof(struct esp) + ivlen; - derived = 0; } else { /* RFC 2406 */ if (sav->flags & SADB_X_EXT_DERIV) { @@ -627,11 +625,9 @@ esp_cbc_decrypt(struct mbuf *m, size_t off, struct secasvar *sav, ivoff = off + sizeof(struct esp); bodyoff = off + sizeof(struct esp) + sizeof(u_int32_t); ivlen = sizeof(u_int32_t); - derived = 1; } else { ivoff = off + sizeof(struct newesp); bodyoff = off + sizeof(struct newesp) + ivlen; - derived = 0; } } diff --git a/sys/netinet6/esp_input.c b/sys/netinet6/esp_input.c index 983a38d14b..aa5566fb5c 100644 --- a/sys/netinet6/esp_input.c +++ b/sys/netinet6/esp_input.c @@ -116,7 +116,6 @@ esp4_input(struct mbuf **mp, int *offp, int proto) u_int16_t nxt; const struct esp_algorithm *algo; int ivlen; - size_t hlen; size_t esplen; off = *offp; @@ -143,11 +142,6 @@ esp4_input(struct mbuf **mp, int *offp, int proto) ip = mtod(m, struct ip *); esp = (struct esp *)(((u_int8_t *)ip) + off); -#ifdef _IP_VHL - hlen = IP_VHL_HL(ip->ip_vhl) << 2; -#else - hlen = ip->ip_hl << 2; -#endif /* find the sassoc. */ spi = esp->esp_spi; diff --git a/sys/netinet6/esp_output.c b/sys/netinet6/esp_output.c index 88e2decb44..d456348da7 100644 --- a/sys/netinet6/esp_output.c +++ b/sys/netinet6/esp_output.c @@ -1,5 +1,4 @@ /* $FreeBSD: src/sys/netinet6/esp_output.c,v 1.1.2.4 2003/05/06 06:46:58 suz Exp $ */ -/* $DragonFly: src/sys/netinet6/esp_output.c,v 1.9 2006/10/24 06:18:42 hsu Exp $ */ /* $KAME: esp_output.c,v 1.44 2001/07/26 06:53:15 jinmei Exp $ */ /* @@ -267,13 +266,9 @@ esp_output(struct mbuf *m, u_char *nexthdrp, struct mbuf *md, */ #ifdef INET struct ip *ip = NULL; -#endif -#ifdef INET6 - struct ip6_hdr *ip6 = NULL; #endif size_t esplen; /* sizeof(struct esp/newesp) */ size_t esphlen; /* sizeof(struct esp/newesp) + ivlen */ - size_t hlen = 0; /* ip header len */ if (sav->flags & SADB_X_EXT_OLD) { /* RFC 1827 */ @@ -304,17 +299,10 @@ esp_output(struct mbuf *m, u_char *nexthdrp, struct mbuf *md, #ifdef INET case AF_INET: ip = mtod(m, struct ip *); -#ifdef _IP_VHL - hlen = IP_VHL_HL(ip->ip_vhl) << 2; -#else - hlen = ip->ip_hl << 2; -#endif break; #endif #ifdef INET6 case AF_INET6: - ip6 = mtod(m, struct ip6_hdr *); - hlen = sizeof(*ip6); break; #endif } diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index decc8a0913..7fb270ec9a 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -2140,8 +2140,10 @@ icmp6_redirect_input(struct mbuf *m, int off) int icmp6len = ntohs(ip6->ip6_plen); char *lladdr = NULL; int lladdrlen = 0; +#if 0 u_char *redirhdr = NULL; int redirhdrlen = 0; +#endif struct rtentry *rt = NULL; int is_router; int is_onlink; @@ -2270,10 +2272,12 @@ icmp6_redirect_input(struct mbuf *m, int off) lladdrlen = ndopts.nd_opts_tgt_lladdr->nd_opt_len << 3; } +#if 0 if (ndopts.nd_opts_rh) { redirhdrlen = ndopts.nd_opts_rh->nd_opt_rh_len; redirhdr = (u_char *)(ndopts.nd_opts_rh + 1); /* xxx */ } +#endif if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) { nd6log((LOG_INFO, diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index cb40406595..f739e29baa 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -938,7 +938,6 @@ ip6_hopopts_input(u_int32_t *plenp, struct mbuf *m = *mp; int off = *offp, hbhlen; struct ip6_hbh *hbh; - u_int8_t *opt; /* validation of the length of the header */ #ifndef PULLDOWN_TEST @@ -965,7 +964,6 @@ ip6_hopopts_input(u_int32_t *plenp, #endif off += hbhlen; hbhlen -= sizeof(struct ip6_hbh); - opt = (u_int8_t *)hbh + sizeof(struct ip6_hbh); if (ip6_process_hopopts(m, (u_int8_t *)hbh + sizeof(struct ip6_hbh), hbhlen, rtalertp, plenp) < 0) @@ -1167,7 +1165,6 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf **mp, struct ip6_hdr *ip6, #define IS2292(x, y) ((in6p->in6p_flags & IN6P_RFC2292) ? (x) : (y)) struct thread *td = curthread; /* XXX */ int privileged = 0; - int rthdr_exist = 0; if (priv_check(td, PRIV_ROOT) == 0) @@ -1304,10 +1301,8 @@ ip6_savecontrol(struct inpcb *in6p, struct mbuf **mp, struct ip6_hdr *ip6, break; if (newoff < off) /* invalid, check for safety */ break; - if ((proto = nxt) == IPPROTO_ROUTING) { - rthdr_exist = 1; + if ((proto = nxt) == IPPROTO_ROUTING) break; - } off = newoff; } } diff --git a/sys/netinet6/ipcomp_input.c b/sys/netinet6/ipcomp_input.c index 20778172f0..4dae9f13d9 100644 --- a/sys/netinet6/ipcomp_input.c +++ b/sys/netinet6/ipcomp_input.c @@ -1,5 +1,4 @@ /* $FreeBSD: src/sys/netinet6/ipcomp_input.c,v 1.1.2.3 2002/04/28 05:40:27 suz Exp $ */ -/* $DragonFly: src/sys/netinet6/ipcomp_input.c,v 1.9 2007/11/22 20:19:43 hasso Exp $ */ /* $KAME: ipcomp_input.c,v 1.25 2001/03/01 09:12:09 itojun Exp $ */ /* @@ -97,7 +96,6 @@ ipcomp4_input(struct mbuf **mp, int *offp, int proto) const struct ipcomp_algorithm *algo; u_int16_t cpi; /* host order */ u_int16_t nxt; - size_t hlen; int error; size_t newlen, olen; struct secasvar *sav = NULL; @@ -124,11 +122,6 @@ ipcomp4_input(struct mbuf **mp, int *offp, int proto) ipcomp = mtod(md, struct ipcomp *); ip = mtod(m, struct ip *); nxt = ipcomp->comp_nxt; -#ifdef _IP_VHL - hlen = IP_VHL_HL(ip->ip_vhl) << 2; -#else - hlen = ip->ip_hl << 2; -#endif cpi = ntohs(ipcomp->comp_cpi); diff --git a/sys/netinet6/ipcomp_output.c b/sys/netinet6/ipcomp_output.c index 1f1c75ada8..832996f93c 100644 --- a/sys/netinet6/ipcomp_output.c +++ b/sys/netinet6/ipcomp_output.c @@ -1,5 +1,4 @@ /* $FreeBSD: src/sys/netinet6/ipcomp_output.c,v 1.1.2.4 2003/04/29 08:33:50 suz Exp $ */ -/* $DragonFly: src/sys/netinet6/ipcomp_output.c,v 1.7 2004/06/02 14:43:01 eirikn Exp $ */ /* $KAME: ipcomp_output.c,v 1.25 2002/06/09 14:44:00 itojun Exp $ */ /* @@ -243,27 +242,16 @@ ipcomp_output(struct mbuf *m, u_char *nexthdrp, struct mbuf *md, #ifdef INET struct ip *ip = NULL; #endif -#ifdef INET6 - struct ip6_hdr *ip6 = NULL; -#endif - size_t hlen = 0; /* ip header len */ size_t complen = sizeof(struct ipcomp); switch (af) { #ifdef INET case AF_INET: ip = mtod(m, struct ip *); -#ifdef _IP_VHL - hlen = IP_VHL_HL(ip->ip_vhl) << 2; -#else - hlen = ip->ip_hl << 2; -#endif break; #endif #ifdef INET6 case AF_INET6: - ip6 = mtod(m, struct ip6_hdr *); - hlen = sizeof(*ip6); break; #endif } diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 4dda747aa7..91fa00ccf9 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -404,7 +404,6 @@ nd6_timer(void *ignored_arg) struct nd_prefix *pr; struct ifnet *ifp; struct in6_ifaddr *ia6, *nia6; - struct in6_addrlifetime *lt6; mtx_lock(&nd6_mtx); callout_reset(&nd6_timer_ch, nd6_prune * hz, @@ -537,7 +536,6 @@ addrloop: for (ia6 = in6_ifaddr; ia6; ia6 = nia6) { nia6 = ia6->ia_next; /* check address lifetime */ - lt6 = &ia6->ia6_lifetime; if (IFA6_IS_INVALID(ia6)) { int regen = 0; diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index 3e652d62b3..db399149a2 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -1338,7 +1338,6 @@ static void nd6_dad_ns_input(struct ifaddr *ifa) { struct in6_ifaddr *ia; - struct ifnet *ifp; const struct in6_addr *taddr6; struct dadq *dp; int duplicate; @@ -1347,7 +1346,6 @@ nd6_dad_ns_input(struct ifaddr *ifa) panic("ifa == NULL in nd6_dad_ns_input"); ia = (struct in6_ifaddr *)ifa; - ifp = ifa->ifa_ifp; taddr6 = &ia->ia_addr.sin6_addr; duplicate = 0; dp = nd6_dad_find(ifa); diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index 66e76b8446..f701042bbc 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -901,7 +901,6 @@ prelist_update(struct nd_prefix *new, struct nd_defrouter *dr, struct mbuf *m) struct ifnet *ifp = new->ndpr_ifp; struct nd_prefix *pr; int error = 0; - int newprefix = 0; int auth; struct in6_addrlifetime lt6_tmp; @@ -961,8 +960,6 @@ prelist_update(struct nd_prefix *new, struct nd_defrouter *dr, struct mbuf *m) } else { struct nd_prefix *newpr = NULL; - newprefix = 1; - if (new->ndpr_vltime == 0) goto end; if (new->ndpr_raf_onlink == 0 && new->ndpr_raf_auto == 0) diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index 5abeaa1941..a7aae8380f 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -289,9 +289,6 @@ rip6_ctlinput(netmsg_t msg) int cmd = msg->ctlinput.nm_cmd; struct sockaddr *sa = msg->ctlinput.nm_arg; void *d = msg->ctlinput.nm_extra; - struct ip6_hdr *ip6; - struct mbuf *m; - int off = 0; struct ip6ctlparam *ip6cp = NULL; const struct sockaddr_in6 *sa6_src = NULL; void (*notify) (struct inpcb *, int) = in6_rtchange; @@ -312,13 +309,8 @@ rip6_ctlinput(netmsg_t msg) /* if the parameter is from icmp6, decode it. */ if (d != NULL) { ip6cp = (struct ip6ctlparam *)d; - m = ip6cp->ip6c_m; - ip6 = ip6cp->ip6c_ip6; - off = ip6cp->ip6c_off; sa6_src = ip6cp->ip6c_src; } else { - m = NULL; - ip6 = NULL; sa6_src = &sa6_any; } diff --git a/sys/netinet6/sctp6_usrreq.c b/sys/netinet6/sctp6_usrreq.c index 89686e1efd..6e7c6be756 100644 --- a/sys/netinet6/sctp6_usrreq.c +++ b/sys/netinet6/sctp6_usrreq.c @@ -1065,7 +1065,6 @@ sctp6_send(netmsg_t msg) struct mbuf *control = msg->send.nm_control; struct sockaddr *addr = msg->send.nm_addr; struct sctp_inpcb *inp; - struct inpcb *in_inp; struct in6pcb *inp6; int flags = msg->send.nm_flags; #ifdef INET @@ -1084,7 +1083,6 @@ sctp6_send(netmsg_t msg) error = EINVAL; goto out; } - in_inp = (struct inpcb *)inp; inp6 = (struct in6pcb *)inp; /* For the TCP model we may get a NULL addr, if we * are a connected socket thats ok. -- 2.41.0