Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netipsec - apply some __diagused



details:   https://anonhg.NetBSD.org/src/rev/2ea5164ba220
branches:  trunk
changeset: 791077:2ea5164ba220
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Nov 03 18:37:10 2013 +0000

description:
- apply some __diagused
- remove unused variables
- move some variables inside their relevant use #ifdef

diffstat:

 sys/netipsec/ipsec_input.c  |   6 +++---
 sys/netipsec/ipsec_output.c |  10 ++++++----
 sys/netipsec/key.c          |   6 ++----
 sys/netipsec/xform_ah.c     |  13 +++----------
 sys/netipsec/xform_esp.c    |  11 ++++-------
 sys/netipsec/xform_ipcomp.c |  11 +++--------
 6 files changed, 21 insertions(+), 36 deletions(-)

diffs (262 lines):

diff -r 8984a7f4478f -r 2ea5164ba220 sys/netipsec/ipsec_input.c
--- a/sys/netipsec/ipsec_input.c        Sun Nov 03 14:45:50 2013 +0000
+++ b/sys/netipsec/ipsec_input.c        Sun Nov 03 18:37:10 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ipsec_input.c,v 1.30 2013/06/04 22:47:37 christos Exp $        */
+/*     $NetBSD: ipsec_input.c,v 1.31 2013/11/03 18:37:10 mrg Exp $     */
 /*     $FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/netipsec/ipsec_input.c,v 1.2.4.2 2003/03/28 20:32:53 sam Exp $ */
 /*     $OpenBSD: ipsec_input.c,v 1.63 2003/02/20 18:35:43 deraadt Exp $        */
 
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipsec_input.c,v 1.30 2013/06/04 22:47:37 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_input.c,v 1.31 2013/11/03 18:37:10 mrg Exp $");
 
 /*
  * IPsec input processing.
@@ -278,7 +278,7 @@
 ipsec4_common_input_cb(struct mbuf *m, struct secasvar *sav,
     int skip, int protoff, struct m_tag *mt)
 {
-       int prot, af, sproto;
+       int prot, af __diagused, sproto;
        struct ip *ip;
        struct m_tag *mtag;
        struct tdb_ident *tdbi;
diff -r 8984a7f4478f -r 2ea5164ba220 sys/netipsec/ipsec_output.c
--- a/sys/netipsec/ipsec_output.c       Sun Nov 03 14:45:50 2013 +0000
+++ b/sys/netipsec/ipsec_output.c       Sun Nov 03 18:37:10 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ipsec_output.c,v 1.39 2013/06/04 22:47:37 christos Exp $       */
+/*     $NetBSD: ipsec_output.c,v 1.40 2013/11/03 18:37:10 mrg Exp $    */
 
 /*-
  * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipsec_output.c,v 1.39 2013/06/04 22:47:37 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_output.c,v 1.40 2013/11/03 18:37:10 mrg Exp $");
 
 /*
  * IPsec output processing.
@@ -119,7 +119,9 @@
 ipsec_reinject_ipstack(struct mbuf *m, int af)
 {
 #ifdef INET
-       struct ip * ip;
+#ifdef __FreeBSD__
+       struct ip *ip;
+#endif /* __FreeBSD_ */
 #endif /* INET */
 #if defined(INET) || defined(INET6)
        int rv;
