Hi all,

At first, I told a lie in one point,

> We had removed all the varargs input/output functions from the
> IPv4/IPv6 stacks of the KAME repositry.  These modifications will
> make

We removed all the varargs functions from the IPv4 stack (#ifdef'ed
for FreeBSD), but preserved for the IPv6 stack.  This is for our
inter-OS source code maintainancability.  We share all the IPv6 code
among the *BSDs.  Since we are developing the IPv6 stack actively now,
it is important for us to reduce the difference among several OSes.

Anyway, as we don't have any varargs input/output functions in FreeBSD
code any more, some of annoying warning messages have disappeared.

> it easier to import KAME code into FreeBSD4/5.  Now we are testing the
> code with KAME/FreeBSD4 and it looks OK.  I will soon make a patch for
> FreeBSD5 and post it to the related mailing lists for review.

Please look into the attached patch for FreeBSD-current.

---
Keiichi SHIMA <[EMAIL PROTECTED]>
IIJ Research Laboratory / KAME Project


diff -ur sys.orig/net/if_stf.c sys/net/if_stf.c
--- sys.orig/net/if_stf.c       Tue Sep  4 15:25:24 2001
+++ sys/net/if_stf.c    Wed Sep  5 10:22:33 2001
@@ -530,14 +530,11 @@
 }
 
 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 @@
        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 -ur sys.orig/net/if_stf.h sys/net/if_stf.h
--- sys.orig/net/if_stf.h       Wed Jul  5 01:35:04 2000
+++ sys/net/if_stf.h    Wed Sep  5 10:22:45 2001
@@ -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 -ur sys.orig/netinet/ip_encap.c sys/netinet/ip_encap.c
--- sys.orig/netinet/ip_encap.c Tue Sep  4 15:25:28 2001
+++ sys/netinet/ip_encap.c      Wed Sep  5 10:11:26 2001
@@ -127,25 +127,16 @@
 
 #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 -ur sys.orig/netinet/ip_encap.h sys/netinet/ip_encap.h
--- sys.orig/netinet/ip_encap.h Wed Jul  5 01:35:05 2000
+++ sys/netinet/ip_encap.h      Tue Sep  4 15:51:33 2001
@@ -49,7 +49,7 @@
 };
 
 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 -ur sys.orig/netinet6/ah.h sys/netinet6/ah.h
--- sys.orig/netinet6/ah.h      Mon Jun 11 21:39:03 2001
+++ sys/netinet6/ah.h   Wed Sep  5 10:08:12 2001
@@ -85,7 +85,7 @@
 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 -ur sys.orig/netinet6/ah_input.c sys/netinet6/ah_input.c
--- sys.orig/netinet6/ah_input.c        Tue Sep  4 15:25:32 2001
+++ sys/netinet6/ah_input.c     Wed Sep  5 10:12:09 2001
@@ -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 @@
        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 @@
        }
 
        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 -ur sys.orig/netinet6/esp.h sys/netinet6/esp.h
--- sys.orig/netinet6/esp.h     Mon Jun 11 21:39:04 2001
+++ sys/netinet6/esp.h  Wed Sep  5 10:09:28 2001
@@ -98,7 +98,7 @@
 
 /* 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 -ur sys.orig/netinet6/esp_input.c sys/netinet6/esp_input.c
--- sys.orig/netinet6/esp_input.c       Tue Sep  4 15:25:32 2001
+++ sys/netinet6/esp_input.c    Wed Sep  5 10:12:24 2001
@@ -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 @@
        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 @@
        }
 
        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 -ur sys.orig/netinet6/ipcomp.h sys/netinet6/ipcomp.h
--- sys.orig/netinet6/ipcomp.h  Mon Jun 11 21:39:06 2001
+++ sys/netinet6/ipcomp.h       Wed Sep  5 10:10:34 2001
@@ -64,7 +64,7 @@
 
 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 -ur sys.orig/netinet6/ipcomp_input.c sys/netinet6/ipcomp_input.c
--- sys.orig/netinet6/ipcomp_input.c    Tue Sep  4 15:25:32 2001
+++ sys/netinet6/ipcomp_input.c Wed Sep  5 10:10:24 2001
@@ -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 @@
        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 @@
        }
        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;

Reply via email to