Netfilter SYNPROXY mss and wscale bugfix
Subsystems (3)
cover Netfilter SYNPROXY mss and wscale bugfix
The following series fixes two bugs we have discovered in the netfilter module SYNPROXY.
The first is related to the mss option not getting transferred to the backend servers.
And the second it related to passing of the windows scaling option.
Martin Topholm (2):
netfilter: synproxy: send mss option to backend
netfilter: synproxy: correct wscale option passing
net/ipv4/netfilter/ipt_SYNPROXY.c | 1 + net/ipv6/netfilter/ip6t_SYNPROXY.c | 1 + net/netfilter/nf_synproxy_core.c | 7 ++++--- 3 files changed, 6 insertions(+), 3 deletions(-)
PATCH 1/2 netfilter: synproxy: send mss option to backend
When the synproxy_parse_options is called on the client ack the mss option will not be present. Consequently mss wont be included in the backend syn packet, which falls back to 536 bytes mss.
Therefore XT_SYNPROXY_OPT_MSS is explicitly flagged when recovering mss value from cookie.
--- net/ipv4/netfilter/ipt_SYNPROXY.c | 1 + net/ipv6/netfilter/ip6t_SYNPROXY.c | 1 + 2 files changed, 2 insertions(+)
net/ipv4/netfilter/ipt_SYNPROXY.c +1 -0
@@ -244,6 +244,7 @@ synproxy_recv_client_ack(const struct synproxy_net *snet,this_cpu_inc (snet->stats->cookie_valid); opts->mss = mss; + opts->options |=XT_SYNPROXY_OPT_MSS ;if (opts->options &XT_SYNPROXY_OPT_TIMESTAMP )synproxy_check_timestamp_cookie (opts);
net/ipv6/netfilter/ip6t_SYNPROXY.c +1 -0
@@ -259,6 +259,7 @@ synproxy_recv_client_ack(const struct synproxy_net *snet,this_cpu_inc (snet->stats->cookie_valid); opts->mss = mss; + opts->options |=XT_SYNPROXY_OPT_MSS ;if (opts->options &XT_SYNPROXY_OPT_TIMESTAMP )synproxy_check_timestamp_cookie (opts);
Re: [PATCH 1/2] netfilter: synproxy: send mss option to backend
Quoted 6 lines · Martin Topholm
When the
synproxy_parse_optionsis called on the client ack the mss option will not be present. Consequently mss wont be included in the backend syn packet, which falls back to 536 bytes mss.Therefore
XT_SYNPROXY_OPT_MSSis explicitly flagged when recovering mss value from cookie.
Applied, thanks Martin.
PATCH 2/2 netfilter: synproxy: correct wscale option passing
In reply to Martin TopholmTimestamp are used to store additional syncookie parameters such as sack, ecn, and wscale. The wscale value we need to encode is the client's wscale, since we can't recover that later in the session. Next overwrite the wscale option so the later synproxy_send_client_synack will send the backend's wscale to the client.
--- net/netfilter/nf_synproxy_core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/netfilter/nf_synproxy_core.c +4 -3
@@ -151,9 +151,10 @@ void synproxy_init_timestamp_cookie(const struct xt_synproxy_info *info, opts->tsecr = opts->tsval; opts->tsval = tcp_time_stamp & ~0x3f ; -if (opts->options &XT_SYNPROXY_OPT_WSCALE ) - opts->tsval |= info->wscale; -else +if (opts->options &XT_SYNPROXY_OPT_WSCALE ) { + opts->tsval |= opts->wscale; + opts->wscale = info->wscale; + }else opts->tsval |=0xf ;if (opts->options &XT_SYNPROXY_OPT_SACK_PERM )
Pablo Neira Ayuso
maintainerRe: [PATCH 2/2] netfilter: synproxy: correct wscale option passing
Quoted 5 lines · Martin Topholm
Timestamp are used to store additional syncookie parameters such as sack, ecn, and wscale. The wscale value we need to encode is the client's wscale, since we can't recover that later in the session. Next overwrite the wscale option so the later
synproxy_send_client_synackwill send the backend's wscale to the client.
Also applied, thanks.
Quoted 8 lines · On Thu, 14 Nov 2013 15:35:29 +0100 Martin Topholm <[email protected]> wrote:
The following series fixes two bugs we have discovered in the netfilter module SYNPROXY.
The first is related to the mss option not getting transferred to the backend servers.
And the second it related to passing of the windows scaling option.
Quoted 8 lines
Martin Topholm (2):
netfilter: synproxy: send mss option to backend
netfilter: synproxy: correct wscale option passingnet/ipv4/netfilter/ipt_SYNPROXY.c | 1 + net/ipv6/netfilter/ip6t_SYNPROXY.c | 1 + net/netfilter/nf_synproxy_core.c | 7 ++++--- 3 files changed, 6 insertions(+), 3 deletions(-)
ACK series
I have already reviewed the patches offlist with Martin and helped him on howto submit patches etc.. Nice work Martin :-)
Signature · 5 lines
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