summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorsvn2git <svn2git@FreeBSD.org>1994-07-01 08:00:00 +0000
committersvn2git <svn2git@FreeBSD.org>1994-07-01 08:00:00 +0000
commit5e0e9b99dc3fc0ecd49d929db0d57c784b66f481 (patch)
treee779b5a6edddbb949b7990751b12d6f25304ba86 /sys/net
parenta16f65c7d117419bd266c28a1901ef129a337569 (diff)
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if.c7
-rw-r--r--sys/net/if.h12
-rw-r--r--sys/net/if_ethersubr.c226
-rw-r--r--sys/net/if_loop.c30
-rw-r--r--sys/net/if_ppp.c108
-rw-r--r--sys/net/if_sl.c54
-rw-r--r--sys/net/netisr.h15
-rw-r--r--sys/net/pppdefs.h (renamed from sys/net/ppp.h)8
-rw-r--r--sys/net/raw_cb.h3
-rw-r--r--sys/net/route.c2
10 files changed, 348 insertions, 117 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index fc51448e9ef5..42a7a5de4a70 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)if.c 7.14 (Berkeley) 4/20/91
- * $Id: if.c,v 1.7 1993/12/19 00:52:00 wollman Exp $
+ * $Id: if.c,v 1.9 1994/06/10 11:10:24 ache Exp $
*/
#include "param.h"
@@ -204,7 +204,7 @@ ifa_ifwithdstaddr(addr)
for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next) {
if (ifa->ifa_addr->sa_family != addr->sa_family)
continue;
- if (equal(addr, ifa->ifa_dstaddr))
+ if (ifa->ifa_dstaddr && equal(addr, ifa->ifa_dstaddr))
return (ifa);
}
return ((struct ifaddr *)0);
@@ -506,7 +506,8 @@ ifioctl(so, cmd, data, p)
return (EOPNOTSUPP);
#ifndef COMPAT_43
return ((*so->so_proto->pr_usrreq)(so, PRU_CONTROL,
- cmd, data, ifp));
+ (struct mbuf *)cmd, (struct mbuf *)data,
+ (struct mbuf *)ifp, (struct mbuf *)0));
#else
{
int ocmd = cmd;
diff --git a/sys/net/if.h b/sys/net/if.h
index e1d7f316b04a..b434f795a59f 100644
--- a/sys/net/if.h
+++ b/sys/net/if.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)if.h 7.11 (Berkeley) 3/19/91
- * $Id: if.h,v 1.11 1993/12/19 00:52:02 wollman Exp $
+ * $Id: if.h,v 1.12 1994/05/17 22:30:53 jkh Exp $
*/
#ifndef _NET_IF_H_
@@ -81,7 +81,7 @@ struct ifnet {
char *if_name; /* name, e.g. ``en'' or ``lo'' */
short if_unit; /* sub-unit for lower level driver */
u_short if_mtu; /* maximum transmission unit */
- short if_flags; /* up/down, broadcast, etc. */
+ u_int if_flags; /* up/down, broadcast, etc. */
short if_timer; /* time 'til if_watchdog called */
int if_metric; /* routing metric (external only) */
struct ifaddr *if_addrlist; /* linked list of addresses per if */
@@ -143,12 +143,18 @@ struct ifnet {
#define IFF_LLC2 0x4000 /* IEEE 802.2 LLC class 2 */
#define IFF_ALTPHYS 0x8000 /* alternative physical connection */
#define IFF_MULTICAST 0x10000 /* i'face supports multicast */
+#ifdef notdef
#define IFF_VIRTUAL 0x20000 /* i'face is really a VIF */
/* flags set internally only: */
#define IFF_CANTCHANGE \
(IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|IFF_SIMPLEX\
|IFF_MULTICAST|IFF_VIRTUAL)
+#else
+#define IFF_CANTCHANGE \
+ (IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|IFF_SIMPLEX\
+ |IFF_MULTICAST)
+#endif
/*
* Output queues (ifp->if_snd) and internetwork datagram level (pup level 1)
@@ -222,7 +228,7 @@ struct ifreq {
struct sockaddr ifru_addr;
struct sockaddr ifru_dstaddr;
struct sockaddr ifru_broadaddr;
- short ifru_flags;
+ u_int ifru_flags;
int ifru_metric;
caddr_t ifru_data;
} ifr_ifru;
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 348d51dd148f..9d7e897c32cb 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1982, 1989 Regents of the University of California.
+ * Copyright (c) 1982, 1989, 1993 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)if_ethersubr.c 7.13 (Berkeley) 4/20/91
- * $Id: if_ethersubr.c,v 1.4 1993/11/25 01:34:02 wollman Exp $
+ * $Id: if_ethersubr.c,v 1.5 1994/05/17 22:30:54 jkh Exp $
*/
#include "param.h"
@@ -110,22 +110,12 @@ ether_output(ifp, m0, dst, rt)
idst = ((struct sockaddr_in *)dst)->sin_addr;
if (!arpresolve(ac, m, &idst, edst, &usetrailers))
return (0); /* if not yet resolved */
- if ((ifp->if_flags & IFF_SIMPLEX) && (*edst & 1))
+ /* If broadcasting on a simplex interface, loopback a copy */
+ if ((m->m_flags & M_BCAST) && (ifp->if_flags & IFF_SIMPLEX))
mcopy = m_copy(m, 0, (int)M_COPYALL);
off = m->m_pkthdr.len - m->m_len;
- if (usetrailers && off > 0 && (off & 0x1ff) == 0 &&
- (m->m_flags & M_EXT) == 0 &&
- m->m_data >= m->m_pktdat + 2 * sizeof (u_short)) {
- type = ETHERTYPE_TRAIL + (off>>9);
- m->m_data -= 2 * sizeof (u_short);
- m->m_len += 2 * sizeof (u_short);
- len += 2 * sizeof (u_short);
- *mtod(m, u_short *) = htons((u_short)ETHERTYPE_IP);
- *(mtod(m, u_short *) + 1) = htons((u_short)m->m_len);
- goto gottrailertype;
- }
type = ETHERTYPE_IP;
- goto gottype;
+ break;
#endif
#ifdef NS
case AF_NS:
@@ -134,9 +124,10 @@ ether_output(ifp, m0, dst, rt)
(caddr_t)edst, sizeof (edst));
if (!bcmp((caddr_t)edst, (caddr_t)&ns_thishost, sizeof(edst)))
return (looutput(ifp, m, dst, rt));
- if ((ifp->if_flags & IFF_SIMPLEX) && (*edst & 1))
+ /* If broadcasting on a simplex interface, loopback a copy */
+ if ((m->m_flags & M_BCAST) && (ifp->if_flags & IFF_SIMPLEX))
mcopy = m_copy(m, 0, (int)M_COPYALL);
- goto gottype;
+ break;
#endif
#ifdef ISO
case AF_ISO: {
@@ -165,7 +156,8 @@ ether_output(ifp, m0, dst, rt)
(char *)edst, &snpalen)) > 0)
goto bad; /* Not Resolved */
iso_resolved:
- if ((ifp->if_flags & IFF_SIMPLEX) && (*edst & 1) &&
+ /* If broadcasting on a simplex interface, loopback a copy */
+ if ((m->m_flags & M_BCAST) && (ifp->if_flags & IFF_SIMPLEX)
(mcopy = m_copy(m, 0, (int)M_COPYALL))) {
M_PREPEND(mcopy, sizeof (*eh), M_DONTWAIT);
if (mcopy) {
@@ -191,7 +183,8 @@ ether_output(ifp, m0, dst, rt)
printf("%x ", edst[i] & 0xff);
printf("\n");
ENDDEBUG
- } goto gottype;
+ }
+ break;
#endif ISO
#ifdef RMP
case AF_RMP:
@@ -208,7 +201,7 @@ ether_output(ifp, m0, dst, rt)
eh = (struct ether_header *)dst->sa_data;
bcopy((caddr_t)eh->ether_dhost, (caddr_t)edst, sizeof (edst));
type = eh->ether_type;
- goto gottype;
+ break;
default:
printf("%s%d: can't handle af%d\n", ifp->if_name, ifp->if_unit,
@@ -217,18 +210,6 @@ ether_output(ifp, m0, dst, rt)
goto bad;
}
-gottrailertype:
- /*
- * Packet to be sent as trailer: move first packet
- * (control information) to end of chain.
- */
- while (m->m_next)
- m = m->m_next;
- m->m_next = m0;
- m = m0->m_next;
- m0->m_next = 0;
-
-gottype:
if (mcopy)
(void) looutput(ifp, mcopy, dst, rt);
/*
@@ -266,7 +247,7 @@ gottype:
(*ifp->if_start)(ifp);
splx(s);
ifp->if_obytes += len + sizeof (struct ether_header);
- if (edst[0] & 1)
+ if (m->m_flags & M_MCAST)
ifp->if_omcasts++;
return (error);
@@ -293,11 +274,13 @@ ether_input(ifp, eh, m)
ifp->if_lastchange = time;
ifp->if_ibytes += m->m_pkthdr.len + sizeof (*eh);
+ if (eh->ether_dhost[0] & 1) {
if (bcmp((caddr_t)etherbroadcastaddr, (caddr_t)eh->ether_dhost,
sizeof(etherbroadcastaddr)) == 0)
m->m_flags |= M_BCAST;
- else if (eh->ether_dhost[0] & 1)
+ else
m->m_flags |= M_MCAST;
+ }
if (m->m_flags & (M_BCAST|M_MCAST))
ifp->if_imcasts++;
@@ -421,3 +404,178 @@ ether_sprintf(ap)
*--cp = 0;
return (etherbuf);
}
+
+#ifdef MULTICAST
+u_char ether_ipmulticast_min[6] = { 0x01, 0x00, 0x5e, 0x00, 0x00, 0x00 };
+u_char ether_ipmulticast_max[6] = { 0x01, 0x00, 0x5e, 0x7f, 0xff, 0xff };
+
+/* XXX */
+#undef ac
+/*
+ * Add an Ethernet multicast address or range of addresses to the list for a
+ * given interface.
+ */
+int
+ether_addmulti(ifr, ac)
+ struct ifreq *ifr;
+ register struct arpcom *ac;
+{
+ register struct ether_multi *enm;
+ struct sockaddr_in *sin;
+ u_char addrlo[6];
+ u_char addrhi[6];
+ int s = splimp();
+
+ switch (ifr->ifr_addr.sa_family) {
+
+ case AF_UNSPEC:
+ bcopy(ifr->ifr_addr.sa_data, addrlo, 6);
+ bcopy(addrlo, addrhi, 6);
+ break;
+
+#ifdef INET
+ case AF_INET:
+ sin = (struct sockaddr_in *)&(ifr->ifr_addr);
+ if (sin->sin_addr.s_addr == INADDR_ANY) {
+ /*
+ * An IP address of INADDR_ANY means listen to all
+ * of the Ethernet multicast addresses used for IP.
+ * (This is for the sake of IP multicast routers.)
+ */
+ bcopy(ether_ipmulticast_min, addrlo, 6);
+ bcopy(ether_ipmulticast_max, addrhi, 6);
+ }
+ else {
+ ETHER_MAP_IP_MULTICAST(&sin->sin_addr, addrlo);
+ bcopy(addrlo, addrhi, 6);
+ }
+ break;
+#endif
+
+ default:
+ splx(s);
+ return (EAFNOSUPPORT);
+ }
+
+ /*
+ * Verify that we have valid Ethernet multicast addresses.
+ */
+ if ((addrlo[0] & 0x01) != 1 || (addrhi[0] & 0x01) != 1) {
+ splx(s);
+ return (EINVAL);
+ }
+ /*
+ * See if the address range is already in the list.
+ */
+ ETHER_LOOKUP_MULTI(addrlo, addrhi, ac, enm);
+ if (enm != NULL) {
+ /*
+ * Found it; just increment the reference count.
+ */
+ ++enm->enm_refcount;
+ splx(s);
+ return (0);
+ }
+ /*
+ * New address or range; malloc a new multicast record
+ * and link it into the interface's multicast list.
+ */
+ enm = (struct ether_multi *)malloc(sizeof(*enm), M_IFMADDR, M_NOWAIT);
+ if (enm == NULL) {
+ splx(s);
+ return (ENOBUFS);
+ }
+ bcopy(addrlo, enm->enm_addrlo, 6);
+ bcopy(addrhi, enm->enm_addrhi, 6);
+ enm->enm_ac = ac;
+ enm->enm_refcount = 1;
+ enm->enm_next = ac->ac_multiaddrs;
+ ac->ac_multiaddrs = enm;
+ ac->ac_multicnt++;
+ splx(s);
+ /*
+ * Return ENETRESET to inform the driver that the list has changed
+ * and its reception filter should be adjusted accordingly.
+ */
+ return (ENETRESET);
+}
+
+/*
+ * Delete a multicast address record.
+ */
+int
+ether_delmulti(ifr, ac)
+ struct ifreq *ifr;
+ 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];
+ int s = splimp();
+
+ switch (ifr->ifr_addr.sa_family) {
+
+ case AF_UNSPEC:
+ bcopy(ifr->ifr_addr.sa_data, addrlo, 6);
+ bcopy(addrlo, addrhi, 6);
+ break;
+
+#ifdef INET
+ case AF_INET:
+ sin = (struct sockaddr_in *)&(ifr->ifr_addr);
+ if (sin->sin_addr.s_addr == INADDR_ANY) {
+ /*
+ * An IP address of INADDR_ANY means stop listening
+ * to the range of Ethernet multicast addresses used
+ * for IP.
+ */
+ bcopy(ether_ipmulticast_min, addrlo, 6);
+ bcopy(ether_ipmulticast_max, addrhi, 6);
+ }
+ else {
+ ETHER_MAP_IP_MULTICAST(&sin->sin_addr, addrlo);
+ bcopy(addrlo, addrhi, 6);
+ }
+ break;
+#endif
+
+ default:
+ splx(s);
+ return (EAFNOSUPPORT);
+ }
+
+ /*
+ * Look up the address in our list.
+ */
+ ETHER_LOOKUP_MULTI(addrlo, addrhi, ac, enm);
+ if (enm == NULL) {
+ splx(s);
+ return (ENXIO);
+ }
+ if (--enm->enm_refcount != 0) {
+ /*
+ * Still some claims to this record.
+ */
+ splx(s);
+ return (0);
+ }
+ /*
+ * No remaining claims to this record; unlink and free it.
+ */
+ for (p = &enm->enm_ac->ac_multiaddrs;
+ *p != enm;
+ p = &(*p)->enm_next)
+ continue;
+ *p = (*p)->enm_next;
+ free(enm, M_IFMADDR);
+ ac->ac_multicnt--;
+ splx(s);
+ /*
+ * Return ENETRESET to inform the driver that the list has changed
+ * and its reception filter should be adjusted accordingly.
+ */
+ return (ENETRESET);
+}
+#endif
diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c
index 163712a66fd1..d9f5028b7e1d 100644
--- a/sys/net/if_loop.c
+++ b/sys/net/if_loop.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)if_loop.c 7.13 (Berkeley) 4/26/91
- * $Id: if_loop.c,v 1.6 1993/12/20 19:31:29 wollman Exp $
+ * $Id: if_loop.c,v 1.7 1994/05/17 22:30:55 jkh Exp $
*/
/*
@@ -95,7 +95,11 @@ loattach(void)
ifp->if_name = "lo";
ifp->if_mtu = LOMTU;
+#ifdef MULTICAST
+ ifp->if_flags = IFF_LOOPBACK|IFF_MULTICAST;
+#else
ifp->if_flags = IFF_LOOPBACK;
+#endif
ifp->if_ioctl = loioctl;
ifp->if_output = looutput;
ifp->if_type = IFT_LOOP;
@@ -216,6 +220,9 @@ loioctl(ifp, cmd, data)
caddr_t data;
{
register struct ifaddr *ifa;
+#ifdef MULTICAST
+ register struct ifreq *ifr;
+#endif
int error = 0;
switch (cmd) {
@@ -230,6 +237,27 @@ loioctl(ifp, cmd, data)
*/
break;
+#ifdef MULTICAST
+ case SIOCADDMULTI:
+ case SIOCDELMULTI:
+ ifr = (struct ifreq *)data;
+ if (ifr == 0) {
+ error = EAFNOSUPPORT; /* XXX */
+ break;
+ }
+ switch (ifr->ifr_addr.sa_family) {
+
+#ifdef INET
+ case AF_INET:
+ break;
+#endif
+
+ default:
+ error = EAFNOSUPPORT;
+ break;
+ }
+ break;
+#endif
default:
error = EINVAL;
}
diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c
index efda46dbe54a..18beb9a345cd 100644
--- a/sys/net/if_ppp.c
+++ b/sys/net/if_ppp.c
@@ -70,7 +70,7 @@
*/
/*
- * $Id: if_ppp.c,v 1.7 1993/12/20 19:31:30 wollman Exp $
+ * $Id: if_ppp.c,v 1.13 1994/05/30 03:37:47 ache Exp $
* From: if_ppp.c,v 1.22 1993/08/31 23:20:40 paulus Exp
* From: if_ppp.c,v 1.21 1993/08/29 11:22:37 paulus Exp
* From: if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp
@@ -92,6 +92,7 @@
#include "kernel.h"
#include "conf.h"
#include "dkstat.h"
+#include "pppdefs.h"
#include "if.h"
#include "if_types.h"
@@ -117,11 +118,11 @@
#ifndef RB_LEN
/* NetBSD, 4.3-Reno or similar */
#define CCOUNT(q) ((q)->c_cc)
+#define TSA_HUP_OR_INPUT(tp) ((caddr_t)&tp->t_rawq)
#else
/* 386BSD, Jolitz-style ring buffers */
#define t_outq t_out
-#define t_rawq t_raw
#define t_canq t_can
#define CCOUNT(q) (RB_LEN(q))
#endif
@@ -249,7 +250,7 @@ pppopen(dev, tp)
if (sc->sc_ttyp == NULL)
break;
if (nppp >= NPPP)
- return ENXIO;
+ return (ENXIO);
sc->sc_flags = 0;
sc->sc_ilen = 0;
@@ -344,33 +345,40 @@ pppread(tp, uio, flag)
{
register struct ppp_softc *sc = (struct ppp_softc *)tp->t_sc;
struct mbuf *m, *m0;
- register int s;
- int error = 0;
+ int s;
+ int error;
- if ((tp->t_state & TS_CARR_ON)==0)
- return (EIO);
s = splimp();
- while (sc->sc_inq.ifq_head == NULL && tp->t_line == PPPDISC) {
+ for (;;) {
+ if (tp->t_line != PPPDISC) {
+ splx(s);
+ return (ENXIO);
+ }
+ if (!CAN_DO_IO(tp)) {
+ splx(s);
+ return (EIO);
+ }
+ if (sc->sc_inq.ifq_head != NULL)
+ break;
if (tp->t_state & TS_ASYNC) {
splx(s);
return (EWOULDBLOCK);
}
- error = ttysleep(tp, (caddr_t)&tp->t_rawq, TTIPRI|PCATCH, ttyin, 0);
- if (error)
- return error;
- }
- if (tp->t_line != PPPDISC) {
- splx(s);
- return (-1);
+ error = ttysleep(tp, TSA_HUP_OR_INPUT(tp), TTIPRI | PCATCH, "pppin", 0);
+ if (error) {
+ splx(s);
+ return (error);
+ }
}
/* Pull place-holder byte out of canonical queue */
- getc(&tp->t_canq);
+ getc(tp->t_canq);
/* Get the packet from the input queue */
IF_DEQUEUE(&sc->sc_inq, m0);
splx(s);
+ error = 0;
for (m = m0; m && uio->uio_resid; m = m->m_next)
if (error = uiomove(mtod(m, u_char *), m->m_len, uio))
break;
@@ -391,19 +399,33 @@ pppwrite(tp, uio, flag)
struct mbuf *m, *m0, **mp;
struct sockaddr dst;
struct ppp_header *ph1, *ph2;
- int len, error;
+ int len, error, s;
- if ((tp->t_state & TS_CARR_ON)==0)
- return (EIO);
if (tp->t_line != PPPDISC)
- return (EINVAL);
+ return (ENXIO);
+
+ /*
+ * XXX the locking is probably too strong, and/or the order of checking
+ * for errors requires an inconvenient number of splx()'s. pppoutput()
+ * does its own locking, but we must hold at least an spltty() lock to
+ * preserve the validity of the test of TS_CARR_ON in CAN_DO_IO().
+ */
+ s = splimp();
+
+ if (!CAN_DO_IO(tp)) {
+ splx(s);
+ return (EIO);
+ }
if (uio->uio_resid > sc->sc_if.if_mtu + PPP_HEADER_LEN ||
- uio->uio_resid < PPP_HEADER_LEN)
+ uio->uio_resid < PPP_HEADER_LEN) {
+ splx(s);
return (EMSGSIZE);
+ }
for (mp = &m0; uio->uio_resid; mp = &m->m_next) {
MGET(m, M_WAIT, MT_DATA);
if ((*mp = m) == NULL) {
m_freem(m0);
+ splx(s);
return (ENOBUFS);
}
if (uio->uio_resid >= MCLBYTES / 2)
@@ -411,6 +433,7 @@ pppwrite(tp, uio, flag)
len = MIN(M_TRAILINGSPACE(m), uio->uio_resid);
if (error = uiomove(mtod(m, u_char *), len, uio)) {
m_freem(m0);
+ splx(s);
return (error);
}
m->m_len = len;
@@ -421,7 +444,9 @@ pppwrite(tp, uio, flag)
*ph1 = *ph2;
m0->m_data += PPP_HEADER_LEN;
m0->m_len -= PPP_HEADER_LEN;
- return (pppoutput(&sc->sc_if, m0, &dst, 0));
+ error = pppoutput(&sc->sc_if, m0, &dst, 0);
+ splx(s);
+ return (error);
}
/*
@@ -589,7 +614,7 @@ pppoutput(ifp, m0, dst, rt)
error = ENETDOWN; /* sort of */
goto bad;
}
- if ((sc->sc_ttyp->t_state & TS_CARR_ON) == 0) {
+ if (!CAN_DO_IO(sc->sc_ttyp)) {
error = EHOSTUNREACH;
goto bad;
}
@@ -711,15 +736,14 @@ pppstart(tp)
for (;;) {
/*
- * If there is more in the output queue, just send it now.
+ * Call output process whether or not there is any output.
* We are being called in lieu of ttstart and must do what
* it would.
*/
- if (CCOUNT(&tp->t_outq) != 0 && tp->t_oproc != NULL) {
- (*tp->t_oproc)(tp);
- if (CCOUNT(&tp->t_outq) > PPP_HIWAT)
- return;
- }
+ (*tp->t_oproc)(tp);
+ if (CCOUNT(tp->t_outq) > PPP_HIWAT)
+ return;
+
/*
* This happens briefly when the line shuts down.
*/
@@ -809,9 +833,9 @@ pppstart(tp)
* will flush any accumulated garbage. We do this whenever
* the line may have been idle for some time.
*/
- if (CCOUNT(&tp->t_outq) == 0) {
+ if (CCOUNT(tp->t_outq) == 0) {
++sc->sc_bytessent;
- (void) putc(PPP_FLAG, &tp->t_outq);
+ (void) putc(PPP_FLAG, tp->t_outq);
}
/* Calculate the FCS for the first mbuf's worth. */
@@ -834,7 +858,7 @@ pppstart(tp)
if (n) {
#ifndef RB_LEN
/* NetBSD (0.9 or later), 4.3-Reno or similar. */
- ndone = n - b_to_q(start, n, &tp->t_outq);
+ ndone = n - b_to_q(start, n, tp->t_outq);
#else
#ifdef NetBSD
/* NetBSD with 2-byte ring buffer entries */
@@ -843,12 +867,12 @@ pppstart(tp)
/* 386BSD, FreeBSD */
int cc, nleft;
for (nleft = n; nleft > 0; nleft -= cc) {
- if ((cc = RB_CONTIGPUT(&tp->t_out)) == 0)
+ if ((cc = RB_CONTIGPUT(tp->t_out)) == 0)
break;
cc = min (cc, nleft);
- bcopy((char *)start + n - nleft, tp->t_out.rb_tl, cc);
- tp->t_out.rb_tl = RB_ROLLOVER(&tp->t_out,
- tp->t_out.rb_tl + cc);
+ bcopy((char *)start + n - nleft, tp->t_out->rb_tl, cc);
+ tp->t_out->rb_tl = RB_ROLLOVER(tp->t_out,
+ tp->t_out->rb_tl + cc);
}
ndone = n - nleft;
#endif /* NetBSD */
@@ -866,10 +890,10 @@ pppstart(tp)
* Put it out in a different form.
*/
if (len) {
- if (putc(PPP_ESCAPE, &tp->t_outq))
+ if (putc(PPP_ESCAPE, tp->t_outq))
break;
- if (putc(*start ^ PPP_TRANS, &tp->t_outq)) {
- (void) unputc(&tp->t_outq);
+ if (putc(*start ^ PPP_TRANS, tp->t_outq)) {
+ (void) unputc(tp->t_outq);
break;
}
sc->sc_bytessent += 2;
@@ -912,10 +936,10 @@ pppstart(tp)
* don't all fit, back out.
*/
for (q = endseq; q < p; ++q)
- if (putc(*q, &tp->t_outq)) {
+ if (putc(*q, tp->t_outq)) {
done = 0;
for (; q > endseq; --q)
- unputc(&tp->t_outq);
+ unputc(tp->t_outq);
break;
}
}
@@ -1213,7 +1237,7 @@ pppinput(c, tp)
* Some other protocol - place on input queue for read().
* Put a placeholder byte in canq for ttselect()/ttnread().
*/
- putc(0, &tp->t_canq);
+ putc(0, tp->t_canq);
ttwakeup(tp);
inq = &sc->sc_inq;
break;
diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c
index 223281337a53..60376b28e1bf 100644
--- a/sys/net/if_sl.c
+++ b/sys/net/if_sl.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)if_sl.c 7.22 (Berkeley) 4/20/91
- * $Id: if_sl.c,v 1.7 1993/12/20 19:31:32 wollman Exp $
+ * $Id: if_sl.c,v 1.12 1994/06/07 13:02:36 davidg Exp $
*/
/*
@@ -65,7 +65,7 @@
* interrupts and network activity; thus, splimp must be >= spltty.
*/
-/* $Id: if_sl.c,v 1.7 1993/12/20 19:31:32 wollman Exp $ */
+/* $Id: if_sl.c,v 1.12 1994/06/07 13:02:36 davidg Exp $ */
/* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */
#include "sl.h"
@@ -170,8 +170,10 @@
#ifndef SLRMTU
#define SLRMTU 296 /* for good latency */
#endif
-#else
+#else /* (not) experimental */
+#ifndef SLMTU
#define SLMTU 296
+#endif
#define SLRMTU SLMTU
#endif
@@ -445,7 +447,7 @@ sloutput(ifp, m, dst, rt)
}
IF_ENQUEUE(ifq, m);
sc->sc_if.if_lastchange = time;
- if (RB_LEN(&sc->sc_ttyp->t_out) == 0)
+ if (RB_LEN(sc->sc_ttyp->t_out) == 0)
slstart(sc->sc_ttyp);
splx(s);
return (0);
@@ -478,7 +480,7 @@ slstart(tp)
* it would.
*/
(*tp->t_oproc)(tp);
- if (RB_LEN(&tp->t_out) > SLIP_HIWAT)
+ if (RB_LEN(tp->t_out) > SLIP_HIWAT)
return;
/*
@@ -495,7 +497,7 @@ slstart(tp)
* of RBSZ in tty.h also has to be upped to be at least
* SLMTU*2.
*/
- if (min(RBSZ, 4 * SLMTU + 4) - RB_LEN(&tp->t_out) < 2 * SLMTU + 2)
+ if (min(RBSZ, 4 * SLMTU + 4) - RB_LEN(tp->t_out) < 2 * SLMTU + 2)
return;
/*
@@ -558,9 +560,9 @@ slstart(tp)
* will flush any accumulated garbage. We do this whenever
* the line may have been idle for some time.
*/
- if (RB_LEN(&tp->t_out) == 0) {
+ if (RB_LEN(tp->t_out) == 0) {
++sc->sc_bytessent;
- (void) putc(FRAME_END, &tp->t_out);
+ (void) putc(FRAME_END, tp->t_out);
}
while (m) {
@@ -589,7 +591,7 @@ slstart(tp)
* into the tty output queue.
*/
sc->sc_bytessent += rb_write(
- &tp->t_out,
+ tp->t_out,
(char *) bp,
cp - bp);
}
@@ -599,12 +601,12 @@ slstart(tp)
* Put it out in a different form.
*/
if (cp < ep) {
- if (putc(FRAME_ESCAPE, &tp->t_out))
+ if (putc(FRAME_ESCAPE, tp->t_out))
break;
if (putc(*cp++ == FRAME_ESCAPE ?
TRANS_FRAME_ESCAPE : TRANS_FRAME_END,
- &tp->t_out)) {
- (void) unputc(&tp->t_out);
+ tp->t_out)) {
+ (void) unputc(tp->t_out);
break;
}
sc->sc_bytessent += 2;
@@ -614,7 +616,7 @@ slstart(tp)
m = m2;
}
- if (putc(FRAME_END, &tp->t_out)) {
+ if (putc(FRAME_END, tp->t_out)) {
/*
* Not enough room. Remove a char to make room
* and end the packet normally.
@@ -622,8 +624,8 @@ slstart(tp)
* a day) you probably do not have enough clists
* and you should increase "nclist" in param.c.
*/
- (void) unputc(&tp->t_out);
- (void) putc(FRAME_END, &tp->t_out);
+ (void) unputc(tp->t_out);
+ (void) putc(FRAME_END, tp->t_out);
sc->sc_if.if_collisions++;
} else {
++sc->sc_bytessent;
@@ -869,6 +871,9 @@ slioctl(ifp, cmd, data)
caddr_t data;
{
register struct ifaddr *ifa = (struct ifaddr *)data;
+#ifdef MULTICAST
+ register struct ifreq *ifr;
+#endif
int s = splimp(), error = 0;
switch (cmd) {
@@ -890,6 +895,25 @@ slioctl(ifp, cmd, data)
error = EAFNOSUPPORT;
break;
+#ifdef MULTICAST
+ case SIOCADDMULTI:
+ case SIOCDELMULTI:
+ ifr = (struct ifreq *)data;
+ if (ifr == 0) {
+ error = EAFNOSUPPORT; /* XXX */
+ break;
+ }
+ switch (ifr->ifr_addr.sa_family) {
+#ifdef INET
+ case AF_INET:
+ break;
+#endif
+ default:
+ error = EAFNOSUPPORT;
+ break;
+ }
+ break;
+#endif
default:
error = EINVAL;
}
diff --git a/sys/net/netisr.h b/sys/net/netisr.h
index b543791db6fb..372388b69ded 100644
--- a/sys/net/netisr.h
+++ b/sys/net/netisr.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)netisr.h 7.8 (Berkeley) 5/7/91
- * $Id: netisr.h,v 1.5 1993/12/20 14:58:31 wollman Exp $
+ * $Id: netisr.h,v 1.6 1994/04/02 07:01:00 davidg Exp $
*/
#ifndef _NET_NETISR_H_
@@ -65,20 +65,9 @@
#define schednetisr(anisr) { netisr |= 1<<(anisr); setsoftnet(); }
-#ifdef i386
-/* XXX Temporary -- soon to vanish - wfj */
-#define NETISR_SCLK 11 /* softclock */
-#define NETISR_AST 12 /* ast -- resched */
-
-#undef schednetisr
-#define schednetisr(anisr) {\
- netisr |= 1<<(anisr); \
-}
-#endif /* i386 */
-
#ifndef LOCORE
#ifdef KERNEL
-extern int netisr; /* scheduling bits for network */
+extern volatile unsigned netisr; /* scheduling bits for network */
#endif
#endif
#endif /* _NET_NETISR_H_ */
diff --git a/sys/net/ppp.h b/sys/net/pppdefs.h
index c2d4a79c4baa..a0b5bc5d5b4f 100644
--- a/sys/net/ppp.h
+++ b/sys/net/pppdefs.h
@@ -1,5 +1,5 @@
/*
- * ppp.h - PPP global declarations.
+ * pppdefs.h - PPP global declarations.
*
* Copyright (c) 1989 Carnegie Mellon University.
* All rights reserved.
@@ -16,14 +16,13 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * from: unknown
- * $Id: ppp.h,v 1.2 1993/10/16 17:43:29 rgrimes Exp $
+ * $Id: pppdefs.h,v 1.1 1994/04/01 10:13:22 jkh Exp $
*/
#ifndef __PPP_H__
#define __PPP_H__
-#define NPPP 1 /* One PPP interface supported (per process) */
+#define _NPPP 1 /* One PPP interface supported (per process) */
/*
* Data Link Layer header = Address, Control, Protocol.
@@ -34,6 +33,7 @@
#define IPCP 0x8021 /* IP Control Protocol */
#define UPAP 0xc023 /* User/Password Authentication Protocol */
#define CHAP 0xc223 /* Crytpographic Handshake Protocol */
+#define LQR 0xc025 /* Link Quality Report protocol */
#define IP_VJ_COMP 0x002d /* VJ TCP compressed IP packet */
#define DLLHEADERLEN (sizeof (u_char) + sizeof (u_char) + sizeof (u_short))
#define MTU 1500 /* Default MTU */
diff --git a/sys/net/raw_cb.h b/sys/net/raw_cb.h
index 5d64b60d9d9a..0eda56573de6 100644
--- a/sys/net/raw_cb.h
+++ b/sys/net/raw_cb.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)raw_cb.h 7.6 (Berkeley) 6/28/90
- * $Id: raw_cb.h,v 1.4 1993/12/19 00:52:05 wollman Exp $
+ * $Id: raw_cb.h,v 1.5 1994/05/17 22:30:57 jkh Exp $
*/
#ifndef _NET_RAW_CB_H_
@@ -48,6 +48,7 @@ struct rawcb {
struct sockaddr *rcb_faddr; /* destination address */
struct sockaddr *rcb_laddr; /* socket's address */
struct sockproto rcb_proto; /* protocol family, protocol */
+ struct mbuf *rcb_moptions; /* proto specific multicast options */
};
#define sotorawcb(so) ((struct rawcb *)(so)->so_pcb)
diff --git a/sys/net/route.c b/sys/net/route.c
index 5cf0cb72d556..ccb1cf63d097 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)route.c 7.22 (Berkeley) 6/27/91
- * $Id: route.c,v 1.5.2.1 1994/03/24 07:42:12 rgrimes Exp $
+ * $Id: route.c,v 1.6 1994/03/22 02:02:25 davidg Exp $
*/
#include "param.h"