netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch net-next rfc 0/7] net: introduce alternative names for network interfaces
@ 2019-07-19 11:00 Jiri Pirko
  2019-07-19 11:00 ` [patch net-next rfc 1/7] net: procfs: use index hashlist instead of name hashlist Jiri Pirko
                   ` (9 more replies)
  0 siblings, 10 replies; 76+ messages in thread
From: Jiri Pirko @ 2019-07-19 11:00 UTC (permalink / raw)
  To: netdev
  Cc: davem, jakub.kicinski, sthemmin, dsahern, dcbw, mkubecek, andrew,
	parav, saeedm, mlxsw

From: Jiri Pirko <jiri@mellanox.com>

In the past, there was repeatedly discussed the IFNAMSIZ (16) limit for
netdevice name length. Now when we have PF and VF representors
with port names like "pfXvfY", it became quite common to hit this limit:
0123456789012345
enp131s0f1npf0vf6
enp131s0f1npf0vf22

Udev cannot rename these interfaces out-of-the-box and user needs to
create custom rules to handle them.

Also, udev has multiple schemes of netdev names. From udev code:
 * Type of names:
 *   b<number>                             - BCMA bus core number
 *   c<bus_id>                             - bus id of a grouped CCW or CCW device,
 *                                           with all leading zeros stripped [s390]
 *   o<index>[n<phys_port_name>|d<dev_port>]
 *                                         - on-board device index number
 *   s<slot>[f<function>][n<phys_port_name>|d<dev_port>]
 *                                         - hotplug slot index number
 *   x<MAC>                                - MAC address
 *   [P<domain>]p<bus>s<slot>[f<function>][n<phys_port_name>|d<dev_port>]
 *                                         - PCI geographical location
 *   [P<domain>]p<bus>s<slot>[f<function>][u<port>][..][c<config>][i<interface>]
 *                                         - USB port number chain
 *   v<slot>                               - VIO slot number (IBM PowerVM)
 *   a<vendor><model>i<instance>           - Platform bus ACPI instance id
 *   i<addr>n<phys_port_name>              - Netdevsim bus address and port name

One device can be often renamed by multiple patterns at the
same time (e.g. pci address/mac).

This patchset introduces alternative names for network interfaces.
Main goal is to:
1) Overcome the IFNAMSIZ limitation
2) Allow to have multiple names at the same time (multiple udev patterns)
3) Allow to use alternative names as handle for commands

See following examples.

$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
3: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 7e:a2:d4:b8:91:7a brd ff:ff:ff:ff:ff:ff

-> Add alternative names for dummy0:

$ ip link altname add dummy0 name someothername
$ ip link altname add dummy0 name someotherveryveryveryverylongname
$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
3: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 7e:a2:d4:b8:91:7a brd ff:ff:ff:ff:ff:ff
    altname someothername
    altname someotherveryveryveryverylongname
  
-> Add bridge brx, add it's alternative name and use alternative names to
   do enslavement.

$ ip link add name brx type bridge
$ ip link altname add brx name mypersonalsuperspecialbridge
$ ip link set someotherveryveryveryverylongname master mypersonalsuperspecialbridge
$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
3: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop master brx state DOWN mode DEFAULT group default qlen 1000
    link/ether 7e:a2:d4:b8:91:7a brd ff:ff:ff:ff:ff:ff
    altname someothername
    altname someotherveryveryveryverylongname
4: brx: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 7e:a2:d4:b8:91:7a brd ff:ff:ff:ff:ff:ff
    altname mypersonalsuperspecialbridge

-> Add ipv4 address to the bridge using alternative name:
    
$ ip addr add 192.168.0.1/24 dev mypersonalsuperspecialbridge
$ ip addr show mypersonalsuperspecialbridge     
4: brx: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 7e:a2:d4:b8:91:7a brd ff:ff:ff:ff:ff:ff
    altname mypersonalsuperspecialbridge
    inet 192.168.0.1/24 scope global brx
       valid_lft forever preferred_lft forever

-> Delete one of dummy0 alternative names:

$ ip link altname del someotherveryveryveryverylongname    
$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
3: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop master brx state DOWN mode DEFAULT group default qlen 1000
    link/ether 7e:a2:d4:b8:91:7a brd ff:ff:ff:ff:ff:ff
    altname someothername
4: brx: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 7e:a2:d4:b8:91:7a brd ff:ff:ff:ff:ff:ff
    altname mypersonalsuperspecialbridge

TODO:
- notifications for alternative names add/removal
- sanitization of add/del cmds (similar to get link)
- test more usecases and write selftests
- extend support for other netlink ifaces (ovs for example)
- add sysfs symlink altname->basename?

Jiri Pirko (7):
  net: procfs: use index hashlist instead of name hashlist
  net: introduce name_node struct to be used in hashlist
  net: rtnetlink: add commands to add and delete alternative ifnames
  net: rtnetlink: put alternative names to getlink message
  net: rtnetlink: unify the code in __rtnl_newlink get dev with the rest
  net: rtnetlink: introduce helper to get net_device instance by ifname
  net: rtnetlink: add possibility to use alternative names as message
    handle

 include/linux/netdevice.h      |  14 ++-
 include/uapi/linux/if.h        |   1 +
 include/uapi/linux/if_link.h   |   3 +
 include/uapi/linux/rtnetlink.h |   7 ++
 net/core/dev.c                 | 152 ++++++++++++++++++++++----
 net/core/net-procfs.c          |   4 +-
 net/core/rtnetlink.c           | 192 +++++++++++++++++++++++++++++----
 security/selinux/nlmsgtab.c    |   4 +-
 8 files changed, 334 insertions(+), 43 deletions(-)

