Thu, Jun 27, 2019 at 09:20:41PM CEST, step...@networkplumber.org wrote: >On Thu, 27 Jun 2019 20:39:48 +0200 >Michal Kubecek <mkube...@suse.cz> wrote: > >> > >> > $ ip li set dev enp3s0 alias "Onboard Ethernet" >> > # ip link show "Onboard Ethernet" >> > Device "Onboard Ethernet" does not exist. >> > >> > So it does not really appear to be an alias, it is a label. To be >> > truly useful, it needs to be more than a label, it needs to be a real >> > alias which you can use. >> >> That's exactly what I meant: to be really useful, one should be able to >> use the alias(es) for setting device options, for adding routes, in >> netfilter rules etc. >> >> Michal > >The kernel doesn't enforce uniqueness of alias. >Also current kernel RTM_GETLINK doesn't do filter by alias (easily fixed). > >If it did, then handling it in iproute would be something like:
I think that it is desired for kernel to work with "real alias" as a handle. Userspace could either pass ifindex, IFLA_NAME or "real alias". Userspace mapping like you did here might be perhaps okay for iproute2, but I think that we need something and easy to use for all. Let's call it "altname". Get would return: IFLA_NAME eth0 IFLA_ALT_NAME_LIST IFLA_ALT_NAME eth0 IFLA_ALT_NAME somethingelse IFLA_ALT_NAME somenamethatisreallylong then userspace would pass with a request (get/set/del): IFLA_ALT_NAME eth0/somethingelse/somenamethatisreallylong or IFLA_NAME eth0 if it is talking with older kernel Then following would do exactly the same: ip link set eth0 addr 11:22:33:44:55:66 ip link set somethingelse addr 11:22:33:44:55:66 ip link set somenamethatisreallylong addr 11:22:33:44:55:66 We would have to figure out the iproute2 iface to add/del altnames: ip link add eth0 altname somethingelse ip link del eth0 altname somethingelse this might be also: ip link del somethingelse altname somethingelse How does this sound?