MFC ifconfig.8 r1.138, ifconfig.c r1.131

Add the -n flag for disabling automatic module loading
This commit is contained in:
thompsa 2007-10-11 20:20:39 +00:00
parent c30c88743a
commit b0693660ac
2 changed files with 18 additions and 2 deletions

View File

@ -39,6 +39,7 @@
.Op Fl L
.Op Fl k
.Op Fl m
.Op Fl n
.Ar interface
.Op Cm create
.Op Ar address_family
@ -1528,6 +1529,13 @@ For example, the values of 802.11 WEP keys will be printed, if accessible to
the current user.
This information is not printed by default, as it may be considered
sensitive.
.Pp
If the network interface driver is not present in the kernel then
.Nm
will attempt to load it.
The
.Fl n
flag disables this behavior.
.Pp
Only the super-user may modify the configuration of a network interface.
.Sh NOTES

View File

@ -89,6 +89,7 @@ int doalias;
int clearaddr;
int newaddr = 1;
int verbose;
int noload;
int supmedia = 0;
int printkeys = 0; /* Print keying material for interfaces. */
@ -154,10 +155,10 @@ main(int argc, char *argv[])
char options[1024];
struct option *p;
all = downonly = uponly = namesonly = verbose = 0;
all = downonly = uponly = namesonly = noload = verbose = 0;
/* Parse leading line options */
strlcpy(options, "adklmuv", sizeof(options));
strlcpy(options, "adklmnuv", sizeof(options));
for (p = opts; p != NULL; p = p->next)
strlcat(options, p->opt, sizeof(options));
while ((c = getopt(argc, argv, options)) != -1) {
@ -177,6 +178,9 @@ main(int argc, char *argv[])
case 'm': /* show media choices in status */
supmedia = 1;
break;
case 'n': /* suppress module loading */
noload++;
break;
case 'u': /* restrict scan to "up" interfaces */
uponly++;
break;
@ -969,6 +973,10 @@ ifmaybeload(char *name)
int fileid, modid;
char ifkind[35], *cp, *dp;
/* loading suppressed by the user */
if (noload)
return;
/* turn interface and unit into module name */
strcpy(ifkind, "if_");
for (cp = name, dp = ifkind + 3;