* [nf-next PATCH] netfilter: Extend SYNPROXY with a --continue option
@ 2013-08-28 15:26 Jesper Dangaard Brouer
2013-08-28 16:00 ` Patrick McHardy
0 siblings, 1 reply; 3+ messages in thread
From: Jesper Dangaard Brouer @ 2013-08-28 15:26 UTC (permalink / raw)
To: Pablo Neira Ayuso, Patrick McHardy
Cc: netfilter-devel, netdev, mph, as, Jesper Dangaard Brouer
Packets reaching SYNPROXY are default dropped, as they are most likely
invalid (given the state matching). In other configurations it might
be beneficial to let packet not consumed by SYNPROXY (SYN and ACK) to
continue being processed by the stack.
Introducing a --continue option/flag for the SYNPROXY target to allow
these unmatched packets to continue being processed. This would also
help in debugging the module via LOG.
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
---
Comment:
This patch depend on the one send earlier, and I also have the
userspace iptables part ready, if this patch is received positively
include/uapi/linux/netfilter/xt_SYNPROXY.h | 1 +
net/ipv4/netfilter/ipt_SYNPROXY.c | 9 ++++++++-
net/ipv6/netfilter/ip6t_SYNPROXY.c | 9 ++++++++-
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/include/uapi/linux/netfilter/xt_SYNPROXY.h b/include/uapi/linux/netfilter/xt_SYNPROXY.h
index 2d59fba..6b788bc 100644
--- a/include/uapi/linux/netfilter/xt_SYNPROXY.h
+++ b/include/uapi/linux/netfilter/xt_SYNPROXY.h
@@ -6,6 +6,7 @@
#define XT_SYNPROXY_OPT_SACK_PERM 0x04
#define XT_SYNPROXY_OPT_TIMESTAMP 0x08
#define XT_SYNPROXY_OPT_ECN 0x10
+#define XT_SYNPROXY_OPT_CONTINUE 0x20
struct xt_synproxy_info {
__u8 options;
diff --git a/net/ipv4/netfilter/ipt_SYNPROXY.c b/net/ipv4/netfilter/ipt_SYNPROXY.c
index 90e489e..3a09759 100644
--- a/net/ipv4/netfilter/ipt_SYNPROXY.c
+++ b/net/ipv4/netfilter/ipt_SYNPROXY.c
@@ -285,9 +285,16 @@ synproxy_tg4(struct sk_buff *skb, const struct xt_action_param *par)
XT_SYNPROXY_OPT_ECN);
synproxy_send_client_synack(skb, th, &opts);
- } else if (th->ack && !(th->fin || th->rst || th->syn))
+ return NF_DROP;
+
+ } else if (th->ack && !(th->fin || th->rst || th->syn)) {
/* ACK from client */
synproxy_recv_client_ack(snet, skb, th, &opts, ntohl(th->seq));
+ return NF_DROP;
+ }
+
+ if (info->options & XT_SYNPROXY_OPT_CONTINUE)
+ return XT_CONTINUE;
return NF_DROP;
}
diff --git a/net/ipv6/netfilter/ip6t_SYNPROXY.c b/net/ipv6/netfilter/ip6t_SYNPROXY.c
index a5af0bf..02f41fa 100644
--- a/net/ipv6/netfilter/ip6t_SYNPROXY.c
+++ b/net/ipv6/netfilter/ip6t_SYNPROXY.c
@@ -300,9 +300,16 @@ synproxy_tg6(struct sk_buff *skb, const struct xt_action_param *par)
XT_SYNPROXY_OPT_ECN);
synproxy_send_client_synack(skb, th, &opts);
- } else if (th->ack && !(th->fin || th->rst || th->syn))
+ return NF_DROP;
+
+ } else if (th->ack && !(th->fin || th->rst || th->syn)) {
/* ACK from client */
synproxy_recv_client_ack(snet, skb, th, &opts, ntohl(th->seq));
+ return NF_DROP;
+ }
+
+ if (info->options & XT_SYNPROXY_OPT_CONTINUE)
+ return XT_CONTINUE;
return NF_DROP;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [nf-next PATCH] netfilter: Extend SYNPROXY with a --continue option
2013-08-28 15:26 [nf-next PATCH] netfilter: Extend SYNPROXY with a --continue option Jesper Dangaard Brouer
@ 2013-08-28 16:00 ` Patrick McHardy
2013-08-29 8:23 ` Jesper Dangaard Brouer
0 siblings, 1 reply; 3+ messages in thread
From: Patrick McHardy @ 2013-08-28 16:00 UTC (permalink / raw)
To: Jesper Dangaard Brouer
Cc: Pablo Neira Ayuso, netfilter-devel, netdev, mph, as
On Wed, Aug 28, 2013 at 05:26:55PM +0200, Jesper Dangaard Brouer wrote:
> Packets reaching SYNPROXY are default dropped, as they are most likely
> invalid (given the state matching). In other configurations it might
> be beneficial to let packet not consumed by SYNPROXY (SYN and ACK) to
> continue being processed by the stack.
>
> Introducing a --continue option/flag for the SYNPROXY target to allow
> these unmatched packets to continue being processed. This would also
> help in debugging the module via LOG.
I don't think we should add an option for this. Just DROP packets consumed
by the target and have the other ones continue.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [nf-next PATCH] netfilter: Extend SYNPROXY with a --continue option
2013-08-28 16:00 ` Patrick McHardy
@ 2013-08-29 8:23 ` Jesper Dangaard Brouer
0 siblings, 0 replies; 3+ messages in thread
From: Jesper Dangaard Brouer @ 2013-08-29 8:23 UTC (permalink / raw)
To: Patrick McHardy; +Cc: Pablo Neira Ayuso, netfilter-devel, netdev, mph, as
On Wed, 28 Aug 2013 18:00:42 +0200
Patrick McHardy <kaber@trash.net> wrote:
> On Wed, Aug 28, 2013 at 05:26:55PM +0200, Jesper Dangaard Brouer wrote:
> > Packets reaching SYNPROXY are default dropped, as they are most likely
> > invalid (given the state matching). In other configurations it might
> > be beneficial to let packet not consumed by SYNPROXY (SYN and ACK) to
> > continue being processed by the stack.
> >
> > Introducing a --continue option/flag for the SYNPROXY target to allow
> > these unmatched packets to continue being processed. This would also
> > help in debugging the module via LOG.
>
> I don't think we should add an option for this. Just DROP packets consumed
> by the target and have the other ones continue.
I agree. I'll send a new patch, defaulting to XT_CONTINUE.
Self:
Nacked-by: Jesper Dangaard Brouer <brouer@redhat.com>
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Sr. Network Kernel Developer at Red Hat
Author of http://www.iptv-analyzer.org
LinkedIn: http://www.linkedin.com/in/brouer
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-08-29 8:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-28 15:26 [nf-next PATCH] netfilter: Extend SYNPROXY with a --continue option Jesper Dangaard Brouer
2013-08-28 16:00 ` Patrick McHardy
2013-08-29 8:23 ` Jesper Dangaard Brouer
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).