From ff01feea1bfb3f6883d104c2010696eec200620f Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Tue, 11 Sep 2012 10:39:21 +0200 Subject: [PATCH] kernel/inet: Remove some unused variables. --- sys/netinet/ip_demux.c | 2 -- sys/netinet/ip_encap.c | 30 ++++++------------------------ sys/netinet/ip_input.c | 2 -- sys/netinet/raw_ip.c | 2 -- 4 files changed, 6 insertions(+), 30 deletions(-) diff --git a/sys/netinet/ip_demux.c b/sys/netinet/ip_demux.c index c92a79bf48..6e081c6fa1 100644 --- a/sys/netinet/ip_demux.c +++ b/sys/netinet/ip_demux.c @@ -271,7 +271,6 @@ ip_cpufn(struct mbuf **mptr, int hoff, int dir) struct tcphdr *th; struct udphdr *uh; struct mbuf *m; - int thoff; /* TCP data offset */ int cpu; if (!ip_lengthcheck(mptr, hoff)) @@ -292,7 +291,6 @@ ip_cpufn(struct mbuf **mptr, int hoff, int dir) switch (ip->ip_p) { case IPPROTO_TCP: th = (struct tcphdr *)((caddr_t)ip + iphlen); - thoff = th->th_off << 2; cpu = INP_MPORT_HASH_TCP(ip->ip_src.s_addr, ip->ip_dst.s_addr, th->th_sport, diff --git a/sys/netinet/ip_encap.c b/sys/netinet/ip_encap.c index cfdd03fb2b..6d1a404ce8 100644 --- a/sys/netinet/ip_encap.c +++ b/sys/netinet/ip_encap.c @@ -1,5 +1,4 @@ /* $FreeBSD: src/sys/netinet/ip_encap.c,v 1.1.2.5 2003/01/23 21:06:45 sam Exp $ */ -/* $DragonFly: src/sys/netinet/ip_encap.c,v 1.15 2006/09/05 00:55:48 dillon Exp $ */ /* $KAME: ip_encap.c,v 1.41 2001/03/15 08:35:08 itojun Exp $ */ /* @@ -308,22 +307,15 @@ encap_attach(int af, int proto, const struct sockaddr *sp, const struct sockaddr *dm, const struct protosw *psw, void *arg) { struct encaptab *ep; - int error; crit_enter(); /* sanity check on args */ - if (sp->sa_len > sizeof ep->src || dp->sa_len > sizeof ep->dst) { - error = EINVAL; + if (sp->sa_len > sizeof ep->src || dp->sa_len > sizeof ep->dst) goto fail; - } - if (sp->sa_len != dp->sa_len) { - error = EINVAL; + if (sp->sa_len != dp->sa_len) goto fail; - } - if (af != sp->sa_family || af != dp->sa_family) { - error = EINVAL; + if (af != sp->sa_family || af != dp->sa_family) goto fail; - } /* check if anyone have already attached with exactly same config */ for (ep = LIST_FIRST(&encaptab); ep; ep = LIST_NEXT(ep, chain)) { @@ -340,15 +332,12 @@ encap_attach(int af, int proto, const struct sockaddr *sp, bcmp(&ep->dstmask, dm, dp->sa_len) != 0) continue; - error = EEXIST; goto fail; } ep = kmalloc(sizeof *ep, M_NETADDR, M_INTWAIT | M_ZERO | M_NULLOK); - if (ep == NULL) { - error = ENOBUFS; + if (ep == NULL) goto fail; - } ep->af = af; ep->proto = proto; @@ -361,7 +350,6 @@ encap_attach(int af, int proto, const struct sockaddr *sp, encap_add(ep); - error = 0; crit_exit(); return ep; @@ -376,20 +364,15 @@ encap_attach_func(int af, int proto, const struct protosw *psw, void *arg) { struct encaptab *ep; - int error; crit_enter(); /* sanity check on args */ - if (!func) { - error = EINVAL; + if (!func) goto fail; - } ep = kmalloc(sizeof *ep, M_NETADDR, M_INTWAIT | M_ZERO | M_NULLOK); - if (ep == NULL) { - error = ENOBUFS; + if (ep == NULL) goto fail; - } ep->af = af; ep->proto = proto; @@ -399,7 +382,6 @@ encap_attach_func(int af, int proto, encap_add(ep); - error = 0; crit_exit(); return ep; diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 8b16dccb19..72d585cfae 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -2249,9 +2249,7 @@ int rsvp_input(struct mbuf **mp, int *offp, int proto) { struct mbuf *m = *mp; - int off; - off = *offp; *mp = NULL; if (rsvp_input_p) { /* call the real one if loaded */ diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index c63627c83c..357c48c442 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -157,9 +157,7 @@ rip_input(struct mbuf **mp, int *offp, int proto) struct inpcb *inp; struct inpcb *last = NULL; struct mbuf *opts = NULL; - int off; - off = *offp; *mp = NULL; ripsrc.sin_addr = ip->ip_src; -- 2.41.0