diff options
| author | Duncan Eastoe <duncan.eastoe@att.com> | 2020-09-28 12:51:19 +0100 | 
|---|---|---|
| committer | Duncan Eastoe <duncan.eastoe@att.com> | 2020-09-29 12:59:30 +0100 | 
| commit | 94f7786375030e08063cdae5b4577edf26adb456 (patch) | |
| tree | 08d20b7e2457f75b6a6d903cbf7d4011fdf1a141 | |
| parent | 1e5b8daf37e2ce4e56015d834988e8c7df9c6f11 (diff) | |
zebra: fix FPM abort for unreach/prohibit routes
b0e9567ed162da708f8d0b3a3caf87cd03b62e96 fixed an issue whereby
zebra would abort while building an update for a blackhole route.
The same issue, `assert(data_len)` failing in
`zfpm_build_route_updates()`, can be observed when building updates
for unreachable and prohibit routes.
To address this `netlink_route_info_fill()` is updated to not
indicate failure, due to lack of nexthops, for any blackhole routes.
Signed-off-by: Duncan Eastoe <duncan.eastoe@att.com>
| -rw-r--r-- | zebra/zebra_fpm_netlink.c | 16 | 
1 files changed, 12 insertions, 4 deletions
diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c index 3e11d53b16..2c07413638 100644 --- a/zebra/zebra_fpm_netlink.c +++ b/zebra/zebra_fpm_netlink.c @@ -335,10 +335,18 @@ static int netlink_route_info_fill(struct netlink_route_info *ri, int cmd,  		}  	} -	/* If there is no useful nexthop then return. */ -	if (ri->rtm_type != RTN_BLACKHOLE && ri->num_nhs == 0) { -		zfpm_debug("netlink_encode_route(): No useful nexthop."); -		return 0; +	if (ri->num_nhs == 0) { +		switch (ri->rtm_type) { +		case RTN_PROHIBIT: +		case RTN_UNREACHABLE: +		case RTN_BLACKHOLE: +			break; +		default: +			/* If there is no useful nexthop then return. */ +			zfpm_debug( +				"netlink_encode_route(): No useful nexthop."); +			return 0; +		}  	}  	return 1;  | 
