From 854940045a27a8ccb0e4300fa1ca20d92e7fe9c7 Mon Sep 17 00:00:00 2001 From: dyoung Date: Tue, 28 Jul 2009 18:22:33 +0000 Subject: [PATCH] Don't require a "vlan" argument with "-vlanif". "ifconfig vlan0 -vlanif" works as one would expect, now. --- sbin/ifconfig/vlan.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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)