From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Cc: Netfilter Development Mailing list
<netfilter-devel@vger.kernel.org>,
Patrick McHardy <kaber@trash.net>
Subject: Re: [PATCH nf-next 3/3 v2] netfilter: nf_tables: export rule-set generation ID
Date: Thu, 11 Sep 2014 18:25:21 +0200 [thread overview]
Message-ID: <20140911162521.GC5824@salvia> (raw)
In-Reply-To: <CAOkSjBhc65FVRK5CZSVuGnWz9sN0J1Ot9LOwGat_xKPuO83p_g@mail.gmail.com>
On Thu, Sep 11, 2014 at 05:46:57PM +0200, Arturo Borrero Gonzalez wrote:
> On 11 September 2014 17:20, Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > +
> > +static int nf_tables_gen_notify(struct net *net, struct sk_buff *skb, int event)
> > +{
> > + struct nlmsghdr *nlh = nlmsg_hdr(skb);
> > + struct sk_buff *skb2;
> > + int err;
> > +
> > + if (nlmsg_report(nlh) &&
> > + !nfnetlink_has_listeners(net, NFNLGRP_NFTABLES))
> > + return 0;
> > +
>
> The above logic is different from the other functions.
>
> I don't know if that was deliberate.
We don't have nft_ctx at that point. nlmsg_report(nlh) is basically
what ctx->report usually constains.
Unless I'm overlooking something obvious, this looks correct to me.
> > + err = -ENOBUFS;
> > + skb2 = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
> > + if (skb2 == NULL)
> > + goto err;
> > +
> > + err = nf_tables_fill_gen_info(skb2, net, NETLINK_CB(skb).portid,
> > + nlh->nlmsg_seq);
> > + if (err < 0) {
> > + kfree_skb(skb2);
> > + goto err;
> > + }
> > +
> > + err = nfnetlink_send(skb2, net, NETLINK_CB(skb).portid,
> > + NFNLGRP_NFTABLES, nlmsg_report(nlh), GFP_KERNEL);
> > +err:
> > + if (err < 0) {
> > + nfnetlink_set_err(net, NETLINK_CB(skb).portid, NFNLGRP_NFTABLES,
> > + err);
> > + }
> > + return err;
> > +}
> > +
>
> All the xx_notify() functions looks very similar. Do you think it
> worth to factorize the code?
I prefer if we focus on adding missing features, fixing bugs and so
on. We'll have the time to revisit things later on.
prev parent reply other threads:[~2014-09-11 16:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-11 15:20 [PATCH nf-next 1/3] netfilter: nf_tables: add NFTA_MASQ_UNSPEC to nft_masq_attributes Pablo Neira Ayuso
2014-09-11 15:20 ` [PATCH nf-next 2/3] netfilter: nfnetlink: use original skbuff when committing/aborting Pablo Neira Ayuso
2014-09-11 15:20 ` [PATCH nf-next 3/3 v2] netfilter: nf_tables: export rule-set generation ID Pablo Neira Ayuso
2014-09-11 15:32 ` Patrick McHardy
2014-09-11 16:10 ` Pablo Neira Ayuso
2014-09-11 16:45 ` Patrick McHardy
2014-09-11 16:57 ` Pablo Neira Ayuso
2014-09-11 17:22 ` Pablo Neira Ayuso
2014-09-11 17:35 ` Patrick McHardy
2014-09-12 7:47 ` Pablo Neira Ayuso
2014-09-11 15:46 ` Arturo Borrero Gonzalez
2014-09-11 16:25 ` Pablo Neira Ayuso [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=20140911162521.GC5824@salvia \
--to=pablo@netfilter.org \
--cc=arturo.borrero.glez@gmail.com \
--cc=kaber@trash.net \
--cc=netfilter-devel@vger.kernel.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).