platform/netlink: add "rxbuf/txbuf" arguments to nl_socket_new()

This commit is contained in:
Thomas Haller 2022-06-21 20:45:20 +02:00
parent 260d693ec4
commit 80afc691d5
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
3 changed files with 6 additions and 8 deletions

View file

@ -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

View file

@ -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;

View file

@ -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);