netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jamal Hadi Salim <jhs@mojatatu.com>
To: Jiri Pirko <jiri@resnulli.us>, 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 <stephen@networkplumber.org>
Subject: Re: [patch iproute2] tc: add support for vlan tc action
Date: Tue, 11 Nov 2014 08:36:42 -0500	[thread overview]
Message-ID: <546210EA.7090201@mojatatu.com> (raw)
In-Reply-To: <1415700966-9225-1-git-send-email-jiri@resnulli.us>

[-- Attachment #1: Type: text/plain, Size: 115 bytes --]


Ive run out of time - but will test; so far looks good.
Attached a small patchlet on top of yours.

cheers,
jamal

[-- Attachment #2: patch-for-jiri --]
[-- Type: text/plain, Size: 1493 bytes --]

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 <stdlib.h>
 #include <unistd.h>
 #include <string.h>
+#include <linux/if_ether.h>
 #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;

  parent reply	other threads:[~2014-11-11 13:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <reply-to=1415700789-9171-2-git-send-email-jiri@resnulli.us>
2014-11-11 10:16 ` [patch iproute2] tc: add support for vlan tc action Jiri Pirko
2014-11-11 12:35   ` Jamal Hadi Salim
2014-11-11 13:36   ` Jamal Hadi Salim [this message]
2014-11-11 13:46     ` Jiri Pirko
2014-11-12 14:52 [patch net-next v2 4/4] sched: introduce vlan action Jiri Pirko
2014-11-12 14:55 ` [patch iproute2] tc: add support for vlan tc action Jiri Pirko
2014-11-16 20:19   ` Jamal Hadi Salim
2014-11-18 20:48     ` Jiri Pirko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=546210EA.7090201@mojatatu.com \
    --to=jhs@mojatatu.com \
    --cc=Paul.Durrant@citrix.com \
    --cc=davem@davemloft.net \
    --cc=dborkman@redhat.com \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=jiri@resnulli.us \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pshelar@nicira.com \
    --cc=stephen@networkplumber.org \
    --cc=tgraf@suug.ch \
    --cc=therbert@google.com \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).