mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-13 22:57:45 +00:00
zebra: use rib_add_multipath in rt_netlink.c
The new route code path was using a combination of both rib_add() and rib_add_multipath() let's clean it up some to use rib_add_multipath() Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
b0385873fa
commit
07fd1f7e94
@ -937,36 +937,38 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id,
|
||||
afi = AFI_IP6;
|
||||
|
||||
if (h->nlmsg_type == RTM_NEWROUTE) {
|
||||
struct route_entry *re;
|
||||
struct nexthop_group *ng = NULL;
|
||||
|
||||
re = zebra_rib_route_entry_new(vrf_id, proto, 0, flags, nhe_id,
|
||||
table, metric, mtu, distance,
|
||||
tag);
|
||||
if (!nhe_id)
|
||||
ng = nexthop_group_new();
|
||||
|
||||
if (!tb[RTA_MULTIPATH]) {
|
||||
struct nexthop nh = {0};
|
||||
struct nexthop *nexthop, nh;
|
||||
|
||||
if (!nhe_id) {
|
||||
nh = parse_nexthop_unicast(
|
||||
ns_id, rtm, tb, bh_type, index, prefsrc,
|
||||
gate, afi, vrf_id);
|
||||
|
||||
nexthop = nexthop_new();
|
||||
*nexthop = nh;
|
||||
nexthop_group_add_sorted(ng, nexthop);
|
||||
}
|
||||
rib_add(afi, SAFI_UNICAST, vrf_id, proto, 0, flags, &p,
|
||||
&src_p, &nh, nhe_id, table, metric, mtu,
|
||||
distance, tag, startup);
|
||||
} else {
|
||||
/* This is a multipath route */
|
||||
struct route_entry *re;
|
||||
struct nexthop_group *ng = NULL;
|
||||
struct rtnexthop *rtnh =
|
||||
(struct rtnexthop *)RTA_DATA(tb[RTA_MULTIPATH]);
|
||||
|
||||
re = zebra_rib_route_entry_new(vrf_id, proto, 0, flags,
|
||||
nhe_id, table, metric,
|
||||
mtu, distance, tag);
|
||||
|
||||
if (!nhe_id) {
|
||||
uint8_t nhop_num;
|
||||
|
||||
/* Use temporary list of nexthops; parse
|
||||
* message payload's nexthops.
|
||||
*/
|
||||
ng = nexthop_group_new();
|
||||
nhop_num =
|
||||
parse_multipath_nexthops_unicast(
|
||||
ns_id, ng, rtm, rtnh, tb,
|
||||
@ -981,23 +983,22 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id,
|
||||
ng = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (nhe_id || ng)
|
||||
rib_add_multipath(afi, SAFI_UNICAST, &p,
|
||||
&src_p, re, ng, startup);
|
||||
else {
|
||||
/*
|
||||
* I really don't see how this is possible
|
||||
* but since we are testing for it let's
|
||||
* let the end user know why the route
|
||||
* that was just received was swallowed
|
||||
* up and forgotten
|
||||
*/
|
||||
zlog_err(
|
||||
"%s: %pFX multipath RTM_NEWROUTE has a invalid nexthop group from the kernel",
|
||||
__func__, &p);
|
||||
XFREE(MTYPE_RE, re);
|
||||
}
|
||||
}
|
||||
if (nhe_id || ng)
|
||||
rib_add_multipath(afi, SAFI_UNICAST, &p, &src_p, re, ng,
|
||||
startup);
|
||||
else {
|
||||
/*
|
||||
* I really don't see how this is possible
|
||||
* but since we are testing for it let's
|
||||
* let the end user know why the route
|
||||
* that was just received was swallowed
|
||||
* up and forgotten
|
||||
*/
|
||||
zlog_err(
|
||||
"%s: %pFX multipath RTM_NEWROUTE has a invalid nexthop group from the kernel",
|
||||
__func__, &p);
|
||||
XFREE(MTYPE_RE, re);
|
||||
}
|
||||
} else {
|
||||
if (nhe_id) {
|
||||
|
Loading…
Reference in New Issue
Block a user