This email list is read-only.  Emails sent to this list will be discarded
----------------------------------
 .gitignore                                         |    1 -
 README                                             |   24 +++
 configure.ac                                       |   85 +++++++++++
 configure.in                                       |   86 -----------
 include/element.h                                  |    3 +-
 plugins/ethernet.c                                 |   91 ++++++++++++
 plugins/ipv4.c                                     |  156 ++++++++++++++++++++
 plugins/resolvconf.c                               |   26 +++-
 plugins/supplicant.c                               |  136 ++++++++---------
 plugins/supplicant.h                               |   15 ++-
 plugins/wifi.c                                     |   10 ++
 scripts/Makefile.am                                |   12 +--
 scripts/fi.epitest.hostap.WPASupplicant.conf       |   10 --
 scripts/fi.epitest.hostap.WPASupplicant.service.in |    4 -
 src/element.c                                      |   86 ++++++++++-
 src/main.c                                         |    2 +
 test/Makefile.am                                   |    4 +-
 test/disable-network                               |   25 +++
 test/list-networks                                 |   22 +++
 test/monitor-state                                 |   57 +++++++
 test/select-network                                |   40 +++---
 test/start-scanning                                |   19 ++-
 22 files changed, 687 insertions(+), 227 deletions(-)

New commits:
commit 081e214a6fba5282fd9561e52e2edc202b55b964
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Thu Jul 31 17:06:48 2008 +0200

    Add skeleton for setting properties via D-Bus

commit 51671d4aa4c0e487e875c960510cea0da2749bf1
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Thu Jul 31 01:00:21 2008 +0200

    Fix broken start-scanning test script

commit a2e26b701c4017b6ea8acfd21d7c18be365b399d
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Thu Jul 31 00:58:57 2008 +0200

    Add support for Update method via D-Bus

commit e3e75cb4135323aee1f2e2bf08e4f4841ec0d1f1
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Wed Jul 30 22:54:24 2008 +0200

    Add simple test script to monitor states

commit 6d23265f3ef64912639e5d460ef4b74380e14f10
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Wed Jul 30 22:16:37 2008 +0200

    Add support for connected property

commit 8e0a0c3a63075f0769fd909c574ee264671e1da1
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Wed Jul 30 22:15:54 2008 +0200

    Fix network selection and add network disconnect scripts

commit 03c9df24dec069902c415066c81554e4ff249aa7
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Wed Jul 30 20:35:16 2008 +0200

    Use async D-Bus calls and support state change callback

commit c2908070308fc8522dff68a4c2006b6e64b95693
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Wed Jul 30 20:34:25 2008 +0200

    Set IPv4 address and routing information

commit 18e5d7d3de2d5dabb94f8a7c9f665f02bb5ae324
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Wed Jul 30 20:33:44 2008 +0200

    Execute resolvconf command and create Internet element

commit 0a208a97b097a0ef33d002abde857feeb13b1b21
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Wed Jul 30 20:33:08 2008 +0200

    Add default name for Internet elements

commit 664fc8eb9dae45273e2d34eb80c1b0bad093542e
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Wed Jul 30 20:32:34 2008 +0200

    Bring Ethernet device up and down if needed

commit 426271d6f854493529c28632152dec25a6142a1d
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Wed Jul 30 19:41:39 2008 +0200

    Quit when receiving D-Bus disconnect

commit d0274f2868275f4cb0dd0214f4972b84bed81884
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Wed Jul 30 08:01:40 2008 +0200

    Add static property for plain text SSID value

commit df6b76be817b02329dd8eaa538fd9849e342d872
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Wed Jul 30 08:00:41 2008 +0200

    Add test program to list current networks

commit 6fe69067543ec09b4be1354c7b02a7307dc8fe7f
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Wed Jul 30 07:43:37 2008 +0200

    Ignore broken network identifiers

commit 598f0dcc0acd86fe84a693c2e84e7c89b6c3e81e
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Wed Jul 30 07:43:16 2008 +0200

    Print error if interface registration fails

commit 5fde7cb02abca746e442b18e8b251ccdeba276b9
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Wed Jul 30 06:43:52 2008 +0200

    Remove the wpa_supplicant D-Bus scripts

commit e7f97e6cfeb8e50356547663b23e1b8bd5097b70
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Tue Jul 29 23:34:45 2008 +0200

    Define CONNMAN_ELEMENT_TYPE_INTERNET

commit 8f4ff42f40e48954df28bdea79fcdfdb9e201418
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Tue Jul 29 22:35:31 2008 +0200

    Use configure.ac as it is the preferred name

