Skip to content

Commit 594850c

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf
Pablo Neira Ayuso says: ==================== Netfilter fixes for net 1) Update debugging in IPVS tcp protocol handler to make it easier to understand, from longguang.yue 2) Update TCP tracker to deal with keepalive packet after re-registration, from Franceso Ruggeri. 3) Missing IP6SKB_FRAGMENTED from netfilter fragment reassembly, from Georg Kohmann. 4) Fix bogus packet drop in ebtables nat extensions, from Thimothee Cocault. 5) Fix typo in flowtable documentation. 6) Reset skb timestamp in nft_fwd_netdev. ==================== Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents d277598 + c77761c commit 594850c

12 files changed

Lines changed: 37 additions & 19 deletions

File tree

Documentation/networking/nf_flowtable.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ More reading
109109
This documentation is based on the LWN.net articles [1]_\ [2]_. Rafal Milecki
110110
also made a very complete and comprehensive summary called "A state of network
111111
acceleration" that describes how things were before this infrastructure was
112-
mailined [3]_ and it also makes a rough summary of this work [4]_.
112+
mainlined [3]_ and it also makes a rough summary of this work [4]_.
113113

114114
.. [1] https://lwn.net/Articles/738214/
115115
.. [2] https://lwn.net/Articles/742164/

include/net/netfilter/nf_tables.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,12 @@ static inline struct nft_expr *nft_expr_last(const struct nft_rule *rule)
891891
return (struct nft_expr *)&rule->data[rule->dlen];
892892
}
893893

