Re: [PATCH nf-next 3/3 v2] netfilter: nf_tables: export rule-set generation ID

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11 September 2014 17:20, Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> 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.


> +       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?

-- 
Arturo Borrero González
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux