diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-11-15 11:19:06 -0500 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-11-16 08:45:28 -0500 |
| commit | 3f5682c88d6f4f0b85539a8776c9e869f1cbd4fa (patch) | |
| tree | 370e7b43bb76ef73fadabe4636b0a21dac4e6bc3 /ripd/rip_interface.c | |
| parent | dd127197f9f165c23ced8165b08b66b2509c5da9 (diff) | |
ripd: Allow rip_redistribute_add to know the nexthop type
Allow rip_redistribute_add to receive and properly store
the nexthop type passed up from zebra.
Additionally display the different nexthop types appropriately.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'ripd/rip_interface.c')
| -rw-r--r-- | ripd/rip_interface.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index 184f2f2b81..d20954037d 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -591,6 +591,7 @@ void rip_if_down_all() static void rip_apply_address_add(struct connected *ifc) { struct prefix_ipv4 address; + struct nexthop nh; struct prefix *p; if (!rip) @@ -602,18 +603,22 @@ static void rip_apply_address_add(struct connected *ifc) p = ifc->address; memset(&address, 0, sizeof(address)); + memset(&nh, 0, sizeof(nh)); + address.family = p->family; address.prefix = p->u.prefix4; address.prefixlen = p->prefixlen; apply_mask_ipv4(&address); + nh.ifindex = ifc->ifp->ifindex; + nh.type = NEXTHOP_TYPE_IFINDEX; + /* Check if this interface is RIP enabled or not or Check if this address's prefix is RIP enabled */ if ((rip_enable_if_lookup(ifc->ifp->name) >= 0) || (rip_enable_network_lookup2(ifc) >= 0)) rip_redistribute_add(ZEBRA_ROUTE_CONNECT, RIP_ROUTE_INTERFACE, - &address, ifc->ifp->ifindex, NULL, 0, 0, - 0); + &address, &nh, 0, 0, 0); } int rip_interface_address_add(int command, struct zclient *zclient, @@ -879,6 +884,9 @@ static void rip_connect_set(struct interface *ifp, int set) struct listnode *node, *nnode; struct connected *connected; struct prefix_ipv4 address; + struct nexthop nh; + + memset(&nh, 0, sizeof(nh)); for (ALL_LIST_ELEMENTS(ifp->connected, node, nnode, connected)) { struct prefix *p; @@ -892,6 +900,8 @@ static void rip_connect_set(struct interface *ifp, int set) address.prefixlen = p->prefixlen; apply_mask_ipv4(&address); + nh.ifindex = connected->ifp->ifindex; + nh.type = NEXTHOP_TYPE_IFINDEX; if (set) { /* Check once more wether this prefix is within a * "network IF_OR_PREF" one */ @@ -900,7 +910,7 @@ static void rip_connect_set(struct interface *ifp, int set) rip_redistribute_add( ZEBRA_ROUTE_CONNECT, RIP_ROUTE_INTERFACE, &address, - connected->ifp->ifindex, NULL, 0, 0, 0); + &nh, 0, 0, 0); } else { rip_redistribute_delete(ZEBRA_ROUTE_CONNECT, RIP_ROUTE_INTERFACE, &address, @@ -909,7 +919,7 @@ static void rip_connect_set(struct interface *ifp, int set) rip_redistribute_add( ZEBRA_ROUTE_CONNECT, RIP_ROUTE_REDISTRIBUTE, &address, - connected->ifp->ifindex, NULL, 0, 0, 0); + &nh, 0, 0, 0); } } } |