@@ -128,8 +130,8 @@
        switch (af) {
 #ifdef INET
        case AF_INET:
+#ifdef __FreeBSD__
                ip = mtod(m, struct ip *);
-#ifdef __FreeBSD__
                /* FreeBSD ip_output() expects ip_len, ip_off in host endian */
                ip->ip_len = ntohs(ip->ip_len);
                ip->ip_off = ntohs(ip->ip_off);
diff -r 8984a7f4478f -r 2ea5164ba220 sys/netipsec/key.c
--- a/sys/netipsec/key.c        Sun Nov 03 14:45:50 2013 +0000
+++ b/sys/netipsec/key.c        Sun Nov 03 18:37:10 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: key.c,v 1.83 2013/09/19 19:29:35 christos Exp $        */
+/*     $NetBSD: key.c,v 1.84 2013/11/03 18:37:10 mrg Exp $     */
 /*     $FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $        */
 /*     $KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $   */
 
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.83 2013/09/19 19:29:35 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.84 2013/11/03 18:37:10 mrg Exp $");
 
 /*
  * This code is referd to RFC 2367
@@ -7261,7 +7261,6 @@
 {
        struct sadb_msg *msg;
        struct sadb_msghdr mh;
-       u_int orglen;
        int error;
        int target;
 
@@ -7281,7 +7280,6 @@
                        return ENOBUFS;
        }
        msg = mtod(m, struct sadb_msg *);
-       orglen = PFKEY_UNUNIT64(msg->sadb_msg_len);
        target = KEY_SENDUP_ONE;
 
        if ((m->m_flags & M_PKTHDR) == 0 ||
diff -r 8984a7f4478f -r 2ea5164ba220 sys/netipsec/xform_ah.c
--- a/sys/netipsec/xform_ah.c   Sun Nov 03 14:45:50 2013 +0000
+++ b/sys/netipsec/xform_ah.c   Sun Nov 03 18:37:10 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xform_ah.c,v 1.41 2013/08/28 15:24:41 riastradh Exp $  */
+/*     $NetBSD: xform_ah.c,v 1.42 2013/11/03 18:37:10 mrg Exp $        */
 /*     $FreeBSD: src/sys/netipsec/xform_ah.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $   */
 /*     $OpenBSD: ip_ah.c,v 1.63 2001/06/26 06:18:58 angelos Exp $ */
 /*
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.41 2013/08/28 15:24:41 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.42 2013/11/03 18:37:10 mrg Exp $");
 
 #include "opt_inet.h"
 #ifdef __FreeBSD__
@@ -818,8 +818,6 @@
        int rplen, error, skip, protoff;
        unsigned char calc[AH_ALEN_MAX];
        struct mbuf *m;
-       struct cryptodesc *crd;
-       const struct auth_hash *ahx;
        struct tdb_crypto *tc;
        struct m_tag *mtag;
        struct secasvar *sav;
@@ -830,8 +828,6 @@
        u_int16_t dport;
        u_int16_t sport;
 
-       crd = crp->crp_desc;
-
        tc = (struct tdb_crypto *) crp->crp_opaque;
        IPSEC_ASSERT(tc != NULL, ("ah_input_cb: null opaque crypto data area!"));
        skip = tc->tc_skip;
@@ -861,8 +857,6 @@
                ("ah_input_cb: unexpected protocol family %u",
                 saidx->dst.sa.sa_family));
 
-       ahx = sav->tdb_authalgxform;
-
        /* Check for crypto errors. */
        if (crp->crp_etype) {
                if (sav->tdb_cryptoid != 0)
@@ -1235,7 +1229,7 @@
 static int
 ah_output_cb(struct cryptop *crp)
 {
-       int skip, protoff, error;
+       int skip, error;
        struct tdb_crypto *tc;
        struct ipsecrequest *isr;
        struct secasvar *sav;
@@ -1246,7 +1240,6 @@
        tc = (struct tdb_crypto *) crp->crp_opaque;
        IPSEC_ASSERT(tc != NULL, ("ah_output_cb: null opaque data area!"));
        skip = tc->tc_skip;
-       protoff = tc->tc_protoff;
        ptr = (tc + 1);
        m = (struct mbuf *) crp->crp_buf;
 
diff -r 8984a7f4478f -r 2ea5164ba220 sys/netipsec/xform_esp.c
--- a/sys/netipsec/xform_esp.c  Sun Nov 03 14:45:50 2013 +0000
+++ b/sys/netipsec/xform_esp.c  Sun Nov 03 18:37:10 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xform_esp.c,v 1.44 2013/08/28 15:24:41 riastradh Exp $ */
+/*     $NetBSD: xform_esp.c,v 1.45 2013/11/03 18:37:10 mrg Exp $       */
 /*     $FreeBSD: src/sys/netipsec/xform_esp.c,v 1.2.2.1 2003/01/24 05:11:36 sam Exp $  */
 /*     $OpenBSD: ip_esp.c,v 1.69 2001/06/26 06:18:59 angelos Exp $ */
 
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.44 2013/08/28 15:24:41 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.45 2013/11/03 18:37:10 mrg Exp $");
 
 #include "opt_inet.h"
 #ifdef __FreeBSD__
@@ -503,9 +503,8 @@
        u_int8_t lastthree[3], aalg[AH_ALEN_MAX];
        int s, hlen, skip, protoff, error;
        struct mbuf *m;
-       struct cryptodesc *crd;
+       struct cryptodesc *crd __diagused;
        const struct auth_hash *esph;
-       const struct enc_xform *espx;
        struct tdb_crypto *tc;
        struct m_tag *mtag;
        struct secasvar *sav;
@@ -547,7 +546,6 @@
                 saidx->dst.sa.sa_family));
 
        esph = sav->tdb_authalgxform;
-       espx = sav->tdb_encalgxform;
 
        /* Check for crypto errors */
        if (crp->crp_etype) {
@@ -719,7 +717,7 @@
 {
        const struct enc_xform *espx;
        const struct auth_hash *esph;
-       int hlen, rlen, plen, padding, blks, alen, i, roff;
+       int hlen, rlen, padding, blks, alen, i, roff;
        struct mbuf *mo = NULL;
        struct tdb_crypto *tc;
        const struct secasvar *sav;
@@ -753,7 +751,6 @@
 
        /* XXX clamp padding length a la KAME??? */
        padding = ((blks - ((rlen + 2) % blks)) % blks) + 2;
-       plen = rlen + padding;          /* Padded payload length. */
 
        if (esph)
                alen = esph->authsize;
diff -r 8984a7f4478f -r 2ea5164ba220 sys/netipsec/xform_ipcomp.c
--- a/sys/netipsec/xform_ipcomp.c       Sun Nov 03 14:45:50 2013 +0000
+++ b/sys/netipsec/xform_ipcomp.c       Sun Nov 03 18:37:10 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xform_ipcomp.c,v 1.30 2013/06/04 22:47:37 christos Exp $       */
+/*     $NetBSD: xform_ipcomp.c,v 1.31 2013/11/03 18:37:10 mrg Exp $    */
 /*     $FreeBSD: src/sys/netipsec/xform_ipcomp.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $       */
 /* $OpenBSD: ip_ipcomp.c,v 1.1 2001/07/05 12:08:52 jjbg Exp $ */
 
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xform_ipcomp.c,v 1.30 2013/06/04 22:47:37 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ipcomp.c,v 1.31 2013/11/03 18:37:10 mrg Exp $");
 
 /* IP payload compression protocol (IPComp), see RFC 2393 */
 #include "opt_inet.h"
@@ -233,26 +233,21 @@
 static int
 ipcomp_input_cb(struct cryptop *crp)
 {
-       struct cryptodesc *crd;
        struct tdb_crypto *tc;
        int skip, protoff;
-       struct mtag *mtag;
        struct mbuf *m;
        struct secasvar *sav;
-       struct secasindex *saidx;
+       struct secasindex *saidx __diagused;
        int s, hlen = IPCOMP_HLENGTH, error, clen;
        u_int8_t nproto;
        void *addr;
        u_int16_t dport;
        u_int16_t sport;
 
-       crd = crp->crp_desc;
-
        tc = (struct tdb_crypto *) crp->crp_opaque;
        IPSEC_ASSERT(tc != NULL, ("ipcomp_input_cb: null opaque crypto data area!"));
        skip = tc->tc_skip;
        protoff = tc->tc_protoff;
-       mtag = (struct mtag *) tc->tc_ptr;
        m = (struct mbuf *) crp->crp_buf;
 
        /* find the source port for NAT-T */



Home | Main Index | Thread Index | Old Index