pt-pt, loopback can transmit, fixed en bug that bugged sam
authorBill Joy <wnj@ucbvax.Berkeley.EDU>
Tue, 25 May 1982 08:16:12 +0000 (00:16 -0800)
committerBill Joy <wnj@ucbvax.Berkeley.EDU>
Tue, 25 May 1982 08:16:12 +0000 (00:16 -0800)
SCCS-vsn: sys/net/if.h 4.13
SCCS-vsn: sys/vax/if/if_ec.c 4.10
SCCS-vsn: sys/vax/if/if_en.c 4.60
SCCS-vsn: sys/vax/if/if_il.c 4.2

usr/src/sys/net/if.h
usr/src/sys/vax/if/if_ec.c
usr/src/sys/vax/if/if_en.c
usr/src/sys/vax/if/if_il.c

index f2d5508..a166d53 100644 (file)
@@ -1,4 +1,4 @@
-/*     if.h    4.12    82/03/30        */
+/*     if.h    4.13    82/05/24        */
 
 /*
  * Structures defining a network interface, providing a packet
 
 /*
  * Structures defining a network interface, providing a packet
@@ -37,8 +37,13 @@ struct ifnet {
        short   if_net;                 /* network number of interface */
        short   if_flags;               /* up/down, broadcast, etc. */
        int     if_host[2];             /* local net host number */
        short   if_net;                 /* network number of interface */
        short   if_flags;               /* up/down, broadcast, etc. */
        int     if_host[2];             /* local net host number */
