Re: [PATCH iproute2-next 3/9] rdma: Add filtering infrastructure

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

 



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;
> +}
> +

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux