From patchwork Tue Nov 11 13:36:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jamal Hadi Salim X-Patchwork-Id: 409440 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id B034A140179 for ; Wed, 12 Nov 2014 00:36:50 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751311AbaKKNgq (ORCPT ); Tue, 11 Nov 2014 08:36:46 -0500 Received: from mail-ie0-f170.google.com ([209.85.223.170]:33485 "EHLO mail-ie0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751022AbaKKNgp (ORCPT ); Tue, 11 Nov 2014 08:36:45 -0500 Received: by mail-ie0-f170.google.com with SMTP id tp5so11483019ieb.15 for ; Tue, 11 Nov 2014 05:36:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type; bh=7fH8vYiaBJrlf/pzXM2EiiftWcvHVTwBJymHW1REXsU=; b=d/ryVBRyQhrfHd6z9qMpZp3G8iPAErY19xUkd6ivuWLnVLLNWlIkfRQtQ24XioN3vp LlsbQnZsh+wJR6qAKrDqKSNR5U5o6OldWjzDNHFVGo/mVui2KxBr0U65vzssxFVNZVxD BguLa5tlnounyhVbd2LZm3jwtMR8WrGQxjc61ZjXwSQ+jNcIThK2rmLp/LS5V/UW6uaN jxpmXW6j9Po2Svh7WfcCoIRyqBBhaFEUZQBXatcQDx89lyG066NCfP+xzu6XUkMKpf6k dFCDHMURKk8LFKiwv1gORjVlmdDVt9ZC/jfYdJZ7Tv/tqdgu2/FE2vbYOSeBLgta+PY6 un/g== X-Gm-Message-State: ALoCoQn86UyjYy5gEB5R5cI3/slckgGr9inozoL+Vu44F3ZCNHesOOB62KZoJ5Crik3mnJiwnbne X-Received: by 10.107.134.203 with SMTP id q72mr41267630ioi.51.1415713005002; Tue, 11 Nov 2014 05:36:45 -0800 (PST) Received: from [10.0.0.12] ([23.233.28.49]) by mx.google.com with ESMTPSA id au2sm6295005igc.4.2014.11.11.05.36.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Nov 2014 05:36:44 -0800 (PST) Message-ID: <546210EA.7090201@mojatatu.com> Date: Tue, 11 Nov 2014 08:36:42 -0500 From: Jamal Hadi Salim User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Jiri Pirko , netdev@vger.kernel.org CC: davem@davemloft.net, pshelar@nicira.com, therbert@google.com, edumazet@google.com, willemb@google.com, dborkman@redhat.com, mst@redhat.com, fw@strlen.de, Paul.Durrant@citrix.com, tgraf@suug.ch, Stephen Hemminger Subject: Re: [patch iproute2] tc: add support for vlan tc action References: <1415700966-9225-1-git-send-email-jiri@resnulli.us> In-Reply-To: <1415700966-9225-1-git-send-email-jiri@resnulli.us> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Ive run out of time - but will test; so far looks good. Attached a small patchlet on top of yours. cheers, jamal diff --git a/tc/m_vlan.c b/tc/m_vlan.c index 54c0ce7..2755e20 100644 --- a/tc/m_vlan.c +++ b/tc/m_vlan.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "utils.h" #include "rt_names.h" #include "tc_util.h" @@ -22,6 +23,8 @@ static void explain(void) { fprintf(stderr, "Usage: vlan pop\n"); fprintf(stderr, " vlan push [ protocol VLANPROTO ] id VLANID\n"); + fprintf(stderr, " VLANPROTO is one of 802.1Q or 802.1ad\n"); + fprintf(stderr, " with default: 802.1Q\n"); } static void usage(void) @@ -121,7 +124,7 @@ static int parse_vlan(struct action_util *a, int *argc_p, char ***argv_p, if (matches(*argv, "index") == 0) { NEXT_ARG(); if (get_u32(&parm.index, *argv, 10)) { - fprintf(stderr, "Pedit: Illegal \"index\"\n"); + fprintf(stderr, "vlan: Illegal \"index\"\n"); return -1; } argc--; @@ -141,8 +144,15 @@ static int parse_vlan(struct action_util *a, int *argc_p, char ***argv_p, addattr_l(n, MAX_MSG, TCA_VLAN_PARMS, &parm, sizeof(parm)); if (id_set) addattr_l(n, MAX_MSG, TCA_VLAN_PUSH_VLAN_ID, &id, 2); - if (proto_set) + if (proto_set) { + if (proto != ETH_P_8021Q && proto != ETH_P_8021AD) { + fprintf(stderr, "protocol id 0x%x not supported\n", proto); + explain(); + return -1; + } + addattr_l(n, MAX_MSG, TCA_VLAN_PUSH_VLAN_PROTOCOL, &proto, 2); + } tail->rta_len = (char *)NLMSG_TAIL(n) - (char *)tail; *argc_p = argc;