netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 00/13] Introduce NETDEV_PRE_CHANGEADDR
@ 2018-12-13 11:54 Petr Machata
  2018-12-13 11:54 ` [PATCH net-next 01/13] net: dev: Add extack argument to dev_set_mac_address() Petr Machata
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: Petr Machata @ 2018-12-13 11:54 UTC (permalink / raw)
  To: netdev@vger.kernel.org
  Cc: j.vosburgh@gmail.com, vfalico@gmail.com, andy@greyhouse.net,
	davem@davemloft.net, Jiri Pirko, Ido Schimmel,
	roopa@cumulusnetworks.com, nikolay@cumulusnetworks.com

Spectrum devices have a limitation that all router interfaces need to
have the same address prefix. In Spectrum-1, the requirement is for the
initial 38 bits of all RIFs to be the same, in Spectrum-2 the limit is
36 bits. Currently violations of this requirement are not diagnosed. At
the same time, if the condition is not upheld, the mismatched MAC
address ends up overwriting the common prefix, and all RIF MAC addresses
silently change to the new prefix.

It is therefore desirable to be able at least to diagnose the issue, and
better to reject attempts to change MAC addresses in ways that is
incompatible with the device.

Currently MAC address changes are notified through emission of
NETDEV_CHANGEADDR, which is done after the change. Extending this
message to allow vetoing is certainly possible, but several other
notification types have instead adopted a simple two-stage approach:
first a "pre" notification is sent to make sure all interested parties
are OK with the change that's about to be done. Then the change is done,
and afterwards a "post" notification is sent.

This dual approach is easier to use: when the change is vetoed, nothing
has changed yet, and it's therefore unnecessary to roll anything back.
Therefore this patchset introduces it for NETDEV_CHANGEADDR as well.

One prominent path to emitting NETDEV_CHANGEADDR is through
dev_set_mac_address(). Therefore in patch #1, give this function an
extack argument, so that a textual reason for rejection (or a warning)
can be communicated back to the user.

In patch #2, add the new notification type. In patch #3, have dev.c emit
the notification for instances of dev_addr change, or addition of an
address to dev_addrs list.

In patches #4 and #5, extend the bridge driver to handle and emit the
new notifier.

In patch #6, change IPVLAN to emit the new notifier.

Likewise for bonding driver in patches #7 and #8. Note that the team
driver doesn't need this treatment, as it goes through
dev_set_mac_address().

In patches #9, #10 and #11 adapt mlxsw to veto MAC addresses on router
interfaces, if they violate the requirement that all RIF MAC addresses
have the same prefix.

Finally in patches #12 and #13, add a test for vetoing of a direct
change of a port device MAC, and indirect change of a bridge MAC.

Petr Machata (13):
  net: dev: Add extack argument to dev_set_mac_address()
  net: dev: Add NETDEV_PRE_CHANGEADDR
  net: dev: Issue NETDEV_PRE_CHANGEADDR
  net: bridge: Issue NETDEV_PRE_CHANGEADDR
  net: bridge: Handle NETDEV_PRE_CHANGEADDR from ports
  net: ipvlan: Issue NETDEV_PRE_CHANGEADDR
  net: bonding: Give bond_set_dev_addr() a return value
  net: bonding: Issue NETDEV_PRE_CHANGEADDR
  mlxsw: spectrum_router: Generalize
    mlxsw_sp_netdevice_router_port_event()
  mlxsw: spectrum: Add mlxsw_sp.mac_mask
  mlxsw: spectrum_router: Veto unsupported RIF MAC addresses
  selftests: mlxsw: Test RIF MAC vetoing
  selftests: mlxsw: Test FID RIF MAC vetoing

 drivers/net/bonding/bond_alb.c                     |   9 +-
 drivers/net/bonding/bond_main.c                    |  44 ++++--
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c     |  15 +-
 drivers/net/ethernet/mellanox/mlxsw/spectrum.h     |   4 +-
 .../net/ethernet/mellanox/mlxsw/spectrum_router.c  |  86 +++++++++--
 drivers/net/hyperv/netvsc_drv.c                    |   4 +-
 drivers/net/ipvlan/ipvlan_main.c                   |  14 ++
 drivers/net/macvlan.c                              |   4 +-
 drivers/net/tap.c                                  |   2 +-
 drivers/net/team/team.c                            |   2 +-
 drivers/net/tun.c                                  |   2 +-
 drivers/usb/gadget/function/u_ether.c              |   2 +-
 include/linux/netdevice.h                          |  13 +-
 net/bridge/br.c                                    |  13 ++
 net/bridge/br_if.c                                 |   9 ++
 net/core/dev.c                                     |  29 +++-
 net/core/dev_addr_lists.c                          |   3 +
 net/core/dev_ioctl.c                               |   2 +-
 net/core/rtnetlink.c                               |   2 +-
 net/ieee802154/nl-phy.c                            |   2 +-
 .../selftests/drivers/net/mlxsw/rtnetlink.sh       | 170 +++++++++++++++++++++
 21 files changed, 385 insertions(+), 46 deletions(-)
 create mode 100755 tools/testing/selftests/drivers/net/mlxsw/rtnetlink.sh

-- 
2.4.11

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

end of thread, other threads:[~2018-12-13 11:55 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-13 11:54 [PATCH net-next 00/13] Introduce NETDEV_PRE_CHANGEADDR Petr Machata
2018-12-13 11:54 ` [PATCH net-next 01/13] net: dev: Add extack argument to dev_set_mac_address() Petr Machata
2018-12-13 11:54 ` [PATCH net-next 02/13] net: dev: Add NETDEV_PRE_CHANGEADDR Petr Machata
2018-12-13 11:54 ` [PATCH net-next 03/13] net: dev: Issue NETDEV_PRE_CHANGEADDR Petr Machata
2018-12-13 11:54 ` [PATCH net-next 04/13] net: bridge: " Petr Machata
2018-12-13 11:54 ` [PATCH net-next 05/13] net: bridge: Handle NETDEV_PRE_CHANGEADDR from ports Petr Machata
2018-12-13 11:54 ` [PATCH net-next 06/13] net: ipvlan: Issue NETDEV_PRE_CHANGEADDR Petr Machata
2018-12-13 11:54 ` [PATCH net-next 07/13] net: bonding: Give bond_set_dev_addr() a return value Petr Machata
2018-12-13 11:54 ` [PATCH net-next 08/13] net: bonding: Issue NETDEV_PRE_CHANGEADDR Petr Machata
2018-12-13 11:54 ` [PATCH net-next 09/13] mlxsw: spectrum_router: Generalize mlxsw_sp_netdevice_router_port_event() Petr Machata
2018-12-13 11:54 ` [PATCH net-next 10/13] mlxsw: spectrum: Add mlxsw_sp.mac_mask Petr Machata
2018-12-13 11:54 ` [PATCH net-next 11/13] mlxsw: spectrum_router: Veto unsupported RIF MAC addresses Petr Machata
2018-12-13 11:54 ` [PATCH net-next 12/13] selftests: mlxsw: Test RIF MAC vetoing Petr Machata
2018-12-13 11:54 ` [PATCH net-next 13/13] selftests: mlxsw: Test FID " Petr Machata

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