+ /*
+ * 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.
+ */
+ if ((entry->rt_flags & RTF_GATEWAY)==0) {
+ if (entry->rt_flags & RTF_HOST)
+ ifa = ifa_ifwithdstaddr(&entry->rt_dst);
+ else
+ ifa = ifa_ifwithaddr(&entry->rt_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(&entry->rt_gateway);
+ }