Hello,

The attached patch fixes: https://fedorahosted.org/sssd/ticket/2860

This provides an option used primarily for testing purpose to ignore network status changes from the netlink interface(helpful when sssd should remaining in offline/online mode)

===================================

Before the patch, restarting the network triggers sssd to go back online

(Mon Aug 8 15:50:18 2016) [sssd] [route_msg_debug_print] (0x1000): route idx 1 flags 0 family 10 addr 2002:ac10::/28 (Mon Aug 8 15:50:18 2016) [sssd] [network_status_change_cb] (0x2000): A networking status change detected signaling providers to reset offline status (Mon Aug 8 15:50:18 2016) [sssd] [sbus_add_timeout] (0x2000): 0x21af1a0 (Mon Aug 8 15:50:18 2016) [sssd] [sbus_remove_timeout] (0x2000): 0x21af1a0 (Mon Aug 8 15:50:18 2016) [sssd] [sbus_dispatch] (0x4000): dbus conn: 0x21ba170 (Mon Aug 8 15:50:18 2016) [sssd] [sbus_dispatch] (0x4000): Dispatching. (Mon Aug 8 15:50:18 2016) [sssd] [message_type] (0x0200): netlink Message type: 24 (Mon Aug 8 15:50:18 2016) [sssd] [route_msg_debug_print] (0x1000): route idx 1 flags 0 family 10 addr 2002:c0a8::/32 (Mon Aug 8 15:50:18 2016) [sssd] [network_status_change_cb] (0x2000): A networking status change detected signaling providers to reset offline status (Mon Aug 8 15:50:18 2016) [sssd] [sbus_add_timeout] (0x2000): 0x21bd2a0 (Mon Aug 8 15:50:18 2016) [sssd] [sbus_remove_timeout] (0x2000): 0x21bd2a0 (Mon Aug 8 15:50:18 2016) [sssd] [sbus_dispatch] (0x4000): dbus conn: 0x21ba170 (Mon Aug 8 15:50:18 2016) [sssd] [sbus_dispatch] (0x4000): Dispatching. (Mon Aug 8 15:50:18 2016) [sssd] [message_type] (0x0200): netlink Message type: 24

After the patch,

    # pkill -USR1 sssd

    Restart the network, sssd remains offline
    # service network restart

    Test backend lookup with no cache shows backend is still offline
    # id aduser@ad.domain


