From: Simon Horman <simon.horman@netronome.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: Jiri Pirko <jiri@resnulli.us>,
Jamal Hadi Salim <jhs@mojatatu.com>,
Cong Wang <xiyou.wangcong@gmail.com>,
netdev@vger.kernel.org, oss-drivers@netronome.com,
Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>,
Simon Horman <simon.horman@netronome.com>
Subject: [PATCH iproute2/net-next] tc: f_flower: Add support for matching first frag packets
Date: Fri, 9 Mar 2018 11:07:22 +0100 [thread overview]
Message-ID: <20180309100722.21627-1-simon.horman@netronome.com> (raw)
From: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>
Add matching support for distinguishing between first and later fragmented
packets.
# tc filter add dev eth0 protocol ip parent ffff: \
flower indev eth0 \
ip_flags firstfrag \
ip_proto udp \
action mirred egress redirect dev eth1
# tc filter add dev eth0 protocol ip parent ffff: \
flower indev eth0 \
ip_flags nofirstfrag \
ip_proto udp \
action mirred egress redirect dev eth1
Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
---
man/man8/tc-flower.8 | 8 ++++++--
tc/f_flower.c | 1 +
2 files changed, 7 insertions(+), 2 deletions(-)
This patch depends on updating pkt_cls.h to add
TCA_FLOWER_KEY_FLAGS_FRAG_IS_FIRST along side
TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT.
That change is present in the kernel net-next tree as of
459d153d9916 ("net/sched: cls_flower: Add support to handle first frag as match field")
diff --git a/man/man8/tc-flower.8 b/man/man8/tc-flower.8
index 768eda3d52bd..a561443b9978 100644
--- a/man/man8/tc-flower.8
+++ b/man/man8/tc-flower.8
@@ -258,8 +258,12 @@ is a 16 bit UDP dst port.
.BI ip_flags " IP_FLAGS"
.I IP_FLAGS
may be either
-.BR frag " or " nofrag
-to match on fragmented packets or not respectively.
+.BR frag ", " nofrag ", " firstfrag " or " nofirstfrag
+where frag and nofrag could be used to match on fragmented packets or not,
+respectively. firstfrag and nofirstfrag can be used to further distinguish
+fragmented packet. firstfrag can be used to indicate the first fragmented
+packet. nofirstfrag can be used to indicates subsequent fragmented packets
+or non-fragmented packets.
.SH NOTES
As stated above where applicable, matches of a certain layer implicitly depend
on the matches of the next lower layer. Precisely, layer one and two matches
diff --git a/tc/f_flower.c b/tc/f_flower.c
index 5a4ec832bc19..9d4bfd2f808b 100644
--- a/tc/f_flower.c
+++ b/tc/f_flower.c
@@ -155,6 +155,7 @@ struct flag_to_string {
static struct flag_to_string flags_str[] = {
{ TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT, FLOWER_IP_FLAGS, "frag" },
+ { TCA_FLOWER_KEY_FLAGS_FRAG_IS_FIRST, FLOWER_IP_FLAGS, "firstfrag" },
};
static int flower_parse_matching_flags(char *str,
--
2.11.0
next reply other threads:[~2018-03-09 10:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-09 10:07 Simon Horman [this message]
2018-03-14 1:05 ` [PATCH iproute2/net-next] tc: f_flower: Add support for matching first frag packets David Ahern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180309100722.21627-1-simon.horman@netronome.com \
--to=simon.horman@netronome.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
--cc=oss-drivers@netronome.com \
--cc=pieter.jansenvanvuuren@netronome.com \
--cc=stephen@networkplumber.org \
--cc=xiyou.wangcong@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).