@@ -937,36 +937,38 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id,
937
937
afi = AFI_IP6 ;
938
938
939
939
if (h -> nlmsg_type == RTM_NEWROUTE ) {
940
+ struct route_entry * re ;
941
+ struct nexthop_group * ng = NULL ;
942
+
943
+ re = zebra_rib_route_entry_new (vrf_id , proto , 0 , flags , nhe_id ,
944
+ table , metric , mtu , distance ,
945
+ tag );
946
+ if (!nhe_id )
947
+ ng = nexthop_group_new ();
940
948
941
949
if (!tb [RTA_MULTIPATH ]) {
942
- struct nexthop nh = { 0 } ;
950
+ struct nexthop * nexthop , nh ;
943
951
944
952
if (!nhe_id ) {
945
953
nh = parse_nexthop_unicast (
946
954
ns_id , rtm , tb , bh_type , index , prefsrc ,
947
955
gate , afi , vrf_id );
956
+
957
+ nexthop = nexthop_new ();
958
+ * nexthop = nh ;
959
+ nexthop_group_add_sorted (ng , nexthop );
948
960
}
949
- rib_add (afi , SAFI_UNICAST , vrf_id , proto , 0 , flags , & p ,
950
- & src_p , & nh , nhe_id , table , metric , mtu ,
951
- distance , tag , startup );
952
961
} else {
953
962
/* This is a multipath route */
954
- struct route_entry * re ;
955
- struct nexthop_group * ng = NULL ;
956
963
struct rtnexthop * rtnh =
957
964
(struct rtnexthop * )RTA_DATA (tb [RTA_MULTIPATH ]);
958
965
959
- re = zebra_rib_route_entry_new (vrf_id , proto , 0 , flags ,
960
- nhe_id , table , metric ,
961
- mtu , distance , tag );
962
-
963
966
if (!nhe_id ) {
964
967
uint8_t nhop_num ;
965
968
966
969
/* Use temporary list of nexthops; parse
967
970
* message payload's nexthops.
968
971
*/
969
- ng = nexthop_group_new ();
970
972
nhop_num =
971
973
parse_multipath_nexthops_unicast (
972
974
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,
981
983
ng = NULL ;
982
984
}
983
985
}
984
-
985
- if (nhe_id || ng )
986
- rib_add_multipath (afi , SAFI_UNICAST , & p ,
987
- & src_p , re , ng , startup );
988
- else {
989
- /*
990
- * I really don't see how this is possible
991
- * but since we are testing for it let's
992
- * let the end user know why the route
993
- * that was just received was swallowed
994
- * up and forgotten
995
- */
996
- zlog_err (
997
- "%s: %pFX multipath RTM_NEWROUTE has a invalid nexthop group from the kernel" ,
998
- __func__ , & p );
999
- XFREE (MTYPE_RE , re );
1000
- }
986
+ }
987
+ if (nhe_id || ng )
988
+ rib_add_multipath (afi , SAFI_UNICAST , & p , & src_p , re , ng ,
989
+ startup );
990
+ else {
991
+ /*
992
+ * I really don't see how this is possible
993
+ * but since we are testing for it let's
994
+ * let the end user know why the route
995
+ * that was just received was swallowed
996
+ * up and forgotten
997
+ */
998
+ zlog_err (
999
+ "%s: %pFX multipath RTM_NEWROUTE has a invalid nexthop group from the kernel" ,
1000
+ __func__ , & p );
1001
+ XFREE (MTYPE_RE , re );
1001
1002
}
1002
1003
} else {
1003
1004
if (nhe_id ) {
0 commit comments