]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
xshared: Move arp_opcodes into shared space
authorPhil Sutter <phil@nwl.cc>
Thu, 5 May 2022 16:07:38 +0000 (18:07 +0200)
committerPhil Sutter <phil@nwl.cc>
Wed, 11 May 2022 10:02:19 +0000 (12:02 +0200)
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>
extensions/libarpt_mangle.c
iptables/nft-arp.c
iptables/nft-arp.h [deleted file]
iptables/xshared.c
iptables/xshared.h
iptables/xtables-arp.c
iptables/xtables-monitor.c
iptables/xtables.c

index a2378a8ba6ccb507452ffb9dcfb5c63d2eb19697..765edf34781f35c1ef76c044f01cde1f768e3e0b 100644 (file)
@@ -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)
 {
index 65bd965eb69f6290e24140858de538b4a5a7ae30..e6e4d2d81e528793c2121ddfcbf1dfdfc6b1a860 100644 (file)
 #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 (file)
index 3411fc3..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef _NFT_ARP_H_
-#define _NFT_ARP_H_
-
-extern char *arp_opcodes[];
-#define NUMOPCODES 9
-
-#endif
index 00828c8ae87d999bf40cf40f6be198576b9a5bcf..674b49cb72798bf61bff3d85c23effc94ff153c8 100644 (file)
 #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
index ca761ee7246ad74a676a33338703114b8e04b0d8..2fdebc326a6d6cafc80d069a2c0102d5be5663b9 100644 (file)
@@ -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 */
index 68514297f381f09eeef1df73362234c166a19c57..f1a128fc55647fc5c08d0232f041151271ea45fe 100644 (file)
@@ -37,7 +37,6 @@
 #include "xshared.h"
 
 #include "nft.h"
-#include "nft-arp.h"
 
 static struct option original_opts[] = {
        { "append", 1, 0, 'A' },
index 8a04f4d1490c180e10fa32155e58689be95e3b86..905bb7fed63097c2225e2439f639e1322e444ab5 100644 (file)
@@ -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;
index c44b39acdcd9730bd9ea570821960e10d690c2d2..c65c3fce5cfbe0e47cd30549e0c83b41b4d045cd 100644 (file)
@@ -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[] = {