provide correct exit values
[unix-history] / usr / src / sbin / routed / af.c
index a6e0257..ed21864 100644 (file)
@@ -1,12 +1,23 @@
 /*
  * 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.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, 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'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)af.c       5.3 (Berkeley) %G%";
-#endif not lint
+static char sccsid[] = "@(#)af.c       5.8 (Berkeley) %G%";
+#endif /* not lint */
 
 #include "defs.h"
 
 
 #include "defs.h"
 
@@ -15,16 +26,22 @@ static char sccsid[] = "@(#)af.c    5.3 (Berkeley) %G%";
  */
 int    inet_hash(), inet_netmatch(), inet_output(),
        inet_portmatch(), inet_portcheck(),
  */
 int    inet_hash(), inet_netmatch(), inet_output(),
        inet_portmatch(), inet_portcheck(),
-       inet_checkhost(), inet_ishost(), inet_canon();
+       inet_checkhost(), inet_rtflags(), inet_sendroute(), inet_canon();
 char   *inet_format();
 char   *inet_format();
+
 #define NIL    { 0 }
 #define        INET \
        { inet_hash,            inet_netmatch,          inet_output, \
          inet_portmatch,       inet_portcheck,         inet_checkhost, \
 #define NIL    { 0 }
 #define        INET \
        { inet_hash,            inet_netmatch,          inet_output, \
          inet_portmatch,       inet_portcheck,         inet_checkhost, \
-         inet_ishost,          inet_canon,             inet_format }
+         inet_rtflags,         inet_sendroute,         inet_canon, \
+         inet_format \
+       }
 
 
-struct afswitch afswitch[AF_MAX] =
-       { NIL, NIL, INET, };
+struct afswitch afswitch[AF_MAX] = {
+       NIL,            /* 0- unused */
+       NIL,            /* 1- Unix domain, unused */
+       INET,           /* Internet */
+};
 
 int af_max = sizeof(afswitch) / sizeof(afswitch[0]);
 
 
 int af_max = sizeof(afswitch) / sizeof(afswitch[0]);
 
@@ -99,9 +116,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);
@@ -111,17 +130,6 @@ inet_checkhost(sin)
        return (1);
 }
 
        return (1);
 }
 
-/*
- * Return 1 if the address is
- * for an Internet host, 0 for a network.
- */
-inet_ishost(sin)
-       struct sockaddr_in *sin;
-{
-
-       return (inet_lnaof(sin->sin_addr) != 0);
-}
-
 inet_canon(sin)
        struct sockaddr_in *sin;
 {
 inet_canon(sin)
        struct sockaddr_in *sin;
 {