diff mbox series

[ovs-dev] Add local route entries on netdev-dummy IP address set

Message ID 20201216024108.1227014-1-ihrachys@redhat.com
State Superseded
Headers show
Series [ovs-dev] Add local route entries on netdev-dummy IP address set | expand

Commit Message

Ihar Hrachyshka Dec. 16, 2020, 2:41 a.m. UTC
To mimic what kernel routing subsystem does [1], add a local route
entry for every dummy IP address. This helps with OVN testing multiple
chassis on a single host.

There seems to be no way to explicitly remove an IP address from
netdev-dummy, hence no code path to handle route entry cleanup.

[1]: http://linux-ip.net/html/routing-tables.html#routing-table-local

"If the the machine has several IP addresses on one Ethernet
interface, there will be a route to each locally hosted IP in the
local routing table. This is a normal side effect of bringing up an IP
address on an interface under linux."

Signed-off-by: Ihar Hrachyshka <ihrachys@redhat.com>
---
 lib/netdev-dummy.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Simon Horman Oct. 5, 2023, 8:59 a.m. UTC | #1
On Tue, Dec 15, 2020 at 09:41:08PM -0500, Ihar Hrachyshka wrote:
> To mimic what kernel routing subsystem does [1], add a local route
> entry for every dummy IP address. This helps with OVN testing multiple
> chassis on a single host.
> 
> There seems to be no way to explicitly remove an IP address from
> netdev-dummy, hence no code path to handle route entry cleanup.
> 
> [1]: http://linux-ip.net/html/routing-tables.html#routing-table-local
> 
> "If the the machine has several IP addresses on one Ethernet
> interface, there will be a route to each locally hosted IP in the
> local routing table. This is a normal side effect of bringing up an IP
> address on an interface under linux."
> 
> Signed-off-by: Ihar Hrachyshka <ihrachys@redhat.com>

Hi Ihar,

This patch appears to have gone stale in patchwork, for one reason or
another. If it is still relevant then I think it needs to be revisited,
by being reposted after appropriate preparation.

As such I'm marking this patch as "Deferred" in patchwork.

No action is required unless there is a desire to revisit this patch.
diff mbox series

Patch

diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c
index 71df29184..bb6196da5 100644
--- a/lib/netdev-dummy.c
+++ b/lib/netdev-dummy.c
@@ -39,6 +39,7 @@ 
 #include "pcap-file.h"
 #include "openvswitch/poll-loop.h"
 #include "openvswitch/shash.h"
+#include "ovs-router.h"
 #include "sset.h"
 #include "stream.h"
 #include "unaligned.h"
@@ -1941,6 +1942,12 @@  netdev_dummy_ip4addr(struct unixctl_conn *conn, int argc OVS_UNUSED,
         error = ip_parse_masked(argv[2], &ip.s_addr, &mask.s_addr);
         if (!error) {
             netdev_dummy_set_in4(netdev, ip, mask);
+
+            /* insert local route entry for the new address */
+            struct in6_addr ip6;
+            in6_addr_set_mapped_ipv4(&ip6, ip.s_addr);
+            ovs_router_insert(0, &ip6, 128, true, argv[1], &in6addr_any);
+
             unixctl_command_reply(conn, "OK");
         } else {
             unixctl_command_reply_error(conn, error);
@@ -1970,6 +1977,10 @@  netdev_dummy_ip6addr(struct unixctl_conn *conn, int argc OVS_UNUSED,
 
             mask = ipv6_create_mask(plen);
             netdev_dummy_set_in6(netdev, &ip6, &mask);
+
+            /* insert local route entry for the new address */
+            ovs_router_insert(0, &ip6, 128, true, argv[1], &in6addr_any);
+
             unixctl_command_reply(conn, "OK");
         } else {
             unixctl_command_reply_error(conn, error);