lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAE4R7bA2VHepe8CCYuubH8teXMvRry10jnpsisYq+7Qv+gXzHQ@mail.gmail.com>
Date:	Sat, 17 Jan 2015 17:35:38 -0800
From:	Scott Feldman <sfeldma@...il.com>
To:	Roopa Prabhu <roopa@...ulusnetworks.com>
Cc:	Netdev <netdev@...r.kernel.org>, shemminger@...tta.com,
	"vyasevic@...hat.com" <vyasevic@...hat.com>,
	Wilson Kok <wkok@...ulusnetworks.com>
Subject: Re: [PATCH net-next] iproute2: bridge: support vlan range

On Thu, Jan 15, 2015 at 10:52 PM,  <roopa@...ulusnetworks.com> wrote:
> From: Roopa Prabhu <roopa@...ulusnetworks.com>
>
> This patch adds vlan range support to bridge command
> using the newly added vinfo flags BRIDGE_VLAN_INFO_RANGE_BEGIN and
> BRIDGE_VLAN_INFO_RANGE_END.
>
> $bridge vlan show
> port    vlan ids
> br0      1 PVID Egress Untagged
>
> dummy0   1 PVID Egress Untagged
>
> $bridge vlan add vid 10-15 dev dummy0
> port    vlan ids
> br0      1 PVID Egress Untagged
>
> dummy0   1 PVID Egress Untagged
>          10
>          11
>          12
>          13
>          14
>          15
>
> $bridge vlan del vid 14 dev dummy0
>
> $bridge vlan show
> port    vlan ids
> br0      1 PVID Egress Untagged
>
> dummy0   1 PVID Egress Untagged
>          10
>          11
>          12
>          13
>          15
>
> $bridge vlan del vid 10-15 dev dummy0
>
> $bridge vlan show
> port    vlan ids
> br0      1 PVID Egress Untagged
>
> dummy0   1 PVID Egress Untagged
>
> Signed-off-by: Roopa Prabhu <roopa@...ulusnetworks.com>
> Signed-off-by: Wilson Kok <wkok@...ulusnetworks.com>
> ---
>  bridge/vlan.c             |   46 ++++++++++++++++++++++++++++++++++++++-------
>  include/linux/if_bridge.h |    2 ++
>  2 files changed, 41 insertions(+), 7 deletions(-)
>
> diff --git a/bridge/vlan.c b/bridge/vlan.c
> index 3bd7b0d..90b3b6b 100644
> --- a/bridge/vlan.c
> +++ b/bridge/vlan.c
> @@ -32,6 +32,7 @@ static int vlan_modify(int cmd, int argc, char **argv)
>         } req;
>         char *d = NULL;
>         short vid = -1;
> +       short vid_end = -1;
>         struct rtattr *afspec;
>         struct bridge_vlan_info vinfo;
>         unsigned short flags = 0;
> @@ -49,8 +50,18 @@ static int vlan_modify(int cmd, int argc, char **argv)
>                         NEXT_ARG();
>                         d = *argv;
>                 } else if (strcmp(*argv, "vid") == 0) {
> +                       char *p;
>                         NEXT_ARG();
> -                       vid = atoi(*argv);
> +                       p = strchr(*argv, '-');
> +                       if (p) {
> +                               *p = '\0';
> +                               p++;
> +                               vinfo.vid = atoi(*argv);
> +                               vid_end = atoi(p);

Is "vid 10-" same as "vid 10-0"?

Is "vid -15" same as "vid 0-15"?

What is "vid -"?

Does the "-" char mess up shells?  I don't know the answer; just asking.

> +                               vinfo.flags |= BRIDGE_VLAN_INFO_RANGE_BEGIN;
> +                       } else {
> +                               vinfo.vid = atoi(*argv);
> +                       }
>                 } else if (strcmp(*argv, "self") == 0) {
>                         flags |= BRIDGE_FLAGS_SELF;
>                 } else if (strcmp(*argv, "master") == 0) {
> @@ -67,7 +78,7 @@ static int vlan_modify(int cmd, int argc, char **argv)
>                 argc--; argv++;
>         }
>
> -       if (d == NULL || vid == -1) {
> +       if (d == NULL || vinfo.vid == -1) {

Where was vinfo.vid initialized to -1?  Maybe use vid rather than
vinfo.vid in the code above where parsing the arg, and continue using
vid and vid_end until final put of vinfo.

-scott
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