mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
sd-netlink: drop unused ret_messages argument
This is not only unused, the kernel never provide any meaningful reply for batch message. Let's drop it.
This commit is contained in:
@@ -187,8 +187,7 @@ int sd_nfnl_call_batch(
|
||||
sd_netlink *nfnl,
|
||||
sd_netlink_message **messages,
|
||||
size_t n_messages,
|
||||
uint64_t usec,
|
||||
sd_netlink_message ***ret_messages);
|
||||
uint64_t usec);
|
||||
int sd_nfnl_message_new(
|
||||
sd_netlink *nfnl,
|
||||
sd_netlink_message **ret,
|
||||
|
||||
@@ -178,10 +178,8 @@ int sd_nfnl_call_batch(
|
||||
sd_netlink *nfnl,
|
||||
sd_netlink_message **messages,
|
||||
size_t n_messages,
|
||||
uint64_t usec,
|
||||
sd_netlink_message ***ret_messages) {
|
||||
uint64_t usec) {
|
||||
|
||||
_cleanup_free_ sd_netlink_message **replies = NULL;
|
||||
_cleanup_free_ uint32_t *serials = NULL;
|
||||
int r;
|
||||
|
||||
@@ -190,25 +188,15 @@ int sd_nfnl_call_batch(
|
||||
assert_return(messages, -EINVAL);
|
||||
assert_return(n_messages > 0, -EINVAL);
|
||||
|
||||
if (ret_messages) {
|
||||
replies = new0(sd_netlink_message*, n_messages);
|
||||
if (!replies)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
r = sd_nfnl_send_batch(nfnl, messages, n_messages, &serials);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
for (size_t i = 0; i < n_messages; i++)
|
||||
RET_GATHER(r,
|
||||
sd_netlink_read(nfnl, serials[i], usec, ret_messages ? replies + i : NULL));
|
||||
RET_GATHER(r, sd_netlink_read(nfnl, serials[i], usec, /* ret= */ NULL));
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (ret_messages)
|
||||
*ret_messages = TAKE_PTR(replies);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -807,7 +807,7 @@ static int fw_nftables_init_family(sd_netlink *nfnl, int family) {
|
||||
return r;
|
||||
|
||||
assert(msgcnt < ELEMENTSOF(messages));
|
||||
r = sd_nfnl_call_batch(nfnl, messages, msgcnt, NFNL_DEFAULT_TIMEOUT_USECS, NULL);
|
||||
r = sd_nfnl_call_batch(nfnl, messages, msgcnt, NFNL_DEFAULT_TIMEOUT_USECS);
|
||||
if (r < 0 && r != -EEXIST)
|
||||
return r;
|
||||
|
||||
@@ -919,7 +919,7 @@ int nft_set_element_modify_iprange(
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return sd_nfnl_call_batch(nfnl, &m, 1, NFNL_DEFAULT_TIMEOUT_USECS, NULL);
|
||||
return sd_nfnl_call_batch(nfnl, &m, 1, NFNL_DEFAULT_TIMEOUT_USECS);
|
||||
}
|
||||
|
||||
int nft_set_element_modify_ip(
|
||||
@@ -959,7 +959,7 @@ int nft_set_element_modify_ip(
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return sd_nfnl_call_batch(nfnl, &m, 1, NFNL_DEFAULT_TIMEOUT_USECS, NULL);
|
||||
return sd_nfnl_call_batch(nfnl, &m, 1, NFNL_DEFAULT_TIMEOUT_USECS);
|
||||
}
|
||||
|
||||
int nft_set_element_modify_any(
|
||||
@@ -987,7 +987,7 @@ int nft_set_element_modify_any(
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return sd_nfnl_call_batch(nfnl, &m, 1, NFNL_DEFAULT_TIMEOUT_USECS, NULL);
|
||||
return sd_nfnl_call_batch(nfnl, &m, 1, NFNL_DEFAULT_TIMEOUT_USECS);
|
||||
}
|
||||
|
||||
static int af_to_nfproto(int af) {
|
||||
@@ -1124,7 +1124,7 @@ static int fw_nftables_add_local_dnat_internal(
|
||||
return r;
|
||||
|
||||
assert(msgcnt < ELEMENTSOF(messages));
|
||||
r = sd_nfnl_call_batch(nfnl, messages, msgcnt, NFNL_DEFAULT_TIMEOUT_USECS, NULL);
|
||||
r = sd_nfnl_call_batch(nfnl, messages, msgcnt, NFNL_DEFAULT_TIMEOUT_USECS);
|
||||
if (r == -EOVERFLOW && af == AF_INET6) {
|
||||
/* The current implementation of DNAT in systemd requires kernel's
|
||||
* fdb9c405e35bdc6e305b9b4e20ebc141ed14fc81 (v5.8), and the older kernel returns
|
||||
|
||||
Reference in New Issue
Block a user