[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6421a75c-0341-4813-7c12-5836a440df76@gmail.com>
Date: Wed, 12 Jan 2022 10:57:49 -0700
From: David Ahern <dsahern@...il.com>
To: Anton Danilov <littlesmilingcloud@...il.com>
Cc: Stephen Hemminger <stephen@...workplumber.org>,
Linux Kernel Network Developers <netdev@...r.kernel.org>
Subject: Re: [PATCH iproute2 v2] ip: Extend filter links/addresses
On 1/11/22 12:09 PM, Anton Danilov wrote:
> Hello, David.
>
>> current 'type' filtering is the 'kind' string in the rtnl_link_ops --
>> bridge, veth, vlan, vrf, etc. You are now wanting to add 'exclude_type'
>> and make it based on hardware type. That is a confusing user api.
>
> The 'exclude_type' options first checks the 'kind' in the
> rtnl_link_ops, then the hardware type.
ok; missed that on the first pass.
Update the commit message to say filtering by "hardware type"
>> On 1/8/22 12:58 PM, Anton Danilov wrote:
>>> @@ -227,6 +227,28 @@ static int match_link_kind(struct rtattr **tb, const char *kind, bool slave)
>>> return strcmp(parse_link_kind(tb[IFLA_LINKINFO], slave), kind);
>>> }
>>>
>>> +static int match_if_type_name(unsigned short if_type, const char *type_name)
>>> +{
>>> +
>>> + char *expected_type_name;
>>> +
>>> + switch (if_type) {
>>> + case ARPHRD_ETHER:
>>> + expected_type_name = "ether";
>>> + break;
>>> + case ARPHRD_LOOPBACK:
>>> + expected_type_name = "loopback";
>>> + break;
>>> + case ARPHRD_PPP:
>>> + expected_type_name = "ppp";
ppp devices have kind set, so ARPHRD_PPP should not be needed.
Also, you have supported hardware types in multiple places - this match
function and the filter.kind check. Make 1 table with supported types
and use that table with helpers or both paths.
Why not allow exclude by "_slave" type? e.g., should all devices but
bridge ports?
Powered by blists - more mailing lists