[PATCH v4 2/3] platform-linux: open a genl socket



Open another socket to speak Generic Netlink.
This is aimed towards adding WireGuard support, which requires genl.
---
 src/platform/nm-linux-platform.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index b6537d5cb..32d4203b8 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -2987,6 +2987,8 @@ typedef struct {
        GIOChannel *event_channel;
        guint event_id;
 
+       struct nl_sock *genlh;
+
        bool pruning[_DELAYED_ACTION_IDX_REFRESH_ALL_NUM];
 
        bool sysctl_get_warned;
@@ -7094,6 +7096,13 @@ constructed (GObject *_object)
                                        (EVENT_CONDITIONS | ERROR_CONDITIONS | DISCONNECT_CONDITIONS),
                                         event_handler, platform);
 
+       priv->genlh = nl_socket_alloc ();
+       g_assert (priv->genlh);
+
+       nle = nl_connect (priv->genlh, NETLINK_GENERIC);
+       g_assert (!nle);
+       _LOGD ("Generic netlink socket established: port=%u, fd=%d", nl_socket_get_local_port (priv->genlh), 
nl_socket_get_fd (priv->genlh));
+
        /* complete construction of the GObject instance before populating the cache. */
        G_OBJECT_CLASS (nm_linux_platform_parent_class)->constructed (_object);
 
-- 
2.17.1



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]