gprs: Make sure to clean up interfaces
authorDenis Kenzior <denkenz@gmail.com>
Wed, 11 May 2011 18:24:04 +0000 (13:24 -0500)
committerDenis Kenzior <denkenz@gmail.com>
Wed, 11 May 2011 18:29:33 +0000 (13:29 -0500)
When going down, it is sometimes possible for us not to ifconfig down
the interface or reset the MMS context IPv4 address propertly

src/gprs.c

index 0c709ad..9d6e829 100644 (file)
@@ -1362,6 +1362,16 @@ static gboolean context_dbus_unregister(struct pri_context *ctx)
        DBusConnection *conn = ofono_dbus_get_connection();
        char path[256];
 
+       if (ctx->active == TRUE) {
+               const char *interface =
+                       ctx->context_driver->settings->interface;
+
+               if (ctx->type == OFONO_GPRS_CONTEXT_TYPE_MMS)
+                       pri_set_ipv4_addr(interface, NULL);
+
+               pri_ifupdown(interface, FALSE);
+       }
+
        strcpy(path, ctx->path);
        idmap_put(ctx->gprs->pid_map, ctx->id);