Subject: [IPROUTE]: iflink_vlan: support GVRP flag

From: Patrick McHardy <[email-masked]>
Date: Thu, 03 Jul 2008 19:06:29 +0200

This is the patch for iproute for configuring GVRP.

commit 32143eed8b706e5c6554ab42903533b3bccdc060
Author: Patrick McHardy <[email-masked]>
Date:   Thu Jul 3 19:05:09 2008 +0200

    [IPROUTE]: iflink_vlan: support GVRP flag
    
    Signed-off-by: Patrick McHardy <[email-masked]>

diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 4014ba9..2dc4a57 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -32,6 +32,7 @@ enum vlan_ioctl_cmds {
 
 enum vlan_flags {
 	VLAN_FLAG_REORDER_HDR	= 0x1,
+	VLAN_FLAG_GVRP		= 0x2,
 };
 
 enum vlan_name_types {
diff --git a/ip/iplink_vlan.c b/ip/iplink_vlan.c
index 1964839..9724482 100644
--- a/ip/iplink_vlan.c
+++ b/ip/iplink_vlan.c
@@ -26,7 +26,7 @@ static void explain(void)
 		"\n"
 		"VLANID := 0-4095\n"
 		"FLAG-LIST := [ FLAG-LIST ] FLAG\n"
-		"FLAG := [ reorder_hdr { on | off } ]\n"
+		"FLAG := [ reorder_hdr { on | off } ] [ gvrp { on | off } ]\n"
 		"QOS-MAP := [ QOS-MAP ] QOS-MAPPING\n"
 		"QOS-MAPPING := FROM:TO\n"
 	);
@@ -93,6 +93,15 @@ static int vlan_parse_opt(struct link_util *lu, int argc, char **argv,
 				flags.flags &= ~VLAN_FLAG_REORDER_HDR;
 			else
 				return on_off("reorder_hdr");
+		} else if (matches(*argv, "gvrp") == 0) {
+			NEXT_ARG();
+			flags.mask |= VLAN_FLAG_GVRP;
+			if (strcmp(*argv, "on") == 0)
+				flags.flags |= VLAN_FLAG_GVRP;
+			else if (strcmp(*argv, "off") == 0)
+				flags.flags &= ~VLAN_FLAG_GVRP;
+			else
+				return on_off("gvrp");
 		} else if (matches(*argv, "ingress-qos-map") == 0) {
 			NEXT_ARG();
 			if (vlan_parse_qos_map(&argc, &argv, n,
@@ -146,6 +155,7 @@ static void vlan_print_flags(FILE *fp, __u32 flags)
 			fprintf(fp, #f "%s", flags ? "," : ""); \
 		}
 	_PF(REORDER_HDR);
+	_PF(GVRP);
 #undef _PF
 	if (flags)
 		fprintf(fp, "%x", flags);