summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1996-08-07 04:09:05 +0000
committerjulian <julian@FreeBSD.org>1996-08-07 04:09:05 +0000
commit19085cb072ff77a2fa057784e788403091e71890 (patch)
tree44c7262ed122016de5de5c7e6c00a8bfc768b87f /sys/net
parent62cecb7c375615f90f5e3842915d25c9f555489b (diff)
downloadFreeBSD-src-19085cb072ff77a2fa057784e788403091e71890.zip
FreeBSD-src-19085cb072ff77a2fa057784e788403091e71890.tar.gz
Submitted by: archie@whistle.com
This is a patch to sys/net/if.c. What it does is patch the algorithm for finding an IP address on an interface which most closely matches a given IP address. The problem with it is when no address matches, and you have to just pick one at random. Then the code ends up picking the last IP address in the list. This patch changes things so it picks up the first address instead. Usually the first address is more useful as the later ones are aliases.
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 912b8a5..26d37f7 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)if.c 8.3 (Berkeley) 1/4/94
- * $Id: if.c,v 1.34 1996/07/24 19:59:53 wollman Exp $
+ * $Id: if.c,v 1.35 1996/07/30 19:16:58 wollman Exp $
*/
#include <sys/param.h>
@@ -279,7 +279,8 @@ ifaof_ifpforaddr(addr, ifp)
for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next) {
if (ifa->ifa_addr->sa_family != af)
continue;
- ifa_maybe = ifa;
+ if (ifa_maybe == 0)
+ ifa_maybe = ifa;
if (ifa->ifa_netmask == 0) {
if (equal(addr, ifa->ifa_addr) ||
(ifa->ifa_dstaddr && equal(addr, ifa->ifa_dstaddr)))
OpenPOWER on IntegriCloud