Add the -n flag for disabling automatic module loading, this will be used by

rc.d to stop it reloading the network module on unload.
This commit is contained in:
Andrew Thompson 2007-05-22 17:41:09 +00:00
parent a0c0e34bd4
commit a389ab003f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=169873
2 changed files with 18 additions and 2 deletions

View File

@ -39,6 +39,7 @@
.Op Fl L .Op Fl L
.Op Fl k .Op Fl k
.Op Fl m .Op Fl m
.Op Fl n
.Ar interface .Ar interface
.Op Cm create .Op Cm create
.Op Ar address_family .Op Ar address_family
@ -1579,6 +1580,13 @@ For example, the values of 802.11 WEP keys will be printed, if accessible to
the current user. the current user.
This information is not printed by default, as it may be considered This information is not printed by default, as it may be considered
sensitive. 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 .Pp
Only the super-user may modify the configuration of a network interface. Only the super-user may modify the configuration of a network interface.
.Sh NOTES .Sh NOTES

View File

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