-       struct  sockaddr if_addr;       /* internet address of interface */
-       struct  sockaddr if_broadaddr;  /* broadcast address of interface */
+       struct  sockaddr if_addr;       /* address of interface */
+       union {
+               struct  sockaddr ifu_broadaddr;
+               struct  sockaddr ifu_dstaddr;
+       } if_ifu;
+#define        if_broadaddr    if_ifu.ifu_broadaddr    /* broadcast address */
+#define        if_dstaddr      if_ifu.ifu_dstaddr      /* other end of p-to-p link */
        struct  ifqueue {
                struct  mbuf *ifq_head;
                struct  mbuf *ifq_tail;
        struct  ifqueue {
                struct  mbuf *ifq_head;
                struct  mbuf *ifq_tail;
@@ -63,7 +68,8 @@ struct ifnet {
 #define        IFF_UP          0x1             /* interface is up */
 #define        IFF_BROADCAST   0x2             /* broadcast address valid */
 #define        IFF_DEBUG       0x4             /* turn on debugging */
 #define        IFF_UP          0x1             /* interface is up */
 #define        IFF_BROADCAST   0x2             /* broadcast address valid */
 #define        IFF_DEBUG       0x4             /* turn on debugging */
-#define        IFF_ROUTE       0x8             /* routine entry installed */
+#define        IFF_ROUTE       0x8             /* routing entry installed */
+#define        IFF_POINTOPOINT 0x10            /* interface is point-to-point link */
 
 /*
  * Output queues (ifp->if_snd) and internetwork datagram level (pup level 1)
 
 /*
  * Output queues (ifp->if_snd) and internetwork datagram level (pup level 1)
index e788a51..847a1af 100644 (file)
@@ -1,4 +1,4 @@
-/*     if_ec.c 4.9     82/05/21        */
+/*     if_ec.c 4.10    82/05/24        */
 
 #include "ec.h"
 #include "imp.h"
 
 #include "ec.h"
 #include "imp.h"
@@ -186,7 +186,7 @@ COUNT(ECATTACH);
 #if NIMP == 0
        /* here's one for you john baby.... */
        if (ui->ui_flags &~ 0xff)
 #if NIMP == 0
        /* here's one for you john baby.... */
        if (ui->ui_flags &~ 0xff)
-               eclhinit((ui->ui_flags &~ 0xff) | 0x0a);
+               eclhinit(&es->es_if, (ui->ui_flags &~ 0xff) | 0x0a);
 #endif
 }
 
 #endif
 }
 
@@ -738,15 +738,15 @@ bad:
  */
 
 struct ifnet eclhif;
  */
 
 struct ifnet eclhif;
-int    eclhoutput();
+int    looutput();
 
 /*
  * Called by localnet interface to allow logical
 
 /*
  * Called by localnet interface to allow logical
- * host interface to "attach".  Nothing should ever
- * be sent locally to this interface, it's purpose
+ * host interface to "attach", it's purpose
  * is simply to establish the host's arpanet address.
  */
  * is simply to establish the host's arpanet address.
  */
-eclhinit(addr)
+eclhinit(ecifp, addr)
+       struct ifnet *ecifp;
        int addr;
 {
        register struct ifnet *ifp = &eclhif;
        int addr;
 {
        register struct ifnet *ifp = &eclhif;
@@ -759,19 +759,10 @@ COUNT(ECLHINIT);
        sin->sin_family = AF_INET;
        sin->sin_addr.s_addr = addr;
        ifp->if_net = sin->sin_addr.s_net;
        sin->sin_family = AF_INET;
        sin->sin_addr.s_addr = addr;
        ifp->if_net = sin->sin_addr.s_net;
-       ifp->if_flags = IFF_UP;
-       ifp->if_output = eclhoutput;    /* should never be used */
+       ifp->if_dstaddr = ecifp->if_addr;
+       ifp->if_flags = IFF_UP|IFF_POINTOPOINT;
+       ifp->if_output = looutput;
        if_attach(ifp);
        if_attach(ifp);
-}
-
-eclhoutput(ifp, m0, dst)
-       struct ifnet *ifp;
-       struct mbuf *m0;
-       struct sockaddr *dst;
-{
-COUNT(ECLHOUTPUT);
-       ifp->if_oerrors++;
-       m_freem(m0);
-       return (0);
+       rtinit(&ifp->if_addr, &ifp->if_addr, RTF_UP|RTF_DIRECT);
 }
 #endif
 }
 #endif
index f28c1e1..08fdba4 100644 (file)
@@ -1,4 +1,4 @@
-/*     if_en.c 4.59    82/04/24        */
+/*     if_en.c 4.60    82/05/24        */
 
 #include "en.h"
 #include "imp.h"
 
 #include "en.h"
 #include "imp.h"
@@ -32,6 +32,7 @@
 #include <errno.h>
 
 #define        ENMTU   (1024+512)
 #include <errno.h>
 
 #define        ENMTU   (1024+512)
+#define        ENMRU   (1024+512+16)           /* 16 is enough to receive trailer */
 
 int    enprobe(), enattach(), enrint(), enxint(), encollide();
 struct uba_device *eninfo[NEN];
 
 int    enprobe(), enattach(), enrint(), enxint(), encollide();
 struct uba_device *eninfo[NEN];
@@ -123,14 +124,8 @@ COUNT(ENATTACH);
        if_attach(&es->es_if);
 #if NIMP == 0
        /* here's one for you john baby.... */
        if_attach(&es->es_if);
 #if NIMP == 0
        /* here's one for you john baby.... */
-       if (ui->ui_flags &~ 0xff) {
-               struct in_addr logicaladdr;
-
-               logicaladdr.s_addr = ui->ui_flags;      /* gateway */
-               logicaladdr.s_lh = es->es_if.if_host[0];
-               logicaladdr.s_net = 10;
-               enlhinit(logicaladdr);
-       }
+       if (ui->ui_flags &~ 0xff)
+               enlhinit(&es->es_if, (ui->ui_flags &~ 0xff) | 0x0a);
 #endif
 }
 
 #endif
 }
 
