The neighbor entry expiry is only checked in dpif-poll
event handler, But in absence of any event we could keep
using arp entry forever. This patch changes it to check
expiration on each lookup.
Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
hash = tnl_neigh_hash(dst);
CMAP_FOR_EACH_WITH_HASH (neigh, cmap_node, hash, &table) {
if (ipv6_addr_equals(&neigh->ip, dst) && !strcmp(neigh->br_name, br_name)) {
hash = tnl_neigh_hash(dst);
CMAP_FOR_EACH_WITH_HASH (neigh, cmap_node, hash, &table) {
if (ipv6_addr_equals(&neigh->ip, dst) && !strcmp(neigh->br_name, br_name)) {
+ if (neigh->expires <= time_now()) {
+ return NULL;
+ }
+
neigh->expires = time_now() + NEIGH_ENTRY_DEFAULT_IDLE_TIME;
return neigh;
}
neigh->expires = time_now() + NEIGH_ENTRY_DEFAULT_IDLE_TIME;
return neigh;
}
need_ws = INET6_ADDRSTRLEN - (ds.length - start_len);
ds_put_char_multiple(&ds, ' ', need_ws);
need_ws = INET6_ADDRSTRLEN - (ds.length - start_len);
ds_put_char_multiple(&ds, ' ', need_ws);
- ds_put_format(&ds, ETH_ADDR_FMT" %s\n",
+ ds_put_format(&ds, ETH_ADDR_FMT" %s",
ETH_ADDR_ARGS(neigh->mac), neigh->br_name);
ETH_ADDR_ARGS(neigh->mac), neigh->br_name);
+ if (neigh->expires <= time_now()) {
+ ds_put_format(&ds, " STALE");
+ }
+ ds_put_char(&ds, '\n');
}
ovs_mutex_unlock(&mutex);
}
ovs_mutex_unlock(&mutex);