summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-06-21 20:45:20 +0200
committerThomas Haller <thaller@redhat.com>2022-06-23 20:36:52 +0200
commit80afc691d54b3d8a22e129e598320bba07af92e5 (patch)
tree0890c9617a42329c451855476e1889246cec68e8
parent260d693ec48e7b01714f70aa3b467a56e58d42f9 (diff)
platform/netlink: add "rxbuf/txbuf" arguments to nl_socket_new()
-rw-r--r--src/libnm-platform/nm-linux-platform.c7
-rw-r--r--src/libnm-platform/nm-netlink.c4
-rw-r--r--src/libnm-platform/nm-netlink.h3
3 files changed, 6 insertions, 8 deletions
diff --git a/src/libnm-platform/nm-linux-platform.c b/src/libnm-platform/nm-linux-platform.c
index 9a629a8194..e7f773cd8a 100644
--- a/src/libnm-platform/nm-linux-platform.c
+++ b/src/libnm-platform/nm-linux-platform.c
@@ -9747,7 +9747,7 @@ constructed(GObject *_object)
/*************************************************************************/
- nle = nl_socket_new(&priv->sk_genl_sync, NETLINK_GENERIC, TRUE);
+ nle = nl_socket_new(&priv->sk_genl_sync, NETLINK_GENERIC, TRUE, 0, 0);
g_assert(!nle);
_LOGD("genl: generic netlink socket for sync operations created: port=%u, fd=%d",
@@ -9756,15 +9756,12 @@ constructed(GObject *_object)
/*************************************************************************/
- nle = nl_socket_new(&priv->sk_rtnl, NETLINK_ROUTE, FALSE);
+ nle = nl_socket_new(&priv->sk_rtnl, NETLINK_ROUTE, FALSE, 8 * 1024 * 1024, 0);
g_assert(!nle);
nle = nl_socket_set_passcred(priv->sk_rtnl, 1);
g_assert(!nle);
- nle = nl_socket_set_buffer_size(priv->sk_rtnl, 8 * 1024 * 1024, 0);
- g_assert(!nle);
-
/* explicitly set the msg buffer size and disable MSG_PEEK.
* We use our own receive buffer priv->netlink_recv_buf.
* If we encounter NME_NL_MSG_TRUNC, we will increase the buffer
diff --git a/src/libnm-platform/nm-netlink.c b/src/libnm-platform/nm-netlink.c
index f1918df63b..1760628d2e 100644
--- a/src/libnm-platform/nm-netlink.c
+++ b/src/libnm-platform/nm-netlink.c
@@ -1051,7 +1051,7 @@ nl_socket_disable_msg_peek(struct nl_sock *sk)
/*****************************************************************************/
int
-nl_socket_new(struct nl_sock **out_sk, int protocol, bool blocking)
+nl_socket_new(struct nl_sock **out_sk, int protocol, bool blocking, int bufsize_rx, int bufsize_tx)
{
nm_auto_nlsock struct nl_sock *sk = NULL;
nm_auto_close int fd = -1;
@@ -1088,7 +1088,7 @@ nl_socket_new(struct nl_sock **out_sk, int protocol, bool blocking)
.s_seq_next = t,
};
- nmerr = nl_socket_set_buffer_size(sk, 0, 0);
+ nmerr = nl_socket_set_buffer_size(sk, bufsize_rx, bufsize_tx);
if (nmerr < 0)
return nmerr;
diff --git a/src/libnm-platform/nm-netlink.h b/src/libnm-platform/nm-netlink.h
index f9082c99f1..08fd63bfcb 100644
--- a/src/libnm-platform/nm-netlink.h
+++ b/src/libnm-platform/nm-netlink.h
@@ -489,7 +489,8 @@ nlmsg_put(struct nl_msg *n, uint32_t pid, uint32_t seq, int type, int payload, i
struct nl_sock;
-int nl_socket_new(struct nl_sock **out_sk, int protocol, bool blocking);
+int
+nl_socket_new(struct nl_sock **out_sk, int protocol, bool blocking, int bufsize_rx, int bufsize_tx);
void nl_socket_free(struct nl_sock *sk);