From: "Harout Hedeshian" <harouth@codeaurora.org>
To: "'Pablo Neira Ayuso'" <pablo@netfilter.org>
Cc: <netfilter-devel@vger.kernel.org>,
"'Lorenzo Colitti'" <lorenzo@google.com>
Subject: RE: [PATCH nf-next] netfilter: xt_socket: add XT_SOCKET_MATCHSOCKMARK flag and mark fields
Date: Mon, 15 Jun 2015 18:45:29 -0600 [thread overview]
Message-ID: <007001d0a7cd$bef33ad0$3cd9b070$@codeaurora.org> (raw)
In-Reply-To: <20150615205752.GA3184@salvia>
> -----Original Message-----
> From: Pablo Neira Ayuso [mailto:pablo@netfilter.org]
> Sent: Monday, June 15, 2015 2:58 PM
> To: Harout Hedeshian
> Cc: netfilter-devel@vger.kernel.org; 'Lorenzo Colitti'
> Subject: Re: [PATCH nf-next] netfilter: xt_socket: add
> XT_SOCKET_MATCHSOCKMARK flag and mark fields
>
> >
> > Actually, on second thought, I'm not so sure. This socket lookup is
> > happening as part of a match operation in xt_socket.c.
> > From x_tables.h, I can see that match functions are not supposed to
> > modify the skb:
> >
> > struct xt_match{
> > ...
> > bool (*match)(const struct sk_buff *skb, struct xt_action_param *);
> >
> > In that case, would this even be valid?
> > -m socket --transparent --restore-skmark
> >
> > Keeping in mind --restore-skmark is happening as part of -m socket
> >
> > I would think we would need a whole new target to handle something
> > like
> > this:
> > iptables -t mangle -I PREROUTING -m socket --transparent --no-wildcard
> > -j SOCKET --restore-skmark
> >
> > Since the target invocation would be separate, we would need a second
> > socket lookup? Seems perhaps a little overkill...
>
> Yes, it's simply overkill to add a new target to add this.
>
> So just cast it:
Yuck...
> struct sk_buff *pskb = (struct sk_buff *)skb;
>
> iptables matches were originally design not to modify anything, but it
> can lead us to situations like this. That's one of the reasons why we
> have no distinction between matches and targets in nftables anymore.
That makes sense.
> Thanks.
These 2 MATCHSOCKMARK patches should be replaced with:
[PATCH nf-next] netfilter: xt_socket: add XT_SOCKET_RESTORESKMARK flag
[PATCH iptables] xt_socket: add --restore-skmark option
Thanks,
Harout
prev parent reply other threads:[~2015-06-16 0:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-12 22:39 [PATCH nf-next] netfilter: xt_socket: add XT_SOCKET_MATCHSOCKMARK flag and mark fields Harout Hedeshian
2015-06-15 16:22 ` Pablo Neira Ayuso
2015-06-15 17:41 ` Harout Hedeshian
2015-06-15 19:39 ` Harout Hedeshian
2015-06-15 20:57 ` Pablo Neira Ayuso
2015-06-16 0:45 ` Harout Hedeshian [this message]
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='007001d0a7cd$bef33ad0$3cd9b070$@codeaurora.org' \
--to=harouth@codeaurora.org \
--cc=lorenzo@google.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/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).