@@ -1613,6 +1613,9 @@ void RouteSync::onRouteMsg(int nlmsg_type, struct nl_object *obj, char *vrf)
16131613 {
16141614 sendOffloadReply (route_obj);
16151615 }
1616+ auto proto_num = rtnl_route_get_protocol (route_obj);
1617+ auto proto_str = getProtocolString (proto_num);
1618+ FieldValueTuple proto (" protocol" , proto_str);
16161619
16171620 switch (rtnl_route_get_type (route_obj))
16181621 {
@@ -1621,6 +1624,7 @@ void RouteSync::onRouteMsg(int nlmsg_type, struct nl_object *obj, char *vrf)
16211624 vector<FieldValueTuple> fvVector;
16221625 FieldValueTuple fv (" blackhole" , " true" );
16231626 fvVector.push_back (fv);
1627+ fvVector.push_back (proto);
16241628 m_routeTable.set (destipprefix, fvVector);
16251629 return ;
16261630 }
@@ -1692,11 +1696,8 @@ void RouteSync::onRouteMsg(int nlmsg_type, struct nl_object *obj, char *vrf)
16921696 }
16931697 }
16941698
1695- auto proto_num = rtnl_route_get_protocol (route_obj);
1696- auto proto_str = getProtocolString (proto_num);
16971699
16981700 vector<FieldValueTuple> fvVector;
1699- FieldValueTuple proto (" protocol" , proto_str);
17001701 FieldValueTuple gw (" nexthop" , gw_list);
17011702 FieldValueTuple intf (" ifname" , intf_list);
17021703
@@ -1776,13 +1777,18 @@ void RouteSync::onLabelRouteMsg(int nlmsg_type, struct nl_object *obj)
17761777 return ;
17771778 }
17781779
1780+ auto proto_num = rtnl_route_get_protocol (route_obj);
1781+ auto proto_str = getProtocolString (proto_num);
1782+ FieldValueTuple proto (" protocol" , proto_str);
1783+
17791784 switch (rtnl_route_get_type (route_obj))
17801785 {
17811786 case RTN_BLACKHOLE:
17821787 {
17831788 vector<FieldValueTuple> fvVector;
17841789 FieldValueTuple fv (" blackhole" , " true" );
17851790 fvVector.push_back (fv);
1791+ fvVector.push_back (proto);
17861792 m_label_routeTable.set (destaddr, fvVector);
17871793 return ;
17881794 }
@@ -2181,14 +2187,11 @@ string RouteSync::getNextHopWt(struct rtnl_route *route_obj)
21812187 struct rtnl_nexthop *nexthop = rtnl_route_nexthop_n (route_obj, i);
21822188 /* Get the weight of next hop */
21832189 uint8_t weight = rtnl_route_nh_get_weight (nexthop);
2184- if (weight)
2185- {
2186- result += to_string (weight);
2187- }
2188- else
2190+ if (weight == 0 )
21892191 {
2190- return " " ;
2192+ weight = 1 ; // default weight is 1
21912193 }
2194+ result += to_string (weight);
21922195
21932196 if (i + 1 < rtnl_route_get_nnexthops (route_obj))
21942197 {
0 commit comments