Skip to content

Commit

Permalink
Merge pull request #31 from opensourcerouting/freebsd-route-update-fi…
Browse files Browse the repository at this point in the history
…x-for-2.0

Fixes #20
  • Loading branch information
eqvinox authored Dec 28, 2016
2 parents 2504fdc + e3edd1d commit 524f2ba
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
1 change: 1 addition & 0 deletions SERVICES
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ ospf6d 2606/tcp
ospfapi 2607/tcp
isisd 2608/tcp
pimd 2611/tcp
ldpd 2612/tcp
3 changes: 1 addition & 2 deletions zebra/rib.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ struct rib
/* Nexthop information. */
u_char nexthop_num;
u_char nexthop_active_num;
u_char nexthop_fib_num;
};

/* meta-queue structure:
Expand Down Expand Up @@ -335,7 +334,7 @@ extern int zebra_check_addr (struct prefix *p);

extern void rib_addnode (struct route_node *rn, struct rib *rib, int process);
extern void rib_delnode (struct route_node *rn, struct rib *rib);
extern int rib_install_kernel (struct route_node *rn, struct rib *rib, int update);
extern int rib_install_kernel (struct route_node *rn, struct rib *rib, struct rib *old);
extern int rib_uninstall_kernel (struct route_node *rn, struct rib *rib);

/* NOTE:
Expand Down
17 changes: 8 additions & 9 deletions zebra/zebra_rib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,7 @@ nexthop_active_update (struct route_node *rn, struct rib *rib, int set)
* is only used for IPv4.
*/
int
rib_install_kernel (struct route_node *rn, struct rib *rib, int update)
rib_install_kernel (struct route_node *rn, struct rib *rib, struct rib *old)
{
int ret = 0;
struct nexthop *nexthop, *tnexthop;
Expand All @@ -1231,7 +1231,7 @@ rib_install_kernel (struct route_node *rn, struct rib *rib, int update)
* the kernel.
*/
zfpm_trigger_update (rn, "installing in kernel");
ret = kernel_route_rib (&rn->p, update ? rib : NULL, rib);
ret = kernel_route_rib (&rn->p, old, rib);

/* If install succeeds, update FIB flag for nexthops. */
if (!ret)
Expand Down Expand Up @@ -1388,7 +1388,7 @@ rib_process_add_fib(struct zebra_vrf *zvrf, struct route_node *rn,

if (!RIB_SYSTEM_ROUTE (new))
{
if (rib_install_kernel (rn, new, 0))
if (rib_install_kernel (rn, new, NULL))
{
inet_ntop (rn->p.family, &rn->p.u.prefix, buf, INET6_ADDRSTRLEN);
zlog_warn ("%u:%s/%d: Route install failed",
Expand Down Expand Up @@ -1470,7 +1470,7 @@ rib_process_update_fib (struct zebra_vrf *zvrf, struct route_node *rn,
/* Non-system route should be installed. */
if (!RIB_SYSTEM_ROUTE (new))
{
if (rib_install_kernel (rn, new, 1))
if (rib_install_kernel (rn, new, old))
{
installed = 0;
inet_ntop (rn->p.family, &rn->p.u.prefix, buf, INET6_ADDRSTRLEN);
Expand Down Expand Up @@ -1542,7 +1542,7 @@ rib_process_update_fib (struct zebra_vrf *zvrf, struct route_node *rn,
break;
}
if (!in_fib)
rib_install_kernel (rn, new, 0);
rib_install_kernel (rn, new, NULL);
}
}

Expand Down Expand Up @@ -2459,11 +2459,10 @@ void _rib_dump (const char * func,
);
zlog_debug
(
"%s: nexthop_num == %u, nexthop_active_num == %u, nexthop_fib_num == %u",
"%s: nexthop_num == %u, nexthop_active_num == %u",
func,
rib->nexthop_num,
rib->nexthop_active_num,
rib->nexthop_fib_num
rib->nexthop_active_num
);

for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
Expand Down Expand Up @@ -2779,7 +2778,7 @@ rib_delete (afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, u_short instance,
{
/* This means someone else, other than Zebra, has deleted
* a Zebra router from the kernel. We will add it back */
rib_install_kernel(rn, fib, 0);
rib_install_kernel(rn, fib, NULL);
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion zebra/zebra_static.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ static_uninstall_route (afi_t afi, safi_t safi, struct prefix *p, struct static_
{
/* Update route in kernel if it's in fib */
if (CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
rib_install_kernel (rn, rib, 1);
rib_install_kernel (rn, rib, rib);
/* Update redistribution if it's selected */
if (CHECK_FLAG(rib->flags, ZEBRA_FLAG_SELECTED))
redistribute_update (&rn->p, rib, NULL);
Expand Down

0 comments on commit 524f2ba

Please sign in to comment.