[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <cover.1679399108.git.petrm@nvidia.com>
Date: Tue, 21 Mar 2023 12:51:58 +0100
From: Petr Machata <petrm@...dia.com>
To: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, <netdev@...r.kernel.org>
CC: David Ahern <dsahern@...nel.org>, Shuah Khan <shuah@...nel.org>,
"Ido Schimmel" <idosch@...dia.com>,
Jacques de Laval <Jacques.De.Laval@...termo.com>,
Petr Machata <petrm@...dia.com>
Subject: [PATCH net-next 0/3] net: Allow changing IPv4 address protocol
IPv4 and IPv6 addresses can be assigned a protocol value that indicates the
provenance of the IP address. The attribute is modeled after ip route
protocols, and essentially allows the administrator or userspace stack to
tag addresses in some way that makes sense to the actor in question.
When IP address protocol field was added in commit 47f0bd503210 ("net: Add
new protocol attribute to IP addresses"), the semantics included the
ability to change the protocol for IPv6 addresses, but not for IPv4
addresses. It seems this was not deliberate, but rather by accident.
One particular use case is tagging the addresses differently depending on
whether the routing stack should advertise them or not. Without support for
protocol replacement, this can not be done.
In this patchset, extend IPv4 to allow changing the protocol defined at an
address (in patch #1). Then in patches #2 and #3 add selftest coverage for
ip address protocols.
Currently the kernel simply ignores the new value. Thus allowing the
replacement changes the observable behavior. However, since IPv6 already
behaves like this anyway, and since the feature as such is relatively new,
it seems like the change is safe to make.
An example session with the feature in action:
bash-5.2# ip address add dev d 192.0.2.1/28 proto 0xab
bash-5.2# ip address show dev d
4: d: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 06:29:74:fd:1f:eb brd ff:ff:ff:ff:ff:ff
inet 192.0.2.1/28 scope global proto 0xab d
valid_lft forever preferred_lft forever
bash-5.2# ip address replace dev d 192.0.2.1/28 proto 0x11
bash-5.2# ip address show dev d
4: d: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 06:29:74:fd:1f:eb brd ff:ff:ff:ff:ff:ff
inet 192.0.2.1/28 scope global proto 0x11 d
valid_lft forever preferred_lft forever
Petr Machata (3):
net: ipv4: Allow changing IPv4 address protocol
selftests: rtnetlink: Make the set of tests to run configurable
selftests: rtnetlink: Add an address proto test
net/ipv4/devinet.c | 3 +
tools/testing/selftests/net/rtnetlink.sh | 181 +++++++++++++++++------
2 files changed, 142 insertions(+), 42 deletions(-)
--
2.39.0
Powered by blists - more mailing lists