Skip to content

Commit 48f8e0a

Browse files
committed
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next
Pablo Neira Ayuso says: ==================== The following batch contains: * Three fixes for the new synproxy target available in your net-next tree, from Jesper D. Brouer and Patrick McHardy. * One fix for TCPMSS to correctly handling the fragmentation case, from Phil Oester. I'll pass this one to -stable. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents c995ae2 + 1205e1f commit 48f8e0a

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

net/ipv4/netfilter/ipt_SYNPROXY.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ synproxy_tg4(struct sk_buff *skb, const struct xt_action_param *par)
269269

270270
synproxy_parse_options(skb, par->thoff, th, &opts);
271271

272-
if (th->syn && !th->ack) {
272+
if (th->syn && !(th->ack || th->fin || th->rst)) {
273273
/* Initial SYN from client */
274274
this_cpu_inc(snet->stats->syn_received);
275275

@@ -285,11 +285,15 @@ synproxy_tg4(struct sk_buff *skb, const struct xt_action_param *par)
285285
XT_SYNPROXY_OPT_ECN);
286286

287287
synproxy_send_client_synack(skb, th, &opts);
288-
} else if (th->ack && !(th->fin || th->rst))
288+
return NF_DROP;
289+
290+
} else if (th->ack && !(th->fin || th->rst || th->syn)) {
289291
/* ACK from client */
290292
synproxy_recv_client_ack(snet, skb, th, &opts, ntohl(th->seq));
293+
return NF_DROP;
294+
}
291295

292-
return NF_DROP;
296+
return XT_CONTINUE;
293297
}
294298

295299
static unsigned int ipv4_synproxy_hook(unsigned int hooknum,

net/ipv6/netfilter/ip6t_SYNPROXY.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ synproxy_tg6(struct sk_buff *skb, const struct xt_action_param *par)
284284

285285
synproxy_parse_options(skb, par->thoff, th, &opts);
286286

287-
if (th->syn) {
287+
if (th->syn && !(th->ack || th->fin || th->rst)) {
288288
/* Initial SYN from client */
289289
this_cpu_inc(snet->stats->syn_received);
290290

@@ -300,11 +300,15 @@ synproxy_tg6(struct sk_buff *skb, const struct xt_action_param *par)
300300
XT_SYNPROXY_OPT_ECN);
301301

302302
synproxy_send_client_synack(skb, th, &opts);
303-
} else if (th->ack && !(th->fin || th->rst))
303+
return NF_DROP;
304+
305+
} else if (th->ack && !(th->fin || th->rst || th->syn)) {
304306
/* ACK from client */
305307
synproxy_recv_client_ack(snet, skb, th, &opts, ntohl(th->seq));
308+
return NF_DROP;
309+
}
306310

307-
return NF_DROP;
311+
return XT_CONTINUE;
308312
}
309313

310314
static unsigned int ipv6_synproxy_hook(unsigned int hooknum,

net/netfilter/nf_synproxy_core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,12 +356,12 @@ static int __net_init synproxy_net_init(struct net *net)
356356
goto err1;
357357
}
358358

359-
__set_bit(IPS_TEMPLATE_BIT, &ct->status);
360-
__set_bit(IPS_CONFIRMED_BIT, &ct->status);
361359
if (!nfct_seqadj_ext_add(ct))
362360
goto err2;
363361
if (!nfct_synproxy_ext_add(ct))
364362
goto err2;
363+
__set_bit(IPS_TEMPLATE_BIT, &ct->status);
364+
__set_bit(IPS_CONFIRMED_BIT, &ct->status);
365365

366366
snet->tmpl = ct;
367367

net/netfilter/xt_TCPMSS.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ tcpmss_mangle_packet(struct sk_buff *skb,
6060

6161
/* This is a fragment, no TCP header is available */
6262
if (par->fragoff != 0)
63-
return XT_CONTINUE;
63+
return 0;
6464

6565
if (!skb_make_writable(skb, skb->len))
6666
return -1;

0 commit comments

Comments
 (0)