diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2014-05-07 08:26:39 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2014-05-07 08:26:39 +0000 |
commit | 5431aabbb1265f4a7832cebaf3696510a86092ab (patch) | |
tree | f0ee63e2d3bc9068e312c717900410b9c4ff5064 /sys/nfs | |
parent | f42bbc1efedba08990ee2a1be6e7cd53b3cab676 (diff) |
Remove the last hacks concerning the global list of IPv4 addresses in the
source address selection logic.
These hacks were only relevant for the NFS diskless boot code in order to
pick the local broadcast address of the only configured interface. So, be
explicit and set this address directly.
Tested by florian@, ok henning@, beck@, chrisz@
Diffstat (limited to 'sys/nfs')
-rw-r--r-- | sys/nfs/nfs_boot.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/nfs/nfs_boot.c b/sys/nfs/nfs_boot.c index c3d6752570a..116f8e24a6b 100644 --- a/sys/nfs/nfs_boot.c +++ b/sys/nfs/nfs_boot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_boot.c,v 1.31 2014/03/20 09:18:01 mpi Exp $ */ +/* $OpenBSD: nfs_boot.c,v 1.32 2014/05/07 08:26:38 mpi Exp $ */ /* $NetBSD: nfs_boot.c,v 1.26 1996/05/07 02:51:25 thorpej Exp $ */ /* @@ -121,6 +121,7 @@ nfs_boot_init(struct nfs_diskless *nd, struct proc *procp) struct sockaddr_in *sin; struct ifnet *ifp; struct socket *so; + struct ifaddr *ifa; char addr[INET_ADDRSTRLEN]; int error; @@ -192,18 +193,23 @@ nfs_boot_init(struct nfs_diskless *nd, struct proc *procp) soclose(so); + TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { + if (ifa->ifa_addr->sa_family == AF_INET) + break; + } + if (ifa == NULL) + panic("nfs_boot: address not configured on %s", ifp->if_xname); + /* * Get client name and gateway address. * RPC: bootparam/whoami - * Use the old broadcast address for the WHOAMI - * call because we do not yet know our netmask. * The server address returned by the WHOAMI call * is used for all subsequent bootparam RPCs. */ bzero((caddr_t)&bp_sin, sizeof(bp_sin)); bp_sin.sin_len = sizeof(bp_sin); bp_sin.sin_family = AF_INET; - bp_sin.sin_addr.s_addr = INADDR_BROADCAST; + bp_sin.sin_addr.s_addr = ifatoia(ifa)->ia_broadaddr.sin_addr.s_addr; hostnamelen = MAXHOSTNAMELEN; /* this returns gateway IP address */ |