]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
vxlan: refactor verification and application of configuration
authorMatthias Schiffer <mschiffer@universe-factory.net>
Mon, 19 Jun 2017 08:03:55 +0000 (10:03 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 20 Jun 2017 17:37:01 +0000 (13:37 -0400)
commita985343ba90635cda3f3704f71021254c91cebbd
tree6b409f87fb8a1602d88a75187a467a7ee4d07cfe
parentc0ca9e7201c4507e70c4d71c1997c410651fe3c5
vxlan: refactor verification and application of configuration

The vxlan_dev_configure function was mixing validation and application of
the vxlan configuration; this could easily lead to bugs with the changelink
operation, as it was hard to see if the function wcould return an error
after parts of the configuration had already been applied.

This commit splits validation and application out of vxlan_dev_configure as
separate functions to make it clearer where error returns are allowed and
where the vxlan_dev or net_device may be configured. Log messages in these
functions are removed, as it is generally unexpected to find error output
for netlink requests in the kernel log. Userspace should be able to handle
errors based on the error codes returned via netlink just fine.

In addition, some validation and initialization is moved to vxlan_validate
and vxlan_setup respectively to improve grouping of similar settings.

Finally, this also fixes two actual bugs:

* if set, conf->mtu would overwrite dev->mtu in each changelink operation,
  reverting other changes of dev->mtu
* the "if (!conf->dst_port)" branch would never be run, as conf->dst_port
  was set in vxlan_setup before. This caused VXLAN-GPE to use the same
  default port as other VXLAN sockets instead of the intended IANA-assigned
  4790.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/vxlan.c