Skip to content

Commit fbcadb4

Browse files
committed
UCS/NETLINK: some fixes
1 parent eb97742 commit fbcadb4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/ucs/sys/netlink.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ ucs_netlink_send_request(int protocol, unsigned short nlmsg_type,
176176

177177
static ucs_status_t
178178
ucs_netlink_get_route_info(const struct rtattr *rta, int len, int *if_index_p,
179-
const void **dst_in_addr, unsigned char rtm_dst_len)
179+
const void **dst_in_addr, size_t rtm_dst_len)
180180
{
181181
*if_index_p = -1;
182182
*dst_in_addr = NULL;
@@ -189,8 +189,10 @@ ucs_netlink_get_route_info(const struct rtattr *rta, int len, int *if_index_p,
189189
}
190190
}
191191

192-
/* dst_in_addr is required only for non-default gateway routes */
193-
if ((*if_index_p == -1) || ((*dst_in_addr == NULL) && (rtm_dst_len != 0))) {
192+
if (/* Network interface index is not valid */
193+
(*if_index_p == -1) ||
194+
/* dst_in_addr required but not present */
195+
((rtm_dst_len != 0) && (*dst_in_addr == NULL))) {
194196
return UCS_ERR_INVALID_PARAM;
195197
}
196198

@@ -263,8 +265,6 @@ static void ucs_netlink_lookup_route(ucs_netlink_route_info_t *info)
263265
iface_rules = &kh_val(&ucs_netlink_routing_table_cache, iter);
264266
ucs_array_for_each(curr_entry, iface_rules) {
265267

266-
/* Skip default gateway routes if not allowed (e.g., for
267-
IPoIB remote devices) */
268268
if ((curr_entry->subnet_prefix_len == 0) && !info->allow_default_gw) {
269269
ucs_trace("iface_index=%d: skipping default gateway route",
270270
info->if_index);

0 commit comments

Comments
 (0)