commit 908161662bbe796e2962929ff2131c9bae07f13e
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Sun Jul 27 22:05:38 2008 +0200

    Fill README with details


Diff in this email is a maximum of 400 lines.
diff --git a/.gitignore b/.gitignore
index c9a29fb..c3a0edf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,4 +29,3 @@ src/connman.ver
 src/connman.service
 scripts/connman
 scripts/dhclient-script
-scripts/fi.epitest.hostap.WPASupplicant.service
diff --git a/README b/README
index e69de29..f6be6fb 100644
--- a/README
+++ b/README
@@ -0,0 +1,24 @@
+Connection Manager
+******************
+
+Copyright (C) 2007-2008  Intel Corporation. All rights reserved.
+
+
+Compilation and installation
+============================
+
+In order to compile libgdbus you need following software packages:
+       - GCC compiler
+       - GLib library
+       - D-Bus library
+       - GDBus library
+       - HAL library
+       - SQLite3 library
+
+To configure run:
+       ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
+ 
+Configure automatically searches for all required components and packages. 
+
+To compile and install run:
+       make && make install
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..64196c9
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,85 @@
+AC_PREREQ(2.50)
+AC_INIT()
+
+AM_INIT_AUTOMAKE(connman, 0.0)
+AM_CONFIG_HEADER(config.h)
+
+AM_MAINTAINER_MODE
+
+AC_PREFIX_DEFAULT(/usr/local)
+
+if (test "${CFLAGS}" = ""); then
+       CFLAGS="-Wall -O2 -D_FORTIFY_SOURCE=2"
+fi
+
+AC_LANG_C
+
+AC_PROG_CC
+AC_PROG_CC_PIE
+AC_PROG_INSTALL
+
+m4_define([_LT_AC_TAGCONFIG], [])
+m4_ifdef([AC_LIBTOOL_TAGS], [AC_LIBTOOL_TAGS([])])
+
+AC_DISABLE_STATIC
+AC_PROG_LIBTOOL
+
+AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
+                       [enable compiling with debugging information]), [
+       if (test "${enableval}" = "yes" &&
+                               test "${ac_cv_prog_cc_g}" = "yes"); then
+               CFLAGS="$CFLAGS -g"
+       fi
+])
+
+AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie],
+                       [enable position independent executables flag]), [
+       if (test "${enableval}" = "yes" &&
+                               test "${ac_cv_prog_cc_pie}" = "yes"); then
+               CFLAGS="$CFLAGS -fPIE"
+               LDFLAGS="$LDFLAGS -pie"
+       fi
+])
+
+AC_PATH_PROG(DHCLIENT, [dhclient])
+AC_PATH_PROG(WPASUPPLICANT, [wpa_supplicant])
+
+PKG_CHECK_MODULES(GLIB, glib-2.0, dummy=yes,
+                                AC_MSG_ERROR(glib is required))
+AC_SUBST(GLIB_CFLAGS)
+AC_SUBST(GLIB_LIBS)
+
+PKG_CHECK_MODULES(GTHREAD, gthread-2.0, dummy=yes,
+                               AC_MSG_ERROR(gthread is required))
+AC_SUBST(GTHREAD_CFLAGS)
+AC_SUBST(GTHREAD_LIBS)
+
+PKG_CHECK_MODULES(GMODULE, gmodule-2.0, dummy=yes,
+                               AC_MSG_ERROR(gmodule is required))
+AC_SUBST(GMODULE_CFLAGS)
+AC_SUBST(GMODULE_LIBS)
+
+PKG_CHECK_MODULES(GDBUS, gdbus, dummy=yes,
+                               AC_MSG_ERROR(libgdbus is required))
+AC_SUBST(GDBUS_CFLAGS)
+AC_SUBST(GDBUS_LIBS)
+
+PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, dummy=yes,
+                               AC_MSG_ERROR(libdbus is required))
+AC_SUBST(DBUS_CFLAGS)
+AC_SUBST(DBUS_LIBS)
+
+PKG_CHECK_MODULES(HAL, hal >= 0.5.8, dummy=yes,
+                               AC_MSG_ERROR(libhal is required))
+AC_SUBST(HAL_CFLAGS)
+AC_SUBST(HAL_LIBS)
+
+PKG_CHECK_MODULES(SQLITE, sqlite3, dummy=yes,
+                               AC_MSG_ERROR(sqlite3 is required))
+AC_SUBST(SQLITE_CFLAGS)
+AC_SUBST(SQLITE_LIBS)
+
+AC_OUTPUT(Makefile include/Makefile src/Makefile doc/Makefile
+                       test/Makefile plugins/Makefile scripts/Makefile
+                       scripts/connman src/connman.service connman.pc)
+                       
diff --git a/configure.in b/configure.in
deleted file mode 100644
index 8abdd13..0000000
--- a/configure.in
+++ /dev/null
@@ -1,86 +0,0 @@
-AC_PREREQ(2.50)
-AC_INIT()
-
-AM_INIT_AUTOMAKE(connman, 0.0)
-AM_CONFIG_HEADER(config.h)
-
-AM_MAINTAINER_MODE
-
-AC_PREFIX_DEFAULT(/usr/local)
-
-if (test "${CFLAGS}" = ""); then
-       CFLAGS="-Wall -O2 -D_FORTIFY_SOURCE=2"
-fi
-
-AC_LANG_C
-
-AC_PROG_CC
-AC_PROG_CC_PIE
-AC_PROG_INSTALL
-
-m4_define([_LT_AC_TAGCONFIG], [])
-m4_ifdef([AC_LIBTOOL_TAGS], [AC_LIBTOOL_TAGS([])])
-
-AC_DISABLE_STATIC
-AC_PROG_LIBTOOL
-
-AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
-                       [enable compiling with debugging information]), [
-       if (test "${enableval}" = "yes" &&
-                               test "${ac_cv_prog_cc_g}" = "yes"); then
-               CFLAGS="$CFLAGS -g"
-       fi
-])
-
-AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie],
-                       [enable position independent executables flag]), [
-       if (test "${enableval}" = "yes" &&
-                               test "${ac_cv_prog_cc_pie}" = "yes"); then
-               CFLAGS="$CFLAGS -fPIE"
-               LDFLAGS="$LDFLAGS -pie"
-       fi
-])
-
-AC_PATH_PROG(DHCLIENT, [dhclient])
-AC_PATH_PROG(WPASUPPLICANT, [wpa_supplicant])
-
-PKG_CHECK_MODULES(GLIB, glib-2.0, dummy=yes,
-                                AC_MSG_ERROR(glib is required))
-AC_SUBST(GLIB_CFLAGS)
-AC_SUBST(GLIB_LIBS)
-
-PKG_CHECK_MODULES(GTHREAD, gthread-2.0, dummy=yes,
-                               AC_MSG_ERROR(gthread is required))
-AC_SUBST(GTHREAD_CFLAGS)
-AC_SUBST(GTHREAD_LIBS)
-
-PKG_CHECK_MODULES(GMODULE, gmodule-2.0, dummy=yes,
-                               AC_MSG_ERROR(gmodule is required))
-AC_SUBST(GMODULE_CFLAGS)
-AC_SUBST(GMODULE_LIBS)
-
-PKG_CHECK_MODULES(GDBUS, gdbus, dummy=yes,
-                               AC_MSG_ERROR(libgdbus is required))
-AC_SUBST(GDBUS_CFLAGS)
-AC_SUBST(GDBUS_LIBS)
-
-PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, dummy=yes,
-                               AC_MSG_ERROR(libdbus is required))
-AC_SUBST(DBUS_CFLAGS)
-AC_SUBST(DBUS_LIBS)
-
-PKG_CHECK_MODULES(HAL, hal >= 0.5.8, dummy=yes,
-                               AC_MSG_ERROR(libhal is required))
-AC_SUBST(HAL_CFLAGS)
-AC_SUBST(HAL_LIBS)
-
-PKG_CHECK_MODULES(SQLITE, sqlite3, dummy=yes,
-                               AC_MSG_ERROR(sqlite3 is required))
-AC_SUBST(SQLITE_CFLAGS)
-AC_SUBST(SQLITE_LIBS)
-
-AC_OUTPUT(Makefile include/Makefile src/Makefile doc/Makefile
-                       test/Makefile plugins/Makefile scripts/Makefile
-                       scripts/fi.epitest.hostap.WPASupplicant.service
-                       scripts/connman src/connman.service connman.pc)
-                       
diff --git a/include/element.h b/include/element.h
index e000a58..fb4f70f 100644
--- a/include/element.h
+++ b/include/element.h
@@ -50,7 +50,7 @@ enum connman_element_type {
        CONNMAN_ELEMENT_TYPE_ZEROCONF   = 8,
        CONNMAN_ELEMENT_TYPE_RESOLVER   = 9,
 
-       CONNMAN_ELEMENT_TYPE_CONNECTION = 42,
+       CONNMAN_ELEMENT_TYPE_INTERNET   = 42,
 };
 
 enum connman_element_subtype {
@@ -72,6 +72,7 @@ struct connman_element {
        enum connman_element_type type;
        enum connman_element_subtype subtype;
        enum connman_element_state state;
+       gboolean connected;
        guint16 priority;
 
        struct connman_element *parent;
diff --git a/plugins/ethernet.c b/plugins/ethernet.c
index 21ca7fc..b908940 100644
--- a/plugins/ethernet.c
+++ b/plugins/ethernet.c
@@ -25,6 +25,7 @@
 
 #include <unistd.h>
 #include <string.h>
+#include <sys/ioctl.h>
 #include <sys/socket.h>
 #include <linux/if.h>
 #include <linux/netlink.h>
@@ -219,6 +220,92 @@ static int rtnl_request(void)
                        (struct sockaddr *) &addr, sizeof(addr));
 }
 
