[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8380b3a6-54f3-851c-f059-5f37d377d3f0@gmail.com>
Date: Tue, 2 Jan 2018 19:47:34 -0700
From: David Ahern <dsahern@...il.com>
To: Leon Romanovsky <leon@...nel.org>,
Doug Ledford <dledford@...hat.com>,
Jason Gunthorpe <jgg@...lanox.com>
Cc: RDMA mailing list <linux-rdma@...r.kernel.org>,
Leon Romanovsky <leonro@...lanox.com>,
netdev <netdev@...r.kernel.org>,
Stephen Hemminger <stephen@...workplumber.org>
Subject: Re: [PATCH iproute2-next 3/9] rdma: Add filtering infrastructure
On 1/2/18 2:37 AM, Leon Romanovsky wrote:
> +/*
> + * Check if string entry is filtered:
> + * * key doesn't exist -> user didn't request -> not filtered
> + */
> +bool rd_check_is_string_filtered(struct rd *rd, const char *key, char *val)
> +{
> + bool key_is_filtered = false;
> + struct filter_entry *fe;
> + char *p = NULL;
> + char *str;
> +
> + list_for_each_entry(fe, &rd->filter_list, list) {
> + if (!strcmpx(fe->key, key)) {
> + /* We found the key */
> + p = strdup(fe->value);
if (p == NULL) ...
> +
> + /*
> + * Need to check if value in range
> + * It can come in the following formats
> + * and their permutations:
> + * str
> + * str1,str2
> + */
> + str = strtok(p, ",");
> + while (str) {
> + if (!strcmpx(str, val)) {
> + key_is_filtered = true;
> + goto out;
> + }
> + str = strtok(NULL, ",");
> + }
> + goto out;
> + }
> + }
> +
> +out:
> + free(p);
> + return key_is_filtered;
> +}
> +
Powered by blists - more mailing lists