58 lines
1.3 KiB
Diff
58 lines
1.3 KiB
Diff
|
diff --git a/tc/f_u32.c b/tc/f_u32.c
|
||
|
index 4f5f74e..290595c 100644
|
||
|
--- a/tc/f_u32.c
|
||
|
+++ b/tc/f_u32.c
|
||
|
@@ -403,6 +403,43 @@ 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)
|
||
|
+{
|
||
|
+ int res = -1;
|
||
|
+ int argc = *argc_p;
|
||
|
+ char **argv = *argv_p;
|
||
|
+ __u32 key;
|
||
|
+ __u32 mask;
|
||
|
+ int offmask = 0;
|
||
|
+
|
||
|
+ if (argc < 2)
|
||
|
+ return -1;
|
||
|
+
|
||
|
+ if (get_u32(&key, *argv, 0))
|
||
|
+ return -1;
|
||
|
+ argc--; argv++;
|
||
|
+
|
||
|
+ if (get_u32(&mask, *argv, 16))
|
||
|
+ return -1;
|
||
|
+ argc--; argv++;
|
||
|
+
|
||
|
+ if (key > 0xFF || mask > 0xFF)
|
||
|
+ return -1;
|
||
|
+
|
||
|
+ key <<= 20;
|
||
|
+ mask <<= 20;
|
||
|
+ key = htonl(key);
|
||
|
+ mask = htonl(mask);
|
||
|
+
|
||
|
+ if (res = pack_key(sel, key, mask, 0, offmask) < 0)
|
||
|
+ return -1;
|
||
|
+ res = 0;
|
||
|
+
|
||
|
+ *argc_p = argc;
|
||
|
+ *argv_p = argv;
|
||
|
+ return res;
|
||
|
+}
|
||
|
+
|
||
|
static int parse_ether_addr(int *argc_p, char ***argv_p,
|
||
|
struct tc_u32_sel *sel, int off)
|
||
|
{
|
||
|
@@ -522,7 +559,7 @@ static int parse_ip6(int *argc_p, char ***argv_p, struct tc_u32_sel *sel)
|
||
|
res = parse_ip6_addr(&argc, &argv, sel, 24);
|
||
|
} else if (strcmp(*argv, "priority") == 0) {
|
||
|
NEXT_ARG();
|
||
|
- res = parse_u8(&argc, &argv, sel, 4, 0);
|
||
|
+ res = parse_ip6_class(&argc, &argv, sel);
|
||
|
} else if (strcmp(*argv, "protocol") == 0) {
|
||
|
NEXT_ARG();
|
||
|
res = parse_u8(&argc, &argv, sel, 6, 0);
|