(Mon Aug 8 16:44:17 2016) [sssd[be[AD.JSTEPHEN]]] [sbus_dispatch] (0x4000): dbus conn: 0x1853d60 (Mon Aug 8 16:44:17 2016) [sssd[be[AD.JSTEPHEN]]] [sbus_dispatch] (0x4000): Dispatching. (Mon Aug 8 16:44:17 2016) [sssd[be[AD.JSTEPHEN]]] [sbus_message_handler] (0x2000): Received SBUS method org.freedesktop.sssd.dataprovider.getAccountInfo on path /org/freedesktop/sssd/dataprovider (Mon Aug 8 16:44:17 2016) [sssd[be[AD.JSTEPHEN]]] [sbus_get_sender_id_send] (0x2000): Not a sysbus message, quit (Mon Aug 8 16:44:17 2016) [sssd[be[AD.JSTEPHEN]]] [dp_attach_req] (0x0400): DP Request [Account #2]: New request. Flags [0x0001]. (Mon Aug 8 16:44:17 2016) [sssd[be[AD.JSTEPHEN]]] [dp_attach_req] (0x0400): Number of active DP request: 1 (Mon Aug 8 16:44:17 2016) [sssd[be[AD.JSTEPHEN]]] [_dp_req_recv] (0x0400): DP Request [Account #2]: Receiving request data. (Mon Aug 8 16:44:17 2016) [sssd[be[AD.JSTEPHEN]]] [dp_req_reply_gen_error] (0x0080): DP Request [Account #2]: Finished. Backend is currently offline. (Mon Aug 8 16:44:17 2016) [sssd[be[AD.JSTEPHEN]]] [dp_table_value_destructor] (0x0400): Removing [0:1:0x0001:1:1::AD.JSTEPHEN:name=myaduser@ad.jstephen] from reply table (Mon Aug 8 16:44:17 2016) [sssd[be[AD.JSTEPHEN]]] [dp_req_destructor] (0x0400): DP Request [Account #2]: Request removed. (Mon Aug 8 16:44:17 2016) [sssd[be[AD.JSTEPHEN]]] [dp_req_destructor] (0x0400): Number of active DP request: 0 (Mon Aug 8 16:44:17 2016) [sssd[nss]] [sss_dp_get_reply] (0x0010): The Data Provider returned an error [org.freedesktop.sssd.Error.DataProvider.Offline]


Kind regards,

Justin Stephenson

>From a22f1b5f1fe0ae8bd60c238b0069a26f1360e02b Mon Sep 17 00:00:00 2001
From: Justin Stephenson <jstep...@redhat.com>
Date: Tue, 9 Aug 2016 11:59:49 -0400
Subject: [PATCH] Add support for disabling netlink use with --disable-netlink
 option

Resolves:
https://fedorahosted.org/sssd/ticket/2860
---
 src/monitor/monitor.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index 89dd0a91d1fbd41dd853cf8745de732b7059d02b..e7537d7303d4c9ef1fef7d073ba7d171a78c8087 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -2341,7 +2341,8 @@ static void missing_resolv_conf(struct tevent_context *ev,
 }
 
 static int monitor_process_init(struct mt_ctx *ctx,
-                                const char *config_file)
+                                const char *config_file,
+                                bool opt_netlinkoff)
 {
     TALLOC_CTX *tmp_ctx;
     struct tevent_signal *tes;
@@ -2472,12 +2473,14 @@ static int monitor_process_init(struct mt_ctx *ctx,
         return ret;
     }
 
-    ret = setup_netlink(ctx, ctx->ev, network_status_change_cb,
-                        ctx, &ctx->nlctx);
-    if (ret != EOK) {
-        DEBUG(SSSDBG_OP_FAILURE,
-              "Cannot set up listening for network notifications\n");
-        return ret;
+    if (opt_netlinkoff == false) {
+        ret = setup_netlink(ctx, ctx->ev, network_status_change_cb,
+                            ctx, &ctx->nlctx);
+        if (ret != EOK) {
+            DEBUG(SSSDBG_OP_FAILURE,
+                  "Cannot set up listening for network notifications\n");
+            return ret;
+        }
     }
 
     /* start providers */
@@ -2773,6 +2776,7 @@ int main(int argc, const char *argv[])
     int opt_interactive = 0;
     int opt_genconf = 0;
     int opt_version = 0;
+    int opt_netlinkoff = 0;
     char *opt_config_file = NULL;
     char *config_file = NULL;
     int flags = 0;
@@ -2789,6 +2793,8 @@ int main(int argc, const char *argv[])
          _("Become a daemon (default)"), NULL }, \
         {"interactive", 'i', POPT_ARG_NONE, &opt_interactive, 0, \
          _("Run interactive (not a daemon)"), NULL}, \
+        {"disable-netlink", '\0', POPT_ARG_NONE, &opt_netlinkoff, 0, \
+         _("Disable netlink interface"), NULL}, \
         {"config", 'c', POPT_ARG_STRING, &opt_config_file, 0, \
          _("Specify a non-default config file"), NULL}, \
         {"genconf", 'g', POPT_ARG_NONE, &opt_genconf, 0, \
@@ -2991,8 +2997,8 @@ int main(int argc, const char *argv[])
     monitor->ev = main_ctx->event_ctx;
     talloc_steal(main_ctx, monitor);
 
-    ret = monitor_process_init(monitor,
-                               config_file);
+    ret = monitor_process_init(monitor, config_file,
+                               opt_netlinkoff);
     if (ret != EOK) return 3;
     talloc_free(tmp_ctx);
 
-- 
2.7.4

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/sssd-devel@lists.fedorahosted.org

Reply via email to