iproute2: bridge vlan show new option to print ranges

Introduce new option -c[ompressvlans] to request
vlan ranges from kernel

(pls suggest better option names if this does not look ok)

$bridge vlan show
port	vlan ids
dummy0	 1 PVID Egress Untagged

dummy1	 1 PVID Egress Untagged
	 2
	 3
	 4
	 5
	 6
	 7
	 9
	 10
	 12

br0	 1 PVID Egress Untagged

$bridge help
Usage: bridge [ OPTIONS ] OBJECT { COMMAND | help }
where  OBJECT := { link | fdb | mdb | vlan | monitor }
       OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] |
                    -o[neline] | -t[imestamp] | -n[etns] name |
                    -c[ompressvlans] }
$bridge -c vlan show
port	vlan ids
dummy0	 1 PVID Egress Untagged

dummy1	 1 PVID Egress Untagged
	 2-7
	 9-10
	 12

br0	 1 PVID Egress Untagged

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
diff --git a/bridge/vlan.c b/bridge/vlan.c
index 88992e6..9f6c84e 100644
--- a/bridge/vlan.c
+++ b/bridge/vlan.c
@@ -182,7 +182,12 @@
 				continue;
 
 			vinfo = RTA_DATA(i);
-			fprintf(fp, "\t %hu", vinfo->vid);
+			if (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_END)
+				fprintf(fp, "-%hu", vinfo->vid);
+			else
+				fprintf(fp, "\t %hu", vinfo->vid);
+			if (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_BEGIN)
+				continue;
 			if (vinfo->flags & BRIDGE_VLAN_INFO_PVID)
 				fprintf(fp, " PVID");
 			if (vinfo->flags & BRIDGE_VLAN_INFO_UNTAGGED)
@@ -218,7 +223,9 @@
 	}
 
 	if (rtnl_wilddump_req_filter(&rth, PF_BRIDGE, RTM_GETLINK,
-				     RTEXT_FILTER_BRVLAN) < 0) {
+				    (compress_vlans ?
+				    RTEXT_FILTER_BRVLAN_COMPRESSED :
+				    RTEXT_FILTER_BRVLAN)) < 0) {
 		perror("Cannont send dump request");
 		exit(1);
 	}