BSD 4_4 release
[unix-history] / usr / src / sys / net / if_sl.c
index 0787c38..0f51fc2 100644 (file)
@@ -1,10 +1,36 @@
 /*
 /*
- * Copyright (c) 1987, 1989, 1992 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1987, 1989, 1992, 1993
+ *     The Regents of the University of California.  All rights reserved.
  *
  *
- * %sccs.include.redist.c%
+ * 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 the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
  *
  *
- *     @(#)if_sl.c     7.29 (Berkeley) %G%
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ *
+ *     @(#)if_sl.c     8.1 (Berkeley) 6/10/93
  */
 
 /*
  */
 
 /*
 #include "sl.h"
 #if NSL > 0
 
 #include "sl.h"
 #if NSL > 0
 
-#include "param.h"
-#include "proc.h"
-#include "mbuf.h"
-#include "buf.h"
-#include "dk.h"
-#include "socket.h"
-#include "ioctl.h"
-#include "file.h"
-#include "tty.h"
-#include "kernel.h"
-#include "conf.h"
-#include "machine/cpu.h"
-
-#include "if.h"
-#include "if_types.h"
-#include "netisr.h"
-#include "route.h"
+#include <sys/param.h>
+#include <sys/proc.h>
+#include <sys/mbuf.h>
+#include <sys/buf.h>
+#include <sys/dkstat.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <sys/file.h>
+#include <sys/tty.h>
+#include <sys/kernel.h>
+#include <sys/conf.h>
+
+#include <machine/cpu.h>
+
+#include <net/if.h>
+#include <net/if_types.h>
+#include <net/netisr.h>
+#include <net/route.h>
 
 #if INET
 
 #if INET
-#include "netinet/in.h"
-#include "netinet/in_systm.h"
-#include "netinet/in_var.h"
-#include "netinet/ip.h"
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/in_var.h>
+#include <netinet/ip.h>
 #else
 Huh? Slip without inet?
 #endif
 
 #else
 Huh? Slip without inet?
 #endif
 
-#include "slcompress.h"
-#include "if_slvar.h"
+#include <net/slcompress.h>
+#include <net/if_slvar.h>
 
 /*
  * SLMAX is a hard limit on input packet size.  To simplify the code
 
 /*
  * SLMAX is a hard limit on input packet size.  To simplify the code
@@ -139,12 +166,15 @@ struct sl_softc sl_softc[NSL];
 
 #define t_sc T_LINEP
 
 
 #define t_sc T_LINEP
 
-int sloutput(), slioctl(), ttrstrt();
 extern struct timeval time;
 
 extern struct timeval time;
 
+static int slinit __P((struct sl_softc *));
+static struct mbuf *sl_btom __P((struct sl_softc *, int));
+
 /*
  * Called from boot code to establish sl interfaces.
  */
 /*
  * Called from boot code to establish sl interfaces.
  */
