summaryrefslogtreecommitdiff
path: root/pimd/pim_nht.c
diff options
context:
space:
mode:
authorMartin Buck <martin.buck@ruag.com>2018-06-04 15:52:14 +0200
committerMartin Buck <martin.buck@ruag.com>2018-06-05 09:58:33 +0200
commit66f5152f9898ba232373d0103b31d9b93c82c151 (patch)
tree417f8260b173542ed3cf4e62bdbff02adfdbcf95 /pimd/pim_nht.c
parentebb46153b06a48fa5402b850ad8041a469f1a26d (diff)
pimd: Fix nexthop determination when sending towards RP
When sending a PIM join upwards on the RP-based tree, it may get dropped on the last hop before the RP if the RP is reachable via a connected route (i.e. there's no associated nexthop). pimd needs to put the nexthop IP address into the PIM join payload and fails to do that if that route has a nexthop of 0.0.0.0. So whenever we look up a route to determine the nexthop or we receive a nexthop tracking update from Zebra, use the destination address as the nexthop address for connected routes. Fixes #2326. Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
Diffstat (limited to 'pimd/pim_nht.c')
-rw-r--r--pimd/pim_nht.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/pimd/pim_nht.c b/pimd/pim_nht.c
index 94cb32bc23..e59428fa9e 100644
--- a/pimd/pim_nht.c
+++ b/pimd/pim_nht.c
@@ -657,11 +657,20 @@ int pim_parse_nexthop_update(int command, struct zclient *zclient,
nexthop = nexthop_from_zapi_nexthop(&nhr.nexthops[i]);
switch (nexthop->type) {
case NEXTHOP_TYPE_IPV4:
- case NEXTHOP_TYPE_IFINDEX:
case NEXTHOP_TYPE_IPV4_IFINDEX:
case NEXTHOP_TYPE_IPV6:
case NEXTHOP_TYPE_BLACKHOLE:
break;
+ case NEXTHOP_TYPE_IFINDEX:
+ /*
+ * Connected route (i.e. no nexthop), use
+ * RPF address from nexthop cache (i.e.
+ * destination) as PIM nexthop.
+ */
+ nexthop->type = NEXTHOP_TYPE_IPV4;
+ nexthop->gate.ipv4 =
+ pnc->rpf.rpf_addr.u.prefix4;
+ break;
case NEXTHOP_TYPE_IPV6_IFINDEX:
ifp1 = if_lookup_by_index(nexthop->ifindex,
pim->vrf_id);