add if_ifwithdstaddr
authorMike Karels <karels@ucbvax.Berkeley.EDU>
Fri, 21 Dec 1984 10:01:19 +0000 (02:01 -0800)
committerMike Karels <karels@ucbvax.Berkeley.EDU>
Fri, 21 Dec 1984 10:01:19 +0000 (02:01 -0800)
SCCS-vsn: sbin/routed/if.c 4.4

usr/src/sbin/routed/if.c

index b8ca7b6..07aa434 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)if.c       4.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)if.c       4.4 (Berkeley) %G%";
 #endif
 
 /*
 #endif
 
 /*
@@ -10,7 +10,7 @@ static char sccsid[] = "@(#)if.c      4.3 (Berkeley) %G%";
 extern struct interface *ifnet;
 
 /*
 extern struct interface *ifnet;
 
 /*
- * Find the interface with address add.
+ * Find the interface with address addr.
  */
 struct interface *
 if_ifwithaddr(addr)
  */
 struct interface *
 if_ifwithaddr(addr)
@@ -34,6 +34,24 @@ if_ifwithaddr(addr)
        return (ifp);
 }
 
        return (ifp);
 }
 
+/*
+ * Find the point-to-point interface with destination address addr.
+ */
+struct interface *
+if_ifwithdstaddr(addr)
+       struct sockaddr *addr;
+{
+       register struct interface *ifp;
+
+       for (ifp = ifnet; ifp; ifp = ifp->int_next) {
+               if ((ifp->int_flags & IFF_POINTOPOINT) == 0)
+                       continue;
+               if (same(&ifp->int_dstaddr, addr))
+                       break;
+       }
+       return (ifp);
+}
+
 /*
  * Find the interface on the network 
  * of the specified address.
 /*
  * Find the interface on the network 
  * of the specified address.