@@ -164,7 +159,7 @@ eninit(unit)
        int s;
 
        if (if_ubainit(&es->es_ifuba, ui->ui_ubanum,
        int s;
 
        if (if_ubainit(&es->es_ifuba, ui->ui_ubanum,
-           sizeof (struct en_header), (int)btoc(ENMTU)) == 0) { 
+           sizeof (struct en_header), (int)btoc(ENMRU)) == 0) { 
                printf("en%d: can't initialize\n", unit);
                es->es_if.if_flags &= ~IFF_UP;
                return;
                printf("en%d: can't initialize\n", unit);
                es->es_if.if_flags &= ~IFF_UP;
                return;
@@ -178,7 +173,7 @@ eninit(unit)
         */
        s = splimp();
        addr->en_iba = es->es_ifuba.ifu_r.ifrw_info;
         */
        s = splimp();
        addr->en_iba = es->es_ifuba.ifu_r.ifrw_info;
-       addr->en_iwc = -(sizeof (struct en_header) + ENMTU) >> 1;
+       addr->en_iwc = -(sizeof (struct en_header) + ENMRU) >> 1;
        addr->en_istat = EN_IEN|EN_GO;
        es->es_oactive = 1;
        es->es_if.if_flags |= IFF_UP;
        addr->en_istat = EN_IEN|EN_GO;
        es->es_oactive = 1;
        es->es_if.if_flags |= IFF_UP;
@@ -380,16 +375,16 @@ COUNT(ENRINT);
        resid = addr->en_iwc;
        if (resid)
                resid |= 0176000;
        resid = addr->en_iwc;
        if (resid)
                resid |= 0176000;
-       len = (((sizeof (struct en_header) + ENMTU) >> 1) + resid) << 1;
+       len = (((sizeof (struct en_header) + ENMRU) >> 1) + resid) << 1;
        len -= sizeof (struct en_header);
        len -= sizeof (struct en_header);
-       if (len >= ENMTU)
+       if (len > ENMRU)
                goto setup;                     /* sanity */
        en = (struct en_header *)(es->es_ifuba.ifu_r.ifrw_addr);
 #define        endataaddr(en, off, type)       ((type)(((caddr_t)((en)+1)+(off))))
        if (en->en_type >= ENPUP_TRAIL &&
            en->en_type < ENPUP_TRAIL+ENPUP_NTRAILER) {
                off = (en->en_type - ENPUP_TRAIL) * 512;
                goto setup;                     /* sanity */
        en = (struct en_header *)(es->es_ifuba.ifu_r.ifrw_addr);
 #define        endataaddr(en, off, type)       ((type)(((caddr_t)((en)+1)+(off))))
        if (en->en_type >= ENPUP_TRAIL &&
            en->en_type < ENPUP_TRAIL+ENPUP_NTRAILER) {
                off = (en->en_type - ENPUP_TRAIL) * 512;
-               if (off >= ENMTU)
+               if (off > ENMTU)
                        goto setup;             /* sanity */
                en->en_type = *endataaddr(en, off, u_short *);
                resid = *(endataaddr(en, off+2, u_short *));
                        goto setup;             /* sanity */
                en->en_type = *endataaddr(en, off, u_short *);
                resid = *(endataaddr(en, off+2, u_short *));
@@ -449,7 +444,7 @@ setup:
         * Reset for next packet.
         */
        addr->en_iba = es->es_ifuba.ifu_r.ifrw_info;
         * Reset for next packet.
         */
        addr->en_iba = es->es_ifuba.ifu_r.ifrw_info;
-       addr->en_iwc = -(sizeof (struct en_header) + ENMTU) >> 1;
+       addr->en_iwc = -(sizeof (struct en_header) + ENMRU) >> 1;
        addr->en_istat = EN_IEN|EN_GO;
 }
 
        addr->en_istat = EN_IEN|EN_GO;
 }
 
@@ -578,15 +573,15 @@ bad:
  */
 
 struct ifnet enlhif;
  */
 
 struct ifnet enlhif;
-int    enlhoutput();
+int    looutput();
 
 /*
  * Called by localnet interface to allow logical
 
 /*
  * Called by localnet interface to allow logical
- * host interface to "attach".  Nothing should ever
- * be sent locally to this interface, it's purpose
+ * host interface to "attach", it's purpose
  * is simply to establish the host's arpanet address.
  */
  * is simply to establish the host's arpanet address.
  */
-enlhinit(addr)
+enlhinit(esifp, addr)
+       struct ifnet *esifp;
        int addr;
 {
        register struct ifnet *ifp = &enlhif;
        int addr;
 {
        register struct ifnet *ifp = &enlhif;
@@ -599,19 +594,10 @@ COUNT(ENLHINIT);
        sin->sin_family = AF_INET;
        sin->sin_addr.s_addr = addr;
        ifp->if_net = sin->sin_addr.s_net;
        sin->sin_family = AF_INET;
        sin->sin_addr.s_addr = addr;
        ifp->if_net = sin->sin_addr.s_net;
-       ifp->if_flags = IFF_UP;
-       ifp->if_output = enlhoutput;    /* should never be used */
+       ifp->if_flags = IFF_UP|IFF_POINTOPOINT;
+       ifp->if_dstaddr = esifp->if_addr;
+       ifp->if_output = looutput;
        if_attach(ifp);
        if_attach(ifp);
-}
-
-enlhoutput(ifp, m0, dst)
-       struct ifnet *ifp;
-       struct mbuf *m0;
-       struct sockaddr *dst;
-{
-COUNT(ENLHOUTPUT);
-       ifp->if_oerrors++;
-       m_freem(m0);
-       return (0);
+       rtinit(&ifp->if_addr, &ifp->if_addr, RTF_UP|RTF_DIRECT);
 }
 #endif
 }
 #endif
index 4c7bea5..0de9239 100644 (file)
@@ -1,4 +1,4 @@
-/*     if_il.c 4.1     82/05/21        */
+/*     if_il.c 4.2     82/05/24        */
 
 #include "il.h"
 #include "imp.h"
 
 #include "il.h"
 #include "imp.h"
@@ -169,7 +169,7 @@ COUNT(ILATTACH);
        if_attach(&is->is_if);
 #if NIMP == 0
        if (ui->ui_flags &~ 0xff)
        if_attach(&is->is_if);
 #if NIMP == 0
        if (ui->ui_flags &~ 0xff)
-               illhinit((ui->ui_flags &~ 0xff) | 0x0a);
+               illhinit(&is->is_if, (ui->ui_flags &~ 0xff) | 0x0a);
 #endif
 }
 
 #endif
 }
 
