diff options
author | Vasu Dasari <vdasari@gmail.com> | 2019-07-16 10:54:31 -0400 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2019-07-22 09:20:43 -0700 |
commit | 8416e50f8de6660422462582f9bff40403028720 (patch) | |
tree | 1f85ccd23b3fcbb0656f9c6fea20f7e1c8eb44c5 /lib | |
parent | 0c5a65f20e5bca4cfefe70e69d8e7499799f77e7 (diff) | |
download | openvswitch-8416e50f8de6660422462582f9bff40403028720.tar.gz |
tnl-neigh-cache: Purge learnt neighbors when port/bridge is deleted
Say an ARP entry is learnt on a OVS port and when such a port is deleted,
learnt entry should be removed from the port. It would have be aged out after
ARP ageout time. This code will clean up immediately.
Added test case(tunnel - neighbor entry add and deletion) in tunnel.at, to
verify neighbors are added and removed on deletion of a ports and bridges.
Discussion for this addition is at:
https://mail.openvswitch.org/pipermail/ovs-discuss/2019-June/048754.html
Signed-off-by: Vasu Dasari <vdasari@gmail.com>
Reviewed-by: Flavio Fernandes <flavio@flaviof.com>
Reviewed-by: Ben Pfaff <blp@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tnl-neigh-cache.c | 20 | ||||
-rw-r--r-- | lib/tnl-neigh-cache.h | 1 |
2 files changed, 21 insertions, 0 deletions
diff --git a/lib/tnl-neigh-cache.c b/lib/tnl-neigh-cache.c index b28f9f1bb..5bda4af7e 100644 --- a/lib/tnl-neigh-cache.c +++ b/lib/tnl-neigh-cache.c @@ -220,6 +220,26 @@ tnl_neigh_cache_run(void) } } +void +tnl_neigh_flush(const char br_name[IFNAMSIZ]) +{ + struct tnl_neigh_entry *neigh; + bool changed = false; + + ovs_mutex_lock(&mutex); + CMAP_FOR_EACH (neigh, cmap_node, &table) { + if (!strcmp(neigh->br_name, br_name)) { + tnl_neigh_delete(neigh); + changed = true; + } + } + ovs_mutex_unlock(&mutex); + + if (changed) { + seq_change(tnl_conf_seq); + } +} + static void tnl_neigh_cache_flush(struct unixctl_conn *conn, int argc OVS_UNUSED, const char *argv[] OVS_UNUSED, void *aux OVS_UNUSED) diff --git a/lib/tnl-neigh-cache.h b/lib/tnl-neigh-cache.h index fee8e6a6f..ded9c2f86 100644 --- a/lib/tnl-neigh-cache.h +++ b/lib/tnl-neigh-cache.h @@ -37,5 +37,6 @@ int tnl_neigh_lookup(const char dev_name[], const struct in6_addr *dst, struct eth_addr *mac); void tnl_neigh_cache_init(void); void tnl_neigh_cache_run(void); +void tnl_neigh_flush(const char dev_name[]); #endif |