buildroot/package/netsniff-ng/0006-mausezahn-move-variable-definitions-from-mz-h-to-mausezahn-c.patch
Fabrice Fontaine d0f0d368ac package/netsniff-ng: fix build with gcc 10
Fixes:
 - http://autobuild.buildroot.org/results/811b9eada9558bafde4e4ed824b36239c72e0501

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2020-09-26 15:31:14 +02:00

185 lines
4.8 KiB
Diff

From 56f8f399a20275a4a73ebc4450bd8eeba7ee1656 Mon Sep 17 00:00:00 2001
From: Tobias Klauser <tklauser@distanz.ch>
Date: Wed, 19 Aug 2020 13:13:54 +0200
Subject: [PATCH] mausezahn: move variable definitions from mz.h to mausezahn.c
Move variable definitions to avoid "multiple definition of symbol"
linker errors with gcc-10.
Fixes #216
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
[Retrieved from:
https://github.com/netsniff-ng/netsniff-ng/commit/56f8f399a20275a4a73ebc4450bd8eeba7ee1656]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
staging/mausezahn.c | 46 ++++++++++++++++++++++++++++++++++++++++
staging/mz.h | 51 +++++++++++++++++++++++++--------------------
2 files changed, 74 insertions(+), 23 deletions(-)
diff --git a/staging/mausezahn.c b/staging/mausezahn.c
index 19d2937a..cae57a1b 100644
--- a/staging/mausezahn.c
+++ b/staging/mausezahn.c
@@ -32,8 +32,54 @@
#include "die.h"
#include "dev.h"
+enum operating_modes mode;
+
+int ipv6_mode;
+int quiet; // don't even print 'important standard short messages'
+int verbose; // report character
+int simulate; // if 1 then don't really send frames
+
+char path[256];
+char filename[256];
+FILE *fp, *fp2; // global multipurpose file pointer
+
+long double total_d;
+clock_t mz_start, mz_stop;
+
+int mz_rand;
+int bwidth;
+
+int32_t
+ jitter[TIME_COUNT_MAX];
+
+int
+ rtp_log,
+ time0_flag, // If set then time0 has valid data
+ sqnr0_flag;
+
+u_int8_t
+ mz_ssrc[4]; // holds RTP stream identifier for rcv_rtp()
+
+u_int16_t
+ sqnr_cur,
+ sqnr_last,
+ sqnr_next;
+
+u_int32_t
+ gind, // a global index to run through deltaRX, deltaTX, and jitter
+ gind_max; // the amount of entries used in the (ugly oversized) arrays; per default set to TIME_COUNT
+
+struct tx_struct tx; // NOTE: tx elements are considered as default values for MOPS
+
+struct device_struct device_list[MZ_MAX_DEVICES];
+
+int device_list_entries;
+
int verbose_level = 0;
+char mz_default_config_path[256];
+char mz_default_log_path[256];
+
static const char *short_options = "46hqvVSxra:A:b:B:c:d:E:f:F:l:p:P:R:t:T:M:Q:X:";
static void signal_handler(int number)
diff --git a/staging/mz.h b/staging/mz.h
index 42e64cfc..33e74e60 100644
--- a/staging/mz.h
+++ b/staging/mz.h
@@ -108,8 +108,8 @@ static inline void verbose_l2(const char *format, ...)
#define IPADDRSIZE 46
-char mz_default_config_path[256];
-char mz_default_log_path[256];
+extern char mz_default_config_path[256];
+extern char mz_default_log_path[256];
struct arp_table_struct {
@@ -159,9 +159,11 @@ struct device_struct
struct pcap *p_arp; // pcap handle
struct arp_table_struct *arp_table; // dedicated ARP table
int ps; // packet socket
-} device_list[MZ_MAX_DEVICES];
+};
+
+extern struct device_struct device_list[MZ_MAX_DEVICES];
-int device_list_entries;
+extern int device_list_entries;
#pragma pack(1)
@@ -270,46 +272,47 @@ enum operating_modes
SYSLOG,
LLDP,
IGMP
-} mode;
+};
+extern enum operating_modes mode;
-int ipv6_mode;
-int quiet; // don't even print 'important standard short messages'
-int verbose; // report character
-int simulate; // if 1 then don't really send frames
+extern int ipv6_mode;
+extern int quiet; // don't even print 'important standard short messages'
+extern int verbose; // report character
+extern int simulate; // if 1 then don't really send frames
-char path[256];
-char filename[256];
-FILE *fp, *fp2; // global multipurpose file pointer
+extern char path[256];
+extern char filename[256];
+extern FILE *fp, *fp2; // global multipurpose file pointer
-long double total_d;
-clock_t mz_start, mz_stop;
+extern long double total_d;
+extern clock_t mz_start, mz_stop;
-int mz_rand;
-int bwidth;
+extern int mz_rand;
+extern int bwidth;
struct mz_timestamp {
u_int32_t sec;
u_int32_t nsec;
};
-int32_t
- jitter[TIME_COUNT_MAX];
+extern int32_t
+ jitter[TIME_COUNT_MAX];
-int
+extern int
rtp_log,
time0_flag, // If set then time0 has valid data
sqnr0_flag;
-u_int8_t
+extern u_int8_t
mz_ssrc[4]; // holds RTP stream identifier for rcv_rtp()
-u_int16_t
+extern u_int16_t
sqnr_cur,
sqnr_last,
sqnr_next;
-u_int32_t
+extern u_int32_t
gind, // a global index to run through deltaRX, deltaTX, and jitter
gind_max; // the amount of entries used in the (ugly oversized) arrays; per default set to TIME_COUNT
@@ -476,7 +479,9 @@ struct tx_struct
rtp_sqnr,
rtp_stmp;
-} tx; // NOTE: tx elements are considered as default values for MOPS
+};
+
+extern struct tx_struct tx; // NOTE: tx elements are considered as default values for MOPS
// ************************************
//