All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roopa Prabhu <roopa@cumulusnetworks.com>
To: davem@davemloft.net, netdev@vger.kernel.org
Cc: dsa@cumulusnetworks.com, nikolay@cumulusnetworks.com,
	idosch@mellanox.com, pabeni@redhat.com
Subject: [PATCH net-next v2 2/5] ipv4: fib_rules: support match on sport, dport and ip proto
Date: Tue, 27 Feb 2018 19:52:42 -0800	[thread overview]
Message-ID: <1519789965-3465-3-git-send-email-roopa@cumulusnetworks.com> (raw)
In-Reply-To: <1519789965-3465-1-git-send-email-roopa@cumulusnetworks.com>

From: Roopa Prabhu <roopa@cumulusnetworks.com>

support to match on src port, dst port and ip protocol.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
 net/ipv4/fib_rules.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index 35d646a..16083b8 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -182,6 +182,17 @@ static int fib4_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
 	if (r->tos && (r->tos != fl4->flowi4_tos))
 		return 0;
 
+	if (rule->ip_proto && (rule->ip_proto != fl4->flowi4_proto))
+		return 0;
+
+	if (fib_rule_port_range_set(&rule->sport_range) &&
+	    !fib_rule_port_inrange(&rule->sport_range, fl4->fl4_sport))
+		return 0;
+
+	if (fib_rule_port_range_set(&rule->dport_range) &&
+	    !fib_rule_port_inrange(&rule->dport_range, fl4->fl4_dport))
+		return 0;
+
 	return 1;
 }
 
-- 
2.1.4

  parent reply	other threads:[~2018-02-28  3:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-28  3:52 [PATCH net-next v2 0/5] fib_rules: support sport, dport and proto match Roopa Prabhu
2018-02-28  3:52 ` [PATCH net-next v2 1/5] net: fib_rules: support for match on ip_proto, sport and dport Roopa Prabhu
2018-02-28 13:08   ` Nikolay Aleksandrov
2018-03-01 22:48   ` Eric Dumazet
2018-03-01 23:08     ` Roopa Prabhu
2018-02-28  3:52 ` Roopa Prabhu [this message]
2018-02-28 13:09   ` [PATCH net-next v2 2/5] ipv4: fib_rules: support match on sport, dport and ip proto Nikolay Aleksandrov
2018-02-28  3:52 ` [PATCH net-next v2 3/5] ipv6: fib6_rules: support for " Roopa Prabhu
2018-02-28 13:10   ` Nikolay Aleksandrov
2018-02-28  3:52 ` [PATCH net-next v2 4/5] ipv4: route: dissect flow in input path if fib rules need it Roopa Prabhu
2018-02-28  9:59   ` Paolo Abeni
2018-02-28 13:13   ` Nikolay Aleksandrov
2018-02-28  3:52 ` [PATCH net-next v2 5/5] ipv6: " Roopa Prabhu
2018-02-28 10:05   ` Paolo Abeni
2018-02-28 13:20   ` Nikolay Aleksandrov
2018-02-28 16:59 ` [PATCH net-next v2 0/5] fib_rules: support sport, dport and proto match David Miller
2018-02-28 18:11   ` David Ahern
2018-02-28 19:30     ` David Miller

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=1519789965-3465-3-git-send-email-roopa@cumulusnetworks.com \
    --to=roopa@cumulusnetworks.com \
    --cc=davem@davemloft.net \
    --cc=dsa@cumulusnetworks.com \
    --cc=idosch@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@cumulusnetworks.com \
    --cc=pabeni@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.