clean up some stuff; map broadcast addresses to interface values
[unix-history] / usr / src / sys / netinet / ip_output.c
index 0ec8574..6b2565f 100644 (file)
@@ -1,8 +1,8 @@
-/*     ip_output.c     1.36    82/10/09        */
+/*     ip_output.c     1.43    83/01/04        */
 
 #include "../h/param.h"
 #include "../h/mbuf.h"
 
 #include "../h/param.h"
 #include "../h/mbuf.h"
-#include "../h/mtpr.h"
+#include "../vax/mtpr.h"
 #include "../h/socket.h"
 #include "../h/socketvar.h"
 #include "../netinet/in.h"
 #include "../h/socket.h"
 #include "../h/socketvar.h"
 #include "../netinet/in.h"
@@ -53,7 +53,7 @@ ip_output(m, opt, ro, allowbroadcast)
                 */
                if (ro == &routetoif) {
                        /* check ifp is AF_INET??? */
                 */
                if (ro == &routetoif) {
                        /* check ifp is AF_INET??? */
-                       ifp = if_ifonnetof(IN_NETOF(ip->ip_dst));
+                       ifp = if_ifonnetof(in_netof(ip->ip_dst));
                        if (ifp == 0)
                                goto unreachable;
                        goto gotif;
                        if (ifp == 0)
                                goto unreachable;
                        goto gotif;
@@ -92,10 +92,8 @@ gotif:
         * If small enough for interface, can just send directly.
         */
        if (ip->ip_len <= ifp->if_mtu) {
         * If small enough for interface, can just send directly.
         */
        if (ip->ip_len <= ifp->if_mtu) {
-#if vax
                ip->ip_len = htons((u_short)ip->ip_len);
                ip->ip_off = htons((u_short)ip->ip_off);
                ip->ip_len = htons((u_short)ip->ip_len);
                ip->ip_off = htons((u_short)ip->ip_off);
-#endif
                ip->ip_sum = 0;
                ip->ip_sum = in_cksum(m, hlen);
                error = (*ifp->if_output)(ifp, m, dst);
                ip->ip_sum = 0;
                ip->ip_sum = in_cksum(m, hlen);
                error = (*ifp->if_output)(ifp, m, dst);
@@ -124,7 +122,7 @@ gotif:
        m->m_len -= sizeof (struct ip);
        m->m_off += sizeof (struct ip);
        for (off = 0; off < ip->ip_len-hlen; off += len) {
        m->m_len -= sizeof (struct ip);
        m->m_off += sizeof (struct ip);
        for (off = 0; off < ip->ip_len-hlen; off += len) {
-               struct mbuf *mh = m_get(M_DONTWAIT);
+               struct mbuf *mh = m_get(M_DONTWAIT, MT_HEADER);
                struct ip *mhip;
 
                if (mh == 0) {
                struct ip *mhip;
 
                if (mh == 0) {
@@ -147,18 +145,14 @@ gotif:
                        mhip->ip_off |= IP_MF;
                }
                mhip->ip_len += sizeof (struct ip);
                        mhip->ip_off |= IP_MF;
                }
                mhip->ip_len += sizeof (struct ip);
-#if vax
                mhip->ip_len = htons((u_short)mhip->ip_len);
                mhip->ip_len = htons((u_short)mhip->ip_len);
-#endif
                mh->m_next = m_copy(m, off, len);
                if (mh->m_next == 0) {
                        (void) m_free(mh);
                        error = ENOBUFS;        /* ??? */
                        goto bad;
                }
                mh->m_next = m_copy(m, off, len);
                if (mh->m_next == 0) {
                        (void) m_free(mh);
                        error = ENOBUFS;        /* ??? */
                        goto bad;
                }
-#if vax
                mhip->ip_off = htons((u_short)mhip->ip_off);
                mhip->ip_off = htons((u_short)mhip->ip_off);
-#endif
                mhip->ip_sum = 0;
                mhip->ip_sum = in_cksum(mh, hlen);
                if (error = (*ifp->if_output)(ifp, mh, dst))
                mhip->ip_sum = 0;
                mhip->ip_sum = in_cksum(mh, hlen);
                if (error = (*ifp->if_output)(ifp, mh, dst))