-- 
2.21.0


^ permalink raw reply	[flat|nested] 76+ messages in thread

end of thread, other threads:[~2019-09-13 14:50 UTC | newest]

Thread overview: 76+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-19 11:00 [patch net-next rfc 0/7] net: introduce alternative names for network interfaces Jiri Pirko
2019-07-19 11:00 ` [patch net-next rfc 1/7] net: procfs: use index hashlist instead of name hashlist Jiri Pirko
2019-07-19 11:00 ` [patch net-next rfc 2/7] net: introduce name_node struct to be used in hashlist Jiri Pirko
2019-07-19 16:29   ` Stephen Hemminger
2019-07-19 19:17     ` Jiri Pirko
2019-07-19 20:26       ` Stephen Hemminger
2019-07-20  7:15         ` Jiri Pirko
2019-09-13  9:52         ` Jiri Pirko
2019-08-08  4:34   ` kbuild test robot
2019-07-19 11:00 ` [patch net-next rfc 3/7] net: rtnetlink: add commands to add and delete alternative ifnames Jiri Pirko
2019-07-20  3:58   ` Jakub Kicinski
2019-07-20  7:20     ` Jiri Pirko
2019-08-09  4:11   ` Roopa Prabhu
2019-08-09  6:25     ` Jiri Pirko
2019-08-09 15:40       ` Roopa Prabhu
2019-08-09 15:46         ` Michal Kubecek
2019-08-10 13:46           ` Roopa Prabhu
2019-08-10 15:50             ` Michal Kubecek
2019-08-10 19:39               ` Roopa Prabhu
2019-08-11 22:10                 ` Michal Kubecek
2019-08-12 15:21                   ` Roopa Prabhu
2019-08-12 15:43                     ` Michal Kubecek
2019-08-09 16:14         ` David Ahern
2019-08-10  6:30           ` Jiri Pirko
2019-08-12  1:34             ` David Ahern
2019-08-12  1:37               ` David Ahern
2019-08-12  8:31                 ` Jiri Pirko
2019-08-12 15:13                   ` Roopa Prabhu
2019-08-12 21:43                     ` Jakub Kicinski
2019-08-13  0:29                       ` David Ahern
2019-08-13  6:53                         ` Jiri Pirko
2019-08-13  6:51                     ` Jiri Pirko
2019-08-12 15:40                   ` Stephen Hemminger
2019-08-12 16:23                     ` Roopa Prabhu
2019-08-13  6:55                     ` Jiri Pirko
2019-08-12 16:01                   ` David Ahern
2019-08-13  6:56                     ` Jiri Pirko
2019-08-26 16:09                       ` Jiri Pirko
2019-08-26 16:55                         ` Jakub Kicinski
2019-08-26 21:46                           ` David Ahern
2019-08-26 22:15                             ` Jakub Kicinski
2019-08-26 22:18                               ` David Miller
2019-08-26 22:24                                 ` David Ahern
2019-08-26 22:25                                   ` David Miller
2019-08-27  0:17                                     ` David Ahern
2019-08-27  5:09                                       ` Michal Kubecek
2019-08-27  7:08                                 ` Jiri Pirko
2019-08-27  8:22                                   ` David Miller
2019-08-27  9:35                                     ` Jiri Pirko
2019-08-27 15:14                                       ` Roopa Prabhu
2019-08-28  7:07                                         ` Jiri Pirko
2019-08-29  4:36                                           ` Roopa Prabhu
2019-08-29  5:26                                             ` Michal Kubecek
2019-08-30 14:35                                               ` Roopa Prabhu
2019-08-30 14:47                                                 ` David Ahern
2019-08-30 17:04                                                   ` Jiri Pirko
2019-08-30 14:49                                                 ` Michal Kubecek
2019-08-30 17:03                                                 ` Jiri Pirko
2019-09-12 11:59                                                   ` Jiri Pirko
2019-09-13  8:21                                                     ` Jiri Pirko
2019-09-13 14:50                                                     ` Jiri Pirko
2019-08-27  4:55                             ` Michal Kubecek
2019-08-27 13:43                               ` David Ahern
2019-08-10  6:32         ` Jiri Pirko
2019-07-19 11:00 ` [patch net-next rfc 4/7] net: rtnetlink: put alternative names to getlink message Jiri Pirko
2019-07-20  3:59   ` Jakub Kicinski
2019-07-20  7:17     ` Jiri Pirko
2019-07-19 11:00 ` [patch net-next rfc 5/7] net: rtnetlink: unify the code in __rtnl_newlink get dev with the rest Jiri Pirko
2019-07-19 11:00 ` [patch net-next rfc 6/7] net: rtnetlink: introduce helper to get net_device instance by ifname Jiri Pirko
2019-07-19 11:00 ` [patch net-next rfc 7/7] net: rtnetlink: add possibility to use alternative names as message handle Jiri Pirko
2019-07-20  3:59   ` Jakub Kicinski
2019-07-20  7:22     ` Jiri Pirko
2019-07-19 11:03 ` [patch iproute2 rfc 1/2] ip: add support for alternative name addition/deletion/list Jiri Pirko
2019-07-19 11:03 ` [patch iproute2 rfc 2/2] ip: allow to use alternative names as handle Jiri Pirko
2019-07-19 16:31 ` [patch net-next rfc 0/7] net: introduce alternative names for network interfaces Stephen Hemminger
2019-07-19 19:16   ` Jiri Pirko

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).