platform/netlink: move generic code in _netlink_recv_handle()
This also applies to genl messages. Move the code.
This commit is contained in:
@@ -4140,8 +4140,7 @@ nmp_object_new_from_nl(NMPlatform *platform,
|
|||||||
{
|
{
|
||||||
const struct nlmsghdr *msghdr;
|
const struct nlmsghdr *msghdr;
|
||||||
|
|
||||||
if (msg->nm_protocol != NETLINK_ROUTE)
|
nm_assert(msg->nm_protocol == NETLINK_ROUTE);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
msghdr = msg->nm_nlh;
|
msghdr = msg->nm_nlh;
|
||||||
|
|
||||||
@@ -9317,9 +9316,6 @@ continue_reading:
|
|||||||
/* FIXME: implement */
|
/* FIXME: implement */
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (netlink_protocol) {
|
|
||||||
case NETLINK_ROUTE:
|
|
||||||
{
|
|
||||||
seq_result = WAIT_FOR_NL_RESPONSE_RESULT_RESPONSE_UNKNOWN;
|
seq_result = WAIT_FOR_NL_RESPONSE_RESULT_RESPONSE_UNKNOWN;
|
||||||
|
|
||||||
if (msg.nm_nlh->nlmsg_type == NLMSG_DONE) {
|
if (msg.nm_nlh->nlmsg_type == NLMSG_DONE) {
|
||||||
@@ -9376,8 +9372,7 @@ continue_reading:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Error message reported back from kernel. */
|
/* Error message reported back from kernel. */
|
||||||
_LOGD(
|
_LOGD("netlink: recvmsg: error message from kernel: %s (%d)%s%s%s for request %d",
|
||||||
"netlink: recvmsg: error message from kernel: %s (%d)%s%s%s for request %d",
|
|
||||||
nm_strerror_native(errsv),
|
nm_strerror_native(errsv),
|
||||||
errsv,
|
errsv,
|
||||||
NM_PRINT_FMT_QUOTED(extack_msg, " \"", extack_msg, "\"", ""),
|
NM_PRINT_FMT_QUOTED(extack_msg, " \"", extack_msg, "\"", ""),
|
||||||
@@ -9388,6 +9383,11 @@ continue_reading:
|
|||||||
} else
|
} else
|
||||||
process_valid_msg = TRUE;
|
process_valid_msg = TRUE;
|
||||||
|
|
||||||
|
switch (netlink_protocol) {
|
||||||
|
default:
|
||||||
|
nm_assert_not_reached();
|
||||||
|
/* fall-through */
|
||||||
|
case NETLINK_ROUTE:
|
||||||
/* check whether the seq number is different from before, and
|
/* check whether the seq number is different from before, and
|
||||||
* whether the previous number (@nlh_seq_last_seen) is a pending
|
* whether the previous number (@nlh_seq_last_seen) is a pending
|
||||||
* refresh-all request. In that case, the pending request is thereby
|
* refresh-all request. In that case, the pending request is thereby
|
||||||
@@ -9410,9 +9410,6 @@ continue_reading:
|
|||||||
event_seq_check(platform, seq_number, seq_result, extack_msg);
|
event_seq_check(platform, seq_number, seq_result, extack_msg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
nm_assert_not_reached();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (abort_parsing)
|
if (abort_parsing)
|
||||||
goto stop;
|
goto stop;
|
||||||
@@ -9425,6 +9422,7 @@ continue_reading:
|
|||||||
/* Multipart message not yet complete, continue reading */
|
/* Multipart message not yet complete, continue reading */
|
||||||
goto continue_reading;
|
goto continue_reading;
|
||||||
}
|
}
|
||||||
|
|
||||||
stop:
|
stop:
|
||||||
if (!handle_events) {
|
if (!handle_events) {
|
||||||
/* when we don't handle events, we want to drain all messages from the socket
|
/* when we don't handle events, we want to drain all messages from the socket
|
||||||
|
Reference in New Issue
Block a user