894+
static inline bool nft_expr_more(const struct nft_rule *rule,
895+
const struct nft_expr *expr)
896+
{
897+
return expr != nft_expr_last(rule) && expr->ops;
898+
}
899+
894900
static inline struct nft_userdata *nft_userdata(const struct nft_rule *rule)
895901
{
896902
return (void *)&rule->data[rule->dlen];

net/bridge/netfilter/ebt_dnat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ ebt_dnat_tg(struct sk_buff *skb, const struct xt_action_param *par)
2121
{
2222
const struct ebt_nat_info *info = par->targinfo;
2323

24-
if (skb_ensure_writable(skb, ETH_ALEN))
24+
if (skb_ensure_writable(skb, 0))
2525
return EBT_DROP;
2626

2727
ether_addr_copy(eth_hdr(skb)->h_dest, info->mac);

net/bridge/netfilter/ebt_redirect.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ ebt_redirect_tg(struct sk_buff *skb, const struct xt_action_param *par)
2121
{
2222
const struct ebt_redirect_info *info = par->targinfo;
2323

24-
if (skb_ensure_writable(skb, ETH_ALEN))
24+
if (skb_ensure_writable(skb, 0))
2525
return EBT_DROP;
2626

2727
if (xt_hooknum(par) != NF_BR_BROUTING)

net/bridge/netfilter/ebt_snat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ ebt_snat_tg(struct sk_buff *skb, const struct xt_action_param *par)
2222
{
2323
const struct ebt_nat_info *info = par->targinfo;
2424

25-
if (skb_ensure_writable(skb, ETH_ALEN * 2))
25+
if (skb_ensure_writable(skb, 0))
2626
return EBT_DROP;
2727

2828
ether_addr_copy(eth_hdr(skb)->h_source, info->mac);

net/ipv6/netfilter/nf_conntrack_reasm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ static int nf_ct_frag6_reasm(struct frag_queue *fq, struct sk_buff *skb,
355355
ipv6_hdr(skb)->payload_len = htons(payload_len);
356356
ipv6_change_dsfield(ipv6_hdr(skb), 0xff, ecn);
357357
IP6CB(skb)->frag_max_size = sizeof(struct ipv6hdr) + fq->q.max_size;
358+
IP6CB(skb)->flags |= IP6SKB_FRAGMENTED;
358359

359360
/* Yes, and fold redundant checksum back. 8) */
360361
if (skb->ip_summed == CHECKSUM_COMPLETE)

net/netfilter/ipvs/ip_vs_proto_tcp.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -539,19 +539,21 @@ set_tcp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp,
539539
if (new_state != cp->state) {
540540
struct ip_vs_dest *dest = cp->dest;
541541

542-
IP_VS_DBG_BUF(8, "%s %s [%c%c%c%c] %s:%d->"
543-
"%s:%d state: %s->%s conn->refcnt:%d\n",
542+
IP_VS_DBG_BUF(8, "%s %s [%c%c%c%c] c:%s:%d v:%s:%d "
543+
"d:%s:%d state: %s->%s conn->refcnt:%d\n",
544544
pd->pp->name,
545545
((state_off == TCP_DIR_OUTPUT) ?
546546
"output " : "input "),
547547
th->syn ? 'S' : '.',
548548
th->fin ? 'F' : '.',
549549
th->ack ? 'A' : '.',
550550
th->rst ? 'R' : '.',
551-
IP_VS_DBG_ADDR(cp->daf, &cp->daddr),
552-
ntohs(cp->dport),
553551
IP_VS_DBG_ADDR(cp->af, &cp->caddr),
554552
ntohs(cp->cport),
553+
IP_VS_DBG_ADDR(cp->af, &cp->vaddr),
554+
ntohs(cp->vport),
555+
IP_VS_DBG_ADDR(cp->daf, &cp->daddr),
556+
ntohs(cp->dport),
555557
tcp_state_name(cp->state),
556558
tcp_state_name(new_state),
557559
refcount_read(&cp->refcnt));

net/netfilter/nf_conntrack_proto_tcp.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -541,13 +541,20 @@ static bool tcp_in_window(const struct nf_conn *ct,
541541
swin = win << sender->td_scale;
542542
sender->td_maxwin = (swin == 0 ? 1 : swin);
543543
sender->td_maxend = end + sender->td_maxwin;
544-
/*
545-
* We haven't seen traffic in the other direction yet
546-
* but we have to tweak window tracking to pass III
547-
* and IV until that happens.
548-
*/
549-
if (receiver->td_maxwin == 0)
544+
if (receiver->td_maxwin == 0) {
545+
/* We haven't seen traffic in the other
546+
* direction yet but we have to tweak window
547+
* tracking to pass III and IV until that
548+
* happens.
549+
*/
550550
receiver->td_end = receiver->td_maxend = sack;
551+
} else if (sack == receiver->td_end + 1) {
552+
/* Likely a reply to a keepalive.
553+
* Needed for III.
554+
*/
555+
receiver->td_end++;
556+
}
557+
551558
}
552559
} else if (((state->state == TCP_CONNTRACK_SYN_SENT
553560
&& dir == IP_CT_DIR_ORIGINAL)

net/netfilter/nf_dup_netdev.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ static void nf_do_netdev_egress(struct sk_buff *skb, struct net_device *dev)
1919
skb_push(skb, skb->mac_len);
2020

2121
skb->dev = dev;
22+
skb->tstamp = 0;
2223
dev_queue_xmit(skb);
2324
}
2425

net/netfilter/nf_tables_api.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ static void nft_rule_expr_activate(const struct nft_ctx *ctx,
302302
struct nft_expr *expr;
303303

304304
expr = nft_expr_first(rule);
305-
while (expr != nft_expr_last(rule) && expr->ops) {
305+
while (nft_expr_more(rule, expr)) {
306306
if (expr->ops->activate)
307307
expr->ops->activate(ctx, expr);
308308

@@ -317,7 +317,7 @@ static void nft_rule_expr_deactivate(const struct nft_ctx *ctx,
317317
struct nft_expr *expr;
318318

319319
expr = nft_expr_first(rule);
320-
while (expr != nft_expr_last(rule) && expr->ops) {
320+
while (nft_expr_more(rule, expr)) {
321321
if (expr->ops->deactivate)
322322
expr->ops->deactivate(ctx, expr, phase);
323323

@@ -3080,7 +3080,7 @@ static void nf_tables_rule_destroy(const struct nft_ctx *ctx,
30803080
* is called on error from nf_tables_newrule().
30813081
*/
30823082
expr = nft_expr_first(rule);
3083-
while (expr != nft_expr_last(rule) && expr->ops) {
3083+
while (nft_expr_more(rule, expr)) {
30843084
next = nft_expr_next(expr);
30853085
nf_tables_expr_destroy(ctx, expr);
30863086
expr = next;

0 commit comments

Comments
 (0)