From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Linmujia <linmujia@huawei.com>
Cc: "netfilter-devel@vger.kernel.org" <netfilter-devel@vger.kernel.org>
Subject: Re: [nft]: fix some bugs of return value
Date: Wed, 25 Nov 2015 14:03:39 +0100 [thread overview]
Message-ID: <20151125130339.GA17224@salvia> (raw)
In-Reply-To: <0A900C78B9F2324AB7F4F7A51D1A2F8577977E97@szxema505-mbs.china.huawei.com>
On Tue, Nov 24, 2015 at 09:00:21AM +0000, Linmujia wrote:
>
> linmujia - Nov. 24, 2015, 04:03 p.m.
>
> Signed-off-by: linmujia <linmujia@huawei.com>
> ---
> hello ,i reviewed nftables code and found some bugs of return value.
>
> Thanks!
>
>
>
> Patch
>
> diff --git a/src/netlink.c b/src/netlink.c
> index 974afb1..c555621 100644
> --- a/src/netlink.c
> +++ b/src/netlink.c
> @@ -307,6 +307,8 @@ static void netlink_gen_verdict(const struct expr *expr,
> strncpy(data->chain, expr->chain, NFT_CHAIN_MAXNAMELEN);
> data->chain[NFT_CHAIN_MAXNAMELEN-1] = '\0';
> break;
> + default:
> + BUG("invalid verdict value %u\n", expr->verdict);
> }
> }
>
> @@ -467,7 +469,7 @@ static int list_rule_cb(struct nftnl_rule *nlr, void *arg)
> if (h->family != family ||
> strcmp(table, h->table) != 0 ||
> (h->chain && strcmp(chain, h->chain) != 0))
> - return 0;
> + return -1;
I'm not sure I understand your intention, but this is not OK.
The iteration stops if we return -1, if we return 0 we keep iterating
over the list of objects to find a matching.
prev parent reply other threads:[~2015-11-25 13:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-24 9:00 [nft]: fix some bugs of return value Linmujia
2015-11-25 13:03 ` 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=20151125130339.GA17224@salvia \
--to=pablo@netfilter.org \
--cc=linmujia@huawei.com \
--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).