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 <[email protected]> --- lib/netdev-dummy.c | 11 +++++++++++ 1 file changed, 11 insertions(+) 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); -- 2.29.2 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
