Remove udhcp plugin
authorMarcel Holtmann <marcel@holtmann.org>
Wed, 28 Jul 2010 01:40:18 +0000 (18:40 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 28 Jul 2010 01:40:18 +0000 (18:40 -0700)
.gitignore
Makefile.am
Makefile.plugins
README
bootstrap-configure
configure.ac
plugins/udhcp.c [deleted file]
scripts/udhcpc-script.c [deleted file]

index 180d5ee..e46f5aa 100644 (file)
@@ -36,7 +36,6 @@ src/connman.service
 src/*-connman.rules
 plugins/connman.policy
 scripts/connman
-scripts/udhcpc-script
 scripts/dhclient-script
 scripts/openconnect-script
 client/cm
index 81561f8..50d80de 100644 (file)
@@ -190,7 +190,6 @@ DISTCHECK_CONFIGURE_FLAGS = --disable-gtk-doc \
                                --enable-wifi \
                                --enable-bluetooth \
                                --enable-ofono \
-                               --enable-udhcp \
                                --enable-dhclient \
                                --enable-dnsproxy \
                                --enable-google \
index 7f74333..4ca78d3 100644 (file)
@@ -81,22 +81,6 @@ plugins_ofono_la_LDFLAGS = $(plugin_ldflags)
 endif
 endif
 
-if UDHCP
-if UDHCP_BUILTIN
-builtin_modules += udhcp
-builtin_sources += plugins/udhcp.c
-builtin_cflags += -DUDHCPC=\"@UDHCPC@\"
-else
-plugin_LTLIBRARIES += plugins/udhcp.la
-plugin_objects += $(plugins_udhcp_la_OBJECTS)
-plugins_udhcp_la_SOURCES = plugins/udhcp.c
-plugins_udhcp_la_CFLAGS = $(plugin_cflags) -DUDHCPC=\"@UDHCPC@\" \
-                                       -DSTATEDIR=\""$(statedir)"\" \
-                                       -DSCRIPTDIR=\""$(build_scriptdir)"\"
-plugins_udhcp_la_LDFLAGS = $(plugin_ldflags)
-endif
-endif
-
 if DHCLIENT
 if DHCLIENT_BUILTIN
 builtin_modules += dhclient
@@ -220,12 +204,6 @@ plugins_fake_la_LDFLAGS = $(plugin_ldflags)
 endif
 
 
-if UDHCP
-script_PROGRAMS += scripts/udhcpc-script
-
-scripts_udhcpc_script_LDADD = @DBUS_LIBS@
-endif
-
 if OPENCONNECT
 script_PROGRAMS += scripts/openconnect-script
 
diff --git a/README b/README
index 0c25fe2..d8524e2 100644 (file)
--- a/README
+++ b/README
@@ -18,7 +18,7 @@ Various plugins can be enabled for networking support:
        - Bluetooth plugin
 
 Also plugins with additional features are available:
-       - DHCP plugins (uDHCP and dhclient)
+       - DHCP plugin (dhclient)
        - Resolver plugin (DNS proxy)
        - Loopback setup
        - PolicyKit support
@@ -61,13 +61,6 @@ For a working system, certain configuration options need to be enabled:
 
                Enable support for Bluetooth devices (requires BlueZ)
 
-       --enable-udhcp
-
-               Enable DHCP client support for BusyBox based systems
-
-               The location of the udhcpc binary is auto-detected, but it
-               can be overwritten via --with-udhcpc=<path-to-binary>.
-
        --enable-dhclient
 
                Enable DHCP client support for ISC dhclient based systems
index 9c597cd..1045688 100755 (executable)
@@ -21,7 +21,6 @@ fi
                --enable-wifi=builtin \
                --enable-bluetooth=builtin \
                --enable-ofono=builtin \
-               --enable-udhcp=builtin \
                --enable-dhclient=builtin \
                --enable-openconnect=builtin \
                --enable-dnsproxy=builtin \
index 745e5db..1efa9b4 100644 (file)
@@ -98,23 +98,6 @@ AC_ARG_ENABLE(ofono,
 AM_CONDITIONAL(OFONO, test "${enable_ofono}" != "no")
 AM_CONDITIONAL(OFONO_BUILTIN, test "${enable_ofono}" = "builtin")
 
-AC_ARG_WITH(udhcpc, AC_HELP_STRING([--with-udhcpc=PROGRAM],
-       [specify location of udhcpc binary]), [path_udhcpc=${withval}])
-
-AC_ARG_ENABLE(udhcp,
-       AC_HELP_STRING([--enable-udhcp], [enable uDHCP support]),
-                       [enable_udhcp=${enableval}], [enable_udhcp="no"])
-if (test "${enable_udhcp}" != "no"); then
-       if (test -z "${path_udhcpc}"); then
-               AC_PATH_PROG(UDHCPC, [udhcpc], [], $PATH:/sbin:/usr/sbin)
-       else
-               UDHCPC="${path_udhcpc}"
-               AC_SUBST(UDHCPC)
-       fi
-fi
-AM_CONDITIONAL(UDHCP, test "${enable_udhcp}" != "no")
-AM_CONDITIONAL(UDHCP_BUILTIN, test "${enable_udhcp}" = "builtin")
-
 AC_ARG_WITH(dhclient, AC_HELP_STRING([--with-dhclient=PROGRAM],
        [specify location of dhclient binary]), [path_dhclient=${withval}])
 
diff --git a/plugins/udhcp.c b/plugins/udhcp.c
deleted file mode 100644 (file)
index 4ae7cf4..0000000
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- *
- *  Connection Manager
- *
- *  Copyright (C) 2007-2010  Intel Corporation. All rights reserved.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 2 as
- *  published by the Free Software Foundation.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <errno.h>
-#include <unistd.h>
-
-#include <gdbus.h>
-
-#define CONNMAN_API_SUBJECT_TO_CHANGE
-#include <connman/plugin.h>
-#include <connman/utsname.h>
-#include <connman/dhcp.h>
-#include <connman/task.h>
-#include <connman/log.h>
-
-struct udhcp_data {
-       struct connman_task *task;
-       struct connman_dhcp *dhcp;
-       char *ifname;
-};
-
-static void udhcp_unlink(const char *ifname)
-{
-       char *pathname;
-
-       pathname = g_strdup_printf("%s/udhcpc.%s.pid",
-                                               STATEDIR, ifname);
-       unlink(pathname);
-       g_free(pathname);
-}
-
-static void udhcp_notify(struct connman_task *task,
-                               DBusMessage *msg, void *user_data)
-{
-       struct connman_dhcp *dhcp = user_data;
-       const char *interface, *address, *netmask, *broadcast, *gateway, *dns, *action;
-
-       DBG("");
-
-       dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &interface,
-                                       DBUS_TYPE_STRING, &address,
-                                       DBUS_TYPE_STRING, &netmask,
-                                       DBUS_TYPE_STRING, &broadcast,
-                                       DBUS_TYPE_STRING, &gateway,
-                                       DBUS_TYPE_STRING, &dns,
-                                       DBUS_TYPE_STRING, &action,
-                                                       DBUS_TYPE_INVALID);
-
-       DBG("%s address %s gateway %s", action, address, gateway);
-
-       connman_dhcp_set_value(dhcp, "Address", address);
-       connman_dhcp_set_value(dhcp, "Netmask", netmask);
-       connman_dhcp_set_value(dhcp, "Gateway", gateway);
-       connman_dhcp_set_value(dhcp, "Broadcast", broadcast);
-       connman_dhcp_set_value(dhcp, "Nameserver", dns);
-
-       if (g_strcmp0(action, "bound") == 0) {
-               connman_dhcp_bound(dhcp);
-       } else if (g_strcmp0(action, "renew") == 0) {
-               connman_dhcp_bound(dhcp);
-       } else {
-               connman_error("Unknown action %s", action);
-       }
-}
-
-static void udhcp_died(struct connman_task *task, void *user_data)
-{
-       struct udhcp_data *udhcpc = user_data;
-
-       connman_dhcp_set_data(udhcpc->dhcp, NULL);
-
-       connman_dhcp_unref(udhcpc->dhcp);
-
-       connman_task_destroy(udhcpc->task);
-       udhcpc->task = NULL;
-
-       udhcp_unlink(udhcpc->ifname);
-
-       g_free(udhcpc->ifname);
-       g_free(udhcpc);
-}
-
-
-static void udhcp_setup(struct connman_task *task, const char *ifname)
-{
-       const char *path, *hostname;
-
-       path = connman_task_get_path(task);
-
-       DBG("path %s", path);
-
-       connman_task_add_argument(task, "-f", NULL);
-       connman_task_add_argument(task, "-i", "%s", ifname);
-       connman_task_add_argument(task, "-p", "%s/udhcpc.%s.pid", STATEDIR, ifname);
-       connman_task_add_argument(task, "-s", "%s/udhcpc-script", SCRIPTDIR);
-
-       hostname = connman_utsname_get_hostname();
-       if (hostname != NULL)
-               connman_task_add_argument(task, "-H", hostname);
-
-       connman_task_add_variable(task, "PATH", path);
-
-}
-
-
-static int udhcp_request(struct connman_dhcp *dhcp)
-{
-       struct udhcp_data *udhcpc;
-
-       DBG("dhcp %p %s", dhcp, UDHCPC);
-
-       if (access(UDHCPC, X_OK) < 0)
-               return -EIO;
-
-       udhcpc = g_try_new0(struct udhcp_data, 1);
-       if (udhcpc == NULL)
-               return -ENOMEM;
-
-       udhcpc->task = connman_task_create(UDHCPC);
-       if (udhcpc->task == NULL) {
-               g_free(udhcpc);
-               return -ENOMEM;
-       }
-
-       udhcpc->dhcp = connman_dhcp_ref(dhcp);
-       udhcpc->ifname = connman_dhcp_get_interface(dhcp);
-
-       udhcp_setup(udhcpc->task, udhcpc->ifname);
-
-       connman_dhcp_set_data(dhcp, udhcpc);
-
-       connman_task_set_notify(udhcpc->task, "Notify",
-                                               udhcp_notify, dhcp);
-
-       connman_task_run(udhcpc->task, udhcp_died, udhcpc,
-                                       NULL, NULL, NULL);
-
-       return 0;
-}
-
-static int udhcp_release(struct connman_dhcp *dhcp)
-{
-       struct udhcp_data *udhcpc = connman_dhcp_get_data(dhcp);
-
-       DBG("udhcp %p", udhcpc);
-
-       if (udhcpc == NULL)
-               return -ESRCH;
-
-       if (udhcpc->task != NULL)
-               connman_task_stop(udhcpc->task);
-
-       udhcp_unlink(udhcpc->ifname);
-
-       return 0;
-}
-
-
-static struct connman_dhcp_driver udhcp_driver = {
-       .name           = "udhcp",
-       .priority       = CONNMAN_DHCP_PRIORITY_LOW,
-       .request        = udhcp_request,
-       .release        = udhcp_release,
-};
-
-static int udhcp_init(void)
-{
-       return connman_dhcp_driver_register(&udhcp_driver);
-}
-
-static void udhcp_exit(void)
-{
-       connman_dhcp_driver_unregister(&udhcp_driver);
-}
-
-CONNMAN_PLUGIN_DEFINE(udhcp, "uDHCP client plugin", VERSION,
-               CONNMAN_PLUGIN_PRIORITY_LOW, udhcp_init, udhcp_exit)
diff --git a/scripts/udhcpc-script.c b/scripts/udhcpc-script.c
deleted file mode 100644 (file)
index 5d417b5..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- *
- *  Connection Manager
- *
- *  Copyright (C) 2007-2010  Intel Corporation. All rights reserved.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 2 as
- *  published by the Free Software Foundation.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <dbus/dbus.h>
-
-#define UDHCPC_INTF  "net.busybox.udhcpc"
-#define UDHCPC_PATH  "/net/busybox/udhcpc"
-
-int main(int argc, char *argv[])
-{
-       DBusConnection *conn;
-       DBusError error;
-       DBusMessage *msg;
-       char *busname, *interface, *address, *netmask, *broadcast;
-       char *gateway, *dns;
-       char *path;
-
-       if (argc < 2)
-               return 0;
-
-       if (strcmp(argv[1], "bound") != 0 && strcmp(argv[1], "renew") != 0)
-               return 0;
-
-       busname = "org.moblin.connman";
-
-       interface = getenv("interface");
-
-       path = getenv("PATH");
-       if (path == NULL)
-               path = "";
-
-       address = getenv("ip");
-       if (address == NULL)
-               address = "";
-
-       netmask = getenv("subnet");
-       if (netmask == NULL)
-               netmask = "";
-
-       broadcast = getenv("broadcast");
-       if (broadcast == NULL)
-               broadcast = "";
-
-       gateway = getenv("router");
-       if (gateway == NULL)
-               gateway = "";
-
-       dns = getenv("dns");
-       if (dns == NULL)
-               dns = "";
-
-       dbus_error_init(&error);
-
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
-       if (conn == NULL) {
-               if (dbus_error_is_set(&error) == TRUE) {
-                       fprintf(stderr, "%s\n", error.message);
-                       dbus_error_free(&error);
-               } else
-                       fprintf(stderr, "Failed to get on system bus\n");
-               return 0;
-       }
-
-       msg = dbus_message_new_method_call(busname, path,
-                                               "org.moblin.connman.Task",
-                                               "Notify");
-       if (msg == NULL) {
-               dbus_connection_unref(conn);
-               fprintf(stderr, "Failed to allocate method call\n");
-               return 0;
-       }
-
-       dbus_message_set_no_reply(msg, TRUE);
-
-       dbus_message_append_args(msg, DBUS_TYPE_STRING, &interface,
-                                       DBUS_TYPE_STRING, &address,
-                                       DBUS_TYPE_STRING, &netmask,
-                                       DBUS_TYPE_STRING, &broadcast,
-                                       DBUS_TYPE_STRING, &gateway,
-                                       DBUS_TYPE_STRING, &dns,
-                                       DBUS_TYPE_STRING, &argv[1],
-                                                       DBUS_TYPE_INVALID);
-
-       if (dbus_connection_send(conn, msg, NULL) == FALSE)
-               fprintf(stderr, "Failed to send message\n");
-
-       dbus_connection_flush(conn);
-
-       dbus_message_unref(msg);
-
-       dbus_connection_unref(conn);
-
-       return 0;
-}