BSD 4_3_Net_2 release
[unix-history] / usr / src / sys / vax / if / if_dp.c
index a613f97..f029aa3 100644 (file)
@@ -2,9 +2,35 @@
  * Copyright (c) 1990 Regents of the University of California.
  * All rights reserved.
  *
  * Copyright (c) 1990 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_dp.c     7.7 (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_dp.c     7.9 (Berkeley) 6/27/91
  */
 
 #include "dp.h"
  */
 
 #include "dp.h"
@@ -41,6 +67,7 @@
 #include "sys/kernel.h"
 
 #include "net/if.h"
 #include "sys/kernel.h"
 
 #include "net/if.h"
+#include "net/if_types.h"
 #include "net/netisr.h"
 #include "net/route.h"
 
 #include "net/netisr.h"
 #include "net/route.h"
 
@@ -61,7 +88,8 @@
  * Driver information for auto-configuration stuff.
  */
 int    dpprobe(), dpattach(), dpinit(), dpioctl(), dprint(), dpxint();
  * Driver information for auto-configuration stuff.
  */
 int    dpprobe(), dpattach(), dpinit(), dpioctl(), dprint(), dpxint();
-int    dpoutput(), dpreset(), dptimeout(), dpstart(), x25_ifoutput(), dptestoutput();
+int    dpoutput(), dpreset(), dptimeout(), dpstart(), dptestoutput();
+int    x25_ifoutput(), x25_rtrequest();
 
 struct uba_device *dpinfo[NDP];
 
 
 struct uba_device *dpinfo[NDP];
 
@@ -91,6 +119,7 @@ struct dp_softc {
 #define DPF_ONLINE     0x02            /* device running (had a RDYO) */
 #define DPF_RESTART    0x04            /* software restart in progress */
 #define DPF_FLUSH      0x08            /* had a ROVR, flush ipkt when done */
 #define DPF_ONLINE     0x02            /* device running (had a RDYO) */
 #define DPF_RESTART    0x04            /* software restart in progress */
 #define DPF_FLUSH      0x08            /* had a ROVR, flush ipkt when done */
+#define DPF_X25UP      0x10            /* XXX -- someday we'll do PPP also */
        short   dp_ostate;              /* restarting, etc. */
        short   dp_istate;              /* not sure this is necessary */
 #define DPS_IDLE       0
        short   dp_ostate;              /* restarting, etc. */
        short   dp_istate;              /* not sure this is necessary */
 #define DPS_IDLE       0
@@ -126,7 +155,7 @@ struct      dpstat {
 } dpstat;
 
 short dp_ilb = 0;
 } dpstat;
 
 short dp_ilb = 0;
-short dp_log = 1;
+short dp_log = 0;
 
 #define _offsetof(t, m) ((int)((caddr_t)&((t *)0)->m))
 int dp_sizes[] = {
 
 #define _offsetof(t, m) ((int)((caddr_t)&((t *)0)->m))
 int dp_sizes[] = {
@@ -175,6 +204,9 @@ dpattach(ui)
        dp->dp_if.if_mtu = DP_MTU;
        dp->dp_if.if_init = dpinit;
        dp->dp_if.if_output = x25_ifoutput;
        dp->dp_if.if_mtu = DP_MTU;
        dp->dp_if.if_init = dpinit;
        dp->dp_if.if_output = x25_ifoutput;
+       dp->dp_if.if_type = IFT_X25;
+       dp->dp_if.if_hdrlen = 5;
+       dp->dp_if.if_addrlen = 8;
        dp->dp_if.if_start = dpstart;
        dp->dp_if.if_ioctl = dpioctl;
        dp->dp_if.if_reset = dpreset;
        dp->dp_if.if_start = dpstart;
        dp->dp_if.if_ioctl = dpioctl;
        dp->dp_if.if_reset = dpreset;
@@ -572,26 +604,16 @@ dpioctl(ifp, cmd, data)
 
        dpstat.ioctl++;
        switch (cmd) {
 
        dpstat.ioctl++;
        switch (cmd) {
-
-       case SIOCSIFADDR:
-               ifp->if_flags |= IFF_UP;
-               switch (ifa->ifa_addr->sa_family) {
-               case AF_INET:
-                       ifp->if_output = dptestoutput;
-               default:
-                       dpinit(ifp->if_unit);
-                       break;
-               }
-               break;
-#ifdef CCITT
        case SIOCSIFCONF_X25:
                ifp->if_flags |= IFF_UP;
        case SIOCSIFCONF_X25:
                ifp->if_flags |= IFF_UP;
-               ifp->if_output = x25_ifoutput;
                error = hd_ctlinput(PRC_IFUP, ifa->ifa_addr);
                if (error == 0)
                        dpinit(ifp->if_unit);
                break;
                error = hd_ctlinput(PRC_IFUP, ifa->ifa_addr);
                if (error == 0)
                        dpinit(ifp->if_unit);
                break;
-#endif
+
+       case SIOCSIFADDR:
+               ifa->ifa_rtrequest = x25_rtrequest;
+               break;
 
        case SIOCSIFFLAGS:
                if ((ifp->if_flags & IFF_UP) == 0 &&
 
        case SIOCSIFFLAGS:
                if ((ifp->if_flags & IFF_UP) == 0 &&