+
+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;
+ m0 = m;
+
+gottype:
+ /*
+ * Add local net header. If no space in first mbuf,
+ * allocate another.
+ */
+ if (m->m_off > MMAXOFF ||
+ MMINOFF + sizeof (struct en_header) > m->m_off) {
+ m = m_get(M_DONTWAIT);
+ if (m == 0) {
+ error = ENOBUFS;
+ goto bad;
+ }
+ m->m_next = m0;
+ m->m_off = MMINOFF;
+ m->m_len = sizeof (struct en_header);
+ } else {
+ m->m_off -= sizeof (struct en_header);
+ m->m_len += sizeof (struct en_header);
+ }
+ en = mtod(m, struct en_header *);
+ en->en_shost = ifp->if_host[0];
+ en->en_dhost = dest;
+ en->en_type = type;
+
+ /*
+ * Queue message on interface, and start output if interface
+ * not yet active.
+ */
+ s = splimp();
+ if (IF_QFULL(&ifp->if_snd)) {
+ IF_DROP(&ifp->if_snd);
+ error = ENOBUFS;
+ goto qfull;
+ }
+ IF_ENQUEUE(&ifp->if_snd, m);
+ if (en_softc[ifp->if_unit].es_oactive == 0)
+ enstart(ifp->if_unit);
+ splx(s);
+ return (0);
+qfull:
+ m0 = m;
+ splx(s);
+bad:
+ m_freem(m0);
+ return (error);
+}
+
+#if NIMP == 0 && NEN > 0
+/*
+ * Logical host interface driver.
+ * Allows host to appear as an ARPAnet
+ * logical host. Must also have routing
+ * table entry set up to forward packets
+ * to appropriate gateway on localnet.
+ */
+
+struct ifnet enlhif;
+int looutput();
+
+/*
+ * Called by localnet interface to allow logical
+ * host interface to "attach", it's purpose
+ * is simply to establish the host's arpanet address.
+ */
+enlhinit(esifp, addr)
+ struct ifnet *esifp;
+ int addr;
+{
+ register struct ifnet *ifp = &enlhif;
+ register struct sockaddr_in *sin;
+
+COUNT(ENLHINIT);
+ ifp->if_name = "lh";
+ ifp->if_mtu = ENMTU;
+ sin = (struct sockaddr_in *)&ifp->if_addr;
+ sin->sin_family = AF_INET;
+ sin->sin_addr.s_addr = addr;
+ ifp->if_net = sin->sin_addr.s_net;
+ ifp->if_flags = IFF_UP|IFF_POINTOPOINT;
+ ifp->if_dstaddr = esifp->if_addr;
+ ifp->if_output = looutput;
+ if_attach(ifp);
+ rtinit(&ifp->if_addr, &ifp->if_addr, RTF_UP|RTF_DIRECT);