+#endif
+#ifdef NS
+ case AF_NS:
+ {
+ extern struct sockaddr_ns ns_netmask;
+ netmask = (struct sockaddr *)&ns_netmask;
+ }
+#endif
+ }
+ error = rtrequest(req, &(entry->rt_dst), &(entry->rt_gateway), netmask,
+ entry->rt_flags, (struct rtentry **)0);
+ rt_missmsg((req == RTM_ADD ? RTM_OLDADD : RTM_OLDDEL),
+ &(entry->rt_dst), &(entry->rt_gateway),
+ netmask, SA(0), entry->rt_flags, error);
+ return (error);
+#endif
+}
+
+struct ifaddr *
+ifa_ifwithroute(flags, dst, gateway)
+int flags;
+struct sockaddr *dst, *gateway;
+{
+ struct ifaddr *ifa;
+ if ((flags & RTF_GATEWAY) == 0) {
+ /*
+ * If we are adding a route to an interface,
+ * and the interface is a pt to pt link
+ * we should search for the destination
+ * as our clue to the interface. Otherwise
+ * we can use the local address.
+ */
+ ifa = 0;
+ if (flags & RTF_HOST)
+ ifa = ifa_ifwithdstaddr(dst);
+ if (ifa == 0)
+ ifa = ifa_ifwithaddr(gateway);
+ } else {
+ /*
+ * If we are adding a route to a remote net
+ * or host, the gateway may still be on the
+ * other end of a pt to pt link.
+ */
+ ifa = ifa_ifwithdstaddr(gateway);