+static int iface_up(struct connman_element *element)
+{
+       struct ifreq ifr;
+       int sk, err;
+
+       DBG("element %p", element);
+
+       sk = socket(PF_INET, SOCK_DGRAM, 0);
+       if (sk < 0)
+               return -errno;
+
+       memset(&ifr, 0, sizeof(ifr));
+       ifr.ifr_ifindex = element->netdev.index;
+
+       if (ioctl(sk, SIOCGIFNAME, &ifr) < 0) {
+               err = -errno;
+               goto done;
+       }
+
+       if (ioctl(sk, SIOCGIFFLAGS, &ifr) < 0) {
+               err = -errno;
+               goto done;
+       }
+
+       if (ifr.ifr_flags & IFF_UP) {
+               err = -EALREADY;
+               goto done;
+       }
+
+       ifr.ifr_flags |= IFF_UP;
+
+       if (ioctl(sk, SIOCSIFFLAGS, &ifr) < 0) {
+               err = -errno;
+               goto done;
+       }
+
+       err = 0;
+
+done:
+       close(sk);
+
+       return err;
+}
+
+static int iface_down(struct connman_element *element)
+{
+       struct ifreq ifr;
+       int sk, err;
+
+       DBG("element %p", element);
+
+       sk = socket(PF_INET, SOCK_DGRAM, 0);
+       if (sk < 0)
+               return -errno;
+
+       memset(&ifr, 0, sizeof(ifr));
+       ifr.ifr_ifindex = element->netdev.index;
+
+       if (ioctl(sk, SIOCGIFNAME, &ifr) < 0) {
+               err = -errno;
+               goto done;
+       }
+
+       if (ioctl(sk, SIOCGIFFLAGS, &ifr) < 0) {
+               err = -errno;
+               goto done;
+       }
+
+       if (!(ifr.ifr_flags & IFF_UP)) {
+               err = -EALREADY;
+               goto done;
+       }
+
+       ifr.ifr_flags &= ~IFF_UP;
+
+       if (ioctl(sk, SIOCSIFFLAGS, &ifr) < 0)
+               err = -errno;
+       else
+               err = 0;
+
+done:
+       close(sk);
+
+       return err;
+}
+
 static int ethernet_probe(struct connman_element *element)
 {
        DBG("element %p name %s", element, element->name);
@@ -227,6 +314,8 @@ static int ethernet_probe(struct connman_element *element)
        ethernet_list = g_slist_append(ethernet_list, element);
        g_static_mutex_unlock(&ethernet_mutex);
 
+       iface_up(element);
+
        rtnl_request();
 
        return 0;
@@ -236,6 +325,8 @@ static void ethernet_remove(struct connman_element *element)
 {
        DBG("element %p name %s", element, element->name);
 
+       iface_down(element);
+
        remove_elements(element);
 
        g_static_mutex_lock(&ethernet_mutex);
diff --git a/plugins/ipv4.c b/plugins/ipv4.c
index 6d2e2a8..9654c76 100644
--- a/plugins/ipv4.c
+++ b/plugins/ipv4.c
@@ -23,13 +23,160 @@
 #include <config.h>
 #endif
 
+#include <unistd.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <net/if.h>
+#include <net/route.h>
+
+#include <linux/netlink.h>
+#include <linux/rtnetlink.h>
+
 #include <connman/plugin.h>
 #include <connman/driver.h>
 #include <connman/log.h>
 
+enum connman_ipv4_method {
+       CONNMAN_IPV4_METHOD_UNKNOWN = 0,
+       CONNMAN_IPV4_METHOD_OFF     = 1,
+       CONNMAN_IPV4_METHOD_STATIC  = 2,
+       CONNMAN_IPV4_METHOD_DHCP    = 3,
+};
+
+struct connman_ipv4 {
+       enum connman_ipv4_method method;
+       struct in_addr address;
+       struct in_addr netmask;
_______________________________________________
Commits mailing list
[email protected]
https://www.moblin.org/mailman/listinfo/commits

Reply via email to