summaryrefslogtreecommitdiff
path: root/nest/rt-table.c
diff options
context:
space:
mode:
Diffstat (limited to 'nest/rt-table.c')
-rw-r--r--nest/rt-table.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/nest/rt-table.c b/nest/rt-table.c
index 8980f147..f4ca9170 100644
--- a/nest/rt-table.c
+++ b/nest/rt-table.c
@@ -4740,6 +4740,7 @@ rt_update_hostcache(void *data)
static struct hostentry *
rt_get_hostentry(struct rtable_private *tab, ip_addr a, ip_addr ll, rtable *dep)
{
+ ip_addr link = ipa_zero(ll) ? a : ll;
struct hostentry *he;
if (!tab->hostcache)
@@ -4748,10 +4749,10 @@ rt_get_hostentry(struct rtable_private *tab, ip_addr a, ip_addr ll, rtable *dep)
u32 k = hc_hash(a, dep);
struct hostcache *hc = tab->hostcache;
for (he = hc->hash_table[k >> hc->hash_shift]; he != NULL; he = he->next)
- if (ipa_equal(he->addr, a) && (he->tab == dep))
+ if (ipa_equal(he->addr, a) && ipa_equal(he->link, link) && (he->tab == dep))
return he;
- he = hc_new_hostentry(hc, tab->rp, a, ipa_zero(ll) ? a : ll, dep, k);
+ he = hc_new_hostentry(hc, tab->rp, a, link, dep, k);
rt_update_hostentry(tab, he);
return he;
}