Below is patch for Meego bug:
http://bugs.meego.com/show_bug.cgi?id=9934

Connman from git does not build on latest Meego images. connman fails with 
missing xtables library error. Xtables library is provided by iptables package 
version >=1.4.2 . The iptables package available on latest Meego image is 1.4.1 
which does not provide a separate xtables library.

There are two ways to fix this issue:
1. Provide a build time configurable option for xtable. Below is a patch for 
this.
2. If we do not want to build connman without xtable support, then the iptables 
package on Meego should be updated to version >=1.4.2 

Kindly let know which approach needs to be used.

Patch
===
 Makefile.am         |   11 +++++++++--
 bootstrap-configure |    1 +
 configure.ac        |   13 +++++++++----
 src/main.c          |    6 ++++++
 src/tethering.c     |    3 +++
 5 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 651eede..96785dd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -72,7 +72,10 @@ src_connmand_SOURCES = $(gdbus_sources) $(gdhcp_sources) \
                        src/wifi.c src/storage.c src/dbus.c src/config.c \
                        src/technology.c src/counter.c src/location.c \
                        src/session.c src/tethering.c src/ondemand.c \
-                       src/wpad.c src/wispr.c src/stats.c src/iptables.c
+                       src/wpad.c src/wispr.c src/stats.c
+if XTABLES
+src_connmand_SOURCES += src/iptables.c
+endif
 
 src_connmand_LDADD = $(builtin_libadd) @GLIB_LIBS@ @DBUS_LIBS@ \
                                @CAPNG_LIBS@ @XTABLES_LIBS@ -lresolv -ldl
@@ -130,9 +133,13 @@ noinst_PROGRAMS += tools/wispr tools/wifi-scan 
tools/supplicant-test \
                        tools/dhcp-test tools/addr-test \
                        tools/web-test tools/resolv-test \
                        tools/dbus-test tools/polkit-test \
-                       tools/iptables-test tools/tap-test tools/wpad-test \
+                       tools/tap-test tools/wpad-test \
                        tools/stats-ringbuffer-dump
 
+if XTABLES
+noinst_PROGRAMS += tools/iptables-test
+endif
+
 tools_wispr_SOURCES = $(gweb_sources) tools/wispr.c
 tools_wispr_LDADD = @GLIB_LIBS@ @GNUTLS_LIBS@ -lresolv
 
diff --git a/bootstrap-configure b/bootstrap-configure
index 3bce947..1d33729 100755
--- a/bootstrap-configure
+++ b/bootstrap-configure
@@ -34,4 +34,5 @@ fi
                --enable-polkit=builtin \
                --enable-capng \
                --enable-client \
+               --enable-xtables\
                --enable-tools $*
diff --git a/configure.ac b/configure.ac
index a1390f0..45fcbcb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -333,11 +333,16 @@ else
 fi
 AC_SUBST(DBUS_DATADIR)
 
-PKG_CHECK_MODULES(XTABLES, xtables, dummy=yes,
+AC_ARG_ENABLE(xtables, AC_HELP_STRING([--enable-xtables],
+               [enable xtables]), [enable_xtables=${enableval}])
+if (test "${enable_xtables}" = "yes"); then
+       PKG_CHECK_MODULES(XTABLES, xtables, dummy=yes,
                                AC_MSG_ERROR(Xtables library is required))
-AC_SUBST(XTABLES_CFLAGS)
-AC_SUBST(XTABLES_LIBS)
-
+       AC_SUBST(XTABLES_CFLAGS)
+       AC_SUBST(XTABLES_LIBS)
+       AC_DEFINE(HAVE_XTABLES, 1, [Define to 1 if you have xtables library.])
+fi
+AM_CONDITIONAL(XTABLES, test "${enable_xtables}" = "yes")
 
 AC_ARG_ENABLE(systemd, AC_HELP_STRING([--enable-systemd],
                [enable systemd support]), [enable_systemd=${enableval}])
diff --git a/src/main.c b/src/main.c
index 56675bd..8d4de26 100644
--- a/src/main.c
+++ b/src/main.c
@@ -225,7 +225,10 @@ int main(int argc, char *argv[])
        __connman_element_init(option_device, option_nodevice);
 
        __connman_agent_init();
+
+#ifdef HAVE_XTABLES
        __connman_iptables_init();
+#endif
        __connman_tethering_init();
        __connman_counter_init();
        __connman_ondemand_init();
@@ -280,7 +283,10 @@ int main(int argc, char *argv[])
        __connman_counter_cleanup();
        __connman_agent_cleanup();
        __connman_tethering_cleanup();
+
+#ifdef HAVE_XTABLES
        __connman_iptables_cleanup();
+#endif
 
        __connman_element_cleanup();
        __connman_storage_cleanup();
diff --git a/src/tethering.c b/src/tethering.c
index b7e9c84..fc1b87f 100644
--- a/src/tethering.c
+++ b/src/tethering.c
@@ -112,12 +112,15 @@ static int enable_nat(const char *interface)
                return ret;
 
        /* TODO: Flush nat POSTROUTING chain */
+#ifdef HAVE_XTABLES
        /* Enable masquerading */
        ret = __connman_iptables_command("-t nat -A POSTROUTING -o %s -j 
MASQUERADE", interface);
        if (ret < 0)
                return ret;
 
        return __connman_iptables_commit("nat");
+#endif
+       return ret;
 }
 
 static void disable_nat(const char *interface)
===
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to