Revert to setting vlan and vlandev parametes synchronously, as soon

as both have been read from the command line.  Still use the callback,
but this time only to verify that both vlan and vlandev have been
found on the command line.

This should allow for control over the relative order of processing
parameters, which is needed to satisfy some caveats of the if_vlan
driver.  E.g., MTU cannot be changed on a vlan interface until it's
attached to its parent.

PR:             bin/94028
Reviewed by:    ru
MFC after:      3 days
This commit is contained in:
Yaroslav Tykhiy 2006-03-09 14:58:09 +00:00
parent 05380e0125
commit 2fe9aa26c6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=156498

View File

@ -62,6 +62,8 @@ static struct vlanreq __vreq;
static int __have_dev = 0;
static int __have_tag = 0;
static void vlan_set(int);
static void
vlan_status(int s)
{
@ -93,6 +95,7 @@ setvlantag(const char *val, int d, int s, const struct afswtch *afp)
errx(1, "value for vlan out of range");
/* the kernel will do more specific checks on vlr_tag */
__have_tag = 1;
vlan_set(s); /* try setting vlan params in kernel */
}
static void
@ -101,6 +104,7 @@ setvlandev(const char *val, int d, int s, const struct afswtch *afp)
strncpy(__vreq.vlr_parent, val, sizeof(__vreq.vlr_parent));
__have_dev = 1;
vlan_set(s); /* try setting vlan params in kernel */
}
static void
@ -130,6 +134,11 @@ vlan_cb(int s, void *arg)
if (__have_tag ^ __have_dev)
errx(1, "both vlan and vlandev must be specified");
}
static void
vlan_set(int s)
{
if (__have_tag && __have_dev) {
ifr.ifr_data = (caddr_t)&__vreq;