netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: sctp: probe: allow more advanced ingress filtering by mark
@ 2013-08-29 16:54 Daniel Borkmann
  2013-08-30 11:36 ` Neil Horman
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Borkmann @ 2013-08-29 16:54 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-sctp

This is a follow-up commit for commit b1dcdc68b1f4 ("net: tcp_probe:
allow more advanced ingress filtering by mark") that allows for
advanced SCTP probe module filtering based on skb mark (for a more
detailed description and advantages using mark, refer to b1dcdc68b1f4).
The current option to filter by a given port is still being preserved.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
---
 Tested with various marked flows.

 net/sctp/probe.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/net/sctp/probe.c b/net/sctp/probe.c
index cd72ae5..0118178 100644
--- a/net/sctp/probe.c
+++ b/net/sctp/probe.c
@@ -46,6 +46,10 @@ static int port __read_mostly = 0;
 MODULE_PARM_DESC(port, "Port to match (0=all)");
 module_param(port, int, 0);
 
+static unsigned int fwmark __read_mostly = 0;
+MODULE_PARM_DESC(fwmark, "skb mark to match (0=no mark)");
+module_param(fwmark, uint, 0);
+
 static int bufsize __read_mostly = 64 * 1024;
 MODULE_PARM_DESC(bufsize, "Log buffer size (default 64k)");
 module_param(bufsize, int, 0);
@@ -129,15 +133,19 @@ static sctp_disposition_t jsctp_sf_eat_sack(struct net *net,
 					    void *arg,
 					    sctp_cmd_seq_t *commands)
 {
+	struct sctp_chunk *chunk = arg;
+	struct sk_buff *skb = chunk->skb;
 	struct sctp_transport *sp;
 	static __u32 lcwnd = 0;
 	struct timespec now;
 
 	sp = asoc->peer.primary_path;
 
-	if ((full || sp->cwnd != lcwnd) &&
-	    (!port || asoc->peer.port == port ||
-	     ep->base.bind_addr.port == port)) {
+	if (((port == 0 && fwmark == 0) ||
+	     asoc->peer.port == port ||
+	     ep->base.bind_addr.port == port ||
+	     (fwmark > 0 && skb->mark == fwmark)) &&
+	    (full || sp->cwnd != lcwnd)) {
 		lcwnd = sp->cwnd;
 
 		getnstimeofday(&now);
@@ -198,8 +206,8 @@ static __init int sctpprobe_init(void)
 	if (ret)
 		goto remove_proc;
 
-	pr_info("probe registered (port=%d)\n", port);
-
+	pr_info("probe registered (port=%d/fwmark=%u) bufsize=%u\n",
+		port, fwmark, bufsize);
 	return 0;
 
 remove_proc:
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: sctp: probe: allow more advanced ingress filtering by mark
  2013-08-29 16:54 [PATCH net-next] net: sctp: probe: allow more advanced ingress filtering by mark Daniel Borkmann
@ 2013-08-30 11:36 ` Neil Horman
  2013-09-04  1:44   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Neil Horman @ 2013-08-30 11:36 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: davem, netdev, linux-sctp

On Thu, Aug 29, 2013 at 06:54:49PM +0200, Daniel Borkmann wrote:
> This is a follow-up commit for commit b1dcdc68b1f4 ("net: tcp_probe:
> allow more advanced ingress filtering by mark") that allows for
> advanced SCTP probe module filtering based on skb mark (for a more
> detailed description and advantages using mark, refer to b1dcdc68b1f4).
> The current option to filter by a given port is still being preserved.
> 
> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: sctp: probe: allow more advanced ingress filtering by mark
  2013-08-30 11:36 ` Neil Horman
@ 2013-09-04  1:44   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2013-09-04  1:44 UTC (permalink / raw)
  To: nhorman; +Cc: dborkman, netdev, linux-sctp

From: Neil Horman <nhorman@tuxdriver.com>
Date: Fri, 30 Aug 2013 07:36:30 -0400

> On Thu, Aug 29, 2013 at 06:54:49PM +0200, Daniel Borkmann wrote:
>> This is a follow-up commit for commit b1dcdc68b1f4 ("net: tcp_probe:
>> allow more advanced ingress filtering by mark") that allows for
>> advanced SCTP probe module filtering based on skb mark (for a more
>> detailed description and advantages using mark, refer to b1dcdc68b1f4).
>> The current option to filter by a given port is still being preserved.
>> 
>> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
> Acked-by: Neil Horman <nhorman@tuxdriver.com>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-09-04  1:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-29 16:54 [PATCH net-next] net: sctp: probe: allow more advanced ingress filtering by mark Daniel Borkmann
2013-08-30 11:36 ` Neil Horman
2013-09-04  1:44   ` David Miller

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).