Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save teslamint/cae1c56719945953293c to your computer and use it in GitHub Desktop.
Save teslamint/cae1c56719945953293c to your computer and use it in GitHub Desktop.
[PATCH][package] AA: update coova-chilli to 1.3.0 and add kmod-coova package
From 2a7568d17915edd283a71f4cc4d4c71d066df912 Mon Sep 17 00:00:00 2001
From: Jaehoon You <teslamint@gmail.com>
Date: Fri, 25 Apr 2014 17:00:48 +0900
Subject: [PATCH] update coova-chilli to 1.3.0; add kmod-coova package;
Based on David Bird's patch: https://lists.openwrt.org/pipermail/openwrt-devel/2012-December/018075.html
Signed-off-by: Jaehoon You <teslamint@gmail.com>
---
net/coova-chilli/Config.in | 56 +++++++++++++
net/coova-chilli/Makefile | 94 ++++++++++++++++++++--
net/coova-chilli/files/chilli.firewall | 41 ++++++++++
net/coova-chilli/files/chilli.init | 61 ++++++++++++++
.../patches/100-fix-sysinfo-redeclaration.patch | 24 ++++++
.../patches/200-fix_compile_kmod.patch | 24 ++++++
6 files changed, 292 insertions(+), 8 deletions(-)
create mode 100644 net/coova-chilli/Config.in
create mode 100644 net/coova-chilli/files/chilli.firewall
create mode 100644 net/coova-chilli/files/chilli.init
create mode 100644 net/coova-chilli/patches/100-fix-sysinfo-redeclaration.patch
create mode 100644 net/coova-chilli/patches/200-fix_compile_kmod.patch
diff --git a/net/coova-chilli/Config.in b/net/coova-chilli/Config.in
new file mode 100644
index 0000000..8057d87
--- /dev/null
+++ b/net/coova-chilli/Config.in
@@ -0,0 +1,56 @@
+# CoovaChilli advanced configuration
+
+menu "Configuration"
+ depends on PACKAGE_coova-chilli
+
+config COOVACHILLI_REDIR
+ bool "Enable support for redir server. Required for uamregex"
+ default n
+
+config COOVACHILLI_MINIPORTAL
+ bool "Enable support Coova miniportal"
+ default n
+
+config COOVACHILLI_USERAGENT
+ bool "Enable recording user-agent"
+ default n
+
+config COOVACHILLI_DNSLOG
+ bool "Enable support to log DNS name queries"
+ default n
+
+config COOVACHILLI_UAMDOMAINFILE
+ bool "Enable loading of mass uamdomains from file"
+ default n
+
+config COOVACHILLI_PROXY
+ bool "Enable proxy"
+ default n
+
+config COOVACHILLI_MINICONFIG
+ bool "Enable mini configuration file"
+ default n
+
+config COOVACHILLI_BINSTATUSFILE
+ bool "Enable binary status file"
+ default n
+
+choice
+ prompt "SSL library"
+ default COOVACHILLI_NOSSL
+
+config COOVACHILLI_NOSSL
+ bool "No SSL support"
+
+config COOVACHILLI_MATRIXSSL
+ bool "MatrixSSL"
+
+config COOVACHILLI_CYASSL
+ bool "CyaSSL"
+
+config COOVACHILLI_OPENSSL
+ bool "OpenSSL"
+
+endchoice
+
+endmenu
diff --git a/net/coova-chilli/Makefile b/net/coova-chilli/Makefile
index 3b350cb..b5bd93c 100644
--- a/net/coova-chilli/Makefile
+++ b/net/coova-chilli/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2007-2010 OpenWrt.org
+# Copyright (C) 2007-2013 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@@ -8,25 +8,42 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=coova-chilli
-PKG_VERSION:=1.2.9
-PKG_RELEASE:=1
+PKG_VERSION:=1.3.0
+PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://ap.coova.org/chilli
-PKG_MD5SUM:=a493d0562fc3b05fe86d8ad65f7f2dc0
+PKG_MD5SUM:=dc0037e3cdebcb60508081b4e42e984a
-PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
+
+PKG_CONFIG_DEPENDS := \
+ COOVACHILLI_MINIPORTAL \
+ COOVACHILLI_REDIR \
+ COOVACHILLI_USERAGENT \
+ COOVACHILLI_DNSLOG \
+ COOVACHILLI_UAMDOMAINFILE \
+ COOVACHILLI_NOSSL \
+ COOVACHILLI_MATRIXSSL \
+ COOVACHILLI_CYASSL \
+ COOVACHILLI_OPENSSL \
+ COOVACHILLI_BINSTATUSFILE \
+ COOVACHILLI_PROXY \
+ COOVACHILLI_MINICONFIG
+
include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/kernel.mk
define Package/coova-chilli
SUBMENU:=Captive Portals
SECTION:=net
CATEGORY:=Network
- DEPENDS:=+kmod-tun +librt
+ DEPENDS:=+kmod-tun +librt +COOVACHILLI_MATRIXSSL:libmatrixssl +COOVACHILLI_CYASSL:libcyassl +COOVACHILLI_OPENSSL:libopenssl
TITLE:=Wireless LAN HotSpot controller (Coova Chilli Version)
URL:=http://www.coova.org/CoovaChilli
+ MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
+ MENU:=1
endef
define Package/coova-chilli/description
@@ -39,8 +56,59 @@ define Package/coova-chilli/description
favorite radius server.
endef
-define Package/coova-chilli/conffiles
-/etc/chilli.conf
+define Package/coova-chilli/config
+ source "$(SOURCE)/Config.in"
+endef
+
+define KernelPackage/coova
+ URL:=http://www.coova.org/CoovaChilli
+ SUBMENU:=Network Support
+ DEPENDS:=+coova-chilli
+ TITLE:=Coova kernel module
+ FILES:=$(PKG_BUILD_DIR)/src/linux/xt_coova.$(LINUX_KMOD_SUFFIX)
+ AUTOLOAD:=$(call AutoLoad,90,coova)
+endef
+
+define KernelPackage/coova/description
+Kernel module for CoovaChilli
+endef
+
+DISABLE_NLS=
+
+CONFIGURE_VARS += \
+ ac_cv_func_malloc_0_nonnull=yes \
+ ac_cv_func_realloc_0_nonnull=yes \
+ ac_cv_func_memcmp_working=yes \
+ ac_cv_func_setvbuf_reversed=no \
+ KERNEL_DIR="$(LINUX_DIR)"
+
+CONFIGURE_ARGS += \
+ $(if $(CONFIG_COOVACHILLI_REDIR),--enable,--disable)-chilliredir \
+ $(if $(CONFIG_COOVACHILLI_DNSLOG),--enable,--disable)-dnslog \
+ $(if $(CONFIG_COOVACHILLI_MINIPORTAL),--enable,--disable)-miniportal \
+ $(if $(CONFIG_COOVACHILLI_USERAGENT),--enable,--disable)-useragent \
+ $(if $(CONFIG_COOVACHILLI_UAMDOMAINFILE),--enable,--disable)-uamdomainfile \
+ $(if $(CONFIG_COOVACHILLI_MATRIXSSL),--with,--without)-matrixssl \
+ $(if $(CONFIG_COOVACHILLI_CYASSL),--with,--without)-cyassl \
+ $(if $(CONFIG_COOVACHILLI_OPENSSL),--with,--without)-openssl \
+ $(if $(CONFIG_COOVACHILLI_BINSTATUSFILE),--enable,--disable)-binstatusfile \
+ $(if $(CONFIG_COOVACHILLI_PROXY),--enable,--disable)-chilliproxy \
+ $(if $(CONFIG_COOVACHILLI_MINICONFIG),--enable,--disable)-miniconfig \
+ $(if $(CONFIG_PACKAGE_kmod-coova),--with-nfcoova,)
+
+MAKE_FLAGS += \
+ KERNEL_DIR="$(LINUX_DIR)"
+
+MAKE_INSTALL_FLAGS += \
+ KERNEL_DIR="$(LINUX_DIR)" \
+ INSTALL_MOD_PATH="$(PKG_INSTALL_DIR)"
+
+define Build/Configure
+( \
+ cd $(PKG_BUILD_DIR); \
+ rm -rf config.{cache,status} ; \
+ $(call Build/Configure/Default) \
+)
endef
define Package/coova-chilli/install
@@ -52,6 +120,16 @@ define Package/coova-chilli/install
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/chilli* $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/usr/lib/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so.* $(1)/usr/lib/
+ $(INSTALL_DIR) $(1)/etc/init.d
+ $(CP) files/chilli.init $(1)/etc/init.d/chilli
+ $(INSTALL_DIR) $(1)/lib/firewall
+ $(CP) files/chilli.firewall $(1)/lib/firewall/chilli.sh
+ $(if $(CONFIG_PACKAGE_kmod-coova), \
+ $(INSTALL_DIR) $(1)/usr/lib/iptables; \
+ $(CP) $(PKG_BUILD_DIR)/src/linux/lib*.so $(1)/usr/lib/iptables/ \
+ )
endef
$(eval $(call BuildPackage,coova-chilli))
+$(eval $(call KernelPackage,coova))
+
diff --git a/net/coova-chilli/files/chilli.firewall b/net/coova-chilli/files/chilli.firewall
new file mode 100644
index 0000000..e3856c4
--- /dev/null
+++ b/net/coova-chilli/files/chilli.firewall
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+chilli_firewall() {
+ local cfg="$1"
+
+ local network ifname tun
+
+ config_get network "$cfg" network
+
+ . /lib/functions/network.sh
+ network_get_device ifname ${network:-lan}
+
+ if [ "$ifname" = "" ]
+ then
+ config_get ifname "$cfg" dhcpif
+ fi
+
+ config_get tun "$cfg" tundev
+
+ for n in ACCEPT DROP REJECT
+ do
+ iptables -F zone_${network}_${n}
+ iptables -I zone_${network}_${n} -i $tun -j $n
+ iptables -I zone_${network}_${n} -o $tun -j $n
+ done
+
+ iptables -D forward -i ${ifname} -j zone_${network}_forward
+ iptables -A forward -i ${ifname} -j DROP
+ iptables -A forward -i $tun -j zone_${network}_forward
+
+ iptables -D input -i ${ifname} -j zone_${network}
+ iptables -A input -i $tun -j zone_${network}
+
+ iptables -I zone_${network} -p tcp --dport 3990 -j ACCEPT
+ iptables -I zone_${network} -p tcp --dport 3991 -j ACCEPT
+}
+
+chilli_post_core_cb() {
+ config_load chilli
+ config_foreach chilli_firewall chilli
+}
diff --git a/net/coova-chilli/files/chilli.init b/net/coova-chilli/files/chilli.init
new file mode 100644
index 0000000..a72f4f4
--- /dev/null
+++ b/net/coova-chilli/files/chilli.init
@@ -0,0 +1,61 @@
+#!/bin/sh /etc/rc.common
+
+START=30
+STOP=90
+
+config_cb() {
+ chilli_inst=$2
+ if [ "$chilli_inst" != "" ]
+ then
+ rm -f /var/run/chilli_${chilli_inst}*
+ chilli_conf=/var/run/chilli_${chilli_inst}.conf
+ eval "start_chilli_$chilli_inst=1"
+ fi
+}
+
+option_cb() {
+ case "$1" in
+ # UCI settings
+ network)
+ . /lib/functions/network.sh
+ local ifname
+ network_get_device ifname $2
+ echo "dhcpif=\"$ifname\"" >> $chilli_conf
+ ;;
+ disabled)
+ eval "start_chilli_$chilli_inst=0"
+ ;;
+ # boolean settings
+ dhcpbroadcast|nodynip|vlanlocation|locationstopstart|locationcopycalled|locationimmediateupdate|locationopt82|coanoipcheck|noradallow|proxymacaccept|proxyonacct|dhcpmacset|dhcpradius|noc2c|eapolenable|uamanydns|uamanyip|uamnatanyip|nouamsuccess|nowispr1|nowispr2|domaindnslocal|radsec|macauth|macreauth|macauthdeny|macallowlocal|strictmacauth|strictdhcp|ieee8021q|only8021q|radiusoriginalurl|swapoctets|statusfilesave|wpaguests|openidauth|papalwaysok|mschapv2|chillixml|acctupdate|dnsparanoia|seskeepalive|usetap|noarpentries|framedservice|scalewin|redir|injectwispr|redirurl|routeonetone|nousergardendata|uamgardendata|uamotherdata|withunixipc|uamallowpost|redirssl|uamuissl|layer3|patricia|redirdnsreq|dhcpnotidle|ipv6|ipv6only)
+ [ "$2" = "true" -o "$2" = "1" ] && echo "$1" >> $chilli_conf
+ ;;
+ *)
+ echo "$1=\"$2\"" >> $chilli_conf
+ ;;
+ esac
+}
+
+start_chilli() {
+ local cfg="$1"
+ local start_chilli=$(eval "echo \$start_chilli_$cfg")
+ [ "$start_chilli" = "0" ] && return
+ local base=/var/run/chilli_${cfg}
+ chilli -c ${base}.conf \
+ --pidfile ${base}.pid \
+ --cmdsocket ${base}.sock \
+ --unixipc ${base}.ipc &
+}
+
+start() {
+ config_load chilli
+ config_foreach start_chilli chilli
+}
+
+stop() {
+ ls /var/run/chilli*.pid 2>/dev/null && {
+ kill $(cat /var/run/chilli*.pid)
+ sleep 1
+ killall -9 chilli
+ rm -f /var/run/chilli*
+ }
+}
diff --git a/net/coova-chilli/patches/100-fix-sysinfo-redeclaration.patch b/net/coova-chilli/patches/100-fix-sysinfo-redeclaration.patch
new file mode 100644
index 0000000..446eb63
--- /dev/null
+++ b/net/coova-chilli/patches/100-fix-sysinfo-redeclaration.patch
@@ -0,0 +1,24 @@
+--- a/src/system.h
++++ b/src/system.h
+@@ -76,10 +76,6 @@
+ #include <sys/stat.h>
+ #endif
+
+-#ifdef HAVE_SYS_SYSINFO_H
+-#include <sys/sysinfo.h>
+-#endif
+-
+ #ifdef HAVE_TIME_H
+ #include <time.h>
+ #endif
+@@ -132,6 +128,10 @@
+ #include <linux/un.h>
+ #endif
+
++#ifdef HAVE_SYS_SYSINFO_H
++#include <sys/sysinfo.h>
++#endif
++
+ #elif defined (__FreeBSD__) || defined (__APPLE__) || defined (__OpenBSD__) || defined (__NetBSD__)
+ #include <net/if.h>
+ #include <net/bpf.h>
diff --git a/net/coova-chilli/patches/200-fix_compile_kmod.patch b/net/coova-chilli/patches/200-fix_compile_kmod.patch
new file mode 100644
index 0000000..799d26e
--- /dev/null
+++ b/net/coova-chilli/patches/200-fix_compile_kmod.patch
@@ -0,0 +1,24 @@
+--- a/src/linux/Makefile
++++ b/src/linux/Makefile
+@@ -9,7 +9,6 @@ modules:
+ make -C ${KERNEL_DIR} M=$$PWD $@;
+
+ modules_install:
+- make -C ${KERNEL_DIR} M=$$PWD $@;
+
+ modules_clean:
+ make -C ${KERNEL_DIR} M=$$PWD $@;
+@@ -24,9 +23,9 @@ lib%.o: lib%.c
+ $(CC) $(CFLAGS) -fPIC -O2 -Wall -I${KERNEL_DIR}/include -D_INIT=lib$*_init -c -o $@ $<;
+
+ install: modules_install libxt_coova.so
+- mkdir -p $(DESTDIR)/lib/xtables/
+- cp libxt_coova.so $(DESTDIR)/lib/xtables/
++ mkdir -p $(DESTDIR)/usr/lib/iptables/
++ cp libxt_coova.so $(DESTDIR)/usr/lib/iptables/
+
+ distdir:
+
+-distclean: clean
+\ No newline at end of file
++distclean: clean
--
1.8.2.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment