Fix default route handling in radix4_lockless algo.
Improve nexthop debugging. Reported by: Florian Smeets <flo at smeets.xyz>
This commit is contained in:
parent
180439a173
commit
f733d9701b
@ -322,6 +322,21 @@ fib_error_clear()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
print_op_result(enum flm_op_result result)
|
||||||
|
{
|
||||||
|
switch (result) {
|
||||||
|
case FLM_SUCCESS:
|
||||||
|
return "success";
|
||||||
|
case FLM_REBUILD:
|
||||||
|
return "rebuild";
|
||||||
|
case FLM_ERROR:
|
||||||
|
return "error";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
print_family(int family)
|
print_family(int family)
|
||||||
{
|
{
|
||||||
@ -585,18 +600,18 @@ sync_algo_end_cb(struct rib_head *rnh, enum rib_walk_hook stage, void *_data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fd->hit_nhops) {
|
||||||
|
FD_PRINTF(LOG_INFO, fd, "ran out of nexthops at %u nhops",
|
||||||
|
fd->nh_ref_table->count);
|
||||||
|
if (w->result == FLM_SUCCESS)
|
||||||
|
w->result = FLM_REBUILD;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (stage != RIB_WALK_HOOK_POST || w->result != FLM_SUCCESS)
|
if (stage != RIB_WALK_HOOK_POST || w->result != FLM_SUCCESS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Post-dump hook, dump successful */
|
/* Post-dump hook, dump successful */
|
||||||
|
|
||||||
if (fd->hit_nhops) {
|
|
||||||
FD_PRINTF(LOG_INFO, fd, "ran out of nexthops at %u nhops",
|
|
||||||
fd->nh_ref_table->count);
|
|
||||||
w->result = FLM_REBUILD;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
w->result = fd->fd_flm->flm_dump_end_cb(fd->fd_algo_data, &fd->fd_dp);
|
w->result = fd->fd_flm->flm_dump_end_cb(fd->fd_algo_data, &fd->fd_dp);
|
||||||
|
|
||||||
if (w->result == FLM_SUCCESS) {
|
if (w->result == FLM_SUCCESS) {
|
||||||
@ -648,7 +663,8 @@ sync_algo(struct fib_data *fd)
|
|||||||
|
|
||||||
rib_walk_ext_internal(fd->fd_rh, true, sync_algo_cb, sync_algo_end_cb, &w);
|
rib_walk_ext_internal(fd->fd_rh, true, sync_algo_cb, sync_algo_end_cb, &w);
|
||||||
|
|
||||||
FD_PRINTF(LOG_INFO, fd, "initial dump completed.");
|
FD_PRINTF(LOG_INFO, fd, "initial dump completed, result: %s",
|
||||||
|
print_op_result(w.result));
|
||||||
|
|
||||||
return (w.result);
|
return (w.result);
|
||||||
}
|
}
|
||||||
@ -706,7 +722,6 @@ schedule_destroy_fd_instance(struct fib_data *fd, bool in_callout)
|
|||||||
else
|
else
|
||||||
callout_drain(&fd->fd_callout);
|
callout_drain(&fd->fd_callout);
|
||||||
|
|
||||||
FD_PRINTF(LOG_INFO, fd, "destroying old instance");
|
|
||||||
epoch_call(net_epoch_preempt, destroy_fd_instance_epoch,
|
epoch_call(net_epoch_preempt, destroy_fd_instance_epoch,
|
||||||
&fd->fd_epoch_ctx);
|
&fd->fd_epoch_ctx);
|
||||||
|
|
||||||
@ -859,6 +874,7 @@ try_setup_fd_instance(struct fib_lookup_module *flm, struct rib_head *rh,
|
|||||||
FD_PRINTF(LOG_INFO, fd, "Unable to allocate nhop refcount table (sz:%zu)", size);
|
FD_PRINTF(LOG_INFO, fd, "Unable to allocate nhop refcount table (sz:%zu)", size);
|
||||||
return (FLM_REBUILD);
|
return (FLM_REBUILD);
|
||||||
}
|
}
|
||||||
|
FD_PRINTF(LOG_DEBUG, fd, "Allocated %u nhop indexes", fd->number_nhops);
|
||||||
|
|
||||||
/* Okay, we're ready for algo init */
|
/* Okay, we're ready for algo init */
|
||||||
void *old_algo_data = (old_fd != NULL) ? old_fd->fd_algo_data : NULL;
|
void *old_algo_data = (old_fd != NULL) ? old_fd->fd_algo_data : NULL;
|
||||||
@ -920,7 +936,8 @@ setup_fd_instance(struct fib_lookup_module *flm, struct rib_head *rh,
|
|||||||
}
|
}
|
||||||
NET_EPOCH_EXIT(et);
|
NET_EPOCH_EXIT(et);
|
||||||
|
|
||||||
RH_PRINTF(LOG_INFO, rh, "try %d: fib algo result: %d", i, result);
|
RH_PRINTF(LOG_INFO, rh, "try %d: fib algo result: %s", i,
|
||||||
|
print_op_result(result));
|
||||||
|
|
||||||
if (result == FLM_REBUILD) {
|
if (result == FLM_REBUILD) {
|
||||||
prev_fd = new_fd;
|
prev_fd = new_fd;
|
||||||
|
@ -590,7 +590,7 @@ lradix4_add_route_cb(struct rtentry *rt, void *_data)
|
|||||||
struct lradix4_data *lr = (struct lradix4_data *)_data;
|
struct lradix4_data *lr = (struct lradix4_data *)_data;
|
||||||
struct radix4_addr_entry *ae;
|
struct radix4_addr_entry *ae;
|
||||||
struct sockaddr_in mask;
|
struct sockaddr_in mask;
|
||||||
struct sockaddr *rt_mask = NULL;
|
struct sockaddr *rt_mask;
|
||||||
struct radix_node *rn;
|
struct radix_node *rn;
|
||||||
struct in_addr addr4, mask4;
|
struct in_addr addr4, mask4;
|
||||||
uint32_t scopeid;
|
uint32_t scopeid;
|
||||||
@ -607,12 +607,13 @@ lradix4_add_route_cb(struct rtentry *rt, void *_data)
|
|||||||
ae->addr.sin_len = KEY_LEN_INET;
|
ae->addr.sin_len = KEY_LEN_INET;
|
||||||
ae->addr.sin_addr = addr4;
|
ae->addr.sin_addr = addr4;
|
||||||
|
|
||||||
if (mask4.s_addr != INADDR_ANY) {
|
if (mask4.s_addr != INADDR_BROADCAST) {
|
||||||
bzero(&mask, sizeof(mask));
|
bzero(&mask, sizeof(mask));
|
||||||
mask.sin_len = KEY_LEN_INET;
|
mask.sin_len = KEY_LEN_INET;
|
||||||
mask.sin_addr = mask4;
|
mask.sin_addr = mask4;
|
||||||
rt_mask = (struct sockaddr *)&mask;
|
rt_mask = (struct sockaddr *)&mask;
|
||||||
}
|
} else
|
||||||
|
rt_mask = NULL;
|
||||||
|
|
||||||
rn = lr->rnh->rnh_addaddr((struct sockaddr *)&ae->addr, rt_mask,
|
rn = lr->rnh->rnh_addaddr((struct sockaddr *)&ae->addr, rt_mask,
|
||||||
&lr->rnh->rh, ae->rn);
|
&lr->rnh->rh, ae->rn);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user