Message ID | 546210EA.7090201@mojatatu.com |
---|---|
State | RFC, archived |
Delegated to: | stephen hemminger |
Headers | show |
Tue, Nov 11, 2014 at 02:36:42PM CET, jhs@mojatatu.com wrote: > >Ive run out of time - but will test; so far looks good. >Attached a small patchlet on top of yours. Will squash it in and send v2. > >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 <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; -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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;