Merge ~smb/ubuntu/+source/iproute2:merge-xenial into ubuntu/+source/iproute2:ubuntu/xenial-proposed

Proposed by Stefan Bader on 2019-04-11
Status: Merged
Approved by: Christian Ehrhardt  on 2019-04-12
Approved revision: 9c9e5f06de2ebf7397fa20cc0a7719502b09ec71
Merged at revision: 9c9e5f06de2ebf7397fa20cc0a7719502b09ec71
Proposed branch: ~smb/ubuntu/+source/iproute2:merge-xenial
Merge into: ubuntu/+source/iproute2:ubuntu/xenial-proposed
Diff against target: 260 lines (+238/-0)
3 files modified
debian/changelog (+7/-0)
debian/patches/1011-tc-Add-support-for-the-matchall-traffic-classifier.patch (+230/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Christian Ehrhardt  Approve on 2019-04-12
Canonical Server Team 2019-04-12 Pending
Ubuntu Server Dev import team 2019-04-11 Pending
Review via email: mp+365865@code.launchpad.net
To post a comment you must log in.
Christian Ehrhardt  (paelzer) wrote :

Minor lack of dep3 headers, the rest LGTM

review: Needs Fixing
Stefan Bader (smb) wrote :

> Minor lack of dep3 headers, the rest LGTM

Refreshed branch with updated patch. I mimicked the additional fields done in the previous patch.

Christian Ehrhardt  (paelzer) wrote :

Now it looks good, thanks

review: Approve
Christian Ehrhardt  (paelzer) wrote :

Tagged and Sponsored into -unapproved.
Please track SRU handling and proposed migration later on.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 6a65658..e2297c3 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+iproute2 (4.3.0-1ubuntu3.16.04.5) xenial; urgency=medium
7+
8+ * sched: Match-all classifier is missing in xenial (LP: #1642514)
9+ - d/p/1011-tc-Add-support-for-the-matchall-traffic-classifier.patch
10+
11+ -- Stefan Bader <stefan.bader@canonical.com> Thu, 04 Apr 2019 15:47:07 +0200
12+
13 iproute2 (4.3.0-1ubuntu3.16.04.4) xenial; urgency=medium
14
15 * Add support for VF Trust (LP: #1800877)
16diff --git a/debian/patches/1011-tc-Add-support-for-the-matchall-traffic-classifier.patch b/debian/patches/1011-tc-Add-support-for-the-matchall-traffic-classifier.patch
17new file mode 100644
18index 0000000..7c2fef2
19--- /dev/null
20+++ b/debian/patches/1011-tc-Add-support-for-the-matchall-traffic-classifier.patch
21@@ -0,0 +1,230 @@
22+Origin: upstream, https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=d5cbf3ff0561b6c8158c3538c7fe1946add9dec3
23+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1642514
24+From: Yotam Gigi <yotamg@mellanox.com>
25+Date: Wed, 31 Aug 2016 09:28:26 +0200
26+Subject: [PATCH] tc: Add support for the matchall traffic classifier.
27+
28+The matchall classifier matches every packet and allows the user to apply
29+actions on it. In addition, it supports the skip_sw and skip_hw (as can
30+be found on u32 and flower filter) that direct the kernel to skip the
31+software/hardware processing of the actions.
32+
33+This filter is very useful in usecases where every packet should be
34+matched. For example, packet mirroring (SPAN) can be setup very easily
35+using that filter.
36+
37+Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
38+Signed-off-by: Jiri Pirko <jiri@mellanox.com>
39+
40+(backported from commit d5cbf3ff0561b6c8158c3538c7fe1946add9dec3 iproute2)
41+[smb: Add kernel definitions and merged printing skip flags]
42+Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
43+---
44+ tc/Makefile | 1 +
45+ tc/f_matchall.c | 143 ++++++++++++++++++++++++++++++++++++++++++++++++
46+ 2 files changed, 144 insertions(+)
47+ create mode 100644 tc/f_matchall.c
48+
49+Index: iproute2/tc/Makefile
50+===================================================================
51+--- iproute2.orig/tc/Makefile
52++++ iproute2/tc/Makefile
53+@@ -65,6 +65,7 @@ TCMODULES += q_fq.o
54+ TCMODULES += q_pie.o
55+ TCMODULES += q_hhf.o
56+ TCMODULES += e_bpf.o
57++TCMODULES += f_matchall.o
58+
59+ ifeq ($(TC_CONFIG_IPSET), y)
60+ ifeq ($(TC_CONFIG_XT), y)
61+Index: iproute2/tc/f_matchall.c
62+===================================================================
63+--- /dev/null
64++++ iproute2/tc/f_matchall.c
65+@@ -0,0 +1,152 @@
66++/*
67++ * f_matchall.c Match-all Classifier
68++ *
69++ * This program is free software; you can distribute it and/or
70++ * modify it under the terms of the GNU General Public License
71++ * as published by the Free Software Foundation; either version
72++ * 2 of the License, or (at your option) any later version.
73++ *
74++ * Authors: Jiri Pirko <jiri@mellanox.com>, Yotam Gigi <yotamg@mellanox.com>
75++ *
76++ */
77++
78++#include <stdio.h>
79++#include <stdlib.h>
80++#include <unistd.h>
81++#include <syslog.h>
82++#include <fcntl.h>
83++#include <sys/socket.h>
84++#include <netinet/in.h>
85++#include <arpa/inet.h>
86++#include <string.h>
87++#include <linux/if.h>
88++
89++#include "utils.h"
90++#include "tc_util.h"
91++
92++static void explain(void)
93++{
94++ fprintf(stderr, "Usage: ... matchall [skip_sw | skip_hw]\n");
95++ fprintf(stderr, " [ action ACTION_SPEC ] [ classid CLASSID ]\n");
96++ fprintf(stderr, "\n");
97++ fprintf(stderr, "Where: SELECTOR := SAMPLE SAMPLE ...\n");
98++ fprintf(stderr, " FILTERID := X:Y:Z\n");
99++ fprintf(stderr, " ACTION_SPEC := ... look at individual actions\n");
100++ fprintf(stderr, "\nNOTE: CLASSID is parsed as hexadecimal input.\n");
101++}
102++
103++static int matchall_parse_opt(struct filter_util *qu, char *handle,
104++ int argc, char **argv, struct nlmsghdr *n)
105++{
106++ struct tcmsg *t = NLMSG_DATA(n);
107++ struct rtattr *tail;
108++ __u32 flags = 0;
109++ long h = 0;
110++
111++ if (handle) {
112++ h = strtol(handle, NULL, 0);
113++ if (h == LONG_MIN || h == LONG_MAX) {
114++ fprintf(stderr, "Illegal handle \"%s\", must be numeric.\n",
115++ handle);
116++ return -1;
117++ }
118++ }
119++ t->tcm_handle = h;
120++
121++ if (argc == 0)
122++ return 0;
123++
124++ tail = (struct rtattr *)(((void *)n)+NLMSG_ALIGN(n->nlmsg_len));
125++ addattr_l(n, MAX_MSG, TCA_OPTIONS, NULL, 0);
126++
127++ while (argc > 0) {
128++ if (matches(*argv, "classid") == 0 ||
129++ strcmp(*argv, "flowid") == 0) {
130++ unsigned int handle;
131++
132++ NEXT_ARG();
133++ if (get_tc_classid(&handle, *argv)) {
134++ fprintf(stderr, "Illegal \"classid\"\n");
135++ return -1;
136++ }
137++ addattr_l(n, MAX_MSG, TCA_MATCHALL_CLASSID, &handle, 4);
138++ } else if (matches(*argv, "action") == 0) {
139++ NEXT_ARG();
140++ if (parse_action(&argc, &argv, TCA_MATCHALL_ACT, n)) {
141++ fprintf(stderr, "Illegal \"action\"\n");
142++ return -1;
143++ }
144++ continue;
145++
146++ } else if (strcmp(*argv, "skip_hw") == 0) {
147++ NEXT_ARG();
148++ flags |= TCA_CLS_FLAGS_SKIP_HW;
149++ continue;
150++ } else if (strcmp(*argv, "skip_sw") == 0) {
151++ NEXT_ARG();
152++ flags |= TCA_CLS_FLAGS_SKIP_SW;
153++ continue;
154++ } else if (strcmp(*argv, "help") == 0) {
155++ explain();
156++ return -1;
157++ } else {
158++ fprintf(stderr, "What is \"%s\"?\n", *argv);
159++ explain();
160++ return -1;
161++ }
162++ argc--; argv++;
163++ }
164++
165++ if (flags) {
166++ if (!(flags ^ (TCA_CLS_FLAGS_SKIP_HW |
167++ TCA_CLS_FLAGS_SKIP_SW))) {
168++ fprintf(stderr,
169++ "skip_hw and skip_sw are mutually exclusive\n");
170++ return -1;
171++ }
172++ addattr_l(n, MAX_MSG, TCA_MATCHALL_FLAGS, &flags, 4);
173++ }
174++
175++ tail->rta_len = (((void *)n)+n->nlmsg_len) - (void *)tail;
176++ return 0;
177++}
178++
179++static int matchall_print_opt(struct filter_util *qu, FILE *f,
180++ struct rtattr *opt, __u32 handle)
181++{
182++ struct rtattr *tb[TCA_MATCHALL_MAX+1];
183++
184++ if (opt == NULL)
185++ return 0;
186++
187++ parse_rtattr_nested(tb, TCA_MATCHALL_MAX, opt);
188++
189++ if (handle)
190++ fprintf(f, "handle 0x%x ", handle);
191++
192++ if (tb[TCA_MATCHALL_CLASSID]) {
193++ SPRINT_BUF(b1);
194++ fprintf(f, "flowid %s ",
195++ sprint_tc_classid(rta_getattr_u32(tb[TCA_MATCHALL_CLASSID]), b1));
196++ }
197++
198++ if (tb[TCA_MATCHALL_FLAGS]) {
199++ __u32 flags = rta_getattr_u32(tb[TCA_MATCHALL_FLAGS]);
200++
201++ if (flags & TCA_CLS_FLAGS_SKIP_HW)
202++ fprintf(f, "\n skip_hw");
203++ if (flags & TCA_CLS_FLAGS_SKIP_SW)
204++ fprintf(f, "\n skip_sw");
205++ }
206++
207++ if (tb[TCA_MATCHALL_ACT])
208++ tc_print_action(f, tb[TCA_MATCHALL_ACT]);
209++
210++ return 0;
211++}
212++
213++struct filter_util matchall_filter_util = {
214++ .id = "matchall",
215++ .parse_fopt = matchall_parse_opt,
216++ .print_fopt = matchall_print_opt,
217++};
218+Index: iproute2/include/linux/pkt_cls.h
219+===================================================================
220+--- iproute2.orig/include/linux/pkt_cls.h
221++++ iproute2/include/linux/pkt_cls.h
222+@@ -95,6 +95,10 @@ enum {
223+
224+ #define TCA_POLICE_MAX (__TCA_POLICE_MAX - 1)
225+
226++/* tca flags definitions */
227++#define TCA_CLS_FLAGS_SKIP_HW (1 << 0) /* don't offload filter to HW */
228++#define TCA_CLS_FLAGS_SKIP_SW (1 << 1) /* don't use filter in SW */
229++
230+ /* U32 filters */
231+
232+ #define TC_U32_HTID(h) ((h)&0xFFF00000)
233+@@ -363,6 +367,18 @@ enum {
234+
235+ #define TCA_FLOWER_MAX (__TCA_FLOWER_MAX - 1)
236+
237++/* Match-all classifier */
238++
239++enum {
240++ TCA_MATCHALL_UNSPEC,
241++ TCA_MATCHALL_CLASSID,
242++ TCA_MATCHALL_ACT,
243++ TCA_MATCHALL_FLAGS,
244++ __TCA_MATCHALL_MAX,
245++};
246++
247++#define TCA_MATCHALL_MAX (__TCA_MATCHALL_MAX - 1)
248++
249+ /* Extended Matches */
250+
251+ struct tcf_ematch_tree_hdr {
252diff --git a/debian/patches/series b/debian/patches/series
253index 09a3842..d65e150 100644
254--- a/debian/patches/series
255+++ b/debian/patches/series
256@@ -12,3 +12,4 @@
257 1008-vf_trust_dddf1b44126e.patch
258 1009-vf_trust_b6d77d9ee312.patch
259 1010-vf_trust_fe9322781e63.patch
260+1011-tc-Add-support-for-the-matchall-traffic-classifier.patch

Subscribers

People subscribed via source and target branches