Attempt to load the kernel module only if we are going to create a

new interface.  In other cases loading the module is unwanted and
can lead to ill side effects.  One such effect found is as follows:
"kldunload if_foo" tells the module to kill all its interfaces,
which results in messages sent to devd; the module unloads.  Then
devd starts processing the messages, which ends up in a etc script
running ifconfig fooX, which reloads the module.
This commit is contained in:
Yaroslav Tykhiy 2007-03-12 13:08:56 +00:00
parent 25c0f7b35a
commit a40fb996ae
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=167485

View File

@ -228,9 +228,6 @@ main(int argc, char *argv[])
ifname = *argv;
argc--, argv++;
/* check and maybe load support for this interface */
ifmaybeload(ifname);
ifindex = if_nametoindex(ifname);
if (ifindex == 0) {
/*
@ -244,6 +241,7 @@ main(int argc, char *argv[])
if (iflen >= sizeof(name))
errx(1, "%s: cloning name too long",
ifname);
ifmaybeload(ifname);
ifconfig(argc, argv, NULL);
exit(0);
}