summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2022-05-05 18:07:38 +0200
committerPhil Sutter <phil@nwl.cc>2022-05-11 12:02:19 +0200
commit8ff84eaf987d74603a88b02632bd00187defcf8d (patch)
tree5a5f56fb4dd4ec09e72271387edb604c73b53e37
parentadbfec0b3e3275ea5e7c933b630756cf01a4f8c6 (diff)
xshared: Move arp_opcodes into shared space
It will be referenced by xtables_printhelp() if printing for arptables and therefore must be present in legacy as well even if unused. Signed-off-by: Phil Sutter <phil@nwl.cc>
-rw-r--r--extensions/libarpt_mangle.c1
-rw-r--r--iptables/nft-arp.c22
-rw-r--r--iptables/nft-arp.h7
-rw-r--r--iptables/xshared.c14
-rw-r--r--iptables/xshared.h3
-rw-r--r--iptables/xtables-arp.c1
-rw-r--r--iptables/xtables-monitor.c1
-rw-r--r--iptables/xtables.c1
8 files changed, 21 insertions, 29 deletions
diff --git a/extensions/libarpt_mangle.c b/extensions/libarpt_mangle.c
index a2378a8b..765edf34 100644
--- a/extensions/libarpt_mangle.c
+++ b/extensions/libarpt_mangle.c
@@ -13,7 +13,6 @@
#include <xtables.h>
#include <linux/netfilter_arp/arpt_mangle.h>
#include "iptables/nft.h"
-#include "iptables/nft-arp.h"
static void arpmangle_print_help(void)
{
diff --git a/iptables/nft-arp.c b/iptables/nft-arp.c
index 65bd965e..e6e4d2d8 100644
--- a/iptables/nft-arp.c
+++ b/iptables/nft-arp.c
@@ -25,22 +25,8 @@
#include <linux/netfilter/nf_tables.h>
#include "nft-shared.h"
-#include "nft-arp.h"
#include "nft.h"
-
-/* a few names */
-char *arp_opcodes[] =
-{
- "Request",
- "Reply",
- "Request_Reverse",
- "Reply_Reverse",
- "DRARP_Request",
- "DRARP_Reply",
- "DRARP_Error",
- "InARP_Request",
- "ARP_NAK",
-};
+#include "xshared.h"
static bool need_devaddr(struct arpt_devaddr_info *info)
{
@@ -429,7 +415,7 @@ after_devdst:
printf("%s%s", sep, fw->arp.invflags & IPT_INV_ARPOP
? "! " : "");
- if (tmp <= NUMOPCODES && !(format & FMT_NUMERIC))
+ if (tmp <= ARP_NUMOPCODES && !(format & FMT_NUMERIC))
printf("--opcode %s", arp_opcodes[tmp-1]);
else
printf("--opcode %d", tmp);
@@ -660,11 +646,11 @@ static void nft_arp_post_parse(int command,
&cs->arp.arp.arpop_mask, 10)) {
int i;
- for (i = 0; i < NUMOPCODES; i++)
+ for (i = 0; i < ARP_NUMOPCODES; i++)
if (!strcasecmp(arp_opcodes[i],
args->arp_opcode))
break;
- if (i == NUMOPCODES)
+ if (i == ARP_NUMOPCODES)
xtables_error(PARAMETER_PROBLEM,
"Problem with specified opcode");
cs->arp.arp.arpop = htons(i+1);
diff --git a/iptables/nft-arp.h b/iptables/nft-arp.h
deleted file mode 100644
index 3411fc3d..00000000
--- a/iptables/nft-arp.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef _NFT_ARP_H_
-#define _NFT_ARP_H_
-
-extern char *arp_opcodes[];
-#define NUMOPCODES 9
-
-#endif
diff --git a/iptables/xshared.c b/iptables/xshared.c
index 00828c8a..674b49cb 100644
--- a/iptables/xshared.c
+++ b/iptables/xshared.c
@@ -20,6 +20,20 @@
#include <signal.h>
#include "xshared.h"
+/* a few arp opcode names */
+char *arp_opcodes[] =
+{
+ "Request",
+ "Reply",
+ "Request_Reverse",
+ "Reply_Reverse",
+ "DRARP_Request",
+ "DRARP_Reply",
+ "DRARP_Error",
+ "InARP_Request",
+ "ARP_NAK",
+};
+
/*
* Print out any special helps. A user might like to be able to add a --help
* to the commandline, and see expected results. So we call help for all
diff --git a/iptables/xshared.h b/iptables/xshared.h
index ca761ee7..2fdebc32 100644
--- a/iptables/xshared.h
+++ b/iptables/xshared.h
@@ -330,4 +330,7 @@ void ipv4_post_parse(int command, struct iptables_command_state *cs,
void ipv6_post_parse(int command, struct iptables_command_state *cs,
struct xtables_args *args);
+extern char *arp_opcodes[];
+#define ARP_NUMOPCODES 9
+
#endif /* IPTABLES_XSHARED_H */
diff --git a/iptables/xtables-arp.c b/iptables/xtables-arp.c
index 68514297..f1a128fc 100644
--- a/iptables/xtables-arp.c
+++ b/iptables/xtables-arp.c
@@ -37,7 +37,6 @@
#include "xshared.h"
#include "nft.h"
-#include "nft-arp.h"
static struct option original_opts[] = {
{ "append", 1, 0, 'A' },
diff --git a/iptables/xtables-monitor.c b/iptables/xtables-monitor.c
index 8a04f4d1..905bb7fe 100644
--- a/iptables/xtables-monitor.c
+++ b/iptables/xtables-monitor.c
@@ -37,7 +37,6 @@
#include "iptables.h" /* for xtables_globals */
#include "xtables-multi.h"
#include "nft.h"
-#include "nft-arp.h"
struct cb_arg {
uint32_t nfproto;
diff --git a/iptables/xtables.c b/iptables/xtables.c
index c44b39ac..c65c3fce 100644
--- a/iptables/xtables.c
+++ b/iptables/xtables.c
@@ -42,7 +42,6 @@
#include <fcntl.h>
#include "xshared.h"
#include "nft-shared.h"
-#include "nft-arp.h"
#include "nft.h"
static struct option original_opts[] = {