remove /usr/include dependencies
[unix-history] / usr / src / sys / netinet / ip_output.c
index cadd88c..034d856 100644 (file)
@@ -1,17 +1,20 @@
-/*     ip_output.c     1.42    82/12/30        */
+/*     ip_output.c     1.46    83/02/10        */
 
 #include "../h/param.h"
 #include "../h/mbuf.h"
 
 #include "../h/param.h"
 #include "../h/mbuf.h"
-#include "../vax/mtpr.h"
+#include "../h/errno.h"
 #include "../h/socket.h"
 #include "../h/socketvar.h"
 #include "../h/socket.h"
 #include "../h/socketvar.h"
+
+#include "../net/if.h"
+#include "../net/route.h"
+
 #include "../netinet/in.h"
 #include "../netinet/in_systm.h"
 #include "../netinet/in.h"
 #include "../netinet/in_systm.h"
-#include "../net/if.h"
 #include "../netinet/ip.h"
 #include "../netinet/ip_var.h"
 #include "../netinet/ip.h"
 #include "../netinet/ip_var.h"
-#include "../net/route.h"
-#include <errno.h>
+
+#include "../machine/mtpr.h"
 
 int    ipnorouteprint = 0;
 
 
 int    ipnorouteprint = 0;
 
@@ -66,26 +69,35 @@ ip_output(m, opt, ro, allowbroadcast)
        if (ro->ro_rt->rt_flags & RTF_GATEWAY)
                dst = &ro->ro_rt->rt_gateway;
 gotif:
        if (ro->ro_rt->rt_flags & RTF_GATEWAY)
                dst = &ro->ro_rt->rt_gateway;
 gotif:
+#ifndef notdef
        /*
         * If source address not specified yet, use address
         * of outgoing interface.
         */
        /*
         * If source address not specified yet, use address
         * of outgoing interface.
         */
-       if (ip->ip_src.s_addr == 0)
+       if (in_lnaof(ip->ip_src) == INADDR_ANY)
                ip->ip_src.s_addr =
                    ((struct sockaddr_in *)&ifp->if_addr)->sin_addr.s_addr;
                ip->ip_src.s_addr =
                    ((struct sockaddr_in *)&ifp->if_addr)->sin_addr.s_addr;
+#endif
 
        /*
 
        /*
-        * Have interface for packet.  Allow
-        * broadcasts only by authorized users.
+        * Look for broadcast address and
+        * and verify user is allowed to send
+        * such a packet.
         */
         */
-       if (!allowbroadcast && (ifp->if_flags & IFF_BROADCAST)) {
-               struct sockaddr_in *sin;
-
-               sin = (struct sockaddr_in *)&ifp->if_broadaddr;
-               if (sin->sin_addr.s_addr == ip->ip_dst.s_addr) {
+       if (in_lnaof(dst) == INADDR_ANY) {
+               if ((ifp->if_flags & IFF_BROADCAST) == 0) {
+                       error = EADDRNOTAVAIL;
+                       goto bad;
+               }
+               if (!allowbroadcast) {
                        error = EACCES;
                        goto bad;
                }
                        error = EACCES;
                        goto bad;
                }
+               /* don't allow broadcast messages to be fragmented */
+               if (ip->ip_len > ifp->if_mtu) {
+                       error = EMSGSIZE;
+                       goto bad;
+               }
        }
 
        /*
        }
 
        /*