make it possible to obtain default router address from any interface (-i).
-r might be sufficient. http://pc.2ch.net/test/read.cgi/unix/1050823044/377
This commit is contained in:
parent
3b8a1d1f0c
commit
e195d590d8
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: bootparamd.c,v 1.40 2002/03/22 18:10:26 thorpej Exp $ */
|
||||
/* $NetBSD: bootparamd.c,v 1.41 2003/06/26 05:38:45 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* This code is not copyright, and is placed in the public domain.
|
||||
@ -11,7 +11,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: bootparamd.c,v 1.40 2002/03/22 18:10:26 thorpej Exp $");
|
||||
__RCSID("$NetBSD: bootparamd.c,v 1.41 2003/06/26 05:38:45 itojun Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -62,6 +62,7 @@ int dolog = 0;
|
||||
struct in_addr route_addr;
|
||||
struct sockaddr_in my_addr;
|
||||
char *bootpfile = _PATH_BOOTPARAMS;
|
||||
char *iface = NULL;
|
||||
|
||||
int main __P((int, char *[]));
|
||||
int lookup_bootparam __P((char *, char *, char *, char **, char **));
|
||||
@ -82,11 +83,14 @@ main(argc, argv)
|
||||
struct stat buf;
|
||||
int c;
|
||||
|
||||
while ((c = getopt(argc, argv, "dsr:f:")) != -1)
|
||||
while ((c = getopt(argc, argv, "di:sr:f:")) != -1)
|
||||
switch (c) {
|
||||
case 'd':
|
||||
debug = 1;
|
||||
break;
|
||||
case 'i':
|
||||
iface = optarg;
|
||||
break;
|
||||
case 'r':
|
||||
if (isdigit(*optarg)) {
|
||||
if (inet_aton(optarg, &route_addr) != 0)
|
||||
@ -465,7 +469,7 @@ void
|
||||
usage()
|
||||
{
|
||||
fprintf(stderr,
|
||||
"usage: %s [-d] [-s] [-r router] [-f bootparmsfile]\n",
|
||||
"usage: %s [-ds] [-i interface] [-r router] [-f bootparmsfile]\n",
|
||||
getprogname());
|
||||
exit(1);
|
||||
}
|
||||
@ -498,7 +502,10 @@ get_localaddr(ifname, sin)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
/* XXX more sanity checks? */
|
||||
if (!iface || strcmp(ifa->ifa_name, iface) == 0)
|
||||
;
|
||||
else
|
||||
continue;
|
||||
|
||||
/* candidate found */
|
||||
memcpy(sin, ifa->ifa_addr, ifa->ifa_addr->sa_len);
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: rpc.bootparamd.8,v 1.14 2003/02/14 16:11:36 grant Exp $
|
||||
.\" $NetBSD: rpc.bootparamd.8,v 1.15 2003/06/26 05:38:45 itojun Exp $
|
||||
.\" @(#)bootparamd.8
|
||||
.Dd January 8, 1994
|
||||
.Dt BOOTPARAMD 8
|
||||
@ -9,8 +9,8 @@
|
||||
.Nd boot parameter server
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl d
|
||||
.Op Fl s
|
||||
.Op Fl ds
|
||||
.Op Fl i ar interface
|
||||
.Op Fl r Ar router
|
||||
.Op Fl f Ar file
|
||||
.Sh DESCRIPTION
|
||||
@ -37,6 +37,16 @@ will be searched immediately.
|
||||
.It Fl d
|
||||
Display the debugging information. The daemon does not fork in this
|
||||
case.
|
||||
.It Fl i Ar interface
|
||||
Specify the interface to become the default router.
|
||||
.Nm
|
||||
picks the first IPv4 address it finds on the system by default.
|
||||
With
|
||||
.Fl i ,
|
||||
you can control which interface to be used to obtain the default router address.
|
||||
.Fl r
|
||||
overrides
|
||||
.Fl i .
|
||||
.It Fl s
|
||||
Log the debugging information with
|
||||
.Xr syslog 3 .
|
||||
|
Loading…
Reference in New Issue
Block a user