From: Pablo Neira Ayuso <pablo@netfilter.org>
To: David Miller <davem@davemloft.net>
Cc: eyal.birger@gmail.com, jhs@mojatatu.com,
xiyou.wangcong@gmail.com, netdev@vger.kernel.org,
shmulik@metanetworks.com, eyal@metanetworks.com
Subject: Re: [PATCH net-next 2/2] net: sched: add em_ipt ematch for calling xtables matches
Date: Thu, 25 Jan 2018 01:00:07 +0100 [thread overview]
Message-ID: <20180125000007.dbg536a7ncstpoqc@salvia> (raw)
In-Reply-To: <20180124.163716.301711852222011274.davem@davemloft.net>
On Wed, Jan 24, 2018 at 04:37:16PM -0500, David Miller wrote:
> From: Eyal Birger <eyal.birger@gmail.com>
> Date: Tue, 23 Jan 2018 11:17:32 +0200
>
> > + network_offset = skb_network_offset(skb);
> > + skb_pull(skb, network_offset);
> > +
> > + rcu_read_lock();
> > +
> > + if (skb->skb_iif)
> > + indev = dev_get_by_index_rcu(em->net, skb->skb_iif);
> > +
> > + nf_hook_state_init(&state, im->hook, im->nfproto, indev ?: skb->dev,
> > + skb->dev, NULL, em->net, NULL);
> > +
> > + acpar.match = im->match;
> > + acpar.matchinfo = im->match_data;
> > + acpar.state = &state;
> > +
> > + ret = im->match->match(skb, &acpar);
> > +
> > + rcu_read_unlock();
> > +
> > + skb_push(skb, network_offset);
>
> If the SKB is shared in any way, this pull/push around the NF hook
> invocation is illegal.
At ingress, skb->data points to the network header, which is what the
xtables matches expect, so these are actually noops, therefore,
skb_pull() and skb_push() can be removed.
next prev parent reply other threads:[~2018-01-25 0:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-23 9:17 [PATCH net-next 0/2] net: sched: introduce em_ipt ematch Eyal Birger
2018-01-23 9:17 ` [PATCH net-next 1/2] net: sched: ematch: pass protocol to ematch 'change()' handlers Eyal Birger
2018-01-23 9:17 ` [PATCH net-next 2/2] net: sched: add em_ipt ematch for calling xtables matches Eyal Birger
2018-01-23 12:15 ` Pablo Neira Ayuso
2018-01-24 21:37 ` David Miller
2018-01-25 0:00 ` Pablo Neira Ayuso [this message]
2018-01-26 4:24 ` Eyal Birger
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=20180125000007.dbg536a7ncstpoqc@salvia \
--to=pablo@netfilter.org \
--cc=davem@davemloft.net \
--cc=eyal.birger@gmail.com \
--cc=eyal@metanetworks.com \
--cc=jhs@mojatatu.com \
--cc=netdev@vger.kernel.org \
--cc=shmulik@metanetworks.com \
--cc=xiyou.wangcong@gmail.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