- apply some __diagused

- remove unused variables
- move some variables inside their relevant use #ifdef
This commit is contained in:
mrg 2013-11-03 18:37:10 +00:00
parent b4ab7d1288
commit a370d57c87
6 changed files with 21 additions and 36 deletions

View File

@ -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 @@ int
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;

View File

@ -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 @@ static int
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 @@ ipsec_reinject_ipstack(struct mbuf *m, int af)
switch (af) {
#ifdef INET
case AF_INET:
ip = mtod(m, struct ip *);
#ifdef __FreeBSD__
ip = mtod(m, struct ip *);
/* 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);

View File

@ -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 @@ key_parse(struct mbuf *m, struct socket *so)
{
struct sadb_msg *msg;
struct sadb_msghdr mh;
u_int orglen;
int error;
int target;
@ -7281,7 +7280,6 @@ key_parse(struct mbuf *m, struct socket *so)
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 ||

View File

@ -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 @@ ah_input_cb(struct cryptop *crp)
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 @@ ah_input_cb(struct cryptop *crp)
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(struct cryptop *crp)
("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 @@ bad:
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 @@ ah_output_cb(struct cryptop *crp)
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;

View File

@ -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 @@ esp_input_cb(struct cryptop *crp)
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 @@ esp_input_cb(struct cryptop *crp)
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 @@ esp_output(
{
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 @@ esp_output(
/* 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;

View File

@ -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 @@ ipcomp_input(struct mbuf *m, const struct secasvar *sav, int skip, int protoff)
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 */