private flags collided with multicast and link flags
[unix-history] / usr / src / sbin / routed / af.c
index 2fc61e0..6816bc1 100644 (file)
@@ -1,12 +1,13 @@
 /*
  * Copyright (c) 1983 Regents of the University of California.
 /*
  * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+ * All rights reserved.
+ *
+ * %sccs.include.redist.c%
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)af.c       5.5 (Berkeley) %G%";
-#endif not lint
+static char sccsid[] = "@(#)af.c       5.11 (Berkeley) %G%";
+#endif /* not lint */
 
 #include "defs.h"
 
 
 #include "defs.h"
 
@@ -34,7 +35,11 @@ struct afswitch afswitch[AF_MAX] = {
 
 int af_max = sizeof(afswitch) / sizeof(afswitch[0]);
 
 
 int af_max = sizeof(afswitch) / sizeof(afswitch[0]);
 
-struct sockaddr_in inet_default = { AF_INET, INADDR_ANY };
+struct sockaddr_in inet_default = {
+#ifdef RTM_ADD
+       sizeof (inet_default),
+#endif
+       AF_INET, INADDR_ANY };
 
 inet_hash(sin, hp)
        register struct sockaddr_in *sin;
 
 inet_hash(sin, hp)
        register struct sockaddr_in *sin;
@@ -92,7 +97,10 @@ inet_output(s, flags, sin, size)
        sin = &dst;
        if (sin->sin_port == 0)
                sin->sin_port = sp->s_port;
        sin = &dst;
        if (sin->sin_port == 0)
                sin->sin_port = sp->s_port;
-       if (sendto(s, packet, size, flags, sin, sizeof (*sin)) < 0)
+       if (sin->sin_len == 0)
+               sin->sin_len = sizeof (*sin);
+       if (sendto(s, packet, size, flags,
+           (struct sockaddr *)sin, sizeof (*sin)) < 0)
                perror("sendto");
 }
 
                perror("sendto");
 }
 
@@ -105,9 +113,11 @@ inet_checkhost(sin)
 {
        u_long i = ntohl(sin->sin_addr.s_addr);
 
 {
        u_long i = ntohl(sin->sin_addr.s_addr);
 
-#define        IN_BADCLASS(i)  (((long) (i) & 0xe0000000) == 0xe0000000)
+#ifndef IN_EXPERIMENTAL
+#define        IN_EXPERIMENTAL(i)      (((long) (i) & 0xe0000000) == 0xe0000000)
+#endif
 
 
-       if (IN_BADCLASS(i) || sin->sin_port != 0)
+       if (IN_EXPERIMENTAL(i) || sin->sin_port != 0)
                return (0);
        if (i != 0 && (i & 0xff000000) == 0)
                return (0);
                return (0);
        if (i != 0 && (i & 0xff000000) == 0)
                return (0);
@@ -122,6 +132,7 @@ inet_canon(sin)
 {
 
        sin->sin_port = 0;
 {
 
        sin->sin_port = 0;
+       sin->sin_len = sizeof(*sin);
 }
 
 char *
 }
 
 char *