Subject: [RFC 1/3] [RFC iproute2-next] tc: f_u32: Rename commands and functions ip6 to ipv6 to unify naming

From: Anton Danilov <[email-masked]>
Date: Tue, 8 Jun 2021 18:33:07 +0300

Before patch:
~$ tc filter add dev dummy0 parent 1: protocol ipv6 prio 10 \
    u32 match ip6 src aa:bb:cc:dd::/128 flowid 1:1

After patch:
~$ tc filter add dev dummy0 parent 1: protocol ipv6 prio 10 \
    u32 match ipv6 src aa:bb:cc:dd::/128 flowid 1:1

Signed-off-by: Anton Danilov <[email-masked]>
---
 tc/f_u32.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/tc/f_u32.c b/tc/f_u32.c
index 2ed5254a..3fd3eb17 100644
--- a/tc/f_u32.c
+++ b/tc/f_u32.c
@@ -35,7 +35,7 @@ static void explain(void)
 		"or         u32 divisor DIVISOR\n"
 		"\n"
 		"Where: SELECTOR := SAMPLE SAMPLE ...\n"
-		"       SAMPLE := { ip | ip6 | udp | tcp | icmp | u{32|16|8} | mark }\n"
+		"       SAMPLE := { ip | ipv6 | udp | tcp | icmp | u{32|16|8} | mark }\n"
 		"                 SAMPLE_ARGS [ divisor DIVISOR ]\n"
 		"       FILTERID := X:Y:Z\n"
 		"\nNOTE: CLASSID is parsed at hexadecimal input.\n");
@@ -356,7 +356,7 @@ static int parse_ip_addr(int *argc_p, char ***argv_p, struct tc_u32_sel *sel,
 	return res;
 }
 
-static int parse_ip6_addr(int *argc_p, char ***argv_p,
+static int parse_ipv6_addr(int *argc_p, char ***argv_p,
 			  struct tc_u32_sel *sel, int off)
 {
 	int res = -1;
@@ -403,7 +403,7 @@ static int parse_ip6_addr(int *argc_p, char ***argv_p,
 	return res;
 }
 
-static int parse_ip6_class(int *argc_p, char ***argv_p, struct tc_u32_sel *sel)
+static int parse_ipv6_class(int *argc_p, char ***argv_p, struct tc_u32_sel *sel)
 {
 	int res = -1;
 	int argc = *argc_p;
@@ -538,7 +538,7 @@ static int parse_ip(int *argc_p, char ***argv_p, struct tc_u32_sel *sel)
 	return res;
 }
 
-static int parse_ip6(int *argc_p, char ***argv_p, struct tc_u32_sel *sel)
+static int parse_ipv6(int *argc_p, char ***argv_p, struct tc_u32_sel *sel)
 {
 	int res = -1;
 	int argc = *argc_p;
@@ -549,13 +549,13 @@ static int parse_ip6(int *argc_p, char ***argv_p, struct tc_u32_sel *sel)
 
 	if (strcmp(*argv, "src") == 0) {
 		NEXT_ARG();
-		res = parse_ip6_addr(&argc, &argv, sel, 8);
+		res = parse_ipv6_addr(&argc, &argv, sel, 8);
 	} else if (strcmp(*argv, "dst") == 0) {
 		NEXT_ARG();
-		res = parse_ip6_addr(&argc, &argv, sel, 24);
-	} else if (strcmp(*argv, "priority") == 0) {
+		res = parse_ipv6_addr(&argc, &argv, sel, 24);
+	} else if (strcmp(*argv, "priority") == 0 || strcmp(*argv, "class") == 0) {
 		NEXT_ARG();
-		res = parse_ip6_class(&argc, &argv, sel);
+		res = parse_ipv6_class(&argc, &argv, sel);
 	} else if (strcmp(*argv, "protocol") == 0) {
 		NEXT_ARG();
 		res = parse_u8(&argc, &argv, sel, 6, 0);
@@ -712,9 +712,9 @@ static int parse_selector(int *argc_p, char ***argv_p,
 	} else if (matches(*argv, "ip") == 0) {
 		NEXT_ARG();
 		res = parse_ip(&argc, &argv, sel);
-	} else	if (matches(*argv, "ip6") == 0) {
+	} else	if (matches(*argv, "ip6") == 0 || matches(*argv, "ipv6") == 0) {
 		NEXT_ARG();
-		res = parse_ip6(&argc, &argv, sel);
+		res = parse_ipv6(&argc, &argv, sel);
 	} else if (matches(*argv, "udp") == 0) {
 		NEXT_ARG();
 		res = parse_udp(&argc, &argv, sel);
-- 
2.20.1