From 181444facf0796e0503b351f1428ac6653a7e861 Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Sat, 20 Feb 2010 10:20:56 +0000 Subject: [PATCH] [packages] add ucarp (#6612) SVN-Revision: 19773 --- net/ucarp/Makefile | 35 ++++ net/ucarp/files/ucarp.conf | 24 +++ net/ucarp/files/ucarp.init | 64 +++++++ .../100-configure-cross-compilation.patch | 180 ++++++++++++++++++ 4 files changed, 303 insertions(+) create mode 100644 net/ucarp/Makefile create mode 100644 net/ucarp/files/ucarp.conf create mode 100644 net/ucarp/files/ucarp.init create mode 100644 net/ucarp/patches/100-configure-cross-compilation.patch diff --git a/net/ucarp/Makefile b/net/ucarp/Makefile new file mode 100644 index 0000000000..77d63f4a42 --- /dev/null +++ b/net/ucarp/Makefile @@ -0,0 +1,35 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=ucarp +PKG_VERSION:=1.5.1 +PKG_RELEASE:=1 + +PKG_MD5SUM:=9219ea8214198e8af751353a132087bb +PKG_SOURCE_URL:=http://download.pureftpd.org/pub/ucarp +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_CAT:=bzcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(INCLUDE_DIR)/package.mk + +define Package/ucarp + SECTION:=net + CATEGORY:=Network + TITLE:=Lets several hosts share one IP + URL:=http://carp.org +endef + +define Package/ucarp/description + ucarp allows a couple of hosts to share common virtual IP addresses in order + to provide automatic failover. It is a portable userland implementation of the + secure and patent-free Common Address Redundancy Protocol +endef + +define Package/ucarp/install + $(INSTALL_DIR) $(1)/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ucarp $(1)/sbin/ +endef + +$(eval $(call BuildPackage,ucarp)) diff --git a/net/ucarp/files/ucarp.conf b/net/ucarp/files/ucarp.conf new file mode 100644 index 0000000000..db099eafc6 --- /dev/null +++ b/net/ucarp/files/ucarp.conf @@ -0,0 +1,24 @@ +# Usage for AirOS: +# 1) Edit this file and copy it to /etc/persistent/ucarp.conf +# 2) Run: ucarp.init test +# 3) Run: cfgmtd -w -p /etc/ && reboot + +# Interface to run CARP on +IF=br-lan + +# Virtual IP shared with the other system +VIP=10.0.0.117 + +# Size of the network mask for the virtual IP +VMASK=24 + +# Real, static IP of this host +MYIP=192.168.1.20 + +# Password shared with the other system +PASSWORD=love + +# IP addresses to arping after taking over the shared IP, +# you should list all known systems, those not listed can +# take up to a minute to notice the change. +PINGIP="10.0.0.1 10.0.0.20" diff --git a/net/ucarp/files/ucarp.init b/net/ucarp/files/ucarp.init new file mode 100644 index 0000000000..a422d0d5aa --- /dev/null +++ b/net/ucarp/files/ucarp.init @@ -0,0 +1,64 @@ +#!/bin/sh + +CONF=/etc/persistent/ucarp.conf +MODE="$1" + +if [ "${MODE}" = "stop" ] +then + echo "Killing them all and letting init sort them out" + killall ucarp + exit 0 +fi + +if [ -f "${CONF}" ] +then + + if [ "${MODE}" = "test" ] + then + daemon="" + else + echo "Starting UCARP using ${CONF} as a daemon, use test parameter to run in foreground" + daemon="--daemonize" + fi + + . ${CONF} + + cat > /var/run/ucarp-vip-up <> /var/run/ucarp-vip-up < /var/run/ucarp-vip-down <&5 +-$as_echo_n "checking whether snprintf is C99 conformant... " >&6; } +-if test "$cross_compiling" = yes; then +- { { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling +-See \`config.log' for more details." >&5 +-$as_echo "$as_me: error: cannot run test program while cross compiling +-See \`config.log' for more details." >&2;} +- { (exit 1); exit 1; }; } +-else +- cat >conftest.$ac_ext <<_ACEOF +-/* confdefs.h. */ +-_ACEOF +-cat confdefs.h >>conftest.$ac_ext +-cat >>conftest.$ac_ext <<_ACEOF +-/* end confdefs.h. */ +- +-#include +-#ifdef STDC_HEADERS +-# include +-# include +-#else +-# if HAVE_STDLIB_H +-# include +-# endif +-#endif +-#ifdef HAVE_UNISTD_H +-# include +-#endif +- +-int main(void) +-{ +- char buf[4]; +- +- (void) fprintf(fopen("conftestval", "w"), "%d\n", +- (int) snprintf(buf, sizeof buf, "12345678")); +- return 0; +-} +- +-_ACEOF +-rm -f conftest$ac_exeext +-if { (ac_try="$ac_link" +-case "(($ac_try" in +- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; +- *) ac_try_echo=$ac_try;; +-esac +-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +-$as_echo "$ac_try_echo") >&5 +- (eval "$ac_link") 2>&5 +- ac_status=$? +- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 +- (exit $ac_status); } && { ac_try='./conftest$ac_exeext' +- { (case "(($ac_try" in +- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; +- *) ac_try_echo=$ac_try;; +-esac +-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +-$as_echo "$ac_try_echo") >&5 +- (eval "$ac_try") 2>&5 +- ac_status=$? +- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 +- (exit $ac_status); }; }; then +- CONF_SNPRINTF_TYPE=`cat conftestval` +- +-else +- $as_echo "$as_me: program exited with status $ac_status" >&5 +-$as_echo "$as_me: failed program was:" >&5 +-sed 's/^/| /' conftest.$ac_ext >&5 +- +-fi +-rm -rf conftest.dSYM +-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +-fi +- +- +-{ $as_echo "$as_me:$LINENO: result: done" >&5 +-$as_echo "done" >&6; } +-if test "x$CONF_SNPRINTF_TYPE" = "x" ; then +- { $as_echo "$as_me:$LINENO: WARNING: your operating system doesn't implement snprintf" >&5 +-$as_echo "$as_me: WARNING: your operating system doesn't implement snprintf" >&2;} +-else +- + cat >>confdefs.h <<_ACEOF +-#define CONF_SNPRINTF_TYPE $CONF_SNPRINTF_TYPE +-_ACEOF +- +-fi +- +-{ $as_echo "$as_me:$LINENO: checking whether you already have a standard SHA1 implementation" >&5 +-$as_echo_n "checking whether you already have a standard SHA1 implementation... " >&6; } +-if test "$cross_compiling" = yes; then +- { { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling +-See \`config.log' for more details." >&5 +-$as_echo "$as_me: error: cannot run test program while cross compiling +-See \`config.log' for more details." >&2;} +- { (exit 1); exit 1; }; } +-else +- cat >conftest.$ac_ext <<_ACEOF +-/* confdefs.h. */ +-_ACEOF +-cat confdefs.h >>conftest.$ac_ext +-cat >>conftest.$ac_ext <<_ACEOF +-/* end confdefs.h. */ +- +-#include +-#include +-#include +-#include +- +-int main(void) +-{ +- SHA1_CTX ctx; +- char b[41]; +- +- SHA1Init(&ctx); +- SHA1Update(&ctx, (const unsigned char *) "test", 4U); +- SHA1End(&ctx, b); +- b[40] = 0; +- +- return strcasecmp(b, "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3"); +-} +- +-_ACEOF +-rm -f conftest$ac_exeext +-if { (ac_try="$ac_link" +-case "(($ac_try" in +- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; +- *) ac_try_echo=$ac_try;; +-esac +-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +-$as_echo "$ac_try_echo") >&5 +- (eval "$ac_link") 2>&5 +- ac_status=$? +- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 +- (exit $ac_status); } && { ac_try='./conftest$ac_exeext' +- { (case "(($ac_try" in +- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; +- *) ac_try_echo=$ac_try;; +-esac +-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +-$as_echo "$ac_try_echo") >&5 +- (eval "$ac_try") 2>&5 +- ac_status=$? +- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 +- (exit $ac_status); }; }; then +- +-{ $as_echo "$as_me:$LINENO: result: yes" >&5 +-$as_echo "yes" >&6; } +- +-cat >>confdefs.h <<\_ACEOF +-#define USE_SYSTEM_CRYPT_SHA1 /**/ ++#define CONF_SNPRINTF_TYPE 1 + _ACEOF + + +-else +- $as_echo "$as_me: program exited with status $ac_status" >&5 +-$as_echo "$as_me: failed program was:" >&5 +-sed 's/^/| /' conftest.$ac_ext >&5 +- +-( exit $ac_status ) +-{ $as_echo "$as_me:$LINENO: result: no" >&5 +-$as_echo "no" >&6; } +- +-fi +-rm -rf conftest.dSYM +-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +-fi +- +- + + { $as_echo "$as_me:$LINENO: checking whether syslog names are available" >&5 + $as_echo_n "checking whether syslog names are available... " >&6; } -- 2.30.2