@@ -558,7 +558,7 @@ bad:
  */
 
 struct ifnet illhif;
  */
 
 struct ifnet illhif;
-int    illhoutput();
+int    looutput();
 
 /*
  * Called by localnet interface to allow logical
 
 /*
  * Called by localnet interface to allow logical
@@ -566,7 +566,8 @@ int illhoutput();
  * be sent locally to this interface, it's purpose
  * is simply to establish the host's arpanet address.
  */
  * be sent locally to this interface, it's purpose
  * is simply to establish the host's arpanet address.
  */
-illhinit(addr)
+illhinit(ilifp, addr)
+       struct ifnet *ilifp;
        int addr;
 {
        register struct ifnet *ifp = &illhif;
        int addr;
 {
        register struct ifnet *ifp = &illhif;
@@ -579,19 +580,10 @@ COUNT(ILLHINIT);
        sin->sin_family = AF_INET;
        sin->sin_addr.s_addr = addr;
        ifp->if_net = sin->sin_addr.s_net;
        sin->sin_family = AF_INET;
        sin->sin_addr.s_addr = addr;
        ifp->if_net = sin->sin_addr.s_net;
-       ifp->if_flags = IFF_UP;
-       ifp->if_output = illhoutput;    /* should never be used */
+       ifp->if_dstaddr = ilifp->if_addr;
+       ifp->if_flags = IFF_UP|IFF_POINTOPOINT;
+       ifp->if_output = looutput;
        if_attach(ifp);
        if_attach(ifp);
-}
-
-illhoutput(ifp, m0, dst)
-       struct ifnet *ifp;
-       struct mbuf *m0;
-       struct sockaddr *dst;
-{
-COUNT(ILLHOUTPUT);
-       ifp->if_oerrors++;
-       m_freem(m0);
-       return (0);
+       rtinit(&ifp->if_addr, &ifp->if_addr, RTF_UP|RTF_DIRECT);
 }
 #endif
 }
 #endif