From: Daniel Wagner <[email protected]>

When something goes wrong during session creation, we end up in
cleanup_routing_table() and try to remove a non existing routing table.
Current kernel version seem to get very confused by it and remove
the built in and default tables which leads to a
non functionial system where even localhost is not accessible anymore.

connmand[17841]: src/session.c:__connman_session_create() owner :1.270
connmand[17841]: plugins/session_policy_pold.c:policy_pold_create() session 
0x5e2c8d0
connmand[17841]: plugins/session_policy_pold.c:get_policy_cb() session 0x5e2c8d0
connmand[17841]: plugins/session_policy_pold.c:get_policy_cb() 
org.freedesktop.DBus.Error.Failed
connmand[17841]: src/session.c:session_policy_config_cb() session 0x5e2c8d0 
config 0x5bcfde0
connmand[17841]: src/session.c:cleanup_session() remove /sessions/_1_270/foo
connmand[17841]: src/session.c:cleanup_routing_table()
---
 src/session.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/session.c b/src/session.c
index b91037c..03a4d39 100644
--- a/src/session.c
+++ b/src/session.c
@@ -72,6 +72,7 @@ struct connman_session {
        uint32_t mark;
        int index;
        char *gateway;
+       bool policy_routing;
 };
 
 struct connman_service_info {
@@ -321,6 +322,7 @@ static int init_routing_table(struct connman_session 
*session)
        if (err < 0)
                __connman_inet_del_fwmark_rule(session->mark,
                                                AF_INET, session->mark);
+       session->policy_routing = true;
 
        return err;
 }
@@ -365,11 +367,14 @@ static void cleanup_routing_table(struct connman_session 
*session)
 {
        DBG("");
 
-       __connman_inet_del_fwmark_rule(session->mark,
+       if (session->policy_routing) {
+               __connman_inet_del_fwmark_rule(session->mark,
                                        AF_INET6, session->mark);
 
-       __connman_inet_del_fwmark_rule(session->mark,
+               __connman_inet_del_fwmark_rule(session->mark,
                                        AF_INET, session->mark);
+               session->policy_routing = false;
+       }
 
        del_default_route(session);
 }
-- 
1.8.5.3

_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman

Reply via email to