Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4d0312e0 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'net-Add-address-attribute-to-control-metric-of-prefix-route'



David Ahern says:

====================
net: Add address attribute to control metric of prefix route

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
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 49fb6fe3 d69faad7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -139,6 +139,7 @@ struct in_ifaddr {
	__be32			ifa_local;
	__be32			ifa_address;
	__be32			ifa_mask;
	__u32			ifa_rt_priority;
	__be32			ifa_broadcast;
	unsigned char		ifa_scope;
	unsigned char		ifa_prefixlen;
+13 −0
Original line number Diff line number Diff line
@@ -59,6 +59,19 @@ struct in6_validator_info {
	struct netlink_ext_ack	*extack;
};

struct ifa6_config {
	const struct in6_addr	*pfx;
	unsigned int		plen;

	const struct in6_addr	*peer_pfx;

	u32			rt_priority;
	u32			ifa_flags;
	u32			preferred_lft;
	u32			valid_lft;
	u16			scope;
};

int addrconf_init(void);
void addrconf_cleanup(void);

+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ enum {
struct inet6_ifaddr {
	struct in6_addr		addr;
	__u32			prefix_len;
	__u32			rt_priority;

	/* In seconds, relative to tstamp. Expiry is at tstamp + HZ * lft. */
	__u32			valid_lft;
+1 −0
Original line number Diff line number Diff line
@@ -225,6 +225,7 @@ struct rtable *rt_dst_alloc(struct net_device *dev,
struct in_ifaddr;
void fib_add_ifaddr(struct in_ifaddr *);
void fib_del_ifaddr(struct in_ifaddr *, struct in_ifaddr *);
void fib_modify_prefix_metric(struct in_ifaddr *ifa, u32 new_metric);

void rt_add_uncached_list(struct rtable *rt);
void rt_del_uncached_list(struct rtable *rt);
+1 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ enum {
	IFA_CACHEINFO,
	IFA_MULTICAST,
	IFA_FLAGS,
	IFA_RT_PRIORITY,  /* u32, priority/metric for prefix route */
	__IFA_MAX,
};

Loading