summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-networking/recipes-filter/conntrack-tools/conntrack-tools_1.4.0.bb33
-rw-r--r--meta-networking/recipes-filter/conntrack-tools/files/conntrack-failover77
-rw-r--r--meta-networking/recipes-filter/conntrack-tools/files/init87
3 files changed, 197 insertions, 0 deletions
diff --git a/meta-networking/recipes-filter/conntrack-tools/conntrack-tools_1.4.0.bb b/meta-networking/recipes-filter/conntrack-tools/conntrack-tools_1.4.0.bb
new file mode 100644
index 000000000..9938e2478
--- /dev/null
+++ b/meta-networking/recipes-filter/conntrack-tools/conntrack-tools_1.4.0.bb
@@ -0,0 +1,33 @@
1SUMMARY = "Connection tracking userspace tools for Linux"
2LICENSE = "GPLv2+"
3LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b"
4DEPENDS = "libnfnetlink libnetfilter-conntrack libnetfilter-cttimeout \
5 libnetfilter-cthelper libnetfilter-queue"
6
7PR = "r0"
8
9SRC_URI = " \
10 http://www.netfilter.org/projects/conntrack-tools/files/conntrack-tools-${PV}.tar.bz2;name=tar \
11 file://conntrack-failover \
12 file://init \
13 "
14SRC_URI[tar.md5sum] = "ee737c774e01349f75e935228a2d851b"
15SRC_URI[tar.sha256sum] = "036b032a5c4d180aad686df21399d74506b9b3d3000794eb13ac313482e24896"
16
17inherit autotools update-rc.d
18
19INITSCRIPT_NAME = "conntrackd"
20
21do_install_append() {
22 install -d ${D}/${sysconfdir}/conntrackd
23 install -d ${D}/${sysconfdir}/init.d
24 install -m 0644 doc/sync/ftfw/conntrackd.conf ${D}/${sysconfdir}/conntrackd/conntrackd.conf.sample
25 install -m 0755 ${WORKDIR}/conntrack-failover ${D}/${sysconfdir}/init.d/conntrack-failover
26 install -m 0755 ${WORKDIR}/init ${D}/${sysconfdir}/init.d/conntrackd
27
28 # Fix hardcoded paths in scripts
29 sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}/${sysconfdir}/init.d/conntrack-failover ${D}/${sysconfdir}/init.d/conntrackd
30 sed -i 's!/etc/!${sysconfdir}/!g' ${D}/${sysconfdir}/init.d/conntrack-failover ${D}/${sysconfdir}/init.d/conntrackd
31 sed -i 's!/var/!${localstatedir}/!g' ${D}/${sysconfdir}/init.d/conntrack-failover ${D}/${sysconfdir}/init.d/conntrackd ${D}/${sysconfdir}/conntrackd/conntrackd.conf.sample
32 sed -i 's!^export PATH=.*!export PATH=${base_sbindir}:${base_bindir}:${sbindir}:${bindir}!' ${D}/${sysconfdir}/init.d/conntrackd
33}
diff --git a/meta-networking/recipes-filter/conntrack-tools/files/conntrack-failover b/meta-networking/recipes-filter/conntrack-tools/files/conntrack-failover
new file mode 100644
index 000000000..6d92e637f
--- /dev/null
+++ b/meta-networking/recipes-filter/conntrack-tools/files/conntrack-failover
@@ -0,0 +1,77 @@
1#!/bin/sh
2#
3# (C) 2008 by Pablo Neira Ayuso <pablo@netfilter.org>
4# (C) 2009 Roman I Khimov <khimov@altell.ru>
5#
6# This software may be used and distributed according to the terms
7# of the GNU General Public License, incorporated herein by reference.
8#
9# Description:
10#
11# This is the script for primary-backup setups for keepalived
12# (http://www.keepalived.org). You may adapt it to make it work with other
13# high-availability managers.
14#
15# Do not forget to include the required modifications to your keepalived.conf
16# file to invoke this script during keepalived's state transitions.
17#
18# Contributions to improve this script are welcome :).
19#
20## Modified to work as init.d script under pacemaker control
21
22CONNTRACKD_BIN=/usr/sbin/conntrackd
23CONNTRACKD_LOCK=/var/lock/conntrack.lock
24CONNTRACKD_CONFIG=/etc/conntrackd/conntrackd.conf
25
26case "$1" in
27 start)
28 #
29 # commit the external cache into the kernel table
30 #
31 $CONNTRACKD_BIN -C $CONNTRACKD_CONFIG -c
32 if [ $? -eq 1 ]
33 then
34 logger "ERROR: failed to invoke conntrackd -c"
35 fi
36
37 #
38 # flush the internal and the external caches
39 #
40 $CONNTRACKD_BIN -C $CONNTRACKD_CONFIG -f
41 if [ $? -eq 1 ]
42 then
43 logger "ERROR: failed to invoke conntrackd -f"
44 fi
45
46 #
47 # resynchronize my internal cache to the kernel table
48 #
49 $CONNTRACKD_BIN -C $CONNTRACKD_CONFIG -R
50 if [ $? -eq 1 ]
51 then
52 logger "ERROR: failed to invoke conntrackd -R"
53 fi
54
55 #
56 # send a bulk update to backups
57 #
58 $CONNTRACKD_BIN -C $CONNTRACKD_CONFIG -B
59 if [ $? -eq 1 ]
60 then
61 logger "ERROR: failed to invoke conntrackd -B"
62 fi
63 ;;
64 stop)
65 $CONNTRACKD_BIN -t
66 $CONNTRACKD_BIN -n
67 ;;
68 status)
69 ;;
70 *)
71 logger "ERROR: unknown command"
72 echo "Usage: conntrack-failover {start|stop|status}"
73 exit 1
74 ;;
75esac
76
77exit 0
diff --git a/meta-networking/recipes-filter/conntrack-tools/files/init b/meta-networking/recipes-filter/conntrack-tools/files/init
new file mode 100644
index 000000000..bce2075a7
--- /dev/null
+++ b/meta-networking/recipes-filter/conntrack-tools/files/init
@@ -0,0 +1,87 @@
1#!/bin/sh
2#
3# /etc/init.d/conntrackd
4#
5# Maximilian Wilhelm <max@rfc2324.org>
6# -- Mon, 06 Nov 2006 18:39:07 +0100
7#
8# Roman I Khimov <khimov@altell.ru>
9# -- Tue, 27 Oct 2009 14:34:00 +0300
10
11### BEGIN INIT INFO
12# Provides: conntrackd
13# Required-Start: $remote_fs $syslog
14# Required-Stop: $remote_fs $syslog
15# Default-Start: 2 3 4 5
16# Default-Stop: 0 1 6
17# Description: Starts conntrackd
18# short-description: Starts conntrackd
19### END INIT INFO
20
21export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
22
23NAME="conntrackd"
24DAEMON="/usr/sbin/conntrackd"
25CONFIG="/etc/conntrackd/conntrackd.conf"
26PIDFILE="/var/run/${NAME}.pid"
27
28
29# Gracefully exit if there is no daemon (debian way of life)
30if [ ! -x "${DAEMON}" ]; then
31 exit 0
32fi
33
34# Check for config file
35if [ ! -f /etc/conntrackd/conntrackd.conf ]; then
36 echo "Error: There is no config file for $NAME" >&2
37 exit 1;
38fi
39
40case "$1" in
41 start)
42 echo -n "Starting $NAME: "
43 for i in nf_conntrack_netlink nf_conntrack_netbios_ns nf_conntrack_proto_dccp nf_conntrack_tftp \
44 nf_conntrack_sane nf_conntrack_pptp nf_conntrack_irc nf_conntrack_amanda nf_conntrack_h323 \
45 nf_conntrack_proto_udplite nf_conntrack_proto_gre nf_conntrack_proto_sctp nf_conntrack_ftp \
46 nf_conntrack_sip; do
47 modprobe $i >/dev/null 2>/dev/null &
48 done
49 start-stop-daemon --start --quiet --make-pidfile --pidfile "/var/run/${NAME}.pid" --background --exec "${DAEMON}"
50 RET=$?
51 if [ "$?" = "0" ]; then
52 sleep 2
53 # Sync with other server
54 conntrackd -n
55 echo "done."
56 else
57 echo "FAILED!"
58 fi
59 exit $RET
60 ;;
61 stop)
62 echo -n "Stopping $NAME:"
63 start-stop-daemon --stop --quiet --oknodo --pidfile "/var/run/${NAME}.pid" && echo "done." || echo "FAILED!"
64 ;;
65 status)
66 echo -n "conntrackd "
67 start-stop-daemon -q -K -t -x $DAEMON
68 RET=$?
69 if [ "$RET" = "0" ]; then
70 PID=`cat $PIDFILE`
71 echo "($PID) is running"
72 else
73 echo "is not running"
74 exit $RET
75 fi
76 ;;
77 restart)
78 $0 stop
79 $0 start
80 ;;
81
82 *)
83 echo "Usage: /etc/init.d/conntrackd {start|stop|restart}"
84 exit 1
85esac
86
87exit 0