+void
 slattach()
 {
        register struct sl_softc *sc;
 slattach()
 {
        register struct sl_softc *sc;
@@ -155,12 +185,8 @@ slattach()
                sc->sc_if.if_next = NULL;
                sc->sc_if.if_unit = i++;
                sc->sc_if.if_mtu = SLMTU;
                sc->sc_if.if_next = NULL;
                sc->sc_if.if_unit = i++;
                sc->sc_if.if_mtu = SLMTU;
-#ifdef MULTICAST
                sc->sc_if.if_flags =
                    IFF_POINTOPOINT | SC_AUTOCOMP | IFF_MULTICAST;
                sc->sc_if.if_flags =
                    IFF_POINTOPOINT | SC_AUTOCOMP | IFF_MULTICAST;
-#else
-               sc->sc_if.if_flags = IFF_POINTOPOINT | SC_AUTOCOMP;
-#endif
                sc->sc_if.if_type = IFT_SLIP;
                sc->sc_if.if_ioctl = slioctl;
                sc->sc_if.if_output = sloutput;
                sc->sc_if.if_type = IFT_SLIP;
                sc->sc_if.if_ioctl = slioctl;
                sc->sc_if.if_output = sloutput;
@@ -197,6 +223,7 @@ slinit(sc)
  * Attach the given tty to the first available sl unit.
  */
 /* ARGSUSED */
  * Attach the given tty to the first available sl unit.
  */
 /* ARGSUSED */
+int
 slopen(dev, tp)
        dev_t dev;
        register struct tty *tp;
 slopen(dev, tp)
        dev_t dev;
        register struct tty *tp;
@@ -228,8 +255,8 @@ slopen(dev, tp)
 /*
  * Line specific close routine.
  * Detach the tty from the sl unit.
 /*
  * Line specific close routine.
  * Detach the tty from the sl unit.
- * Mimics part of ttyclose().
  */
  */
+void
 slclose(tp)
        struct tty *tp;
 {
 slclose(tp)
        struct tty *tp;
 {
@@ -257,6 +284,7 @@ slclose(tp)
  * Provide a way to get the sl unit number.
  */
 /* ARGSUSED */
  * Provide a way to get the sl unit number.
  */
 /* ARGSUSED */
+int
 sltioctl(tp, cmd, data, flag)
        struct tty *tp;
        int cmd;
 sltioctl(tp, cmd, data, flag)
        struct tty *tp;
        int cmd;
@@ -280,10 +308,12 @@ sltioctl(tp, cmd, data, flag)
 /*
  * Queue a packet.  Start transmission if not active.
  */
 /*
  * Queue a packet.  Start transmission if not active.
  */
-sloutput(ifp, m, dst)
+int
+sloutput(ifp, m, dst, rtp)
        struct ifnet *ifp;
        register struct mbuf *m;
        struct sockaddr *dst;
        struct ifnet *ifp;
        register struct mbuf *m;
        struct sockaddr *dst;
+       struct rtentry *rtp;
 {
        register struct sl_softc *sc = &sl_softc[ifp->if_unit];
        register struct ip *ip;
 {
        register struct sl_softc *sc = &sl_softc[ifp->if_unit];
        register struct ip *ip;
@@ -355,6 +385,7 @@ sloutput(ifp, m, dst)
  * to send from the interface queue and map it to
  * the interface before starting output.
  */
  * to send from the interface queue and map it to
  * the interface before starting output.
  */
+void
 slstart(tp)
        register struct tty *tp;
 {
 slstart(tp)
        register struct tty *tp;
 {
@@ -530,6 +561,7 @@ sl_btom(sc, len)
 /*
  * tty interface receiver interrupt.
  */
 /*
  * tty interface receiver interrupt.
  */
+void
 slinput(c, tp)
        register int c;
        register struct tty *tp;
 slinput(c, tp)
        register int c;
        register struct tty *tp;
@@ -660,15 +692,14 @@ newpack:
 /*
  * Process an ioctl request.
  */
 /*
  * Process an ioctl request.
  */
+int
 slioctl(ifp, cmd, data)
        register struct ifnet *ifp;
        int cmd;
        caddr_t data;
 {
        register struct ifaddr *ifa = (struct ifaddr *)data;
 slioctl(ifp, cmd, data)
        register struct ifnet *ifp;
        int cmd;
        caddr_t data;
 {
        register struct ifaddr *ifa = (struct ifaddr *)data;
-#ifdef MULTICAST
        register struct ifreq *ifr;
        register struct ifreq *ifr;
-#endif
        register int s = splimp(), error = 0;
 
        switch (cmd) {
        register int s = splimp(), error = 0;
 
        switch (cmd) {
@@ -685,7 +716,6 @@ slioctl(ifp, cmd, data)
                        error = EAFNOSUPPORT;
                break;
 
                        error = EAFNOSUPPORT;
                break;
 
-#ifdef MULTICAST
        case SIOCADDMULTI:
        case SIOCDELMULTI:
                ifr = (struct ifreq *)data;
        case SIOCADDMULTI:
        case SIOCDELMULTI:
                ifr = (struct ifreq *)data;
@@ -713,4 +743,3 @@ slioctl(ifp, cmd, data)
        splx(s);
        return (error);
 }
        splx(s);
        return (error);
 }
-#endif