private flags collided with multicast and link flags
[unix-history] / usr / src / sbin / routed / af.c
index 246d2ba..6816bc1 100644 (file)
@@ -2,16 +2,11 @@
  * Copyright (c) 1983 Regents of the University of California.
  * All rights reserved.
  *
  * Copyright (c) 1983 Regents of the University of California.
  * All rights reserved.
  *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of California at Berkeley. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
+ * %sccs.include.redist.c%
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)af.c       5.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)af.c       5.11 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "defs.h"
 #endif /* not lint */
 
 #include "defs.h"
@@ -40,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;
@@ -98,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");
 }
 
@@ -130,6 +132,7 @@ inet_canon(sin)
 {
 
        sin->sin_port = 0;
 {
 
        sin->sin_port = 0;
+       sin->sin_len = sizeof(*sin);
 }
 
 char *
 }
 
 char *