summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1996-03-03 21:07:23 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1996-03-03 21:07:23 +0000
commit4f317e580dfce2348ec5cfc05dfde20ed8440910 (patch)
treeeb3b13b1292e732a4b08fa5272c6479c351c7f42 /sys
parenta3761d430c4e4adef30c75ff09632e3f410acd58 (diff)
From NetBSD: 960217 merge
Diffstat (limited to 'sys')
-rw-r--r--sys/net/bpf.c40
-rw-r--r--sys/net/bpf.h9
-rw-r--r--sys/net/bpf_filter.c12
-rw-r--r--sys/net/bsd-comp.c20
-rw-r--r--sys/net/if.c26
-rw-r--r--sys/net/if.h6
-rw-r--r--sys/net/if_ethersubr.c35
-rw-r--r--sys/net/if_ppp.c46
-rw-r--r--sys/net/if_ppp.h16
-rw-r--r--sys/net/if_sl.c18
-rw-r--r--sys/net/if_tun.c64
-rw-r--r--sys/net/net_conf.h39
-rw-r--r--sys/net/ppp_tty.c27
-rw-r--r--sys/net/radix.c36
-rw-r--r--sys/net/radix.h9
-rw-r--r--sys/net/raw_cb.c5
-rw-r--r--sys/net/raw_cb.h9
-rw-r--r--sys/net/raw_usrreq.c33
-rw-r--r--sys/net/route.c13
-rw-r--r--sys/net/route.h21
-rw-r--r--sys/net/rtsock.c74
-rw-r--r--sys/net/slcompress.c13
22 files changed, 356 insertions, 215 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index aa3cadb62a2..0c6ce9efef1 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -1,4 +1,5 @@
-/* $NetBSD: bpf.c,v 1.23 1995/09/27 18:30:37 thorpej Exp $ */
+/* $OpenBSD: bpf.c,v 1.2 1996/03/03 21:07:00 niklas Exp $ */
+/* $NetBSD: bpf.c,v 1.24 1996/02/13 21:59:53 christos Exp $ */
/*
* Copyright (c) 1990, 1991, 1993
@@ -65,6 +66,7 @@
#include <net/bpf.h>
#include <net/bpfdesc.h>
+#include <net/net_conf.h>
#include <sys/errno.h>
@@ -122,13 +124,18 @@ static void bpf_ifname __P((struct ifnet *, struct ifreq *));
static void bpf_ifname __P((struct ifnet *, struct ifreq *));
static void bpf_mcopy __P((const void *, void *, size_t));
static int bpf_movein __P((struct uio *, int,
- struct mbuf **, struct sockaddr *));
+ struct mbuf **, struct sockaddr *));
+static void bpf_attachd __P((struct bpf_d *, struct bpf_if *));
+static void bpf_detachd __P((struct bpf_d *));
static int bpf_setif __P((struct bpf_d *, struct ifreq *));
static int bpf_setif __P((struct bpf_d *, struct ifreq *));
+#if BSD >= 199103
+int bpfselect __P((dev_t, int, struct proc *));
+#endif
static __inline void
bpf_wakeup __P((struct bpf_d *));
-static void catchpacket __P((struct bpf_d *, u_char *, size_t,
- size_t, void (*)(const void *, void *, size_t)));
+static void catchpacket __P((struct bpf_d *, u_char *, size_t, size_t,
+ void (*)(const void *, void *, size_t)));
static void reset_d __P((struct bpf_d *));
static int
@@ -317,9 +324,11 @@ bpf_detachd(d)
*/
/* ARGSUSED */
int
-bpfopen(dev, flag)
+bpfopen(dev, flag, mode, p)
dev_t dev;
int flag;
+ int mode;
+ struct proc *p;
{
register struct bpf_d *d;
@@ -347,9 +356,11 @@ bpfopen(dev, flag)
*/
/* ARGSUSED */
int
-bpfclose(dev, flag)
+bpfclose(dev, flag, mode, p)
dev_t dev;
int flag;
+ int mode;
+ struct proc *p;
{
register struct bpf_d *d = &bpf_dtab[minor(dev)];
register int s;
@@ -417,9 +428,10 @@ bpf_sleep(d)
* bpfread - read next chunk of packets from buffers
*/
int
-bpfread(dev, uio)
+bpfread(dev, uio, ioflag)
dev_t dev;
register struct uio *uio;
+ int ioflag;
{
register struct bpf_d *d = &bpf_dtab[minor(dev)];
int error;
@@ -514,7 +526,7 @@ bpf_wakeup(d)
if (d->bd_async && d->bd_sig)
if (d->bd_pgid > 0)
gsignal (d->bd_pgid, d->bd_sig);
- else if (p = pfind (-d->bd_pgid))
+ else if ((p = pfind (-d->bd_pgid)) != NULL)
psignal (p, d->bd_sig);
#if BSD >= 199103
@@ -531,9 +543,10 @@ bpf_wakeup(d)
}
int
-bpfwrite(dev, uio)
+bpfwrite(dev, uio, ioflag)
dev_t dev;
struct uio *uio;
+ int ioflag;
{
register struct bpf_d *d = &bpf_dtab[minor(dev)];
struct ifnet *ifp;
@@ -605,11 +618,12 @@ reset_d(d)
*/
/* ARGSUSED */
int
-bpfioctl(dev, cmd, addr, flag)
+bpfioctl(dev, cmd, addr, flag, p)
dev_t dev;
u_long cmd;
caddr_t addr;
int flag;
+ struct proc *p;
{
register struct bpf_d *d = &bpf_dtab[minor(dev)];
int s, error = 0;
@@ -959,11 +973,9 @@ bpf_ifname(ifp, ifr)
char *s = ifp->if_name;
char *d = ifr->ifr_name;
- while (*d++ = *s++)
+ while ((*d++ = *s++) != '\0')
continue;
- /* XXX Assume that unit number is less than 10. */
- *d++ = ifp->if_unit + '0';
- *d = '\0';
+ sprintf(d, "%d", ifp->if_unit);
}
/*
diff --git a/sys/net/bpf.h b/sys/net/bpf.h
index c2797fc3383..1b3427b61d8 100644
--- a/sys/net/bpf.h
+++ b/sys/net/bpf.h
@@ -1,4 +1,5 @@
-/* $NetBSD: bpf.h,v 1.12 1995/09/27 18:30:40 thorpej Exp $ */
+/* $OpenBSD: bpf.h,v 1.2 1996/03/03 21:07:02 niklas Exp $ */
+/* $NetBSD: bpf.h,v 1.13 1996/02/13 21:59:58 christos Exp $ */
/*
* Copyright (c) 1990, 1991, 1993
@@ -238,12 +239,6 @@ struct bpf_insn {
#ifdef _KERNEL
int bpf_validate __P((struct bpf_insn *, int));
-int bpfopen __P((dev_t, int));
-int bpfclose __P((dev_t, int));
-int bpfread __P((dev_t, struct uio *));
-int bpfwrite __P((dev_t, struct uio *));
-int bpfioctl __P((dev_t, u_long, caddr_t, int));
-int bpf_select __P((dev_t, int, struct proc *));
void bpf_tap __P((caddr_t, u_char *, u_int));
void bpf_mtap __P((caddr_t, struct mbuf *));
void bpfattach __P((caddr_t *, struct ifnet *, u_int, u_int));
diff --git a/sys/net/bpf_filter.c b/sys/net/bpf_filter.c
index aec0e275d0c..7042a50f702 100644
--- a/sys/net/bpf_filter.c
+++ b/sys/net/bpf_filter.c
@@ -1,4 +1,5 @@
-/* $NetBSD: bpf_filter.c,v 1.11 1995/04/22 13:26:39 cgd Exp $ */
+/* $OpenBSD: bpf_filter.c,v 1.3 1996/03/03 21:07:02 niklas Exp $ */
+/* $NetBSD: bpf_filter.c,v 1.12 1996/02/13 22:00:00 christos Exp $ */
/*
* Copyright (c) 1990, 1991, 1992, 1993
@@ -84,6 +85,9 @@
} \
}
+static int m_xword __P((struct mbuf *, int, int *));
+static int m_xhalf __P((struct mbuf *, int, int *));
+
static int
m_xword(m, k, err)
register struct mbuf *m;
@@ -160,7 +164,7 @@ bpf_filter(pc, p, wirelen, buflen)
u_int wirelen;
register u_int buflen;
{
- register u_int32_t A, X;
+ register u_int32_t A = 0, X = 0;
register int k;
int32_t mem[BPF_MEMWORDS];
@@ -169,10 +173,6 @@ bpf_filter(pc, p, wirelen, buflen)
* No filter means accept all.
*/
return (u_int)-1;
-#ifdef lint
- A = 0;
- X = 0;
-#endif
--pc;
while (1) {
++pc;
diff --git a/sys/net/bsd-comp.c b/sys/net/bsd-comp.c
index efe0f02df17..74b90ce1416 100644
--- a/sys/net/bsd-comp.c
+++ b/sys/net/bsd-comp.c
@@ -1,4 +1,5 @@
-/* $NetBSD: bsd-comp.c,v 1.1 1995/07/04 06:28:17 paulus Exp $ */
+/* $OpenBSD: bsd-comp.c,v 1.2 1996/03/03 21:07:03 niklas Exp $ */
+/* $NetBSD: bsd-comp.c,v 1.2 1996/02/13 22:00:03 christos Exp $ */
/* Because this code is derived from the 4.3BSD compress source:
*
@@ -42,11 +43,12 @@
/*
* This version is for use with mbufs on BSD-derived systems.
*
- * $Id: bsd-comp.c,v 1.1 1995/10/18 08:53:05 deraadt Exp $
+ * $Id: bsd-comp.c,v 1.2 1996/03/03 21:07:03 niklas Exp $
*/
#include <sys/param.h>
#include <sys/types.h>
+#include <sys/systm.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <net/if.h>
@@ -188,6 +190,12 @@ struct compressor ppp_bsd_compress = {
#define RATIO_SCALE (1<<RATIO_SCALE_LOG)
#define RATIO_MAX (0x7fffffff>>RATIO_SCALE_LOG)
+static void bsd_clear __P((struct bsd_db *));
+static int bsd_check __P((struct bsd_db *));
+static void *bsd_alloc __P((u_char *, int, int));
+static int bsd_init __P((struct bsd_db *, u_char *, int, int, int, int,
+ int, int));
+
/*
* clear the dictionary
*/
@@ -411,7 +419,7 @@ bsd_init(db, options, opt_len, unit, hdrlen, mru, debug, decomp)
|| options[1] != CILEN_BSD_COMPRESS
|| BSD_VERSION(options[2]) != BSD_CURRENT_VERSION
|| BSD_NBITS(options[2]) != db->maxbits
- || decomp && db->lens == NULL)
+ || (decomp && db->lens == NULL))
return 0;
if (decomp) {
@@ -481,11 +489,10 @@ bsd_compress(state, mret, mp, slen, maxolen)
struct bsd_dict *dictp;
u_char c;
int hval, disp, ent, ilen;
- struct mbuf *np;
u_char *rptr, *wptr;
u_char *cp_end;
int olen;
- struct mbuf *m, **mnp;
+ struct mbuf *m;
#define PUTBYTE(v) { \
++olen; \
@@ -831,7 +838,6 @@ bsd_decompress(state, cmp, dmpp)
struct mbuf *m, *dmp, *mret;
int adrs, ctrl, ilen;
int space, codelen, extra;
- struct mbuf *last;
/*
* Save the address/control from the PPP header
@@ -941,7 +947,7 @@ bsd_decompress(state, cmp, dmpp)
}
if (incode > max_ent + 2 || incode > db->maxmaxcode
- || incode > max_ent && oldcode == CLEAR) {
+ || (incode > max_ent && oldcode == CLEAR)) {
m_freem(mret);
if (db->debug) {
printf("bsd_decomp%d: bad code 0x%x oldcode=0x%x ",
diff --git a/sys/net/if.c b/sys/net/if.c
index ccaad549bae..e45710b4202 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,5 @@
-/* $NetBSD: if.c,v 1.23 1995/08/12 23:59:19 mycroft Exp $ */
+/* $OpenBSD: if.c,v 1.4 1996/03/03 21:07:04 niklas Exp $ */
+/* $NetBSD: if.c,v 1.24 1996/02/13 22:00:09 christos Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@@ -48,6 +49,7 @@
#include <net/if.h>
#include <net/if_dl.h>
#include <net/if_types.h>
+#include <net/radix.h>
int ifqmaxlen = IFQ_MAXLEN;
void if_slowtimo __P((void *arg));
@@ -87,7 +89,6 @@ if_attach(ifp)
register struct sockaddr_dl *sdl;
register struct ifaddr *ifa;
static int if_indexlim = 8;
- extern void link_rtrequest();
if (if_index == 0)
TAILQ_INIT(&ifnet);
@@ -306,7 +307,7 @@ link_rtrequest(cmd, rt, sa)
if (cmd != RTM_ADD || ((ifa = rt->rt_ifa) == 0) ||
((ifp = ifa->ifa_ifp) == 0) || ((dst = rt_key(rt)) == 0))
return;
- if (ifa = ifaof_ifpforaddr(dst, ifp)) {
+ if ((ifa = ifaof_ifpforaddr(dst, ifp)) != NULL) {
IFAFREE(rt->rt_ifa);
rt->rt_ifa = ifa;
ifa->ifa_refcnt++;
@@ -342,12 +343,15 @@ void
if_up(ifp)
register struct ifnet *ifp;
{
+#ifdef notyet
register struct ifaddr *ifa;
+#endif
ifp->if_flags |= IFF_UP;
#ifdef notyet
/* this has no effect on IP, and will kill all ISO connections XXX */
- for (ifa = ifp->if_addrlist.tqh_first; ifa != 0; ifa = ifa->ifa_list.tqe_next)
+ for (ifa = ifp->if_addrlist.tqh_first; ifa != 0;
+ ifa = ifa->ifa_list.tqe_next)
pfctlinput(PRC_IFUP, ifa->ifa_addr);
#endif
rt_ifmsg(ifp);
@@ -363,7 +367,7 @@ if_qflush(ifq)
register struct mbuf *m, *n;
n = ifq->ifq_head;
- while (m = n) {
+ while ((m = n) != NULL) {
n = m->m_act;
m_freem(m);
}
@@ -469,7 +473,7 @@ ifioctl(so, cmd, data, p)
break;
case SIOCSIFFLAGS:
- if (error = suser(p->p_ucred, &p->p_acflag))
+ if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
return (error);
if (ifp->if_flags & IFF_UP && (ifr->ifr_flags & IFF_UP) == 0) {
int s = splimp();
@@ -488,14 +492,14 @@ ifioctl(so, cmd, data, p)
break;
case SIOCSIFMETRIC:
- if (error = suser(p->p_ucred, &p->p_acflag))
+ if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
return (error);
ifp->if_metric = ifr->ifr_metric;
break;
case SIOCADDMULTI:
case SIOCDELMULTI:
- if (error = suser(p->p_ucred, &p->p_acflag))
+ if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
return (error);
if (ifp->if_ioctl == 0)
return (EOPNOTSUPP);
@@ -544,8 +548,10 @@ ifioctl(so, cmd, data, p)
case OSIOCGIFNETMASK:
cmd = SIOCGIFNETMASK;
}
- error = ((*so->so_proto->pr_usrreq)(so, PRU_CONTROL,
- cmd, data, ifp));
+ error = ((*so->so_proto->pr_usrreq)(so, PRU_CONTROL,
+ (struct mbuf *) cmd,
+ (struct mbuf *) data,
+ (struct mbuf *) ifp));
switch (ocmd) {
case OSIOCGIFADDR:
diff --git a/sys/net/if.h b/sys/net/if.h
index dada588d55b..abe87a38015 100644
--- a/sys/net/if.h
+++ b/sys/net/if.h
@@ -1,4 +1,5 @@
-/* $NetBSD: if.h,v 1.19 1995/06/19 21:57:28 cgd Exp $ */
+/* $OpenBSD: if.h,v 1.2 1996/03/03 21:07:06 niklas Exp $ */
+/* $NetBSD: if.h,v 1.20 1996/02/13 22:00:12 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -226,7 +227,8 @@ struct ifaddr {
struct sockaddr *ifa_netmask; /* used to determine subnet */
struct ifnet *ifa_ifp; /* back-pointer to interface */
TAILQ_ENTRY(ifaddr) ifa_list; /* list of addresses for interface */
- void (*ifa_rtrequest)(); /* check or clean routes (+ or -)'d */
+ void (*ifa_rtrequest) /* check or clean routes (+ or -)'d */
+ __P((int, struct rtentry *, struct sockaddr *));
u_short ifa_flags; /* mostly rt_flags for cloning */
short ifa_refcnt; /* count of references */
int ifa_metric; /* cost of going out this interface */
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 56e51d089c3..38a64b0ccc8 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -1,4 +1,5 @@
-/* $NetBSD: if_ethersubr.c,v 1.17 1995/12/24 03:33:43 mycroft Exp $ */
+/* $OpenBSD: if_ethersubr.c,v 1.3 1996/03/03 21:07:07 niklas Exp $ */
+/* $NetBSD: if_ethersubr.c,v 1.18 1996/02/13 22:00:14 christos Exp $ */
/*
* Copyright (c) 1982, 1989, 1993
@@ -109,9 +110,9 @@ ether_output(ifp, m0, dst, rt0)
if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
senderr(ENETDOWN);
ifp->if_lastchange = time;
- if (rt = rt0) {
+ if ((rt = rt0) != NULL) {
if ((rt->rt_flags & RTF_UP) == 0) {
- if (rt0 = rt = rtalloc1(dst, 1))
+ if ((rt0 = rt = rtalloc1(dst, 1)) != NULL)
rt->rt_refcnt--;
else
senderr(EHOSTUNREACH);
@@ -164,10 +165,12 @@ ether_output(ifp, m0, dst, rt0)
if (rt && (sdl = (struct sockaddr_dl *)rt->rt_gateway) &&
sdl->sdl_family == AF_LINK && sdl->sdl_alen > 0) {
bcopy(LLADDR(sdl), (caddr_t)edst, sizeof(edst));
- } else if (error =
- iso_snparesolve(ifp, (struct sockaddr_iso *)dst,
- (char *)edst, &snpalen))
- goto bad; /* Not Resolved */
+ } else {
+ error = iso_snparesolve(ifp, (struct sockaddr_iso *)dst,
+ (char *)edst, &snpalen);
+ if (error)
+ goto bad; /* Not Resolved */
+ }
/* If broadcasting on a simplex interface, loopback a copy */
if (*edst & 1)
m->m_flags |= (M_BCAST|M_MCAST);
@@ -189,13 +192,15 @@ ether_output(ifp, m0, dst, rt0)
l = mtod(m, struct llc *);
l->llc_dsap = l->llc_ssap = LLC_ISO_LSAP;
l->llc_control = LLC_UI;
- IFDEBUG(D_ETHER)
+#ifdef ARGO_DEBUG
+ if (argo_debug[D_ETHER]) {
int i;
printf("unoutput: sending pkt to: ");
for (i=0; i<6; i++)
printf("%x ", edst[i] & 0xff);
printf("\n");
- ENDDEBUG
+ }
+#endif
} break;
#endif /* ISO */
#ifdef LLC
@@ -304,10 +309,12 @@ ether_input(ifp, eh, m)
struct mbuf *m;
{
register struct ifqueue *inq;
- register struct llc *l;
u_int16_t etype;
- struct arpcom *ac = (struct arpcom *)ifp;
int s;
+#if defined (ISO) || defined (LLC)
+ register struct llc *l;
+ struct arpcom *ac = (struct arpcom *)ifp;
+#endif
if ((ifp->if_flags & IFF_UP) == 0) {
m_freem(m);
@@ -372,9 +379,10 @@ ether_input(ifp, eh, m)
if (m == 0)
return;
*mtod(m, struct ether_header *) = *eh;
- IFDEBUG(D_ETHER)
+#ifdef ARGO_DEBUG
+ if (argo_debug[D_ETHER])
printf("clnp packet");
- ENDDEBUG
+#endif
schednetisr(NETISR_ISO);
inq = &clnlintrq;
break;
@@ -610,7 +618,6 @@ ether_delmulti(ifr, ac)
register struct arpcom *ac;
{
register struct ether_multi *enm;
- register struct ether_multi **p;
struct sockaddr_in *sin;
u_char addrlo[6];
u_char addrhi[6];
diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c
index e0f00ebb741..da06e6a69fc 100644
--- a/sys/net/if_ppp.c
+++ b/sys/net/if_ppp.c
@@ -1,4 +1,5 @@
-/* $NetBSD: if_ppp.c,v 1.24 1995/10/05 05:55:09 mycroft Exp $ */
+/* $OpenBSD: if_ppp.c,v 1.4 1996/03/03 21:07:07 niklas Exp $ */
+/* $NetBSD: if_ppp.c,v 1.28 1996/02/13 22:00:18 christos Exp $ */
/*
* if_ppp.c - Point-to-Point Protocol (PPP) Asynchronous driver.
@@ -86,6 +87,7 @@
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/kernel.h>
+#include <sys/systm.h>
#include <net/if.h>
#include <net/if_types.h>
@@ -119,17 +121,9 @@
#include <net/ppp-comp.h>
#endif
-void pppattach __P((void));
-int pppioctl __P((struct ppp_softc *sc, u_long cmd, caddr_t data, int flag,
- struct proc *));
-int pppoutput __P((struct ifnet *ifp, struct mbuf *m0,
- struct sockaddr *dst, struct rtentry *rtp));
-int pppsioctl __P((struct ifnet *ifp, u_long cmd, caddr_t data));
-void pppintr __P((void));
-
static void ppp_requeue __P((struct ppp_softc *));
static void ppp_outpkt __P((struct ppp_softc *));
-static int ppp_ccp __P((struct ppp_softc *, struct mbuf *m, int rcvd));
+static void ppp_ccp __P((struct ppp_softc *, struct mbuf *m, int rcvd));
static void ppp_ccp_closed __P((struct ppp_softc *));
static void ppp_inproc __P((struct ppp_softc *, struct mbuf *));
static void pppdumpm __P((struct mbuf *m0));
@@ -320,7 +314,7 @@ pppioctl(sc, cmd, data, flag, p)
break;
case PPPIOCSFLAGS:
- if (error = suser(p->p_ucred, &p->p_acflag))
+ if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
return (error);
flags = *(int *)data & SC_MASK;
s = splsoftnet();
@@ -334,7 +328,7 @@ pppioctl(sc, cmd, data, flag, p)
break;
case PPPIOCSMRU:
- if (error = suser(p->p_ucred, &p->p_acflag))
+ if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
return (error);
mru = *(int *)data;
if (mru >= PPP_MRU && mru <= PPP_MAXMRU)
@@ -347,7 +341,7 @@ pppioctl(sc, cmd, data, flag, p)
#ifdef VJC
case PPPIOCSMAXCID:
- if (error = suser(p->p_ucred, &p->p_acflag))
+ if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
return (error);
s = splsoftnet();
sl_compress_init(&sc->sc_comp, *(int *)data);
@@ -356,20 +350,20 @@ pppioctl(sc, cmd, data, flag, p)
#endif
case PPPIOCXFERUNIT:
- if (error = suser(p->p_ucred, &p->p_acflag))
+ if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
return (error);
sc->sc_xfer = p->p_pid;
break;
#ifdef PPP_COMPRESS
case PPPIOCSCOMPRESS:
- if (error = suser(p->p_ucred, &p->p_acflag))
+ if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
return (error);
odp = (struct ppp_option_data *) data;
nb = odp->length;
if (nb > sizeof(ccp_option))
nb = sizeof(ccp_option);
- if (error = copyin(odp->ptr, ccp_option, nb))
+ if ((error = copyin(odp->ptr, ccp_option, nb)) != 0)
return (error);
if (ccp_option[1] < 2) /* preliminary check on the length byte */
return (EINVAL);
@@ -433,7 +427,7 @@ pppioctl(sc, cmd, data, flag, p)
if (cmd == PPPIOCGNPMODE) {
npi->mode = sc->sc_npmode[npx];
} else {
- if (error = suser(p->p_ucred, &p->p_acflag))
+ if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
return (error);
if (npi->mode != sc->sc_npmode[npx]) {
s = splsoftnet();
@@ -497,7 +491,7 @@ pppsioctl(ifp, cmd, data)
break;
case SIOCSIFMTU:
- if (error = suser(p->p_ucred, &p->p_acflag))
+ if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
break;
sc->sc_if.if_mtu = ifr->ifr_mtu;
break;
@@ -570,7 +564,6 @@ pppoutput(ifp, m0, dst, rtp)
struct rtentry *rtp;
{
register struct ppp_softc *sc = &ppp_softc[ifp->if_unit];
- struct ppp_header *ph;
int protocol, address, control;
u_char *cp;
int s, error;
@@ -579,7 +572,7 @@ pppoutput(ifp, m0, dst, rtp)
enum NPmode mode;
if (sc->sc_devp == NULL || (ifp->if_flags & IFF_RUNNING) == 0
- || (ifp->if_flags & IFF_UP) == 0 && dst->sa_family != AF_UNSPEC) {
+ || ((ifp->if_flags & IFF_UP) == 0 && dst->sa_family != AF_UNSPEC)) {
error = ENETDOWN; /* sort of */
goto bad;
}
@@ -813,11 +806,9 @@ static void
ppp_outpkt(sc)
struct ppp_softc *sc;
{
- int s;
struct mbuf *m, *mp;
u_char *cp;
int address, control, protocol;
- enum NPmode mode;
/*
* Grab a packet to send: first try the fast queue, then the
@@ -940,7 +931,7 @@ ppp_outpkt(sc)
* Handle a CCP packet. `rcvd' is 1 if the packet was received,
* 0 if it is about to be transmitted.
*/
-static int
+static void
ppp_ccp(sc, m, rcvd)
struct ppp_softc *sc;
struct mbuf *m;
@@ -969,7 +960,7 @@ ppp_ccp(sc, m, rcvd)
slen = CCP_LENGTH(dp);
if (dp + slen > ep) {
if (sc->sc_flags & SC_DEBUG)
- printf("if_ppp/ccp: not enough data in mbuf (%x+%x > %x+%x)\n",
+ printf("if_ppp/ccp: not enough data in mbuf (%p+%x > %p+%x)\n",
dp, slen, mtod(mp, u_char *), mp->m_len);
return;
}
@@ -1087,7 +1078,7 @@ ppp_inproc(sc, m)
{
struct ifnet *ifp = &sc->sc_if;
struct ifqueue *inq;
- int s, ilen, xlen, proto, rv;
+ int s, ilen = 0, xlen, proto, rv;
u_char *cp, adrs, ctrl;
struct mbuf *mp, *dmp;
u_char *iphdr;
@@ -1097,7 +1088,10 @@ ppp_inproc(sc, m)
ifp->if_lastchange = time;
if (sc->sc_flags & SC_LOG_INPKT) {
- printf("ppp%d: got %d bytes\n", ifp->if_unit, ilen);
+ register int len = 0;
+ for (mp = m; mp != NULL; mp = mp->m_next)
+ len += mp->m_len;
+ printf("ppp%d: got %d bytes\n", ifp->if_unit, len);
pppdumpm(m);
}
diff --git a/sys/net/if_ppp.h b/sys/net/if_ppp.h
index aa918868352..c06ca075c69 100644
--- a/sys/net/if_ppp.h
+++ b/sys/net/if_ppp.h
@@ -1,4 +1,5 @@
-/* $NetBSD: if_ppp.h,v 1.9 1995/07/04 06:28:22 paulus Exp $ */
+/* $OpenBSD: if_ppp.h,v 1.2 1996/03/03 21:07:09 niklas Exp $ */
+/* $NetBSD: if_ppp.h,v 1.10 1996/02/13 22:00:21 christos Exp $ */
/*
* if_ppp.h - Point-to-Point Protocol definitions.
@@ -126,5 +127,16 @@ struct ifpppcstatsreq {
#if !defined(ifr_mtu)
#define ifr_mtu ifr_ifru.ifru_metric
#endif
-
+#ifdef _KERNEL
+void pppattach __P((void));
+struct ppp_softc *pppalloc __P((pid_t));
+void pppdealloc __P((struct ppp_softc *));
+int pppioctl __P((struct ppp_softc *, u_long, caddr_t, int, struct proc *));
+int pppsioctl __P((struct ifnet *, u_long, caddr_t));
+int pppoutput __P((struct ifnet *, struct mbuf *, struct sockaddr *,
+ struct rtentry *));
+struct mbuf *ppp_dequeue __P((struct ppp_softc *));
+void pppintr __P((void));
+void ppppktin __P((struct ppp_softc *, struct mbuf *, int));
+#endif
#endif /* _IF_PPP_H_ */
diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c
index d2b768c41df..edd75797b8c 100644
--- a/sys/net/if_sl.c
+++ b/sys/net/if_sl.c
@@ -1,4 +1,5 @@
-/* $NetBSD: if_sl.c,v 1.37 1995/08/12 23:59:22 mycroft Exp $ */
+/* $OpenBSD: if_sl.c,v 1.2 1996/03/03 21:07:10 niklas Exp $ */
+/* $NetBSD: if_sl.c,v 1.38 1996/02/13 22:00:23 christos Exp $ */
/*
* Copyright (c) 1987, 1989, 1992, 1993
@@ -82,6 +83,9 @@
#include <sys/tty.h>
#include <sys/kernel.h>
#include <sys/conf.h>
+#if __NetBSD__
+#include <sys/systm.h>
+#endif
#include <machine/cpu.h>
@@ -255,7 +259,7 @@ slopen(dev, tp)
int s;
#endif
- if (error = suser(p->p_ucred, &p->p_acflag))
+ if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
return (error);
if (tp->t_line == SLIPDISC)
@@ -447,7 +451,7 @@ slstart(tp)
struct mbuf *m2;
#if NBPFILTER > 0
u_char bpfbuf[SLMTU + SLIP_HDRLEN];
- register int len;
+ register int len = 0;
#endif
#ifndef NetBSD /* XXX - cgd */
extern int cfreecount;
@@ -520,7 +524,7 @@ slstart(tp)
bcopy(mtod(m1, caddr_t), cp, mlen);
cp += mlen;
len += mlen;
- } while (m1 = m1->m_next);
+ } while ((m1 = m1->m_next) != NULL);
}
#endif
if ((ip = mtod(m, struct ip *))->ip_p == IPPROTO_TCP) {
@@ -542,7 +546,7 @@ slstart(tp)
#endif
sc->sc_if.if_lastchange = time;
-#ifndef NetBSD /* XXX - cgd */
+#ifndef __NetBSD__ /* XXX - cgd */
/*
* If system is getting low on clists, just flush our
* output queue (if the stuff was important, it'll get
@@ -553,7 +557,7 @@ slstart(tp)
sc->sc_if.if_collisions++;
continue;
}
-#endif /* !NetBSD */
+#endif /* !__NetBSD__ */
/*
* The extra FRAME_END will start up a new packet, and thus
* will flush any accumulated garbage. We do this whenever
@@ -589,7 +593,7 @@ slstart(tp)
* Put n characters at once
* into the tty output queue.
*/
-#ifdef NetBSD /* XXX - cgd */
+#ifdef __NetBSD__ /* XXX - cgd */
if (b_to_q((u_char *)bp, cp - bp,
#else
if (b_to_q((char *)bp, cp - bp,
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index 8b90b206490..863230fc3dc 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -1,4 +1,5 @@
-/* $OpenBSD: if_tun.c,v 1.4 1996/02/21 12:50:02 mickey Exp $ */
+/* $OpenBSD: if_tun.c,v 1.5 1996/03/03 21:07:11 niklas Exp $ */
+/* $NetBSD: if_tun.c,v 1.22 1996/02/13 22:00:26 christos Exp $ */
/*
* Copyright (c) 1988, Julian Onions <jpo@cs.nott.ac.uk>
@@ -8,7 +9,7 @@
* in any changes that are made.
*
* This driver takes packets off the IP i/f and hands them up to a
- * user process to have it's wicked way with. This driver has it's
+ * user process to have its wicked way with. This driver has its
* roots in a similar driver written by Phil Cockcroft (formerly) at
* UCL. This driver is based much more on read/write/select mode of
* operation though.
@@ -34,8 +35,8 @@
#include <sys/file.h>
#include <sys/time.h>
#include <sys/device.h>
-#include <sys/conf.h>
#include <sys/vnode.h>
+#include <sys/signalvar.h>
#include <machine/cpu.h>
@@ -68,6 +69,7 @@
#endif
#include <net/if_tun.h>
+#include <net/net_conf.h>
#ifdef TUN_DEBUG
int tundebug = TUN_DEBUG;
@@ -80,16 +82,17 @@ struct tun_softc tunctl[NTUN];
extern int ifqmaxlen;
-int tunopen __P((dev_t, int, int, struct proc *));
-int tunclose __P((dev_t, int, int, struct proc *));
-int tunoutput __P((struct ifnet *, struct mbuf *, struct sockaddr *,
- struct rtentry *rt));
-int tunread __P((dev_t, struct uio *, int));
-int tunwrite __P((dev_t, struct uio *, int));
-int tunioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
-int tunifioctl __P((struct ifnet *, u_long, caddr_t));
-int tunselect __P((dev_t, int, struct proc *));
-void tunattach __P((int));
+void tunattach __P((int));
+int tunopen __P((dev_t, int, int, struct proc *));
+int tunclose __P((dev_t, int, int, struct proc *));
+int tun_ioctl __P((struct ifnet *, u_long, caddr_t));
+int tun_output __P((struct ifnet *, struct mbuf *, struct sockaddr *,
+ struct rtentry *rt));
+int tunioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
+int tunread __P((dev_t, struct uio *, int));
+int tunwrite __P((dev_t, struct uio *, int));
+int tunselect __P((dev_t, int, struct proc *));
+
static int tuninit __P((int));
@@ -99,7 +102,6 @@ tunattach(unused)
{
register int i;
struct ifnet *ifp;
- struct sockaddr_in *sin;
for (i = 0; i < NTUN; i++) {
tunctl[i].tun_flags = TUN_INITED;
@@ -108,8 +110,8 @@ tunattach(unused)
ifp->if_unit = i;
ifp->if_name = "tun";
ifp->if_mtu = TUNMTU;
- ifp->if_ioctl = tunifioctl;
- ifp->if_output = tunoutput;
+ ifp->if_ioctl = tun_ioctl;
+ ifp->if_output = tun_output;
ifp->if_flags = IFF_POINTOPOINT;
ifp->if_type = IFT_PROPVIRTUAL;
ifp->if_snd.ifq_maxlen = ifqmaxlen;
@@ -141,7 +143,7 @@ tunopen(dev, flag, mode, p)
struct tun_softc *tp;
register int unit, error;
- if (error = suser(p->p_ucred, &p->p_acflag))
+ if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
return (error);
if ((unit = minor(dev)) >= NTUN)
@@ -162,7 +164,8 @@ tunopen(dev, flag, mode, p)
int
tunclose(dev, flag, mode, p)
dev_t dev;
- int flag,mode;
+ int flag;
+ int mode;
struct proc *p;
{
register int unit = minor(dev), s;
@@ -240,12 +243,11 @@ tuninit(unit)
* Process an ioctl request.
*/
int
-tunifioctl(ifp, cmd, data)
+tun_ioctl(ifp, cmd, data)
struct ifnet *ifp;
u_long cmd;
caddr_t data;
{
- struct tun_softc *tp = &tunctl[ifp->if_unit];
int error = 0, s;
s = splimp();
@@ -267,10 +269,10 @@ tunifioctl(ifp, cmd, data)
}
/*
- * tunoutput - queue packets from higher level ready to put out.
+ * tun_output - queue packets from higher level ready to put out.
*/
int
-tunoutput(ifp, m0, dst, rt)
+tun_output(ifp, m0, dst, rt)
struct ifnet *ifp;
struct mbuf *m0;
struct sockaddr *dst;
@@ -280,7 +282,7 @@ tunoutput(ifp, m0, dst, rt)
struct proc *p;
int s;
- TUNDEBUG(("%s%d: tunoutput\n", ifp->if_name, ifp->if_unit));
+ TUNDEBUG(("%s%d: tun_output\n", ifp->if_name, ifp->if_unit));
if ((tp->tun_flags & TUN_READY) != TUN_READY) {
TUNDEBUG(("%s%d: not ready 0%o\n", ifp->if_name,
@@ -322,7 +324,7 @@ tunoutput(ifp, m0, dst, rt)
if (tp->tun_flags & TUN_ASYNC && tp->tun_pgrp) {
if (tp->tun_pgrp > 0)
gsignal(tp->tun_pgrp, SIGIO);
- else if (p = pfind(-tp->tun_pgrp))
+ else if ((p = pfind(-tp->tun_pgrp)) != NULL)
psignal(p, SIGIO);
}
selwakeup(&tp->tun_rsel);
@@ -402,10 +404,10 @@ tunioctl(dev, cmd, data, flag, p)
* least as much of a packet as can be read.
*/
int
-tunread(dev, uio,flags)
+tunread(dev, uio, ioflag)
dev_t dev;
struct uio *uio;
- int flags;
+ int ioflag;
{
int unit = minor(dev);
struct tun_softc *tp = &tunctl[unit];
@@ -426,7 +428,7 @@ tunread(dev, uio,flags)
do {
IF_DEQUEUE(&ifp->if_snd, m0);
if (m0 == 0) {
- if (tp->tun_flags & TUN_NBIO && flags & IO_NDELAY) {
+ if (tp->tun_flags & TUN_NBIO && ioflag & IO_NDELAY) {
splx(s);
return EWOULDBLOCK;
}
@@ -459,10 +461,10 @@ tunread(dev, uio,flags)
* the cdevsw write interface - an atomic write is a packet - or else!
*/
int
-tunwrite(dev, uio, flags)
+tunwrite(dev, uio, ioflag)
dev_t dev;
struct uio *uio;
- int flags;
+ int ioflag;
{
int unit = minor (dev);
struct ifnet *ifp = &tunctl[unit].tun_if;
@@ -574,9 +576,9 @@ tunwrite(dev, uio, flags)
*/
int
tunselect(dev, rw, p)
- dev_t dev;
+ dev_t dev;
int rw;
- struct proc *p;
+ struct proc *p;
{
int unit = minor(dev), s;
struct tun_softc *tp = &tunctl[unit];
diff --git a/sys/net/net_conf.h b/sys/net/net_conf.h
new file mode 100644
index 00000000000..b3d82b615c9
--- /dev/null
+++ b/sys/net/net_conf.h
@@ -0,0 +1,39 @@
+/* $OpenBSD: net_conf.h,v 1.1 1996/03/03 21:07:11 niklas Exp $ */
+/* $NetBSD: net_conf.h,v 1.1 1996/02/13 22:00:28 christos Exp $ */
+
+/*
+ * Copyright (c) 1995 Christos Zoulas. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Christos Zoulas.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/conf.h>
+
+#include "bpfilter.h"
+cdev_decl(bpf);
+
+#include "tun.h"
+cdev_decl(tun);
diff --git a/sys/net/ppp_tty.c b/sys/net/ppp_tty.c
index c484a5e22e7..27dd47ea5d9 100644
--- a/sys/net/ppp_tty.c
+++ b/sys/net/ppp_tty.c
@@ -1,4 +1,5 @@
-/* $NetBSD: ppp_tty.c,v 1.3 1995/10/05 05:55:14 mycroft Exp $ */
+/* $OpenBSD: ppp_tty.c,v 1.2 1996/03/03 21:07:12 niklas Exp $ */
+/* $NetBSD: ppp_tty.c,v 1.4 1996/02/13 22:00:30 christos Exp $ */
/*
* ppp_tty.c - Point-to-Point Protocol (PPP) driver for asynchronous
@@ -92,6 +93,7 @@
#include <sys/kernel.h>
#include <sys/conf.h>
#include <sys/vnode.h>
+#include <sys/systm.h>
#include <net/if.h>
#include <net/if_types.h>
@@ -165,9 +167,9 @@ pppopen(dev, tp)
{
struct proc *p = curproc; /* XXX */
register struct ppp_softc *sc;
- int error, s, i;
+ int error, s;
- if (error = suser(p->p_ucred, &p->p_acflag))
+ if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
return (error);
s = spltty();
@@ -222,7 +224,6 @@ pppclose(tp, flag)
int flag;
{
register struct ppp_softc *sc;
- struct mbuf *m;
int s;
s = spltty();
@@ -317,7 +318,7 @@ pppread(tp, uio, flag)
splx(s);
for (m = m0; m && uio->uio_resid; m = m->m_next)
- if (error = uiomove(mtod(m, u_char *), m->m_len, uio))
+ if ((error = uiomove(mtod(m, u_char *), m->m_len, uio)) != 0)
break;
m_freem(m0);
return (error);
@@ -358,7 +359,7 @@ pppwrite(tp, uio, flag)
len = M_TRAILINGSPACE(m);
if (len > uio->uio_resid)
len = uio->uio_resid;
- if (error = uiomove(mtod(m, u_char *), len, uio)) {
+ if ((error = uiomove(mtod(m, u_char *), len, uio)) != 0) {
m_freem(m0);
return (error);
}
@@ -394,7 +395,7 @@ ppptioctl(tp, cmd, data, flag, p)
error = 0;
switch (cmd) {
case PPPIOCSASYNCMAP:
- if (error = suser(p->p_ucred, &p->p_acflag))
+ if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
break;
sc->sc_asyncmap[0] = *(u_int *)data;
break;
@@ -404,7 +405,7 @@ ppptioctl(tp, cmd, data, flag, p)
break;
case PPPIOCSRASYNCMAP:
- if (error = suser(p->p_ucred, &p->p_acflag))
+ if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
break;
sc->sc_rasyncmap = *(u_int *)data;
break;
@@ -414,7 +415,7 @@ ppptioctl(tp, cmd, data, flag, p)
break;
case PPPIOCSXASYNCMAP:
- if (error = suser(p->p_ucred, &p->p_acflag))
+ if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
break;
s = spltty();
bcopy(data, sc->sc_asyncmap, sizeof(sc->sc_asyncmap));
@@ -537,10 +538,10 @@ pppstart(tp)
register struct mbuf *m;
register int len;
register u_char *start, *stop, *cp;
- int n, s, ndone, done, idle;
+ int n, ndone, done, idle;
struct mbuf *m2;
- if ((tp->t_state & TS_CARR_ON) == 0 && (tp->t_cflag & CLOCAL) == 0
+ if (((tp->t_state & TS_CARR_ON) == 0 && (tp->t_cflag & CLOCAL) == 0)
|| sc == NULL || tp != (struct tty *) sc->sc_devp) {
if (tp->t_oproc != NULL)
(*tp->t_oproc)(tp);
@@ -815,7 +816,7 @@ pppinput(c, tp)
* abort sequence "}~".
*/
if (sc->sc_flags & (SC_FLUSH | SC_ESCAPED)
- || ilen > 0 && sc->sc_fcs != PPP_GOODFCS) {
+ || (ilen > 0 && sc->sc_fcs != PPP_GOODFCS)) {
sc->sc_flags |= SC_PKTLOST; /* note the dropped packet */
if ((sc->sc_flags & (SC_FLUSH | SC_ESCAPED)) == 0){
if (sc->sc_flags & SC_DEBUG)
@@ -992,7 +993,7 @@ ppplogchar(sc, c)
if (c >= 0)
sc->sc_rawin[sc->sc_rawin_count++] = c;
if (sc->sc_rawin_count >= sizeof(sc->sc_rawin)
- || c < 0 && sc->sc_rawin_count > 0) {
+ || (c < 0 && sc->sc_rawin_count > 0)) {
printf("ppp%d input: ", sc->sc_if.if_unit);
pppdumpb(sc->sc_rawin, sc->sc_rawin_count);
sc->sc_rawin_count = 0;
diff --git a/sys/net/radix.c b/sys/net/radix.c
index ea7cb1828dd..e0635541ca8 100644
--- a/sys/net/radix.c
+++ b/sys/net/radix.c
@@ -1,4 +1,5 @@
-/* $NetBSD: radix.c,v 1.9 1995/05/17 15:50:06 mycroft Exp $ */
+/* $OpenBSD: radix.c,v 1.2 1996/03/03 21:07:14 niklas Exp $ */
+/* $NetBSD: radix.c,v 1.10 1996/02/13 22:00:32 christos Exp $ */
/*
* Copyright (c) 1988, 1989, 1993
@@ -60,6 +61,12 @@ static char *rn_zeros, *rn_ones;
#define rn_masktop (mask_rnhead->rnh_treetop)
#undef Bcmp
#define Bcmp(a, b, l) (l == 0 ? 0 : bcmp((caddr_t)(a), (caddr_t)(b), (u_long)l))
+
+
+static int rn_satsifies_leaf __P((char *, struct radix_node *, int));
+static int rn_lexobetter __P((void *, void *));
+static struct radix_mask *rn_new_radix_mask __P((struct radix_node *,
+ struct radix_mask *));
/*
* The data structure for the keys is a radix tree with one way
* branching removed. The index rn_b at an internal node n represents a bit
@@ -177,7 +184,7 @@ rn_lookup(v_arg, m_arg, head)
return x;
}
-static
+static int
rn_satsifies_leaf(trial, leaf, skip)
char *trial;
register struct radix_node *leaf;
@@ -273,7 +280,7 @@ on1:
do {
register struct radix_mask *m;
t = t->rn_p;
- if (m = t->rn_mklist) {
+ if ((m = t->rn_mklist) != NULL) {
/*
* If non-contiguous masks ever become important
* we can restore the masking and open coding of
@@ -292,7 +299,7 @@ on1:
if (x && rn_satsifies_leaf(v, x, off))
return x;
}
- } while (m = m->rm_mklist);
+ } while ((m = m->rm_mklist) != NULL);
}
} while (t != top);
return 0;
@@ -507,9 +514,9 @@ rn_addroute(v_arg, n_arg, head, treenodes)
struct radix_node treenodes[2];
{
caddr_t v = (caddr_t)v_arg, netmask = (caddr_t)n_arg;
- register struct radix_node *t, *x, *tt;
+ register struct radix_node *t, *x = NULL, *tt;
struct radix_node *saved_tt, *top = head->rnh_treetop;
- short b = 0, b_leaf;
+ short b = 0, b_leaf = 0;
int keyduplicated;
caddr_t mmask;
struct radix_mask *m, **mp;
@@ -590,14 +597,15 @@ rn_addroute(v_arg, n_arg, head, treenodes)
if (x->rn_b < 0) {
for (mp = &t->rn_mklist; x; x = x->rn_dupedkey)
if (x->rn_mask && (x->rn_b >= b_leaf) && x->rn_mklist == 0) {
- if (*mp = m = rn_new_radix_mask(x, 0))
+ *mp = m = rn_new_radix_mask(x, 0);
+ if (m)
mp = &m->rm_mklist;
}
} else if (x->rn_mklist) {
/*
* Skip over masks whose index is > that of new node
*/
- for (mp = &x->rn_mklist; m = *mp; mp = &m->rm_mklist)
+ for (mp = &x->rn_mklist; (m = *mp) != NULL; mp = &m->rm_mklist)
if (m->rm_b >= b_leaf)
break;
t->rn_mklist = m; *mp = 0;
@@ -617,7 +625,7 @@ on2:
* Need same criteria as when sorting dupedkeys to avoid
* double loop on deletion.
*/
- for (mp = &x->rn_mklist; m = *mp; mp = &m->rm_mklist) {
+ for (mp = &x->rn_mklist; (m = *mp) != NULL; mp = &m->rm_mklist) {
if (m->rm_b < b_leaf)
continue;
if (m->rm_b > b_leaf)
@@ -699,7 +707,7 @@ rn_delete(v_arg, netmask_arg, head)
x = t;
t = t->rn_p;
} while (b <= t->rn_b && x != top);
- for (mp = &x->rn_mklist; m = *mp; mp = &m->rm_mklist)
+ for (mp = &x->rn_mklist; (m = *mp) != NULL; mp = &m->rm_mklist)
if (m == saved_m) {
*mp = m->rm_mklist;
MKFree(m);
@@ -722,7 +730,7 @@ on1:
if (t) t->rn_ybro = tt->rn_ybro;
#endif
t = tt->rn_p;
- if (dupedkey = saved_tt->rn_dupedkey) {
+ if ((dupedkey = saved_tt->rn_dupedkey) != 0) {
if (tt == saved_tt) {
x = dupedkey; x->rn_p = t;
if (t->rn_l == tt) t->rn_l = x; else t->rn_r = x;
@@ -753,7 +761,7 @@ on1:
*/
if (t->rn_mklist) {
if (x->rn_b >= 0) {
- for (mp = &x->rn_mklist; m = *mp;)
+ for (mp = &x->rn_mklist; (m = *mp) != NULL;)
mp = &m->rm_mklist;
*mp = t->rn_mklist;
} else {
@@ -796,7 +804,7 @@ out:
int
rn_walktree(h, f, w)
struct radix_node_head *h;
- register int (*f)();
+ register int (*f) __P((struct radix_node *, void *));
void *w;
{
int error;
@@ -820,7 +828,7 @@ rn_walktree(h, f, w)
rn = rn->rn_l;
next = rn;
/* Process leaves */
- while (rn = base) {
+ while ((rn = base) != NULL) {
base = rn->rn_dupedkey;
if (!(rn->rn_flags & RNF_ROOT) && (error = (*f)(rn, w)))
return (error);
diff --git a/sys/net/radix.h b/sys/net/radix.h
index 86d1d2a37f3..c5d84eaf55c 100644
--- a/sys/net/radix.h
+++ b/sys/net/radix.h
@@ -1,4 +1,5 @@
-/* $NetBSD: radix.h,v 1.7 1995/05/17 15:50:08 mycroft Exp $ */
+/* $OpenBSD: radix.h,v 1.2 1996/03/03 21:07:15 niklas Exp $ */
+/* $NetBSD: radix.h,v 1.8 1996/02/13 22:00:37 christos Exp $ */
/*
* Copyright (c) 1988, 1989, 1993
@@ -126,7 +127,8 @@ struct radix_node_head {
struct radix_node *(*rnh_matchpkt) /* locate based on packet hdr */
__P((void *v, struct radix_node_head *head));
int (*rnh_walktree) /* traverse tree */
- __P((struct radix_node_head *head, int (*f)(), void *w));
+ __P((struct radix_node_head *,
+ int (*)(struct radix_node *, void *), void *));
struct radix_node rnh_nodes[3]; /* empty tree for common case */
};
@@ -147,7 +149,8 @@ struct radix_node_head {
void rn_init __P((void));
int rn_inithead __P((void **, int));
int rn_refines __P((void *, void *));
-int rn_walktree __P((struct radix_node_head *, int (*)(), void *));
+int rn_walktree __P((struct radix_node_head *,
+ int (*)(struct radix_node *, void *), void *));
struct radix_node
*rn_addmask __P((void *, int, int)),
*rn_addroute __P((void *, void *, struct radix_node_head *,
diff --git a/sys/net/raw_cb.c b/sys/net/raw_cb.c
index a8e1fc36ce0..0960d96f7da 100644
--- a/sys/net/raw_cb.c
+++ b/sys/net/raw_cb.c
@@ -1,4 +1,5 @@
-/* $NetBSD: raw_cb.c,v 1.8 1995/06/12 00:46:53 mycroft Exp $ */
+/* $OpenBSD: raw_cb.c,v 1.2 1996/03/03 21:07:16 niklas Exp $ */
+/* $NetBSD: raw_cb.c,v 1.9 1996/02/13 22:00:39 christos Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@@ -80,7 +81,7 @@ raw_attach(so, proto)
*/
if (rp == 0)
return (ENOBUFS);
- if (error = soreserve(so, raw_sendspace, raw_recvspace))
+ if ((error = soreserve(so, raw_sendspace, raw_recvspace)) != 0)
return (error);
rp->rcb_socket = so;
rp->rcb_proto.sp_family = so->so_proto->pr_domain->dom_family;
diff --git a/sys/net/raw_cb.h b/sys/net/raw_cb.h
index 34c5a72ca9a..070e8a298ae 100644
--- a/sys/net/raw_cb.h
+++ b/sys/net/raw_cb.h
@@ -1,4 +1,5 @@
-/* $NetBSD: raw_cb.h,v 1.8 1995/06/12 00:46:54 mycroft Exp $ */
+/* $OpenBSD: raw_cb.h,v 1.2 1996/03/03 21:07:17 niklas Exp $ */
+/* $NetBSD: raw_cb.h,v 1.9 1996/02/13 22:00:41 christos Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@@ -59,12 +60,12 @@ struct rawcb {
LIST_HEAD(, rawcb) rawcb; /* head of list */
int raw_attach __P((struct socket *, int));
-void raw_ctlinput __P((int, struct sockaddr *));
+void *raw_ctlinput __P((int, struct sockaddr *, void *));
void raw_detach __P((struct rawcb *));
void raw_disconnect __P((struct rawcb *));
void raw_init __P((void));
-void raw_input __P((struct mbuf *,
- struct sockproto *, struct sockaddr *, struct sockaddr *));
+void raw_input __P((struct mbuf *, ...));
int raw_usrreq __P((struct socket *,
int, struct mbuf *, struct mbuf *, struct mbuf *));
+
#endif /* _KERNEL */
diff --git a/sys/net/raw_usrreq.c b/sys/net/raw_usrreq.c
index 04f5e19a0e4..596dfc99691 100644
--- a/sys/net/raw_usrreq.c
+++ b/sys/net/raw_usrreq.c
@@ -1,4 +1,5 @@
-/* $NetBSD: raw_usrreq.c,v 1.10 1995/06/12 00:46:55 mycroft Exp $ */
+/* $OpenBSD: raw_usrreq.c,v 1.2 1996/03/03 21:07:18 niklas Exp $ */
+/* $NetBSD: raw_usrreq.c,v 1.11 1996/02/13 22:00:43 christos Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@@ -42,12 +43,14 @@
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/errno.h>
+#include <sys/systm.h>
#include <net/if.h>
#include <net/route.h>
#include <net/netisr.h>
#include <net/raw_cb.h>
+#include <machine/stdarg.h>
/*
* Initialize raw connection block q.
*/
@@ -68,15 +71,27 @@ raw_init()
* Raw protocol interface.
*/
void
-raw_input(m0, proto, src, dst)
+#if __STDC__
+raw_input(struct mbuf *m0, ...)
+#else
+raw_input(m0, va_alist)
struct mbuf *m0;
- register struct sockproto *proto;
- struct sockaddr *src, *dst;
+ va_dcl
+#endif
{
register struct rawcb *rp;
register struct mbuf *m = m0;
register int sockets = 0;
struct socket *last;
+ va_list ap;
+ register struct sockproto *proto;
+ struct sockaddr *src, *dst;
+
+ va_start(ap, m0);
+ proto = va_arg(ap, struct sockproto *);
+ src = va_arg(ap, struct sockaddr *);
+ dst = va_arg(ap, struct sockaddr *);
+ va_end(ap);
last = 0;
for (rp = rawcb.lh_first; rp != 0; rp = rp->rcb_list.le_next) {
@@ -101,7 +116,7 @@ raw_input(m0, proto, src, dst)
continue;
if (last) {
struct mbuf *n;
- if (n = m_copy(m, 0, (int)M_COPYALL)) {
+ if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) {
if (sbappendaddr(&last->so_rcv, src,
n, (struct mbuf *)0) == 0)
/* should notify about lost packet */
@@ -127,14 +142,16 @@ raw_input(m0, proto, src, dst)
}
/*ARGSUSED*/
-void
-raw_ctlinput(cmd, arg)
+void *
+raw_ctlinput(cmd, arg, d)
int cmd;
struct sockaddr *arg;
+ void *d;
{
if (cmd < 0 || cmd > PRC_NCMDS)
- return;
+ return NULL;
+ return NULL;
/* INCOMPLETE */
}
diff --git a/sys/net/route.c b/sys/net/route.c
index 80a0cda6493..59f83f1d4a8 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -1,4 +1,5 @@
-/* $NetBSD: route.c,v 1.13 1995/08/12 23:59:25 mycroft Exp $ */
+/* $OpenBSD: route.c,v 1.2 1996/03/03 21:07:19 niklas Exp $ */
+/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
* Copyright (c) 1980, 1986, 1991, 1993
@@ -146,7 +147,7 @@ rtfree(rt)
panic ("rtfree 2");
rttrash--;
if (rt->rt_refcnt < 0) {
- printf("rtfree: %x not freed (neg refs)\n", rt);
+ printf("rtfree: %p not freed (neg refs)\n", rt);
return;
}
ifa = rt->rt_ifa;
@@ -176,7 +177,7 @@ ifafree(ifa)
*
* N.B.: must be called at splsoftnet
*/
-int
+void
rtredirect(dst, gateway, netmask, flags, src, rtp)
struct sockaddr *dst, *gateway, *netmask, *src;
int flags;
@@ -498,7 +499,7 @@ rtinit(ifa, cmd, flags)
rt_maskedcopy(dst, deldst, ifa->ifa_netmask);
dst = deldst;
}
- if (rt = rtalloc1(dst, 0)) {
+ if ((rt = rtalloc1(dst, 0)) != NULL) {
rt->rt_refcnt--;
if (rt->rt_ifa != ifa) {
if (m)
@@ -522,8 +523,8 @@ rtinit(ifa, cmd, flags)
if (cmd == RTM_ADD && error == 0 && (rt = nrt)) {
rt->rt_refcnt--;
if (rt->rt_ifa != ifa) {
- printf("rtinit: wrong ifa (%x) was (%x)\n", ifa,
- rt->rt_ifa);
+ printf("rtinit: wrong ifa (%p) was (%p)\n",
+ ifa, rt->rt_ifa);
if (rt->rt_ifa->ifa_rtrequest)
rt->rt_ifa->ifa_rtrequest(RTM_DELETE, rt, SA(0));
IFAFREE(rt->rt_ifa);
diff --git a/sys/net/route.h b/sys/net/route.h
index 0fc39fe4d3b..19fb96c1199 100644
--- a/sys/net/route.h
+++ b/sys/net/route.h
@@ -1,4 +1,5 @@
-/* $NetBSD: route.h,v 1.8 1995/03/26 20:30:19 jtc Exp $ */
+/* $OpenBSD: route.h,v 1.2 1996/03/03 21:07:20 niklas Exp $ */
+/* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@@ -239,16 +240,16 @@ struct radix_node_head *rt_tables[AF_MAX+1];
struct socket;
void route_init __P((void));
-int route_output __P((struct mbuf *, struct socket *));
-int route_usrreq __P((struct socket *,
- int, struct mbuf *, struct mbuf *, struct mbuf *));
+int route_output __P((struct mbuf *, ...));
+int route_usrreq __P((struct socket *, int, struct mbuf *,
+ struct mbuf *, struct mbuf *));
void rt_ifmsg __P((struct ifnet *));
void rt_maskedcopy __P((struct sockaddr *,
struct sockaddr *, struct sockaddr *));
void rt_missmsg __P((int, struct rt_addrinfo *, int, int));
void rt_newaddrmsg __P((int, struct ifaddr *, int, struct rtentry *));
-int rt_setgate __P((struct rtentry *,
- struct sockaddr *, struct sockaddr *));
+int rt_setgate __P((struct rtentry *, struct sockaddr *,
+ struct sockaddr *));
void rt_setmetrics __P((u_long, struct rt_metrics *, struct rt_metrics *));
void rtable_init __P((void **));
void rtalloc __P((struct route *));
@@ -257,8 +258,10 @@ struct rtentry *
void rtfree __P((struct rtentry *));
int rtinit __P((struct ifaddr *, int, int));
int rtioctl __P((u_long, caddr_t, struct proc *));
-int rtredirect __P((struct sockaddr *, struct sockaddr *,
- struct sockaddr *, int, struct sockaddr *, struct rtentry **));
+void rtredirect __P((struct sockaddr *, struct sockaddr *,
+ struct sockaddr *, int, struct sockaddr *,
+ struct rtentry **));
int rtrequest __P((int, struct sockaddr *,
- struct sockaddr *, struct sockaddr *, int, struct rtentry **));
+ struct sockaddr *, struct sockaddr *, int,
+ struct rtentry **));
#endif /* _KERNEL */
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 79e6921cb5e..09e1969ffd6 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -1,4 +1,5 @@
-/* $NetBSD: rtsock.c,v 1.16 1995/08/19 07:48:14 cgd Exp $ */
+/* $OpenBSD: rtsock.c,v 1.2 1996/03/03 21:07:21 niklas Exp $ */
+/* $NetBSD: rtsock.c,v 1.17 1996/02/13 22:00:52 christos Exp $ */
/*
* Copyright (c) 1988, 1991, 1993
@@ -44,10 +45,15 @@
#include <sys/domain.h>
#include <sys/protosw.h>
+#include <vm/vm.h>
+#include <sys/sysctl.h>
+
#include <net/if.h>
#include <net/route.h>
#include <net/raw_cb.h>
+#include <machine/stdarg.h>
+
struct sockaddr route_dst = { 2, PF_ROUTE, };
struct sockaddr route_src = { 2, PF_ROUTE, };
struct sockproto route_proto = { PF_ROUTE, };
@@ -85,8 +91,8 @@ route_usrreq(so, req, m, nam, control)
if (req == PRU_ATTACH) {
MALLOC(rp, struct rawcb *, sizeof(*rp), M_PCB, M_WAITOK);
- if (so->so_pcb = rp)
- bzero((caddr_t)so->so_pcb, sizeof(*rp));
+ if ((so->so_pcb = rp) != NULL)
+ bzero(so->so_pcb, sizeof(*rp));
}
if (req == PRU_DETACH && rp) {
@@ -126,9 +132,13 @@ route_usrreq(so, req, m, nam, control)
/*ARGSUSED*/
int
-route_output(m, so)
- register struct mbuf *m;
- struct socket *so;
+#if __STDC__
+route_output(struct mbuf *m, ...)
+#else
+route_output(m, va_alist)
+ struct mbuf *m;
+ va_dcl
+#endif
{
register struct rt_msghdr *rtm = 0;
register struct rtentry *rt = 0;
@@ -138,6 +148,13 @@ route_output(m, so)
int len, error = 0;
struct ifnet *ifp = 0;
struct ifaddr *ifa = 0;
+ struct socket *so;
+ va_list ap;
+
+ va_start(ap, m);
+ so = va_arg(ap, struct socket *);
+ va_end(ap);
+
#define senderr(e) { error = e; goto flush;}
if (m == 0 || ((m->m_len < sizeof(int32_t)) &&
@@ -203,8 +220,8 @@ route_output(m, so)
case RTM_LOCK:
if ((rnh = rt_tables[dst->sa_family]) == 0) {
senderr(EAFNOSUPPORT);
- } else if (rt = (struct rtentry *)
- rnh->rnh_lookup(dst, netmask, rnh))
+ } else if ((rt = (struct rtentry *)
+ rnh->rnh_lookup(dst, netmask, rnh)) != NULL)
rt->rt_refcnt++;
else
senderr(ESRCH);
@@ -217,7 +234,7 @@ route_output(m, so)
netmask = rt_mask(rt);
genmask = rt->rt_genmask;
if (rtm->rtm_addrs & (RTA_IFP | RTA_IFA)) {
- if (ifp = rt->rt_ifp) {
+ if ((ifp = rt->rt_ifp) != NULL) {
ifpaddr = ifp->if_addrlist.tqh_first->ifa_addr;
ifaaddr = rt->rt_ifa->ifa_addr;
if (ifp->if_flags & IFF_POINTOPOINT)
@@ -503,7 +520,7 @@ again:
default:
len = sizeof(struct rt_msghdr);
}
- if (cp0 = cp)
+ if ((cp0 = cp) != NULL)
cp += len;
for (i = 0; i < RTAX_MAX; i++) {
register struct sockaddr *sa;
@@ -526,8 +543,9 @@ again:
if (rw->w_tmemsize < len) {
if (rw->w_tmem)
free(rw->w_tmem, M_RTABLE);
- if (rw->w_tmem = (caddr_t)
- malloc(len, M_RTABLE, M_NOWAIT))
+ rw->w_tmem = (caddr_t) malloc(len, M_RTABLE,
+ M_NOWAIT);
+ if (rw->w_tmem)
rw->w_tmemsize = len;
}
if (rw->w_tmem) {
@@ -618,9 +636,9 @@ rt_newaddrmsg(cmd, ifa, error, rt)
register struct rtentry *rt;
{
struct rt_addrinfo info;
- struct sockaddr *sa;
+ struct sockaddr *sa = NULL;
int pass;
- struct mbuf *m;
+ struct mbuf *m = NULL;
struct ifnet *ifp = ifa->ifa_ifp;
if (route_cb.any_count == 0)
@@ -670,10 +688,11 @@ rt_newaddrmsg(cmd, ifa, error, rt)
* This is used in dumping the kernel table via sysctl().
*/
int
-sysctl_dumpentry(rn, w)
+sysctl_dumpentry(rn, v)
struct radix_node *rn;
- register struct walkarg *w;
+ register void *v;
{
+ register struct walkarg *w = v;
register struct rtentry *rt = (struct rtentry *)rn;
int error = 0, size;
struct rt_addrinfo info;
@@ -701,7 +720,7 @@ sysctl_dumpentry(rn, w)
rtm->rtm_index = rt->rt_ifp->if_index;
rtm->rtm_errno = rtm->rtm_pid = rtm->rtm_seq = 0;
rtm->rtm_addrs = info.rti_addrs;
- if (error = copyout((caddr_t)rtm, w->w_where, size))
+ if ((error = copyout((caddr_t)rtm, w->w_where, size)) != 0)
w->w_where = NULL;
else
w->w_where += size;
@@ -735,11 +754,12 @@ sysctl_iflist(af, w)
ifm->ifm_flags = ifp->if_flags;
ifm->ifm_data = ifp->if_data;
ifm->ifm_addrs = info.rti_addrs;
- if (error = copyout((caddr_t)ifm, w->w_where, len))
+ error = copyout((caddr_t)ifm, w->w_where, len);
+ if (error)
return (error);
w->w_where += len;
}
- while (ifa = ifa->ifa_list.tqe_next) {
+ while ((ifa = ifa->ifa_list.tqe_next) != NULL) {
if (af && af != ifa->ifa_addr->sa_family)
continue;
ifaaddr = ifa->ifa_addr;
@@ -754,7 +774,8 @@ sysctl_iflist(af, w)
ifam->ifam_flags = ifa->ifa_flags;
ifam->ifam_metric = ifa->ifa_metric;
ifam->ifam_addrs = info.rti_addrs;
- if (error = copyout(w->w_tmem, w->w_where, len))
+ error = copyout(w->w_tmem, w->w_where, len);
+ if (error)
return (error);
w->w_where += len;
}
@@ -767,10 +788,10 @@ sysctl_iflist(af, w)
int
sysctl_rtable(name, namelen, where, given, new, newlen)
int *name;
- int namelen;
- caddr_t where;
+ u_int namelen;
+ void *where;
size_t *given;
- caddr_t *new;
+ void *new;
size_t newlen;
{
register struct radix_node_head *rnh;
@@ -797,8 +818,9 @@ sysctl_rtable(name, namelen, where, given, new, newlen)
case NET_RT_FLAGS:
for (i = 1; i <= AF_MAX; i++)
if ((rnh = rt_tables[i]) && (af == 0 || af == i) &&
- (error = rnh->rnh_walktree(rnh,
- sysctl_dumpentry, &w)))
+ (error = (*rnh->rnh_walktree)(rnh,
+ sysctl_dumpentry,
+ &w)))
break;
break;
@@ -810,7 +832,7 @@ sysctl_rtable(name, namelen, where, given, new, newlen)
free(w.w_tmem, M_RTABLE);
w.w_needed += w.w_given;
if (where) {
- *given = w.w_where - where;
+ *given = w.w_where - (caddr_t) where;
if (*given < w.w_needed)
return (ENOMEM);
} else {
diff --git a/sys/net/slcompress.c b/sys/net/slcompress.c
index 8367be2d00c..9aacff37545 100644
--- a/sys/net/slcompress.c
+++ b/sys/net/slcompress.c
@@ -1,4 +1,5 @@
-/* $NetBSD: slcompress.c,v 1.13 1995/11/20 20:43:33 cgd Exp $ */
+/* $OpenBSD: slcompress.c,v 1.3 1996/03/03 21:07:22 niklas Exp $ */
+/* $NetBSD: slcompress.c,v 1.14 1996/02/13 22:00:55 christos Exp $ */
/*
* Copyright (c) 1989, 1993, 1994
@@ -45,6 +46,7 @@
#include <sys/param.h>
#include <sys/mbuf.h>
+#include <sys/systm.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
@@ -275,19 +277,22 @@ sl_compress_tcp(m, ip, comp, compress_cid)
* with it. */
goto uncompressed;
- if (deltaS = (u_int16_t)(ntohs(th->th_win) - ntohs(oth->th_win))) {
+ deltaS = (u_int16_t)(ntohs(th->th_win) - ntohs(oth->th_win));
+ if (deltaS) {
ENCODE(deltaS);
changes |= NEW_W;
}
- if (deltaA = ntohl(th->th_ack) - ntohl(oth->th_ack)) {
+ deltaA = ntohl(th->th_ack) - ntohl(oth->th_ack);
+ if (deltaA) {
if (deltaA > 0xffff)
goto uncompressed;
ENCODE(deltaA);
changes |= NEW_A;
}
- if (deltaS = ntohl(th->th_seq) - ntohl(oth->th_seq)) {
+ deltaS = ntohl(th->th_seq) - ntohl(oth->th_seq);
+ if (deltaS) {
if (deltaS > 0xffff)
goto uncompressed;
ENCODE(deltaS);