diff --git a/sbin/ifconfig/vlan.c b/sbin/ifconfig/vlan.c index 42c0b945716c..1d921f3c40ad 100644 --- a/sbin/ifconfig/vlan.c +++ b/sbin/ifconfig/vlan.c @@ -1,4 +1,4 @@ -/* $NetBSD: vlan.c,v 1.12 2008/07/15 21:27:58 dyoung Exp $ */ +/* $NetBSD: vlan.c,v 1.13 2009/07/28 18:22:33 dyoung Exp $ */ /* * Copyright (c) 1983, 1993 @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: vlan.c,v 1.12 2008/07/15 21:27:58 dyoung Exp $"); +__RCSID("$NetBSD: vlan.c,v 1.13 2009/07/28 18:22:33 dyoung Exp $"); #endif /* not lint */ #include @@ -140,17 +140,17 @@ setvlanif(prop_dictionary_t env, prop_dictionary_t oenv) if (getvlan(env, &vlr, false) == -1) err(EXIT_FAILURE, "%s: getsock", __func__); - if (!prop_dictionary_get_int64(env, "vlantag", &tag)) { - errno = ENOENT; - return -1; - } - if (!prop_dictionary_get_cstring_nocopy(env, "vlanif", &parent)) { errno = ENOENT; return -1; } strlcpy(vlr.vlr_parent, parent, sizeof(vlr.vlr_parent)); - if (strcmp(parent, "") != 0) + if (strcmp(parent, "") == 0) + ; + else if (!prop_dictionary_get_int64(env, "vlantag", &tag)) { + errno = ENOENT; + return -1; + } else vlr.vlr_tag = (unsigned short)tag; if (indirect_ioctl(env, SIOCSETVLAN, &vlr) == -1)