ソースを参照

ulogd: fix musl compatibility

 - Avoid non-pointer use of `FILE` type since its just a forward declaration
 - Build with -D_GNU_SOURCE to expose required `struct tcphdr` members

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Jo-Philipp Wich 9 年 前
コミット
d5c31e1bf3
共有2 個のファイルを変更した62 個の追加2 個の削除を含む
  1. 5
    2
      net/ulogd/Makefile
  2. 57
    0
      net/ulogd/patches/100-musl-compat.patch

+ 5
- 2
net/ulogd/Makefile ファイルの表示

@@ -1,5 +1,5 @@
1 1
 #
2
-# Copyright (C) 2006-2014 OpenWrt.org
2
+# Copyright (C) 2006-2015 OpenWrt.org
3 3
 #
4 4
 # This is free software, licensed under the GNU General Public License v2.
5 5
 # See /LICENSE for more information.
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
9 9
 
10 10
 PKG_NAME:=ulogd
11 11
 PKG_VERSION:=2.0.4
12
-PKG_RELEASE:=1
12
+PKG_RELEASE:=2
13 13
 
14 14
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 15
 PKG_SOURCE_URL:=ftp://ftp.netfilter.org/pub/ulogd/ \
@@ -124,6 +124,9 @@ PKG_CONFIG_DEPENDS:= \
124 124
 	CONFIG_PACKAGE_ulogd-mod-pgsql \
125 125
 	CONFIG_PACKAGE_ulogd-mod-sqlite \
126 126
 
127
+TARGET_CFLAGS += \
128
+	-D_GNU_SOURCE \
129
+
127 130
 CONFIGURE_ARGS += \
128 131
 	--enable-nfacct \
129 132
 	--enable-nfct \

+ 57
- 0
net/ulogd/patches/100-musl-compat.patch ファイルの表示

@@ -0,0 +1,57 @@
1
+--- a/src/ulogd.c
2
++++ b/src/ulogd.c
3
+@@ -83,7 +83,7 @@ static char *ulogd_logfile = NULL;
4
+ static const char *ulogd_configfile = ULOGD_CONFIGFILE;
5
+ static const char *ulogd_pidfile = NULL;
6
+ static int ulogd_pidfile_fd = -1;
7
+-static FILE syslog_dummy;
8
++static int ulogd_use_syslog = 0;
9
+ 
10
+ static int info_mode = 0;
11
+ 
12
+@@ -427,7 +427,7 @@ void __ulogd_log(int level, char *file,
13
+ 	if (level < loglevel_ce.u.value)
14
+ 		return;
15
+ 
16
+-	if (logfile == &syslog_dummy) {
17
++	if (ulogd_use_syslog) {
18
+ 		/* FIXME: this omits the 'file' string */
19
+ 		va_start(ap, format);
20
+ 		vsyslog(ulogd2syslog_level(level), format, ap);
21
+@@ -950,7 +950,7 @@ static int logfile_open(const char *name
22
+ 		logfile = stdout;
23
+ 	} else if (!strcmp(name, "syslog")) {
24
+ 		openlog("ulogd", LOG_PID, LOG_DAEMON);
25
+-		logfile = &syslog_dummy;
26
++		ulogd_use_syslog = 1;
27
+ 	} else {
28
+ 		logfile = fopen(ulogd_logfile, "a");
29
+ 		if (!logfile) {
30
+@@ -1240,7 +1240,7 @@ static void sigterm_handler(int signal)
31
+ 	unload_plugins();
32
+ #endif
33
+ 
34
+-	if (logfile != NULL  && logfile != stdout && logfile != &syslog_dummy) {
35
++	if (logfile != NULL  && logfile != stdout) {
36
+ 		fclose(logfile);
37
+ 		logfile = NULL;
38
+ 	}
39
+@@ -1262,7 +1262,7 @@ static void signal_handler(int signal)
40
+ 	switch (signal) {
41
+ 	case SIGHUP:
42
+ 		/* reopen logfile */
43
+-		if (logfile != stdout && logfile != &syslog_dummy) {
44
++		if (logfile != NULL && logfile != stdout) {
45
+ 			fclose(logfile);
46
+ 			logfile = fopen(ulogd_logfile, "a");
47
+  			if (!logfile) {
48
+--- a/filter/raw2packet/ulogd_raw2packet_BASE.c
49
++++ b/filter/raw2packet/ulogd_raw2packet_BASE.c
50
+@@ -42,6 +42,7 @@
51
+ #include <ulogd/ulogd.h>
52
+ #include <ulogd/ipfix_protocol.h>
53
+ #include <netinet/if_ether.h>
54
++#include <linux/types.h>
55
+ #include <string.h>
56
+ 
57
+ enum input_keys {