Patches from KAME to remove usage of Varargs in existing

IPV4 code. For now they will still have some in the developing stuff (IPv6)

Submitted by:	Keiichi SHIMA / <keiichi@iij.ad.jp>
Obtained from:	KAME
This commit is contained in:
julian 2001-09-07 07:19:12 +00:00
parent f307b418db
commit 3cc9960fd1
10 changed files with 24 additions and 66 deletions

View File

@ -530,14 +530,11 @@ stf_checkaddr6(sc, in6, inifp)
}
void
#if __STDC__
in_stf_input(struct mbuf *m, ...)
#else
in_stf_input(m, va_alist)
in_stf_input(m, off)
struct mbuf *m;
#endif
int off;
{
int off, proto;
int proto;
struct stf_softc *sc;
struct ip *ip;
struct ip6_hdr *ip6;
@ -545,12 +542,8 @@ in_stf_input(m, va_alist)
int len, isr;
struct ifqueue *ifq = NULL;
struct ifnet *ifp;
va_list ap;
va_start(ap, m);
off = va_arg(ap, int);
proto = mtod(m, struct ip *)->ip_p;
va_end(ap);
if (proto != IPPROTO_IPV6) {
m_freem(m);

View File

@ -33,6 +33,6 @@
#ifndef _NET_IF_STF_H_
#define _NET_IF_STF_H_
void in_stf_input __P((struct mbuf *, ...));
void in_stf_input __P((struct mbuf *, int));
#endif /* _NET_IF_STF_H_ */

View File

@ -127,26 +127,17 @@ encap_init()
#ifdef INET
void
#if __STDC__
encap4_input(struct mbuf *m, ...)
#else
encap4_input(m, va_alist)
encap4_input(m, off)
struct mbuf *m;
va_dcl
#endif
int off;
{
int off, proto;
struct ip *ip;
int proto;
struct sockaddr_in s, d;
const struct protosw *psw;
struct encaptab *ep, *match;
va_list ap;
int prio, matchprio;
va_start(ap, m);
off = va_arg(ap, int);
va_end(ap);
ip = mtod(m, struct ip *);
proto = ip->ip_p;

View File

@ -49,7 +49,7 @@ struct encaptab {
};
void encap_init __P((void));
void encap4_input __P((struct mbuf *, ...));
void encap4_input __P((struct mbuf *, int));
int encap6_input __P((struct mbuf **, int *, int));
const struct encaptab *encap_attach __P((int, int, const struct sockaddr *,
const struct sockaddr *, const struct sockaddr *,

View File

@ -85,7 +85,7 @@ extern const struct ah_algorithm *ah_algorithm_lookup __P((int));
extern int ah_hdrlen __P((struct secasvar *));
extern size_t ah_hdrsiz __P((struct ipsecrequest *));
extern void ah4_input __P((struct mbuf *, ...));
extern void ah4_input __P((struct mbuf *, int));
extern int ah4_output __P((struct mbuf *, struct ipsecrequest *));
extern int ah4_calccksum __P((struct mbuf *, caddr_t, size_t,
const struct ah_algorithm *, struct secasvar *));

View File

@ -97,13 +97,9 @@
extern struct protosw inetsw[];
void
#if __STDC__
ah4_input(struct mbuf *m, ...)
#else
ah4_input(m, va_alist)
ah4_input(m, off)
struct mbuf *m;
va_dcl
#endif
int off;
{
struct ip *ip;
struct ah *ah;
@ -115,15 +111,9 @@ ah4_input(m, va_alist)
struct secasvar *sav = NULL;
u_int16_t nxt;
size_t hlen;
int off, proto;
va_list ap;
int proto;
size_t stripsiz = 0;
va_start(ap, m);
off = va_arg(ap, int);
proto = mtod(m, struct ip *)->ip_p;
va_end(ap);
#ifndef PULLDOWN_TEST
if (m->m_len < off + sizeof(struct newah)) {
m = m_pullup(m, off + sizeof(struct newah));
@ -136,9 +126,11 @@ ah4_input(m, va_alist)
}
ip = mtod(m, struct ip *);
proto = ip->ip_p;
ah = (struct ah *)(((caddr_t)ip) + off);
#else
ip = mtod(m, struct ip *);
proto = ip->ip_p;
IP6_EXTHDR_GET(ah, struct ah *, m, off, sizeof(struct newah));
if (ah == NULL) {
ipseclog((LOG_DEBUG, "IPv4 AH input: can't pullup;"

View File

@ -98,7 +98,7 @@ extern int esp_max_ivlen __P((void));
/* crypt routines */
extern int esp4_output __P((struct mbuf *, struct ipsecrequest *));
extern void esp4_input __P((struct mbuf *, ...));
extern void esp4_input __P((struct mbuf *, int));
extern size_t esp_hdrsiz __P((struct ipsecrequest *));
extern int esp_schedule __P((const struct esp_algorithm *, struct secasvar *));

View File

@ -100,13 +100,9 @@
extern struct protosw inetsw[];
void
#if __STDC__
esp4_input(struct mbuf *m, ...)
#else
esp4_input(m, va_alist)
esp4_input(m, off)
struct mbuf *m;
va_dcl
#endif
int off;
{
struct ip *ip;
struct esp *esp;
@ -119,13 +115,7 @@ esp4_input(m, va_alist)
int ivlen;
size_t hlen;
size_t esplen;
va_list ap;
int off, proto;
va_start(ap, m);
off = va_arg(ap, int);
proto = mtod(m, struct ip *)->ip_p;
va_end(ap);
int proto;
/* sanity check for alignment. */
if (off % 4 != 0 || m->m_pkthdr.len % 4 != 0) {
@ -146,6 +136,7 @@ esp4_input(m, va_alist)
}
ip = mtod(m, struct ip *);
proto = ip->ip_p;
esp = (struct esp *)(((u_int8_t *)ip) + off);
#ifdef _IP_VHL
hlen = IP_VHL_HL(ip->ip_vhl) << 2;

View File

@ -64,7 +64,7 @@ struct ipcomp_algorithm {
struct ipsecrequest;
extern const struct ipcomp_algorithm *ipcomp_algorithm_lookup __P((int));
extern void ipcomp4_input __P((struct mbuf *, ...));
extern void ipcomp4_input __P((struct mbuf *, int));
extern int ipcomp4_output __P((struct mbuf *, struct ipsecrequest *));
#endif /*KERNEL*/

View File

@ -86,13 +86,9 @@
extern struct protosw inetsw[];
void
#if __STDC__
ipcomp4_input(struct mbuf *m, ...)
#else
ipcomp4_input(m, va_alist)
ipcomp4_input(m, off)
struct mbuf *m;
va_dcl
#endif
int off;
{
struct mbuf *md;
struct ip *ip;
@ -104,13 +100,7 @@ ipcomp4_input(m, va_alist)
int error;
size_t newlen, olen;
struct secasvar *sav = NULL;
int off, proto;
va_list ap;
va_start(ap, m);
off = va_arg(ap, int);
proto = mtod(m, struct ip *)->ip_p;
va_end(ap);
int proto;
if (m->m_pkthdr.len < off + sizeof(struct ipcomp)) {
ipseclog((LOG_DEBUG, "IPv4 IPComp input: assumption failed "
@ -129,6 +119,7 @@ ipcomp4_input(m, va_alist)
}
ipcomp = mtod(md, struct ipcomp *);
ip = mtod(m, struct ip *);
proto = ip->ip_p;
nxt = ipcomp->comp_nxt;
#ifdef _IP_VHL
hlen = IP_VHL_HL(ip->ip_vhl) << 2;