/*
*
* Copyright (c) 2004 Christian Limpach.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
if (flags & NFS_BOOT_HAS_MYIP)
aprint_normal("nfs_boot: client_addr=%s\n",
inet_ntoa(nd->nd_myip));
if (flags & NFS_BOOT_HAS_GWIP)
aprint_normal("nfs_boot: gateway=%s\n",
inet_ntoa(nd->nd_gwip));
if (flags & NFS_BOOT_HAS_MASK)
aprint_normal("nfs_boot: netmask=%s\n",
inet_ntoa(nd->nd_mask));
if (flags & NFS_BOOT_HAS_SERVADDR) {
sin = (struct sockaddr_in *) &nd->nd_root.ndm_saddr;
aprint_normal("nfs_boot: server=%s\n",
inet_ntoa(sin->sin_addr));
}
if (flags & NFS_BOOT_HAS_SERVER)
aprint_normal("nfs_boot: root=%.*s\n", MNAMELEN,
nd->nd_root.ndm_host);
/*
* Do enough of ifconfig(8) so that the chosen interface
* can talk to the servers.
*/
error = nfs_boot_setaddress(ifp, lwp,
*_flags & NFS_BOOT_HAS_MYIP ? nd->nd_myip.s_addr : INADDR_ANY,
*_flags & NFS_BOOT_HAS_MASK ? nd->nd_mask.s_addr : INADDR_ANY,
INADDR_ANY);
if (error) {
aprint_error("nfs_boot: set ifaddr, error=%d\n", error);
goto out;
}
if ((*_flags & NFS_BOOT_ALLINFO) != NFS_BOOT_ALLINFO)
return EADDRNOTAVAIL;