netfilter: SYNPROXY: Return NF_STOLEN instead of NF_DROP during handshaking
Subsystems (2)
PATCH 1/1 netfilter: SYNPROXY: Return NF_STOLEN instead of NF_DROP during handshaking
From: Gao Feng <[email protected]>
Current SYNPROXY codes return NF_DROP during normal TCP handshaking, it is not friendly to caller. Because the nf_hook_slow would treat the NF_DROP as an error, and return -EPERM.
As a result, it may cause the top caller think it meets one error.
So use NF_STOLEN instead of NF_DROP now because there is no error happened indeed, and free the skb directly.
Signed-off-by Gao Feng <[email protected]>
--- net/ipv4/netfilter/ipt_SYNPROXY.c | 7 ++++--- net/ipv6/netfilter/ip6t_SYNPROXY.c | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-)
net/ipv4/netfilter/ipt_SYNPROXY.c +4 -3
@@ -293,12 +293,13 @@ XT_SYNPROXY_OPT_ECN);synproxy_send_client_synack (net, skb, th, &opts); -return NF_DROP ; - +consume_skb (skb); +return NF_STOLEN ; }else if (th->ack && !(th->fin || th->rst || th->syn)) {/* ACK from client */ synproxy_recv_client_ack (net, skb, th, &opts,ntohl (th->seq)); -return NF_DROP ; +consume_skb (skb); +return NF_STOLEN ; }return XT_CONTINUE ;
net/ipv6/netfilter/ip6t_SYNPROXY.c +4 -2
@@ -307,12 +307,14 @@ XT_SYNPROXY_OPT_ECN);synproxy_send_client_synack (net, skb, th, &opts); -return NF_DROP ; +consume_skb (skb); +return NF_STOLEN ; }else if (th->ack && !(th->fin || th->rst || th->syn)) {/* ACK from client */ synproxy_recv_client_ack (net, skb, th, &opts,ntohl (th->seq)); -return NF_DROP ; +consume_skb (skb); +return NF_STOLEN ; }return XT_CONTINUE ;
Signature · 1 line
1.9.1