BSD 4_3_Reno release
[unix-history] / usr / src / sys / net / route.c
index 60a6d4d..676a6e6 100644 (file)
@@ -2,9 +2,22 @@
  * Copyright (c) 1980, 1986 Regents of the University of California.
  * All rights reserved.
  *
  * Copyright (c) 1980, 1986 Regents of the University of California.
  * All rights reserved.
  *
- * %sccs.include.redist.c%
+ * Redistribution is only permitted until one year after the first shipment
+ * of 4.4BSD by the Regents.  Otherwise, redistribution and use in source and
+ * binary forms are permitted provided that: (1) source distributions retain
+ * this entire copyright notice and comment, and (2) distributions including
+ * binaries display the following acknowledgement:  This product includes
+ * software developed by the University of California, Berkeley and its
+ * contributors'' in the documentation or other materials provided with the
+ * distribution and in all advertising materials mentioning features or use
+ * of this software.  Neither the name of the University nor the names of
+ * its contributors may 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
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  *
- *     @(#)route.c     7.18 (Berkeley) %G%
+ *     @(#)route.c     7.17 (Berkeley) 6/28/90
  */
 #include "machine/reg.h"
  
  */
 #include "machine/reg.h"
  
@@ -296,7 +309,7 @@ struct sockaddr     *dst, *gateway;
        return (ifa);
 }
 
        return (ifa);
 }
 
-#define ROUNDUP(a) (a>0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
+#define ROUNDUP(a) (1 + (((a) - 1) | (sizeof(long) - 1)))
 
 rtrequest(req, dst, gateway, netmask, flags, ret_nrt)
        int req, flags;
 
 rtrequest(req, dst, gateway, netmask, flags, ret_nrt)
        int req, flags;
@@ -374,6 +387,7 @@ rtrequest(req, dst, gateway, netmask, flags, ret_nrt)
                rt->rt_ifa = ifa;
                rt->rt_ifp = ifa->ifa_ifp;
                rt->rt_flags = RTF_UP | flags;
                rt->rt_ifa = ifa;
                rt->rt_ifp = ifa->ifa_ifp;
                rt->rt_flags = RTF_UP | flags;
+               rn->rn_key = (caddr_t) ndst; /* == rt_dst */
                rt->rt_gateway = (struct sockaddr *)
                                        (rn->rn_key + ROUNDUP(dst->sa_len));
                Bcopy(gateway, rt->rt_gateway, gateway->sa_len);
                rt->rt_gateway = (struct sockaddr *)
                                        (rn->rn_key + ROUNDUP(dst->sa_len));
                Bcopy(gateway, rt->rt_gateway, gateway->sa_len);
@@ -418,8 +432,6 @@ rtinit(ifa, cmd, flags)
        register struct ifaddr *ifa;
        int cmd, flags;
 {
        register struct ifaddr *ifa;
        int cmd, flags;
 {
-       return
-           rtrequest(cmd, flags & RTF_HOST ? ifa->ifa_dstaddr : ifa->ifa_addr,
-                       ifa->ifa_addr, ifa->ifa_netmask,
-                       flags | ifa->ifa_flags, &ifa->ifa_rt);
+       return rtrequest(cmd, ifa->ifa_dstaddr, ifa->ifa_addr,
+                   ifa->ifa_netmask, flags | ifa->ifa_flags, &ifa->ifa_rt);
 }
 }