int rc = lnet_cpt_of_nid_show_start(cb);
if (rc < 0)
- return rc;
+ return lnet_nl_send_error(cb->skb,
+ NETLINK_CB(cb->skb).portid,
+ cb->nlh->nlmsg_seq,
+ rc);
}
return lnet_cpt_of_nid_show_dump(msg, cb);
int rc = lnet_net_show_start(cb);
if (rc < 0)
- return rc;
+ return lnet_nl_send_error(cb->skb,
+ NETLINK_CB(cb->skb).portid,
+ cb->nlh->nlmsg_seq,
+ rc);
}
return lnet_net_show_dump(msg, cb);
int portid = NETLINK_CB(cb->skb).portid;
int seq = cb->nlh->nlmsg_seq;
int idx = rlist->lgrl_index;
+ int msg_len = genlmsg_len(gnlh);
int rc = 0;
#ifdef HAVE_NL_DUMP_WITH_EXT_ACK
#endif
if (!rlist->lgrl_count) {
NL_SET_ERR_MSG(extack, "No routes found");
- GOTO(send_error, rc = -ENOENT);
+ GOTO(send_error, rc = msg_len ? -ENOENT : 0);
}
if (!idx) {
}
}
- /* If not routes found send an empty message and not an error */
- if (!rlist->lgrl_count) {
- void *hdr;
-
- hdr = genlmsg_put(msg, portid, seq, &lnet_family,
- NLM_F_MULTI, LNET_CMD_ROUTES);
- if (!hdr) {
- NL_SET_ERR_MSG(extack, "failed to send values");
- genlmsg_cancel(msg, hdr);
- GOTO(send_error, rc = -EMSGSIZE);
- }
- genlmsg_end(msg, hdr);
-
- goto send_error;
- }
-
while (idx < rlist->lgrl_count) {
struct lnet_route_properties *prop;
void *hdr;
int rc = lnet_route_show_start(cb);
if (rc < 0)
- return rc;
+ return lnet_nl_send_error(cb->skb,
+ NETLINK_CB(cb->skb).portid,
+ cb->nlh->nlmsg_seq,
+ rc);
}
return lnet_route_show_dump(msg, cb);
int portid = NETLINK_CB(cb->skb).portid;
int seq = cb->nlh->nlmsg_seq;
int idx = plist->lgpl_index;
+ int msg_len = genlmsg_len(gnlh);
int rc = 0;
#ifdef HAVE_NL_DUMP_WITH_EXT_ACK
#endif
if (!plist->lgpl_count) {
NL_SET_ERR_MSG(extack, "No peers found");
- GOTO(send_error, rc = -ENOENT);
+ GOTO(send_error, rc = msg_len ? -ENOENT : 0);
}
if (!idx) {
int rc = lnet_peer_ni_show_start(cb);
if (rc < 0)
- return rc;
+ return lnet_nl_send_error(cb->skb,
+ NETLINK_CB(cb->skb).portid,
+ cb->nlh->nlmsg_seq,
+ rc);
}
return lnet_peer_ni_show_dump(msg, cb);
int rc = lnet_ping_show_start(cb);
if (rc < 0)
- return rc;
+ return lnet_nl_send_error(cb->skb,
+ NETLINK_CB(cb->skb).portid,
+ cb->nlh->nlmsg_seq,
+ rc);
}
return lnet_ping_show_dump(msg, cb);