Skip to content

Commit 524f2ba

Browse files
authored
Merge pull request #31 from opensourcerouting/freebsd-route-update-fix-for-2.0
Fixes #20
2 parents 2504fdc + e3edd1d commit 524f2ba

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

SERVICES

+1
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ ospf6d 2606/tcp
1818
ospfapi 2607/tcp
1919
isisd 2608/tcp
2020
pimd 2611/tcp
21+
ldpd 2612/tcp

zebra/rib.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ struct rib
9393
/* Nexthop information. */
9494
u_char nexthop_num;
9595
u_char nexthop_active_num;
96-
u_char nexthop_fib_num;
9796
};
9897

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

336335
extern void rib_addnode (struct route_node *rn, struct rib *rib, int process);
337336
extern void rib_delnode (struct route_node *rn, struct rib *rib);
338-
extern int rib_install_kernel (struct route_node *rn, struct rib *rib, int update);
337+
extern int rib_install_kernel (struct route_node *rn, struct rib *rib, struct rib *old);
339338
extern int rib_uninstall_kernel (struct route_node *rn, struct rib *rib);
340339

341340
/* NOTE:

zebra/zebra_rib.c

+8-9
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,7 @@ nexthop_active_update (struct route_node *rn, struct rib *rib, int set)
12121212
* is only used for IPv4.
12131213
*/
12141214
int
1215-
rib_install_kernel (struct route_node *rn, struct rib *rib, int update)
1215+
rib_install_kernel (struct route_node *rn, struct rib *rib, struct rib *old)
12161216
{
12171217
int ret = 0;
12181218
struct nexthop *nexthop, *tnexthop;
@@ -1231,7 +1231,7 @@ rib_install_kernel (struct route_node *rn, struct rib *rib, int update)
12311231
* the kernel.
12321232
*/
12331233
zfpm_trigger_update (rn, "installing in kernel");
1234-
ret = kernel_route_rib (&rn->p, update ? rib : NULL, rib);
1234+
ret = kernel_route_rib (&rn->p, old, rib);
12351235

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

13891389
if (!RIB_SYSTEM_ROUTE (new))
13901390
{
1391-
if (rib_install_kernel (rn, new, 0))
1391+
if (rib_install_kernel (rn, new, NULL))
13921392
{
13931393
inet_ntop (rn->p.family, &rn->p.u.prefix, buf, INET6_ADDRSTRLEN);
13941394
zlog_warn ("%u:%s/%d: Route install failed",
@@ -1470,7 +1470,7 @@ rib_process_update_fib (struct zebra_vrf *zvrf, struct route_node *rn,
14701470
/* Non-system route should be installed. */
14711471
if (!RIB_SYSTEM_ROUTE (new))
14721472
{
1473-
if (rib_install_kernel (rn, new, 1))
1473+
if (rib_install_kernel (rn, new, old))
14741474
{
14751475
installed = 0;
14761476
inet_ntop (rn->p.family, &rn->p.u.prefix, buf, INET6_ADDRSTRLEN);
@@ -1542,7 +1542,7 @@ rib_process_update_fib (struct zebra_vrf *zvrf, struct route_node *rn,
15421542
break;
15431543
}
15441544
if (!in_fib)
1545-
rib_install_kernel (rn, new, 0);
1545+
rib_install_kernel (rn, new, NULL);
15461546
}
15471547
}
15481548

@@ -2459,11 +2459,10 @@ void _rib_dump (const char * func,
24592459
);
24602460
zlog_debug
24612461
(
2462-
"%s: nexthop_num == %u, nexthop_active_num == %u, nexthop_fib_num == %u",
2462+
"%s: nexthop_num == %u, nexthop_active_num == %u",
24632463
func,
24642464
rib->nexthop_num,
2465-
rib->nexthop_active_num,
2466-
rib->nexthop_fib_num
2465+
rib->nexthop_active_num
24672466
);
24682467

24692468
for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
@@ -2779,7 +2778,7 @@ rib_delete (afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, u_short instance,
27792778
{
27802779
/* This means someone else, other than Zebra, has deleted
27812780
* a Zebra router from the kernel. We will add it back */
2782-
rib_install_kernel(rn, fib, 0);
2781+
rib_install_kernel(rn, fib, NULL);
27832782
}
27842783
}
27852784
else

zebra/zebra_static.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ static_uninstall_route (afi_t afi, safi_t safi, struct prefix *p, struct static_
322322
{
323323
/* Update route in kernel if it's in fib */
324324
if (CHECK_FLAG(rib->status, RIB_ENTRY_SELECTED_FIB))
325-
rib_install_kernel (rn, rib, 1);
325+
rib_install_kernel (rn, rib, rib);
326326
/* Update redistribution if it's selected */
327327
if (CHECK_FLAG(rib->flags, ZEBRA_FLAG_SELECTED))
328328
redistribute_update (&rn->p, rib, NULL);

0 commit comments

Comments
 (0)