From bd02ce58a14bd3ec5318d400b370432fd83672ff Mon Sep 17 00:00:00 2001 From: Packit Service Date: Feb 10 2021 06:14:49 +0000 Subject: Prepare for a new update Reverting patches so we can apply the latest update and changes can be seen in the spec file and sources. --- diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index 36e5bc2..b21cc6a 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -404,9 +404,6 @@ enum { /* Enable memory-mapping BPF map */ BPF_F_MMAPABLE = (1U << 10), - -/* Share perf_event among processes */ - BPF_F_PRESERVE_ELEMS = (1U << 11), }; /* Flags for BPF_PROG_QUERY. */ @@ -417,11 +414,6 @@ enum { */ #define BPF_F_QUERY_EFFECTIVE (1U << 0) -/* Flags for BPF_PROG_TEST_RUN */ - -/* If set, run the test on the cpu specified by bpf_attr.test.cpu */ -#define BPF_F_TEST_RUN_ON_CPU (1U << 0) - /* type for BPF_ENABLE_STATS */ enum bpf_stats_type { /* enabled run_time_ns and run_cnt */ @@ -564,8 +556,6 @@ union bpf_attr { */ __aligned_u64 ctx_in; __aligned_u64 ctx_out; - __u32 flags; - __u32 cpu; } test; struct { /* anonymous struct used by BPF_*_GET_*_ID */ @@ -632,13 +622,8 @@ union bpf_attr { }; __u32 attach_type; /* attach type */ __u32 flags; /* extra flags */ - union { - __u32 target_btf_id; /* btf_id of target to attach to */ - struct { - __aligned_u64 iter_info; /* extra bpf_iter_link_info */ - __u32 iter_info_len; /* iter_info length */ - }; - }; + __aligned_u64 iter_info; /* extra bpf_iter_link_info */ + __u32 iter_info_len; /* iter_info length */ } link_create; struct { /* struct used by BPF_LINK_UPDATE command */ @@ -2511,7 +2496,7 @@ union bpf_attr { * result is from *reuse*\ **->socks**\ [] using the hash of the * tuple. * - * long bpf_sk_release(void *sock) + * long bpf_sk_release(struct bpf_sock *sock) * Description * Release the reference held by *sock*. *sock* must be a * non-**NULL** pointer that was returned from @@ -2691,7 +2676,7 @@ union bpf_attr { * result is from *reuse*\ **->socks**\ [] using the hash of the * tuple. * - * long bpf_tcp_check_syncookie(void *sk, void *iph, u32 iph_len, struct tcphdr *th, u32 th_len) + * long bpf_tcp_check_syncookie(struct bpf_sock *sk, void *iph, u32 iph_len, struct tcphdr *th, u32 th_len) * Description * Check whether *iph* and *th* contain a valid SYN cookie ACK for * the listening socket in *sk*. @@ -2857,7 +2842,6 @@ union bpf_attr { * 0 on success. * * **-ENOENT** if the bpf-local-storage cannot be found. - * **-EINVAL** if sk is not a fullsock (e.g. a request_sock). * * long bpf_send_signal(u32 sig) * Description @@ -2874,7 +2858,7 @@ union bpf_attr { * * **-EAGAIN** if bpf program can try again. * - * s64 bpf_tcp_gen_syncookie(void *sk, void *iph, u32 iph_len, struct tcphdr *th, u32 th_len) + * s64 bpf_tcp_gen_syncookie(struct bpf_sock *sk, void *iph, u32 iph_len, struct tcphdr *th, u32 th_len) * Description * Try to issue a SYN cookie for the packet with corresponding * IP/TCP headers, *iph* and *th*, on the listening socket in *sk*. @@ -3103,7 +3087,7 @@ union bpf_attr { * Return * The id is returned or 0 in case the id could not be retrieved. * - * long bpf_sk_assign(struct sk_buff *skb, void *sk, u64 flags) + * long bpf_sk_assign(struct sk_buff *skb, struct bpf_sock *sk, u64 flags) * Description * Helper is overloaded depending on BPF program type. This * description applies to **BPF_PROG_TYPE_SCHED_CLS** and @@ -3231,11 +3215,11 @@ union bpf_attr { * * **-EOVERFLOW** if an overflow happened: The same object will be tried again. * - * u64 bpf_sk_cgroup_id(void *sk) + * u64 bpf_sk_cgroup_id(struct bpf_sock *sk) * Description * Return the cgroup v2 id of the socket *sk*. * - * *sk* must be a non-**NULL** pointer to a socket, e.g. one + * *sk* must be a non-**NULL** pointer to a full socket, e.g. one * returned from **bpf_sk_lookup_xxx**\ (), * **bpf_sk_fullsock**\ (), etc. The format of returned id is * same as in **bpf_skb_cgroup_id**\ (). @@ -3245,7 +3229,7 @@ union bpf_attr { * Return * The id is returned or 0 in case the id could not be retrieved. * - * u64 bpf_sk_ancestor_cgroup_id(void *sk, int ancestor_level) + * u64 bpf_sk_ancestor_cgroup_id(struct bpf_sock *sk, int ancestor_level) * Description * Return id of cgroup v2 that is ancestor of cgroup associated * with the *sk* at the *ancestor_level*. The root cgroup is at @@ -4463,34 +4447,4 @@ struct bpf_sk_lookup { __u32 local_port; /* Host byte order */ }; -/* - * struct btf_ptr is used for typed pointer representation; the - * type id is used to render the pointer data as the appropriate type - * via the bpf_snprintf_btf() helper described above. A flags field - - * potentially to specify additional details about the BTF pointer - * (rather than its mode of display) - is included for future use. - * Display flags - BTF_F_* - are passed to bpf_snprintf_btf separately. - */ -struct btf_ptr { - void *ptr; - __u32 type_id; - __u32 flags; /* BTF ptr flags; unused at present. */ -}; - -/* - * Flags to control bpf_snprintf_btf() behaviour. - * - BTF_F_COMPACT: no formatting around type information - * - BTF_F_NONAME: no struct/union member names/types - * - BTF_F_PTR_RAW: show raw (unobfuscated) pointer values; - * equivalent to %px. - * - BTF_F_ZERO: show zero-valued struct/union members; they - * are not displayed by default - */ -enum { - BTF_F_COMPACT = (1ULL << 0), - BTF_F_NONAME = (1ULL << 1), - BTF_F_PTR_RAW = (1ULL << 2), - BTF_F_ZERO = (1ULL << 3), -}; - #endif /* __LINUX_BPF_H__ */ diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h index e5586fa..b7f23fa 100644 --- a/include/uapi/linux/devlink.h +++ b/include/uapi/linux/devlink.h @@ -13,8 +13,6 @@ #ifndef _LINUX_DEVLINK_H_ #define _LINUX_DEVLINK_H_ -#include - #define DEVLINK_GENL_NAME "devlink" #define DEVLINK_GENL_VERSION 0x1 #define DEVLINK_GENL_MCGRP_CONFIG_NAME "config" @@ -195,9 +193,6 @@ enum devlink_port_flavour { * port that faces the PCI VF. */ DEVLINK_PORT_FLAVOUR_VIRTUAL, /* Any virtual port facing the user. */ - DEVLINK_PORT_FLAVOUR_UNUSED, /* Port which exists in the switch, but - * is not used in any way. - */ }; enum devlink_param_cmode { diff --git a/include/uapi/linux/genetlink.h b/include/uapi/linux/genetlink.h index 9fa720e..7c6c390 100644 --- a/include/uapi/linux/genetlink.h +++ b/include/uapi/linux/genetlink.h @@ -64,8 +64,6 @@ enum { CTRL_ATTR_OPS, CTRL_ATTR_MCAST_GROUPS, CTRL_ATTR_POLICY, - CTRL_ATTR_OP_POLICY, - CTRL_ATTR_OP, __CTRL_ATTR_MAX, }; @@ -87,15 +85,6 @@ enum { __CTRL_ATTR_MCAST_GRP_MAX, }; -enum { - CTRL_ATTR_POLICY_UNSPEC, - CTRL_ATTR_POLICY_DO, - CTRL_ATTR_POLICY_DUMP, - - __CTRL_ATTR_POLICY_DUMP_MAX, - CTRL_ATTR_POLICY_DUMP_MAX = __CTRL_ATTR_POLICY_DUMP_MAX - 1 -}; - #define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1) diff --git a/include/uapi/linux/l2tp.h b/include/uapi/linux/l2tp.h index abc0fc8..131c3a2 100644 --- a/include/uapi/linux/l2tp.h +++ b/include/uapi/linux/l2tp.h @@ -144,7 +144,6 @@ enum { L2TP_ATTR_RX_OOS_PACKETS, /* u64 */ L2TP_ATTR_RX_ERRORS, /* u64 */ L2TP_ATTR_STATS_PAD, - L2TP_ATTR_RX_COOKIE_DISCARDS, /* u64 */ __L2TP_ATTR_STATS_MAX, }; diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h index f774920..695c88e 100644 --- a/include/uapi/linux/netlink.h +++ b/include/uapi/linux/netlink.h @@ -327,7 +327,6 @@ enum netlink_attribute_type { * the index, if limited inside the nesting (U32) * @NL_POLICY_TYPE_ATTR_BITFIELD32_MASK: valid mask for the * bitfield32 type (U32) - * @NL_POLICY_TYPE_ATTR_MASK: mask of valid bits for unsigned integers (U64) * @NL_POLICY_TYPE_ATTR_PAD: pad attribute for 64-bit alignment */ enum netlink_policy_type_attr { @@ -343,7 +342,6 @@ enum netlink_policy_type_attr { NL_POLICY_TYPE_ATTR_POLICY_MAXTYPE, NL_POLICY_TYPE_ATTR_BITFIELD32_MASK, NL_POLICY_TYPE_ATTR_PAD, - NL_POLICY_TYPE_ATTR_MASK, /* keep last */ __NL_POLICY_TYPE_ATTR_MAX, diff --git a/include/uapi/linux/tc_act/tc_mpls.h b/include/uapi/linux/tc_act/tc_mpls.h index 9e4e8f5..9360e95 100644 --- a/include/uapi/linux/tc_act/tc_mpls.h +++ b/include/uapi/linux/tc_act/tc_mpls.h @@ -10,7 +10,6 @@ #define TCA_MPLS_ACT_PUSH 2 #define TCA_MPLS_ACT_MODIFY 3 #define TCA_MPLS_ACT_DEC_TTL 4 -#define TCA_MPLS_ACT_MAC_PUSH 5 struct tc_mpls { tc_gen; /* generic TC action fields. */ diff --git a/include/uapi/linux/tc_act/tc_vlan.h b/include/uapi/linux/tc_act/tc_vlan.h index 5b306fe..168995b 100644 --- a/include/uapi/linux/tc_act/tc_vlan.h +++ b/include/uapi/linux/tc_act/tc_vlan.h @@ -16,8 +16,6 @@ #define TCA_VLAN_ACT_POP 1 #define TCA_VLAN_ACT_PUSH 2 #define TCA_VLAN_ACT_MODIFY 3 -#define TCA_VLAN_ACT_POP_ETH 4 -#define TCA_VLAN_ACT_PUSH_ETH 5 struct tc_vlan { tc_gen; @@ -32,8 +30,6 @@ enum { TCA_VLAN_PUSH_VLAN_PROTOCOL, TCA_VLAN_PAD, TCA_VLAN_PUSH_VLAN_PRIORITY, - TCA_VLAN_PUSH_ETH_DST, - TCA_VLAN_PUSH_ETH_SRC, __TCA_VLAN_MAX, }; #define TCA_VLAN_MAX (__TCA_VLAN_MAX - 1) diff --git a/include/version.h b/include/version.h index 89d0597..0088493 100644 --- a/include/version.h +++ b/include/version.h @@ -1 +1 @@ -static const char version[] = "5.9.0"; +static const char version[] = "5.8.0"; diff --git a/lib/ll_proto.c b/lib/ll_proto.c index 7817931..2a0c1cb 100644 --- a/lib/ll_proto.c +++ b/lib/ll_proto.c @@ -80,7 +80,6 @@ __PF(8021Q,802.1Q) __PF(8021AD,802.1ad) __PF(MPLS_UC,mpls_uc) __PF(MPLS_MC,mpls_mc) -__PF(TEB,teb) { 0x8100, "802.1Q" }, { 0x88cc, "LLDP" }, diff --git a/man/man8/tc-mpls.8 b/man/man8/tc-mpls.8 index 7f8be22..84ef2ef 100644 --- a/man/man8/tc-mpls.8 +++ b/man/man8/tc-mpls.8 @@ -17,7 +17,7 @@ mpls - mpls manipulation module .ti -8 .IR PUSH " := " -.RB "{ " push " | " mac_push " } [ " protocol +.BR push " [ " protocol .IR MPLS_PROTO " ]" .RB " [ " tc .IR MPLS_TC " ] " @@ -64,14 +64,7 @@ requires no arguments and simply subtracts 1 from the MPLS header TTL field. Decapsulation mode. Requires the protocol of the next header. .TP .B push -Encapsulation mode. Adds the MPLS header between the MAC and the network -headers. Requires at least the -.B label -option. -.TP -.B mac_push -Encapsulation mode. Adds the MPLS header before the MAC header. Requires at -least the +Encapsulation mode. Requires at least the .B label option. .TP @@ -147,48 +140,17 @@ a label 123 and sends them out eth1: .EE .RE -In this example, incoming MPLS unicast packets on eth0 are decapsulated -and redirected to eth1: +In this example, incoming MPLS unicast packets on eth0 are decapsulated and to +ip packets and output to eth1: .RS .EX #tc qdisc add dev eth0 handle ffff: ingress #tc filter add dev eth0 protocol mpls_uc parent ffff: flower \\ action mpls pop protocol ipv4 \\ - action mirred egress redirect dev eth1 -.EE -.RE - -Here is another example, where incoming Ethernet frames are encapsulated into -MPLS with label 123 and TTL 64. Then, an outer Ethernet header is added and the -resulting frame is finally sent on eth1: - -.RS -.EX -#tc qdisc add dev eth0 ingress -#tc filter add dev eth0 ingress matchall \\ - action mpls mac_push label 123 ttl 64 \\ - action vlan push_eth \\ - dst_mac 02:00:00:00:00:02 \\ - src_mac 02:00:00:00:00:01 \\ - action mirred egress redirect dev eth1 -.EE -.RE - -The following example assumes that incoming MPLS packets with label 123 -transport Ethernet frames. The outer Ethernet and the MPLS headers are -stripped, then the inner Ethernet frame is sent on eth1: - -.RS -.EX -#tc qdisc add dev eth0 ingress -#tc filter add dev eth0 ingress protocol mpls_uc \\ - flower mpls_label 123 mpls_bos 1 \\ - action vlan pop_eth \\ - action mpls pop protocol teb \\ - action mirred egress redirect dev eth1 + action mirred egress redirect dev eth0 .EE .RE .SH SEE ALSO -.BR tc "(8), " tc-mirred "(8), " tc-vlan (8) +.BR tc (8) diff --git a/man/man8/tc-vlan.8 b/man/man8/tc-vlan.8 index 264053d..f5ffc25 100644 --- a/man/man8/tc-vlan.8 +++ b/man/man8/tc-vlan.8 @@ -5,8 +5,8 @@ vlan - vlan manipulation module .SH SYNOPSIS .in +8 .ti -8 -.BR tc " ... " "action vlan" " { " pop " | " pop_eth " |" -.IR PUSH " | " MODIFY " | " PUSH_ETH " } [ " CONTROL " ]" +.BR tc " ... " "action vlan" " { " pop " |" +.IR PUSH " | " MODIFY " } [ " CONTROL " ]" .ti -8 .IR PUSH " := " @@ -25,11 +25,6 @@ vlan - vlan manipulation module .BI id " VLANID" .ti -8 -.IR PUSH_ETH " := " -.B push_eth -.BI dst_mac " LLADDR " src_mac " LLADDR " - -.ti -8 .IR CONTROL " := { " .BR reclassify " | " pipe " | " drop " | " continue " | " pass " | " goto " " chain " " CHAIN_INDEX " }" .SH DESCRIPTION @@ -48,20 +43,6 @@ modes require at least a and allow to optionally choose the .I VLANPROTO to use. - -The -.B vlan -action can also be used to add or remove the base Ethernet header. The -.B pop_eth -mode, which takes no argument, is used to remove the base Ethernet header. All -existing VLANs must have been previously dropped. The opposite operation, -adding a base Ethernet header, is done with the -.B push_eth -mode. In that case, the packet must have no MAC header (stacking MAC headers is -not permitted). This mode is mostly useful when a previous action has -encapsulated the whole original frame behind a network header and one needs -to prepend an Ethernet header before forwarding the resulting packet. - .SH OPTIONS .TP .B pop @@ -77,16 +58,6 @@ Replace mode. Existing 802.1Q tag is replaced. Requires at least .B id option. .TP -.B pop_eth -Ethernet header decapsulation mode. Only works on a plain Ethernet header: -VLANs, if any, must be removed first. -.TP -.B push_eth -Ethernet header encapsulation mode. The Ethertype is automatically set -using the network header type. Chaining Ethernet headers is not allowed: the -packet must have no MAC header when using this mode. Requires the -.BR "dst_mac " and " src_mac " options. -.TP .BI id " VLANID" Specify the VLAN ID to encapsulate into. .I VLANID @@ -102,12 +73,6 @@ Choose the VLAN protocol to use. At the time of writing, the kernel accepts only .BI priority " VLANPRIO" Choose the VLAN priority to use. Decimal number in range of 0-7. .TP -.BI dst_mac " LLADDR" -Choose the destination MAC address to use. -.TP -.BI src_mac " LLADDR" -Choose the source MAC address to use. -.TP .I CONTROL How to continue after executing this action. .RS @@ -157,8 +122,5 @@ process then restarted for the plain packet: .EE .RE -For an example of the -.BR pop_eth " and " push_eth " modes, see " tc-mpls (8). - .SH SEE ALSO -.BR tc "(8), " tc-mpls (8) +.BR tc (8) diff --git a/tc/f_flower.c b/tc/f_flower.c index 2773107..00c919f 100644 --- a/tc/f_flower.c +++ b/tc/f_flower.c @@ -2476,7 +2476,7 @@ static void flower_print_u32(const char *name, struct rtattr *attr) print_uint(PRINT_ANY, name, namefrm, rta_getattr_u32(attr)); } -static void flower_print_mpls_opt_lse(struct rtattr *lse) +static void flower_print_mpls_opt_lse(const char *name, struct rtattr *lse) { struct rtattr *tb[TCA_FLOWER_KEY_MPLS_OPT_LSE_MAX + 1]; struct rtattr *attr; @@ -2493,8 +2493,7 @@ static void flower_print_mpls_opt_lse(struct rtattr *lse) RTA_PAYLOAD(lse)); print_nl(); - print_string(PRINT_FP, NULL, " lse", NULL); - open_json_object(NULL); + open_json_array(PRINT_ANY, name); attr = tb[TCA_FLOWER_KEY_MPLS_OPT_LSE_DEPTH]; if (attr) print_hhu(PRINT_ANY, "depth", " depth %u", @@ -2512,10 +2511,10 @@ static void flower_print_mpls_opt_lse(struct rtattr *lse) attr = tb[TCA_FLOWER_KEY_MPLS_OPT_LSE_TTL]; if (attr) print_hhu(PRINT_ANY, "ttl", " ttl %u", rta_getattr_u8(attr)); - close_json_object(); + close_json_array(PRINT_JSON, NULL); } -static void flower_print_mpls_opts(struct rtattr *attr) +static void flower_print_mpls_opts(const char *name, struct rtattr *attr) { struct rtattr *lse; int rem; @@ -2524,12 +2523,11 @@ static void flower_print_mpls_opts(struct rtattr *attr) return; print_nl(); - print_string(PRINT_FP, NULL, " mpls", NULL); - open_json_array(PRINT_JSON, "mpls"); + open_json_array(PRINT_ANY, name); rem = RTA_PAYLOAD(attr); lse = RTA_DATA(attr); while (RTA_OK(lse, rem)) { - flower_print_mpls_opt_lse(lse); + flower_print_mpls_opt_lse(" lse", lse); lse = RTA_NEXT(lse, rem); }; if (rem) @@ -2652,7 +2650,7 @@ static int flower_print_opt(struct filter_util *qu, FILE *f, flower_print_ip_attr("ip_ttl", tb[TCA_FLOWER_KEY_IP_TTL], tb[TCA_FLOWER_KEY_IP_TTL_MASK]); - flower_print_mpls_opts(tb[TCA_FLOWER_KEY_MPLS_OPTS]); + flower_print_mpls_opts(" mpls", tb[TCA_FLOWER_KEY_MPLS_OPTS]); flower_print_u32("mpls_label", tb[TCA_FLOWER_KEY_MPLS_LABEL]); flower_print_u8("mpls_tc", tb[TCA_FLOWER_KEY_MPLS_TC]); flower_print_u8("mpls_bos", tb[TCA_FLOWER_KEY_MPLS_BOS]); diff --git a/tc/m_mpls.c b/tc/m_mpls.c index 9fee22e..3d5d9b2 100644 --- a/tc/m_mpls.c +++ b/tc/m_mpls.c @@ -17,21 +17,17 @@ static const char * const action_names[] = { [TCA_MPLS_ACT_PUSH] = "push", [TCA_MPLS_ACT_MODIFY] = "modify", [TCA_MPLS_ACT_DEC_TTL] = "dec_ttl", - [TCA_MPLS_ACT_MAC_PUSH] = "mac_push", }; static void explain(void) { fprintf(stderr, - "Usage: mpls pop [ protocol MPLS_PROTO ] [CONTROL]\n" + "Usage: mpls pop [ protocol MPLS_PROTO ]\n" " mpls push [ protocol MPLS_PROTO ] [ label MPLS_LABEL ] [ tc MPLS_TC ]\n" " [ ttl MPLS_TTL ] [ bos MPLS_BOS ] [CONTROL]\n" - " mpls mac_push [ protocol MPLS_PROTO ] [ label MPLS_LABEL ] [ tc MPLS_TC ]\n" - " [ ttl MPLS_TTL ] [ bos MPLS_BOS ] [CONTROL]\n" - " mpls modify [ label MPLS_LABEL ] [ tc MPLS_TC ] [ ttl MPLS_TTL ]\n" - " [ bos MPLS_BOS ] [CONTROL]\n" - " for pop, MPLS_PROTO is next header of packet - e.g. ip or mpls_uc\n" - " for push and mac_push, MPLS_PROTO is one of mpls_uc or mpls_mc\n" + " mpls modify [ label MPLS_LABEL ] [ tc MPLS_TC ] [ ttl MPLS_TTL ] [CONTROL]\n" + " for pop MPLS_PROTO is next header of packet - e.g. ip or mpls_uc\n" + " for push MPLS_PROTO is one of mpls_uc or mpls_mc\n" " with default: mpls_uc\n" " CONTROL := reclassify | pipe | drop | continue | pass |\n" " goto chain \n"); @@ -45,14 +41,12 @@ static void usage(void) static bool can_modify_mpls_fields(unsigned int action) { - return action == TCA_MPLS_ACT_PUSH || action == TCA_MPLS_ACT_MAC_PUSH || - action == TCA_MPLS_ACT_MODIFY; + return action == TCA_MPLS_ACT_PUSH || action == TCA_MPLS_ACT_MODIFY; } -static bool can_set_ethtype(unsigned int action) +static bool can_modify_ethtype(unsigned int action) { - return action == TCA_MPLS_ACT_PUSH || action == TCA_MPLS_ACT_MAC_PUSH || - action == TCA_MPLS_ACT_POP; + return action == TCA_MPLS_ACT_PUSH || action == TCA_MPLS_ACT_POP; } static bool is_valid_label(__u32 label) @@ -104,46 +98,37 @@ static int parse_mpls(struct action_util *a, int *argc_p, char ***argv_p, if (check_double_action(action, *argv)) return -1; action = TCA_MPLS_ACT_MODIFY; - } else if (matches(*argv, "mac_push") == 0) { - if (check_double_action(action, *argv)) - return -1; - action = TCA_MPLS_ACT_MAC_PUSH; } else if (matches(*argv, "dec_ttl") == 0) { if (check_double_action(action, *argv)) return -1; action = TCA_MPLS_ACT_DEC_TTL; } else if (matches(*argv, "label") == 0) { if (!can_modify_mpls_fields(action)) - invarg("only valid for push, mac_push and modify", - *argv); + invarg("only valid for push/modify", *argv); NEXT_ARG(); if (get_u32(&label, *argv, 0) || !is_valid_label(label)) invarg("label must be <=0xFFFFF", *argv); } else if (matches(*argv, "tc") == 0) { if (!can_modify_mpls_fields(action)) - invarg("only valid for push, mac_push and modify", - *argv); + invarg("only valid for push/modify", *argv); NEXT_ARG(); if (get_u8(&tc, *argv, 0) || (tc & ~0x7)) invarg("tc field is 3 bits max", *argv); } else if (matches(*argv, "ttl") == 0) { if (!can_modify_mpls_fields(action)) - invarg("only valid for push, mac_push and modify", - *argv); + invarg("only valid for push/modify", *argv); NEXT_ARG(); if (get_u8(&ttl, *argv, 0) || !ttl) invarg("ttl must be >0 and <=255", *argv); } else if (matches(*argv, "bos") == 0) { if (!can_modify_mpls_fields(action)) - invarg("only valid for push, mac_push and modify", - *argv); + invarg("only valid for push/modify", *argv); NEXT_ARG(); if (get_u8(&bos, *argv, 0) || (bos & ~0x1)) invarg("bos must be 0 or 1", *argv); } else if (matches(*argv, "protocol") == 0) { - if (!can_set_ethtype(action)) - invarg("only valid for push, mac_push and pop", - *argv); + if (!can_modify_ethtype(action)) + invarg("only valid for push/pop", *argv); NEXT_ARG(); if (ll_proto_a2n(&proto, *argv)) invarg("protocol is invalid", *argv); @@ -174,12 +159,10 @@ static int parse_mpls(struct action_util *a, int *argc_p, char ***argv_p, if (action == TCA_MPLS_ACT_PUSH && label == 0xffffffff) missarg("label"); - if ((action == TCA_MPLS_ACT_PUSH || action == TCA_MPLS_ACT_MAC_PUSH) && - proto && + if (action == TCA_MPLS_ACT_PUSH && proto && proto != htons(ETH_P_MPLS_UC) && proto != htons(ETH_P_MPLS_MC)) { fprintf(stderr, - "invalid %spush protocol \"0x%04x\" - use mpls_(uc|mc)\n", - action == TCA_MPLS_ACT_MAC_PUSH ? "mac_" : "", + "invalid push protocol \"0x%04x\" - use mpls_(uc|mc)\n", ntohs(proto)); return -1; } @@ -240,7 +223,6 @@ static int print_mpls(struct action_util *au, FILE *f, struct rtattr *arg) } break; case TCA_MPLS_ACT_PUSH: - case TCA_MPLS_ACT_MAC_PUSH: if (tb[TCA_MPLS_PROTO]) { __u16 proto; diff --git a/tc/m_vlan.c b/tc/m_vlan.c index 57722b7..1096ba0 100644 --- a/tc/m_vlan.c +++ b/tc/m_vlan.c @@ -23,18 +23,14 @@ static const char * const action_names[] = { [TCA_VLAN_ACT_POP] = "pop", [TCA_VLAN_ACT_PUSH] = "push", [TCA_VLAN_ACT_MODIFY] = "modify", - [TCA_VLAN_ACT_POP_ETH] = "pop_eth", - [TCA_VLAN_ACT_PUSH_ETH] = "push_eth", }; static void explain(void) { fprintf(stderr, - "Usage: vlan pop [CONTROL]\n" + "Usage: vlan pop\n" " vlan push [ protocol VLANPROTO ] id VLANID [ priority VLANPRIO ] [CONTROL]\n" " vlan modify [ protocol VLANPROTO ] id VLANID [ priority VLANPRIO ] [CONTROL]\n" - " vlan pop_eth [CONTROL]\n" - " vlan push_eth dst_mac LLADDR src_mac LLADDR [CONTROL]\n" " VLANPROTO is one of 802.1Q or 802.1AD\n" " with default: 802.1Q\n" " CONTROL := reclassify | pipe | drop | continue | pass |\n" @@ -67,10 +63,6 @@ static int parse_vlan(struct action_util *a, int *argc_p, char ***argv_p, char **argv = *argv_p; struct rtattr *tail; int action = 0; - char dst_mac[ETH_ALEN] = {}; - int dst_mac_set = 0; - char src_mac[ETH_ALEN] = {}; - int src_mac_set = 0; __u16 id; int id_set = 0; __u16 proto; @@ -103,18 +95,6 @@ static int parse_vlan(struct action_util *a, int *argc_p, char ***argv_p, return -1; } action = TCA_VLAN_ACT_MODIFY; - } else if (matches(*argv, "pop_eth") == 0) { - if (action) { - unexpected(*argv); - return -1; - } - action = TCA_VLAN_ACT_POP_ETH; - } else if (matches(*argv, "push_eth") == 0) { - if (action) { - unexpected(*argv); - return -1; - } - action = TCA_VLAN_ACT_PUSH_ETH; } else if (matches(*argv, "id") == 0) { if (!has_push_attribs(action)) invarg("only valid for push/modify", *argv); @@ -139,22 +119,6 @@ static int parse_vlan(struct action_util *a, int *argc_p, char ***argv_p, if (get_u8(&prio, *argv, 0) || (prio & ~0x7)) invarg("prio is invalid", *argv); prio_set = 1; - } else if (matches(*argv, "dst_mac") == 0) { - if (action != TCA_VLAN_ACT_PUSH_ETH) - invarg("only valid for push_eth", *argv); - - NEXT_ARG(); - if (ll_addr_a2n(dst_mac, sizeof(dst_mac), *argv) < 0) - invarg("dst_mac is invalid", *argv); - dst_mac_set = 1; - } else if (matches(*argv, "src_mac") == 0) { - if (action != TCA_VLAN_ACT_PUSH_ETH) - invarg("only valid for push_eth", *argv); - - NEXT_ARG(); - if (ll_addr_a2n(src_mac, sizeof(src_mac), *argv) < 0) - invarg("src_mac is invalid", *argv); - src_mac_set = 1; } else if (matches(*argv, "help") == 0) { usage(); } else { @@ -186,20 +150,6 @@ static int parse_vlan(struct action_util *a, int *argc_p, char ***argv_p, return -1; } - if (action == TCA_VLAN_ACT_PUSH_ETH) { - if (!dst_mac_set) { - fprintf(stderr, "dst_mac needs to be set for %s\n", - action_names[action]); - explain(); - return -1; - } else if (!src_mac_set) { - fprintf(stderr, "src_mac needs to be set for %s\n", - action_names[action]); - explain(); - return -1; - } - } - parm.v_action = action; tail = addattr_nest(n, MAX_MSG, tca_id); addattr_l(n, MAX_MSG, TCA_VLAN_PARMS, &parm, sizeof(parm)); @@ -217,12 +167,6 @@ static int parse_vlan(struct action_util *a, int *argc_p, char ***argv_p, } if (prio_set) addattr8(n, MAX_MSG, TCA_VLAN_PUSH_VLAN_PRIORITY, prio); - if (dst_mac_set) - addattr_l(n, MAX_MSG, TCA_VLAN_PUSH_ETH_DST, dst_mac, - sizeof(dst_mac)); - if (src_mac_set) - addattr_l(n, MAX_MSG, TCA_VLAN_PUSH_ETH_SRC, src_mac, - sizeof(src_mac)); addattr_nest_end(n, tail); @@ -244,7 +188,7 @@ static int print_vlan(struct action_util *au, FILE *f, struct rtattr *arg) parse_rtattr_nested(tb, TCA_VLAN_MAX, arg); if (!tb[TCA_VLAN_PARMS]) { - fprintf(stderr, "Missing vlan parameters\n"); + fprintf(stderr, "Missing vlanparameters\n"); return -1; } parm = RTA_DATA(tb[TCA_VLAN_PARMS]); @@ -272,19 +216,6 @@ static int print_vlan(struct action_util *au, FILE *f, struct rtattr *arg) print_uint(PRINT_ANY, "priority", " priority %u", val); } break; - case TCA_VLAN_ACT_PUSH_ETH: - if (tb[TCA_VLAN_PUSH_ETH_DST] && - RTA_PAYLOAD(tb[TCA_VLAN_PUSH_ETH_DST]) == ETH_ALEN) { - ll_addr_n2a(RTA_DATA(tb[TCA_VLAN_PUSH_ETH_DST]), - ETH_ALEN, 0, b1, sizeof(b1)); - print_string(PRINT_ANY, "dst_mac", " dst_mac %s", b1); - } - if (tb[TCA_VLAN_PUSH_ETH_SRC && - RTA_PAYLOAD(tb[TCA_VLAN_PUSH_ETH_SRC]) == ETH_ALEN]) { - ll_addr_n2a(RTA_DATA(tb[TCA_VLAN_PUSH_ETH_SRC]), - ETH_ALEN, 0, b1, sizeof(b1)); - print_string(PRINT_ANY, "src_mac", " src_mac %s", b1); - } } print_action_control(f, " ", parm->action, ""); diff --git a/testsuite/tests/tc/mpls.t b/testsuite/tests/tc/mpls.t deleted file mode 100755 index cb25f36..0000000 --- a/testsuite/tests/tc/mpls.t +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh - -. lib/generic.sh - -DEV="$(rand_dev)" -ts_ip "$0" "Add $DEV dummy interface" link add dev $DEV up type dummy -ts_tc "$0" "Add ingress qdisc" qdisc add dev $DEV ingress - -reset_qdisc() -{ - ts_tc "$0" "Remove ingress qdisc" qdisc del dev $DEV ingress - ts_tc "$0" "Add ingress qdisc" qdisc add dev $DEV ingress -} - -ts_tc "$0" "Add mpls action pop" \ - filter add dev $DEV ingress protocol mpls_uc matchall \ - action mpls pop protocol ip -ts_tc "$0" "Show ingress filters" filter show dev $DEV ingress -test_on "mpls" -test_on "pop protocol ip pipe" - -reset_qdisc -ts_tc "$0" "Add mpls action push" \ - filter add dev $DEV ingress protocol ip matchall \ - action mpls push protocol mpls_uc label 20 tc 3 bos 1 ttl 64 -ts_tc "$0" "Show ingress filters" filter show dev $DEV ingress -test_on "mpls" -test_on "push" -test_on "protocol mpls_uc" -test_on "label 20" -test_on "tc 3" -test_on "bos 1" -test_on "ttl 64" -test_on "pipe" - -reset_qdisc -ts_tc "$0" "Add mpls action mac_push" \ - filter add dev $DEV ingress matchall \ - action mpls mac_push protocol mpls_uc label 20 tc 3 bos 1 ttl 64 -ts_tc "$0" "Show ingress filters" filter show dev $DEV ingress -test_on "mpls" -test_on "mac_push" -test_on "protocol mpls_uc" -test_on "label 20" -test_on "tc 3" -test_on "bos 1" -test_on "ttl 64" -test_on "pipe" - -reset_qdisc -ts_tc "$0" "Add mpls action modify" \ - filter add dev $DEV ingress protocol mpls_uc matchall \ - action mpls modify label 20 tc 3 ttl 64 -ts_tc "$0" "Show ingress filters" filter show dev $DEV ingress -test_on "mpls" -test_on "modify" -test_on "label 20" -test_on "tc 3" -test_on "ttl 64" -test_on "pipe" - -reset_qdisc -ts_tc "$0" "Add mpls action dec_ttl" \ - filter add dev $DEV ingress protocol mpls_uc matchall \ - action mpls dec_ttl -ts_tc "$0" "Show ingress filters" filter show dev $DEV ingress -test_on "mpls" -test_on "dec_ttl" -test_on "pipe" diff --git a/testsuite/tests/tc/vlan.t b/testsuite/tests/tc/vlan.t deleted file mode 100755 index b86dc36..0000000 --- a/testsuite/tests/tc/vlan.t +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/sh - -. lib/generic.sh - -DEV="$(rand_dev)" -ts_ip "$0" "Add $DEV dummy interface" link add dev $DEV up type dummy -ts_tc "$0" "Add ingress qdisc" qdisc add dev $DEV ingress - -reset_qdisc() -{ - ts_tc "$0" "Remove ingress qdisc" qdisc del dev $DEV ingress - ts_tc "$0" "Add ingress qdisc" qdisc add dev $DEV ingress -} - -ts_tc "$0" "Add vlan action pop" \ - filter add dev $DEV ingress matchall action vlan pop -ts_tc "$0" "Show ingress filters" filter show dev $DEV ingress -test_on "vlan" -test_on "pop" -test_on "pipe" - -reset_qdisc -ts_tc "$0" "Add vlan action push (default parameters)" \ - filter add dev $DEV ingress matchall action vlan push id 5 -ts_tc "$0" "Show ingress filters" filter show dev $DEV ingress -test_on "vlan" -test_on "push" -test_on "id 5" -test_on "protocol 802.1Q" -test_on "priority 0" -test_on "pipe" - -reset_qdisc -ts_tc "$0" "Add vlan action push (explicit parameters)" \ - filter add dev $DEV ingress matchall \ - action vlan push id 5 protocol 802.1ad priority 2 -ts_tc "$0" "Show ingress filters" filter show dev $DEV ingress -test_on "vlan" -test_on "push" -test_on "id 5" -test_on "protocol 802.1ad" -test_on "priority 2" -test_on "pipe" - -reset_qdisc -ts_tc "$0" "Add vlan action modify (default parameters)" \ - filter add dev $DEV ingress matchall action vlan modify id 5 -ts_tc "$0" "Show ingress filters" filter show dev $DEV ingress -test_on "vlan" -test_on "modify" -test_on "id 5" -test_on "protocol 802.1Q" -test_on "priority 0" -test_on "pipe" - -reset_qdisc -ts_tc "$0" "Add vlan action modify (explicit parameters)" \ - filter add dev $DEV ingress matchall \ - action vlan modify id 5 protocol 802.1ad priority 2 -ts_tc "$0" "Show ingress filters" filter show dev $DEV ingress -test_on "vlan" -test_on "modify" -test_on "id 5" -test_on "protocol 802.1ad" -test_on "priority 2" -test_on "pipe" - -reset_qdisc -ts_tc "$0" "Add vlan action pop_eth" \ - filter add dev $DEV ingress matchall action vlan pop_eth -ts_tc "$0" "Show ingress filters" filter show dev $DEV ingress -test_on "vlan" -test_on "pop_eth" -test_on "pipe" - -reset_qdisc -ts_tc "$0" "Add vlan action push_eth" \ - filter add dev $DEV ingress matchall \ - action vlan push_eth dst_mac 02:00:00:00:00:02 \ - src_mac 02:00:00:00:00:01 -ts_tc "$0" "Show ingress filters" filter show dev $DEV ingress -test_on "vlan" -test_on "push_eth" -test_on "dst_mac 02:00:00:00:00:02" -test_on "src_mac 02:00:00:00:00:01" -test_on "pipe"