Skip to content

net: Add address attribute to control metric of prefix route

[email protected] netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7net/ipv6: Convert ipv6_add_addr to struct ifa6_configinclude/net/addrconf.h net/ipv6/addrconf.c+87 -590 replies
2/7net/ipv6: Pass ifa6_config struct to inet6_addr_addnet/ipv6/addrconf.c+57 -550 replies
3/7net/ipv6: Pass ifa6_config struct to inet6_addr_modifynet/ipv6/addrconf.c+23 -210 replies
4/7net: Add IFA_RT_PRIORITY address attributeinclude/uapi/linux/if_addr.h+1 -00 replies
5/7net/ipv4: Add support for specifying metric of connected routesinclude/linux/inetdevice.h include/net/route.h net/ipv4/devinet.c +1 more+59 -110 replies
6/7net/ipv6: Add support for specifying metric of connected routesinclude/net/addrconf.h include/net/if_inet6.h net/ipv6/addrconf.c+77 -180 replies
7/7selftests: fib_tests: Add prefix route tests with metrictools/testing/selftests/net/fib_tests.sh+180 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH net-next 0/7] net: Add address attribute to control metric of prefix route

From: David Ahern <[email protected]>

For use cases such as VRR (Virtual Router Redundancy) interface managers want efficient control over the order of prefix routes when multiple interfaces have addresses with overlapping/duplicate subnets.

Currently, if two interfaces have addresses in the same subnet, the order of the prefix route entries is determined by the order in which the addresses are assigned or the links brought up. Any actions like cycling an interface up and down changes that order. This set adds a new attribute for addresses to allow a user to specify the metric of the prefix route associated with an address giving interface managers better and more efficient control of the order of prefix routes.

Patches 1-3 refactor IPv6 address add functions to pass an ifa6_config struct. The functions currently have a long list of arguments and adding the metric just makes it worse. Because of the overall diff size in moving the arguments to a struct, the change is done in stages to make it easier to review starting with the bottom function and pushing the struct up to callers in each successive patch.

Patch 4 introduces the new attribute.

Patches 5 and 6 add support for the new attribute to IPv4 and IPv6 addresses.

Patch 7 adds a set of test cases.

Patch 8 adds support to iproute2

Changes since RFC
- collapsed patches 1 and 3 into patch 2
- simplified stack variables in fib_modify_prefix_metric in patch 5

David Ahern (7):
net/ipv6: Convert ipv6_add_addr to struct ifa6_config net/ipv6: Pass ifa6_config struct to inet6_addr_add net/ipv6: Pass ifa6_config struct to inet6_addr_modify
net: Add IFA_RT_PRIORITY address attribute
net/ipv4: Add support for specifying metric of connected routes net/ipv6: Add support for specifying metric of connected routes
selftests: fib_tests: Add prefix route tests with metric

 include/linux/inetdevice.h               |   1 +
 include/net/addrconf.h                   |  13 ++
 include/net/if_inet6.h                   |   1 +
 include/net/route.h                      |   1 +
 include/uapi/linux/if_addr.h             |   1 +
 net/ipv4/devinet.c                       |  15 ++
 net/ipv4/fib_frontend.c                  |  53 ++++-
 net/ipv6/addrconf.c                      | 359 +++++++++++++++++++------------
 tools/testing/selftests/net/fib_tests.sh | 181 +++++++++++++++-
 9 files changed, 472 insertions(+), 153 deletions(-)
 mode change 100755 => 100644 tools/testing/selftests/net/fib_tests.sh
Signature · 1 line
2.11.0