From 3cc9960fd1b52e850d61e0fdab1cf2cb1a9f3735 Mon Sep 17 00:00:00 2001 From: julian Date: Fri, 7 Sep 2001 07:19:12 +0000 Subject: 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 / Obtained from: KAME --- sys/net/if_stf.c | 13 +++---------- sys/net/if_stf.h | 2 +- sys/netinet/ip_encap.c | 15 +++------------ sys/netinet/ip_encap.h | 2 +- sys/netinet6/ah.h | 2 +- sys/netinet6/ah_input.c | 18 +++++------------- sys/netinet6/esp.h | 2 +- sys/netinet6/esp_input.c | 17 ++++------------- sys/netinet6/ipcomp.h | 2 +- sys/netinet6/ipcomp_input.c | 17 ++++------------- 10 files changed, 24 insertions(+), 66 deletions(-) (limited to 'sys') diff --git a/sys/net/if_stf.c b/sys/net/if_stf.c index e6947a1..c553967 100644 --- a/sys/net/if_stf.c +++ b/sys/net/if_stf.c @@ -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); diff --git a/sys/net/if_stf.h b/sys/net/if_stf.h index 258f3a0..67bb2f1 100644 --- a/sys/net/if_stf.h +++ b/sys/net/if_stf.h @@ -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_ */ diff --git a/sys/netinet/ip_encap.c b/sys/netinet/ip_encap.c index 2476d71..e3844df 100644 --- a/sys/netinet/ip_encap.c +++ b/sys/netinet/ip_encap.c @@ -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; diff --git a/sys/netinet/ip_encap.h b/sys/netinet/ip_encap.h index 38df6f9..94f534b 100644 --- a/sys/netinet/ip_encap.h +++ b/sys/netinet/ip_encap.h @@ -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 *, diff --git a/sys/netinet6/ah.h b/sys/netinet6/ah.h index 0846466..e804653 100644 --- a/sys/netinet6/ah.h +++ b/sys/netinet6/ah.h @@ -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 *)); diff --git a/sys/netinet6/ah_input.c b/sys/netinet6/ah_input.c index 4ee2a99..63605d0 100644 --- a/sys/netinet6/ah_input.c +++ b/sys/netinet6/ah_input.c @@ -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;" diff --git a/sys/netinet6/esp.h b/sys/netinet6/esp.h index 6f794a8..320e994 100644 --- a/sys/netinet6/esp.h +++ b/sys/netinet6/esp.h @@ -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 *)); diff --git a/sys/netinet6/esp_input.c b/sys/netinet6/esp_input.c index af12ec0..c235d99 100644 --- a/sys/netinet6/esp_input.c +++ b/sys/netinet6/esp_input.c @@ -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; diff --git a/sys/netinet6/ipcomp.h b/sys/netinet6/ipcomp.h index 08d62da..4c69d58 100644 --- a/sys/netinet6/ipcomp.h +++ b/sys/netinet6/ipcomp.h @@ -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*/ diff --git a/sys/netinet6/ipcomp_input.c b/sys/netinet6/ipcomp_input.c index f3143d2..ece1603 100644 --- a/sys/netinet6/ipcomp_input.c +++ b/sys/netinet6/ipcomp_input.c @@ -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; -- cgit v1.1