.IR BOS " | "
.B mpls_ttl
.IR TTL " | "
-.BR ip_proto " { " tcp " | " udp " | " sctp " | " icmp " | " icmpv6 " | "
+.B l2tpv3_sid
+.IR LSID " | "
+.BR ip_proto " { " tcp " | " udp " | " sctp " | " icmp " | " icmpv6 " | " l2tp " | "
.IR IP_PROTO " } | "
.B ip_tos
.IR MASKED_IP_TOS " | "
.I TTL
is an unsigned 8 bit value in decimal format.
.TP
+.BI l2tpv3_sid " LSID"
+Match on L2TPv3 session id field transported over IPv4 or IPv6.
+.I LSID
+is an unsigned 32 bit value in decimal format.
+.TP
.BI ip_proto " IP_PROTO"
Match on layer four protocol.
.I IP_PROTO
may be
-.BR tcp ", " udp ", " sctp ", " icmp ", " icmpv6
+.BR tcp ", " udp ", " sctp ", " icmp ", " icmpv6 ", " l2tp
or an unsigned 8bit value in hexadecimal format.
.TP
.BI ip_tos " MASKED_IP_TOS"
#include "tc_util.h"
#include "rt_names.h"
+#ifndef IPPROTO_L2TP
+#define IPPROTO_L2TP 115
+#endif
+
enum flower_matching_flags {
FLOWER_IP_FLAGS,
};
" ppp_proto [ ipv4 | ipv6 | mpls_uc | mpls_mc | PPP_PROTO ]"
" dst_mac MASKED-LLADDR |\n"
" src_mac MASKED-LLADDR |\n"
- " ip_proto [tcp | udp | sctp | icmp | icmpv6 | IP-PROTO ] |\n"
+ " ip_proto [tcp | udp | sctp | icmp | icmpv6 | l2tp | IP-PROTO ] |\n"
" ip_tos MASKED-IP_TOS |\n"
" ip_ttl MASKED-IP_TTL |\n"
" mpls LSE-LIST |\n"
" mpls_tc TC |\n"
" mpls_bos BOS |\n"
" mpls_ttl TTL |\n"
+ " l2tpv3_sid LSID |\n"
" dst_ip PREFIX |\n"
" src_ip PREFIX |\n"
" dst_port PORT-NUMBER |\n"
if (eth_type != htons(ETH_P_IPV6))
goto err;
ip_proto = IPPROTO_ICMPV6;
+ } else if (!strcmp(str, "l2tp")) {
+ if (eth_type != htons(ETH_P_IP) &&
+ eth_type != htons(ETH_P_IPV6))
+ goto err;
+ ip_proto = IPPROTO_L2TP;
} else {
ret = get_u8(&ip_proto, str, 16);
if (ret)
return flower_parse_u8(str, value_type, mask_type, NULL, NULL, n);
}
+static int flower_parse_l2tpv3(char *str, __u8 ip_proto,
+ struct nlmsghdr *n)
+{
+ __be32 sid;
+ int ret;
+
+ if (ip_proto != IPPROTO_L2TP) {
+ fprintf(stderr,
+ "Can't set \"l2tpv3_sid\" if ip_proto isn't l2tp\n");
+ return -1;
+ }
+ ret = get_be32(&sid, str, 10);
+ if (ret < 0) {
+ fprintf(stderr, "Illegal \"l2tpv3 session id\"\n");
+ return -1;
+ }
+ addattr32(n, MAX_MSG, TCA_FLOWER_KEY_L2TPV3_SID, sid);
+
+ return 0;
+}
+
static int flower_port_attr_type(__u8 ip_proto, enum flower_endpoint endpoint)
{
if (ip_proto == IPPROTO_TCP)
fprintf(stderr, "Illegal \"icmp code\"\n");
return -1;
}
+ } else if (!strcmp(*argv, "l2tpv3_sid")) {
+ NEXT_ARG();
+ ret = flower_parse_l2tpv3(*argv, ip_proto, n);
+ if (ret < 0)
+ return -1;
} else if (matches(*argv, "arp_tip") == 0) {
NEXT_ARG();
ret = flower_parse_arp_ip_addr(*argv, eth_type,
sprintf(out, "icmp");
else if (ip_proto == IPPROTO_ICMPV6)
sprintf(out, "icmpv6");
+ else if (ip_proto == IPPROTO_L2TP)
+ sprintf(out, "l2tp");
else
sprintf(out, "%02x", ip_proto);
flower_print_masked_u8("icmp_code", tb[nl_type],
tb[nl_mask_type], NULL);
+ if (tb[TCA_FLOWER_KEY_L2TPV3_SID]) {
+ struct rtattr *attr = tb[TCA_FLOWER_KEY_L2TPV3_SID];
+
+ print_nl();
+ print_uint(PRINT_ANY, "l2tpv3_sid", " l2tpv3_sid %u",
+ rta_getattr_be32(attr));
+ }
+
flower_print_ip4_addr("arp_sip", tb[TCA_FLOWER_KEY_ARP_SIP],
tb[TCA_FLOWER_KEY_ARP_SIP_MASK]);
flower_print_ip4_addr("arp_tip", tb[TCA_FLOWER_KEY_ARP_TIP],