routing: Disallow zero nexthop weights in nexthop groups.

Adding such nexthops breaks calc_min_mpath_slots() assumptions,
 thus resulting in the incorrect nexthop group creation and
 eventually leading to panic.
Reported by:	avg
MFC after:	1 week
This commit is contained in:
Alexander V. Chernikov 2021-08-30 21:49:00 +00:00
parent 649ccdd753
commit 0a3a377aee

View File

@ -266,6 +266,8 @@ get_info_weight(const struct rt_addrinfo *info, uint32_t default_weight)
/* Keep upper 1 byte for adm distance purposes */
if (weight > RT_MAX_WEIGHT)
weight = RT_MAX_WEIGHT;
else if (weight == 0)
weight = default_weight;
return (weight);
}