FIX net/honeyd -fno-common build error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

FIX net/honeyd -fno-common build error

Bjorn Ketelaars
Fix taken from FreeBSD.

OK?


diff --git Makefile Makefile
index 24ebef0ddd7..bed32c9ad7d 100644
--- Makefile
+++ Makefile
@@ -2,7 +2,7 @@
 
 COMMENT= utility to create virtual hosts on a network
 DISTNAME= honeyd-1.5c
-REVISION= 12
+REVISION= 13
 CATEGORIES= net
 MASTER_SITES= http://www.citi.umich.edu/u/provos/honeyd/ \
  http://niels.xtdnet.nl/honeyd/
diff --git patches/patch-personality_c patches/patch-personality_c
new file mode 100644
index 00000000000..e1d658643d0
--- /dev/null
+++ patches/patch-personality_c
@@ -0,0 +1,18 @@
+$OpenBSD$
+
+Fix -fno-common build error. Taken from
+https://svnweb.freebsd.org/ports?view=revision&revision=549600
+
+Index: personality.c
+--- personality.c.orig
++++ personality.c
+@@ -65,6 +65,9 @@
+ #include "template.h"
+ #include "debug.h"
+
++personalities_t personalities;
++xp_fprints_t xp_fprints;
++
+ /* ET - Moved SPLAY_HEAD to personality.h so xprobe_assoc.c could use it. */
+ int npersons;
+
diff --git patches/patch-personality_h patches/patch-personality_h
new file mode 100644
index 00000000000..cc3c32e2273
--- /dev/null
+++ patches/patch-personality_h
@@ -0,0 +1,28 @@
+$OpenBSD$
+
+Fix -fno-common build error. Taken from
+https://svnweb.freebsd.org/ports?view=revision&revision=549600
+
+Index: personality.h
+--- personality.h.orig
++++ personality.h
+@@ -179,7 +179,8 @@ void xprobe_personality_init(void);
+ void print_perstree(void);
+
+ /* Splay stuff here so other modules can use it */
+-SPLAY_HEAD(perstree, personality) personalities;
++typedef SPLAY_HEAD(perstree, personality) personalities_t;
++extern personalities_t personalities;
+ static int
+ perscompare(struct personality *a, struct personality *b)
+ {
+@@ -187,7 +188,8 @@ perscompare(struct personality *a, struct personality
+ }
+ SPLAY_PROTOTYPE(perstree, personality, node, perscompare);
+
+-SPLAY_HEAD(xp_fprint_tree, xp_fingerprint) xp_fprints;
++typedef SPLAY_HEAD(xp_fprint_tree, xp_fingerprint) xp_fprints_t;
++extern xp_fprints_t xp_fprints;
+ static int
+ xp_fprint_compare(struct xp_fingerprint *a, struct xp_fingerprint *b)
+ {
diff --git patches/patch-stats_h patches/patch-stats_h
new file mode 100644
index 00000000000..d869d69e102
--- /dev/null
+++ patches/patch-stats_h
@@ -0,0 +1,37 @@
+$OpenBSD$
+
+Fix -fno-common build error. Taken from
+https://svnweb.freebsd.org/ports?view=revision&revision=549600
+
+Index: stats.h
+--- stats.h.orig
++++ stats.h
+@@ -89,10 +89,12 @@ struct stats {
+ reserved:4;
+ };
+
+-enum {
++typedef enum {
+ M_COUNTER, M_TV_START, M_TV_END, M_RECORD, M_MAX
+-} measurement_tags;
++} measurement_tags_t;
+
++extern measurement_tags_t measurement_tags;
++
+ struct measurement {
+ uint32_t counter;
+ struct timeval tv_start;
+@@ -103,9 +105,11 @@ struct measurement {
+ #define SHA1_DIGESTSIZE 20
+ #endif
+
+-enum {
++typedef enum {
+ SIG_NAME, SIG_DIGEST, SIG_DATA, SIG_COMPRESSED_DATA, SIG_MAX
+-} signature_tags;
++} signature_tags_t;
++
++extern signature_tags_t signature_tags;
+
+ struct signature {
+ char *name;
diff --git patches/patch-tagging_h patches/patch-tagging_h
new file mode 100644
index 00000000000..8593f9cbbd9
--- /dev/null
+++ patches/patch-tagging_h
@@ -0,0 +1,39 @@
+$OpenBSD$
+
+Fix -fno-common build error. Taken from
+https://svnweb.freebsd.org/ports?view=revision&revision=549600
+
+Index: tagging.h
+--- tagging.h.orig
++++ tagging.h
+@@ -44,12 +44,14 @@ struct hash {
+ u_char digest[SHINGLE_SIZE];
+ };
+
+-enum {
++typedef enum {
+ REC_TV_START, REC_TV_END, REC_SRC, REC_DST, REC_SRC_PORT, REC_DST_PORT,
+ REC_PROTO, REC_STATE, REC_OS_FP, REC_HASH, REC_BYTES, REC_FLAGS,
+ REC_MAX_TAGS
+-} record_tags;
++} record_tags_t;
+
++extern record_tags_t record_tags;
++
+ #define RECORD_STATE_NEW 0x01
+
+ struct record {
+@@ -69,9 +71,11 @@ struct record {
+ TAILQ_HEAD(hashq, hash) hashes; /* optional */
+ };
+
+-enum {
++typedef enum {
+ ADDR_TYPE, ADDR_BITS, ADDR_ADDR, ADDR_MAX_TAGS
+-} address_tags;
++} address_tags_t;
++
++extern address_tags_t address_tags;
+
+ void record_marshal(struct evbuffer *, struct record *);
+
diff --git pkg/PLIST pkg/PLIST
index 44ae4e01d0f..bb1e3e5de11 100644
--- pkg/PLIST
+++ pkg/PLIST
@@ -11,7 +11,7 @@ include/honeyd/hooks.h
 include/honeyd/plugins.h
 include/honeyd/plugins_config.h
 lib/honeyd/
-lib/honeyd/libhoneyd.so
+@so lib/honeyd/libhoneyd.so
 @man man/man1/honeydctl.1
 @man man/man8/honeyd.8
 share/honeyd/

Reply | Threaded
Open this post in threaded view
|

Re: FIX net/honeyd -fno-common build error

Theo Buehler-3
On Sat, Feb 20, 2021 at 06:52:15PM +0100, Bjorn Ketelaars wrote:
> Fix taken from FreeBSD.

This pattern typedef enum + extern doesn't make all that much sense to
me, as the externed variables don't actually exist.

How about this? Seems simpler and should be functionally equivalent.

Index: Makefile
===================================================================
RCS file: /cvs/ports/net/honeyd/Makefile,v
retrieving revision 1.43
diff -u -p -r1.43 Makefile
--- Makefile 12 Jul 2019 20:48:27 -0000 1.43
+++ Makefile 20 Feb 2021 20:38:02 -0000
@@ -2,7 +2,7 @@
 
 COMMENT= utility to create virtual hosts on a network
 DISTNAME= honeyd-1.5c
-REVISION= 12
+REVISION= 13
 CATEGORIES= net
 MASTER_SITES= http://www.citi.umich.edu/u/provos/honeyd/ \
  http://niels.xtdnet.nl/honeyd/
Index: patches/patch-personality_c
===================================================================
RCS file: patches/patch-personality_c
diff -N patches/patch-personality_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-personality_c 21 Feb 2021 09:09:54 -0000
@@ -0,0 +1,17 @@
+$OpenBSD$
+
+Fix -fno-common build error.
+
+Index: personality.c
+--- personality.c.orig
++++ personality.c
+@@ -65,6 +65,9 @@
+ #include "template.h"
+ #include "debug.h"
+
++struct perstree personalities;
++struct xp_fprint_tree xp_fprints;
++
+ /* ET - Moved SPLAY_HEAD to personality.h so xprobe_assoc.c could use it. */
+ int npersons;
+
Index: patches/patch-personality_h
===================================================================
RCS file: patches/patch-personality_h
diff -N patches/patch-personality_h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-personality_h 21 Feb 2021 09:10:03 -0000
@@ -0,0 +1,27 @@
+$OpenBSD$
+
+Fix -fno-common build error.
+
+Index: personality.h
+--- personality.h.orig
++++ personality.h
+@@ -179,7 +179,8 @@ void xprobe_personality_init(void);
+ void print_perstree(void);
+
+ /* Splay stuff here so other modules can use it */
+-SPLAY_HEAD(perstree, personality) personalities;
++SPLAY_HEAD(perstree, personality);
++extern struct perstree personalities;
+ static int
+ perscompare(struct personality *a, struct personality *b)
+ {
+@@ -187,7 +188,8 @@ perscompare(struct personality *a, struct personality
+ }
+ SPLAY_PROTOTYPE(perstree, personality, node, perscompare);
+
+-SPLAY_HEAD(xp_fprint_tree, xp_fingerprint) xp_fprints;
++SPLAY_HEAD(xp_fprint_tree, xp_fingerprint);
++extern struct xp_fprint_tree xp_fprints;
+ static int
+ xp_fprint_compare(struct xp_fingerprint *a, struct xp_fingerprint *b)
+ {
Index: patches/patch-stats_h
===================================================================
RCS file: patches/patch-stats_h
diff -N patches/patch-stats_h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-stats_h 21 Feb 2021 09:10:10 -0000
@@ -0,0 +1,25 @@
+$OpenBSD$
+
+Fix -fno-common build error.
+
+Index: stats.h
+--- stats.h.orig
++++ stats.h
+@@ -91,7 +91,7 @@ struct stats {
+
+ enum {
+ M_COUNTER, M_TV_START, M_TV_END, M_RECORD, M_MAX
+-} measurement_tags;
++};
+
+ struct measurement {
+ uint32_t counter;
+@@ -105,7 +105,7 @@ struct measurement {
+
+ enum {
+ SIG_NAME, SIG_DIGEST, SIG_DATA, SIG_COMPRESSED_DATA, SIG_MAX
+-} signature_tags;
++};
+
+ struct signature {
+ char *name;
Index: patches/patch-tagging_h
===================================================================
RCS file: patches/patch-tagging_h
diff -N patches/patch-tagging_h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-tagging_h 21 Feb 2021 09:10:15 -0000
@@ -0,0 +1,25 @@
+$OpenBSD$
+
+Fix -fno-common build error.
+
+Index: tagging.h
+--- tagging.h.orig
++++ tagging.h
+@@ -48,7 +48,7 @@ enum {
+ REC_TV_START, REC_TV_END, REC_SRC, REC_DST, REC_SRC_PORT, REC_DST_PORT,
+ REC_PROTO, REC_STATE, REC_OS_FP, REC_HASH, REC_BYTES, REC_FLAGS,
+ REC_MAX_TAGS
+-} record_tags;
++};
+
+ #define RECORD_STATE_NEW 0x01
+
+@@ -71,7 +71,7 @@ struct record {
+
+ enum {
+ ADDR_TYPE, ADDR_BITS, ADDR_ADDR, ADDR_MAX_TAGS
+-} address_tags;
++};
+
+ void record_marshal(struct evbuffer *, struct record *);
+
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/net/honeyd/pkg/PLIST,v
retrieving revision 1.9
diff -u -p -r1.9 PLIST
--- pkg/PLIST 21 Apr 2010 23:42:18 -0000 1.9
+++ pkg/PLIST 20 Feb 2021 20:38:02 -0000
@@ -11,7 +11,7 @@ include/honeyd/hooks.h
 include/honeyd/plugins.h
 include/honeyd/plugins_config.h
 lib/honeyd/
-lib/honeyd/libhoneyd.so
+@so lib/honeyd/libhoneyd.so
 @man man/man1/honeydctl.1
 @man man/man8/honeyd.8
 share/honeyd/