ip rule add from all iif gretap tun_id 2000 lookup 200
Signed-off-by: wenxu <wenxu@ucloud.cn>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
unsigned int tos, tosmask;
unsigned int pref, prefmask;
unsigned int fwmark, fwmask;
unsigned int tos, tosmask;
unsigned int pref, prefmask;
unsigned int fwmark, fwmask;
char iif[IFNAMSIZ];
char oif[IFNAMSIZ];
struct fib_rule_uid_range range;
char iif[IFNAMSIZ];
char oif[IFNAMSIZ];
struct fib_rule_uid_range range;
+ if (filter.tun_id) {
+ __u64 tun_id = 0;
+
+ if (tb[FRA_TUN_ID]) {
+ tun_id = ntohll(rta_getattr_u64(tb[FRA_TUN_ID]));
+ if (filter.tun_id != tun_id)
+ return false;
+ } else {
+ return false;
+ }
+ }
+
table = frh_get_table(frh, tb);
if (filter.tb > 0 && filter.tb ^ table)
return false;
table = frh_get_table(frh, tb);
if (filter.tb > 0 && filter.tb ^ table)
return false;
+ if (tb[FRA_TUN_ID]) {
+ __u64 tun_id = ntohll(rta_getattr_u64(tb[FRA_TUN_ID]));
+
+ print_u64(PRINT_ANY, "tun_id", "tun_id %llu ", tun_id);
+ }
+
table = frh_get_table(frh, tb);
if (table) {
print_string(PRINT_ANY, "table",
table = frh_get_table(frh, tb);
if (table) {
print_string(PRINT_ANY, "table",
&filter.range.end) != 2)
invarg("invalid UID range\n", *argv);
&filter.range.end) != 2)
invarg("invalid UID range\n", *argv);
+ } else if (matches(*argv, "tun_id") == 0) {
+ __u64 tun_id;
+
+ NEXT_ARG();
+ if (get_u64(&tun_id, *argv, 0))
+ invarg("\"tun_id\" value is invalid\n", *argv);
+ filter.tun_id = tun_id;
} else if (matches(*argv, "lookup") == 0 ||
matches(*argv, "table") == 0) {
__u32 tid;
} else if (matches(*argv, "lookup") == 0 ||
matches(*argv, "table") == 0) {
__u32 tid;
if (rtnl_rtprot_a2n(&proto, *argv))
invarg("\"protocol\" value is invalid\n", *argv);
addattr8(&req.n, sizeof(req), FRA_PROTOCOL, proto);
if (rtnl_rtprot_a2n(&proto, *argv))
invarg("\"protocol\" value is invalid\n", *argv);
addattr8(&req.n, sizeof(req), FRA_PROTOCOL, proto);
+ } else if (matches(*argv, "tun_id") == 0) {
+ __u64 tun_id;
+
+ NEXT_ARG();
+ if (get_be64(&tun_id, *argv, 0))
+ invarg("\"tun_id\" value is invalid\n", *argv);
+ addattr64(&req.n, sizeof(req), FRA_TUN_ID, tun_id);
} else if (matches(*argv, "table") == 0 ||
strcmp(*argv, "lookup") == 0) {
NEXT_ARG();
} else if (matches(*argv, "table") == 0 ||
strcmp(*argv, "lookup") == 0) {
NEXT_ARG();
.IR NUMBER "-" NUMBER " ] ] [ "
.BR dport " [ "
.IR NUMBER " | "
.IR NUMBER "-" NUMBER " ] ] [ "
.BR dport " [ "
.IR NUMBER " | "
-.IR NUMBER "-" NUMBER " ] ]"
+.IR NUMBER "-" NUMBER " ] ] [ "
+.B tun_id
+.IR TUN_ID " ]"