summaryrefslogtreecommitdiffstats
path: root/meta-networking
diff options
context:
space:
mode:
Diffstat (limited to 'meta-networking')
-rw-r--r--meta-networking/recipes-filter/ulogd2/ulogd2/ulogd.init180
-rw-r--r--meta-networking/recipes-filter/ulogd2/ulogd2/ulogd.service11
-rw-r--r--meta-networking/recipes-filter/ulogd2/ulogd2_2.0.7.bb80
3 files changed, 271 insertions, 0 deletions
diff --git a/meta-networking/recipes-filter/ulogd2/ulogd2/ulogd.init b/meta-networking/recipes-filter/ulogd2/ulogd2/ulogd.init
new file mode 100644
index 0000000000..05d284e725
--- /dev/null
+++ b/meta-networking/recipes-filter/ulogd2/ulogd2/ulogd.init
@@ -0,0 +1,180 @@
1#! /bin/sh
2### BEGIN INIT INFO
3# Provides: ulogd2 ulogd
4# Required-Start: $local_fs
5# Should-Start:
6# Required-Stop: $local_fs
7# Should-Stop:
8# Default-Start: 2 3 4 5
9# Default-Stop: 0 1 6
10# Short-Description: Userspace logging daemon for netfilter/iptables
11### END INIT INFO
12
13# The definition of actions: (From LSB 3.1.0)
14# start start the service
15# stop stop the service
16# restart stop and restart the service if the service is already running,
17# otherwise start the service
18# try-restart restart the service if the service is already running
19# reload cause the configuration of the service to be reloaded without
20# actually stopping and restarting the service
21# force-reload cause the configuration to be reloaded if the service supports
22# this, otherwise restart the service if it is running
23# status print the current status of the service
24
25# The start, stop, restart, force-reload, and status actions shall be supported
26# by all init scripts; the reload and the try-restart actions are optional
27
28# PATH should only include /usr/* if it runs after the mountnfs.sh script
29PATH=/sbin:/usr/sbin:/bin:/usr/bin
30
31DESC="Userspace logging daemon for netfilter/iptables"
32NAME="ulogd"
33DAEMON=/usr/sbin/$NAME
34DAEMON_ARGS="-d"
35PIDFILE=/var/run/$NAME.pid
36
37. /etc/init.d/functions || exit 1
38
39# Exit if the package is not installed
40[ -x "$DAEMON" ] || exit 0
41
42# Read configuration variable file if it is present
43[ -r /etc/default/$NAME ] && . /etc/default/$NAME
44
45#
46# Function that starts the daemon/service
47#
48do_start() {
49 local status pid
50
51 status=0
52 pid=`pidofproc $NAME` || status=$?
53 case $status in
54 0)
55 echo "$DESC already running ($pid)."
56 exit 1
57 ;;
58 *)
59 echo "Starting $DESC ..."
60 exec $DAEMON $DAEMON_ARGS >/dev/null 2>&1 || status=$?
61 echo "ERROR: Failed to start $DESC."
62 exit $status
63 ;;
64 esac
65
66 # Add code here, if necessary, that waits for the process to be ready
67 # to handle requests from services started subsequently which depend
68 # on this one. As a last resort, sleep for some time.
69}
70
71#
72# Function that stops the daemon/service
73#
74do_stop() {
75 local pid status
76
77 status=0
78 pid=`pidofproc $NAME` || status=$?
79 case $status in
80 0)
81 # Exit when fail to stop, the kill would complain when fail
82 kill -s 15 $pid >/dev/null && rm -f $PIDFILE && \
83 echo "Stopped $DESC ($pid)." || exit $?
84 ;;
85 *)
86 echo "$DESC is not running; none killed." >&2
87 ;;
88 esac
89
90 # Wait for children to finish too if this is a daemon that forks
91 # and if the daemon is only ever run from this initscript.
92 # If the above conditions are not satisfied then add some other code
93 # that waits for the process to drop all resources that could be
94 # needed by services started subsequently. A last resort is to
95 # sleep for some time.
96 return $status
97}
98
99#
100# Function that sends a SIGHUP to the daemon/service
101#
102do_reload() {
103 local pid status
104
105 status=0
106 # If the daemon can reload its configuration without
107 # restarting (for example, when it is sent a SIGHUP),
108 # then implement that here.
109 pid=`pidofproc $NAME` || status=$?
110 case $status in
111 0)
112 echo "Reloading $DESC ..."
113 kill -s 1 $pid || exit $?
114 ;;
115 *)
116 echo "$DESC is not running; none reloaded." >&2
117 ;;
118 esac
119 exit $status
120}
121
122
123#
124# Function that shows the daemon/service status
125#
126status_of_proc () {
127 local pid status
128
129 status=0
130 # pidof output null when no program is running, so no "2>/dev/null".
131 pid=`pidofproc $NAME` || status=$?
132 case $status in
133 0)
134 echo "$DESC is running ($pid)."
135 exit 0
136 ;;
137 *)
138 echo "$DESC is not running." >&2
139 exit $status
140 ;;
141 esac
142}
143
144case "$1" in
145start)
146 do_start
147 ;;
148stop)
149 do_stop || exit $?
150 ;;
151status)
152 status_of_proc
153 ;;
154restart)
155 # Always start the service regardless the status of do_stop
156 do_stop
157 do_start
158 ;;
159try-restart|force-reload)
160 # force-reload is the same as reload or try-restart according
161 # to its definition, the reload is not implemented here, so
162 # force-reload is the alias of try-restart here, but it should
163 # be the alias of reload if reload is implemented.
164 #
165 # Only start the service when do_stop succeeds
166 do_stop && do_start
167 ;;
168reload)
169 # If the "reload" action is implemented properly, then let the
170 # force-reload be the alias of reload, and remove it from
171 # try-restart|force-reload)
172 #
173 do_reload
174 ;;
175*)
176 echo "Usage: $0 {start|stop|status|restart|try-restart|force-reload}" >&2
177 exit 3
178 ;;
179esac
180
diff --git a/meta-networking/recipes-filter/ulogd2/ulogd2/ulogd.service b/meta-networking/recipes-filter/ulogd2/ulogd2/ulogd.service
new file mode 100644
index 0000000000..cf62962a95
--- /dev/null
+++ b/meta-networking/recipes-filter/ulogd2/ulogd2/ulogd.service
@@ -0,0 +1,11 @@
1[Unit]
2Description=Netfilter Ulogd daemon
3Before=network-pre.target
4Wants=network-pre.target
5
6[Service]
7ExecStart=@SBINDIR@/ulogd
8ExecReload=kill -HUP ${MAINPID}
9
10[Install]
11WantedBy=multi-user.target
diff --git a/meta-networking/recipes-filter/ulogd2/ulogd2_2.0.7.bb b/meta-networking/recipes-filter/ulogd2/ulogd2_2.0.7.bb
new file mode 100644
index 0000000000..7a307dc292
--- /dev/null
+++ b/meta-networking/recipes-filter/ulogd2/ulogd2_2.0.7.bb
@@ -0,0 +1,80 @@
1SUMMARY = "Userspace logging daemon for netfilter/iptables"
2DESCRIPTION = "ulogd-2.x provides a flexible, almost universal logging daemon for \
3netfilter logging. This encompasses both packet-based logging (logging of \
4policy violations) and flow-based logging, e.g. for accounting purpose."
5HOMEPAGE = "https://www.netfilter.org/projects/ulogd/index.html"
6LICENSE = "GPL-2.0-only"
7LIC_FILES_CHKSUM = "file://COPYING;md5=c93c0550bd3173f4504b2cbd8991e50b"
8
9DEPENDS = "libnfnetlink"
10PROVIDES = "ulogd"
11
12PV .= "+git${SRCPV}"
13
14SRC_URI = "git://git.netfilter.org/ulogd2;branch=master \
15 file://ulogd.init \
16 file://ulogd.service \
17"
18SRCREV = "5f9628c9273815b6e560603427fe86118e7cb5bb"
19
20S = "${WORKDIR}/git"
21
22inherit autotools manpages pkgconfig systemd update-rc.d
23
24PACKAGECONFIG ?= "dbi json nfacct nfct nflog pcap sqlite3 ulog"
25PACKAGECONFIG[dbi] = "--enable-dbi,--disable-dbi,libdbi"
26PACKAGECONFIG[json] = "--enable-json,--disable-json,jansson"
27PACKAGECONFIG[manpages] = ""
28PACKAGECONFIG[mysql] = "--enable-mysql,--disable-mysql,mysql5"
29PACKAGECONFIG[nfacct] = "--enable-nfacct,--disable-nfacct,libnetfilter-acct"
30PACKAGECONFIG[nfct] = "--enable-nfct,--disable-nfct,libnetfilter-conntrack"
31PACKAGECONFIG[nflog] = "--enable-nflog,--disable-nflog,libnetfilter-log"
32PACKAGECONFIG[pcap] = "--enable-pcap,--disable-pcap,libpcap"
33PACKAGECONFIG[pgsql] = "--enable-pgsql,--disable-pgsql,postgresql"
34PACKAGECONFIG[sqlite3] = "--enable-sqlite3,--disable-sqlite3,sqlite3"
35PACKAGECONFIG[ulog] = "--enable-ulog,--disable-ulog"
36
37do_install:append () {
38 install -d ${D}${sysconfdir}
39 install -m 0644 ${B}/ulogd.conf ${D}${sysconfdir}/ulogd.conf
40
41 install -d ${D}${mandir}/man8
42 install -m 0644 ${S}/ulogd.8 ${D}${mandir}/man8/ulogd.8
43
44 install -d ${D}${systemd_system_unitdir}
45 install -m 0644 ${WORKDIR}/ulogd.service ${D}${systemd_system_unitdir}
46 sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_system_unitdir}/ulogd.service
47
48 install -d ${D}${sysconfdir}/init.d
49 install -m 755 ${WORKDIR}/ulogd.init ${D}${sysconfdir}/init.d/ulogd
50}
51
52PACKAGES += "${PN}-plugins"
53ALLOW_EMPTY:${PN}-plugins = "1"
54
55PACKAGES_DYNAMIC += "^${PN}-plugin-.*$"
56NOAUTOPACKAGEDEBUG = "1"
57
58CONFFILES:${PN} = "${sysconfdir}/ulogd.conf"
59RRECOMMENDS:${PN} += "${PN}-plugins"
60
61FILES:${PN}-dbg += "${sbindir}/.debug"
62
63python split_ulogd_libs () {
64 libdir = d.expand('${libdir}/ulogd')
65 dbglibdir = os.path.join(libdir, '.debug')
66
67 split_packages = do_split_packages(d, libdir, r'^ulogd_.*\_([A-Z0-9]*).so', '${PN}-plugin-%s', 'ulogd2 %s plugin', prepend=True)
68 split_dbg_packages = do_split_packages(d, dbglibdir, r'^ulogd_.*\_([A-Z0-9]*).so', '${PN}-plugin-%s-dbg', 'ulogd2 %s plugin - Debugging files', prepend=True, extra_depends='${PN}-dbg')
69
70 if split_packages:
71 pn = d.getVar('PN')
72 d.setVar('RRECOMMENDS:' + pn + '-plugins', ' '.join(split_packages))
73 d.appendVar('RRECOMMENDS:' + pn + '-dbg', ' ' + ' '.join(split_dbg_packages))
74}
75PACKAGESPLITFUNCS:prepend = "split_ulogd_libs "
76
77SYSTEMD_SERVICE:${PN} = "ulogd.service"
78
79INITSCRIPT_NAME = "ulogd"
80INITSCRIPT_PARAMS = "defaults"