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.
This commit is contained in:
Julian Elischer 1996-08-07 04:09:05 +00:00
parent bdd95fa258
commit 381dd1d2ca
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=17462

View File

@ -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)))