From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, fw@strlen.de,
nikolay@cumulusnetworks.com, roopa@cumulusnetworks.com,
herbert@gondor.apana.org.au
Subject: [PATCH net-next 05/10] net: ipv4: place cb handling away from fraglist iterator
Date: Mon, 15 Apr 2019 23:36:06 +0200 [thread overview]
Message-ID: <20190415213611.21863-6-pablo@netfilter.org> (raw)
In-Reply-To: <20190415213611.21863-1-pablo@netfilter.org>
Deal with the IPCB() area away from the fraglist iterator.
The bridge codebase has its own control buffer layout, move specific
IP control buffer into function.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/ipv4/ip_output.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 23cdeb2d004a..bf02c7d37acd 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -523,9 +523,6 @@ static void ip_copy_metadata(struct sk_buff *to, struct sk_buff *from)
skb_copy_hash(to, from);
- /* Copy the flags to each fragment. */
- IPCB(to)->flags = IPCB(from)->flags;
-
#ifdef CONFIG_NET_SCHED
to->tc_index = from->tc_index;
#endif
@@ -580,6 +577,18 @@ void ip_fraglist_init(struct sk_buff *skb, struct iphdr *iph,
}
EXPORT_SYMBOL(ip_fraglist_init);
+static void ip_fraglist_ipcb_prepare(struct sk_buff *skb,
+ struct ip_fraglist_iter *iter)
+{
+ struct sk_buff *to = iter->frag;
+
+ /* Copy the flags to each fragment. */
+ IPCB(to)->flags = IPCB(skb)->flags;
+
+ if (iter->offset == 0)
+ ip_options_fragment(to);
+}
+
void ip_fraglist_prepare(struct sk_buff *skb, struct ip_fraglist_iter *iter)
{
unsigned int hlen = iter->hlen;
@@ -596,8 +605,6 @@ void ip_fraglist_prepare(struct sk_buff *skb, struct ip_fraglist_iter *iter)
iph = iter->iph;
iph->tot_len = htons(frag->len);
ip_copy_metadata(frag, skb);
- if (iter->offset == 0)
- ip_options_fragment(frag);
iter->offset += skb->len - hlen;
iph->frag_off = htons(iter->offset >> 3);
if (frag->next)
@@ -797,8 +804,10 @@ int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
for (;;) {
/* Prepare header of the next frame,
* before previous one went down. */
- if (iter.frag)
+ if (iter.frag) {
+ ip_fraglist_ipcb_prepare(skb, &iter);
ip_fraglist_prepare(skb, &iter);
+ }
err = output(net, sk, skb);
--
2.11.0
next prev parent reply other threads:[~2019-04-15 21:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-15 21:36 [PATCH net-next 00/10] connection tracking support for bridge Pablo Neira Ayuso
2019-04-15 21:36 ` [PATCH net-next 01/10] net: ipv4: add skbuff fraglist split iterator Pablo Neira Ayuso
2019-04-15 21:36 ` [PATCH net-next 02/10] net: ipv6: " Pablo Neira Ayuso
2019-04-15 21:36 ` [PATCH net-next 03/10] net: ipv4: split skbuff into fragments transformer Pablo Neira Ayuso
2019-04-15 21:36 ` [PATCH net-next 04/10] net: ipv6: " Pablo Neira Ayuso
2019-04-17 4:27 ` David Miller
2019-04-15 21:36 ` Pablo Neira Ayuso [this message]
2019-04-15 21:36 ` [PATCH net-next 06/10] net: ipv4: place cb handling away from fragment transformer Pablo Neira Ayuso
2019-04-15 21:36 ` [PATCH net-next 07/10] netfilter: nf_conntrack: allow to register bridge support Pablo Neira Ayuso
2019-04-15 21:36 ` [PATCH net-next 08/10] netfilter: bridge: add support for conntrack support Pablo Neira Ayuso
2019-04-16 16:43 ` Nikolay Aleksandrov
2019-04-15 21:36 ` [PATCH net-next 09/10] netfilter: nf_conntrack_bridge: add support for IPv6 Pablo Neira Ayuso
2019-04-15 21:36 ` [PATCH net-next 10/10] netfilter: nf_conntrack_bridge: register inet conntrack for bridge Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190415213611.21863-6-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=davem@davemloft.net \
--cc=fw@strlen.de \
--cc=herbert@gondor.apana.org.au \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=nikolay@cumulusnetworks.com \
--cc=roopa@cumulusnetworks.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).