]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
libxtables: prefix exported new functions for etherdb lookups
authorPablo Neira Ayuso <pablo@netfilter.org>
Fri, 19 Oct 2018 10:55:16 +0000 (12:55 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sat, 20 Oct 2018 09:14:10 +0000 (11:14 +0200)
To avoid symbol pollution, place them under the xt_ and xtables_ prefix
name.

Fixes: 31f1434dfe37 ("libxtables: Integrate getethertype.c from xtables core")
Reported-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Acked-by: Phil Sutter <phil@nwl.cc>
extensions/libebt_arp.c
extensions/libebt_vlan.c
include/ebtables/ethernetdb.h
iptables/nft-bridge.c
iptables/xtables-eb-translate.c
iptables/xtables-eb.c
libxtables/getethertype.c

index dc8e306a2879f32f1968921fac56875106ee3404..3a4c29b5fd3ed2f438f6b29bde04d5b9c86193fa 100644 (file)
@@ -75,7 +75,7 @@ static void brarp_print_help(void)
                printf(" %d = %s\n", i + 1, opcodes[i]);
        printf(
 " hardware type string: 1 = Ethernet\n"
-" protocol type string: see "_PATH_ETHERTYPES"\n");
+" protocol type string: see "_XT_PATH_ETHERTYPES"\n");
 }
 
 #define OPT_OPCODE 0x01
@@ -262,9 +262,9 @@ brarp_parse(int c, char **argv, int invert, unsigned int *flags,
 
                i = strtol(optarg, &end, 16);
                if (i < 0 || i >= (0x1 << 16) || *end !='\0') {
-                       struct ethertypeent *ent;
+                       struct xt_ethertypeent *ent;
 
-                       ent = getethertypebyname(argv[optind - 1]);
+                       ent = xtables_getethertypebyname(argv[optind - 1]);
                        if (!ent)
                                xtables_error(PARAMETER_PROBLEM, "Problem with specified ARP "
                                                                 "protocol type");
index 52cc99fa19c7ef568f6cb09f3c14365756ccdad3..57c4dd5bca5de784e5ce603c7cda3a9a71953736 100644 (file)
@@ -55,7 +55,7 @@ brvlan_parse(int c, char **argv, int invert, unsigned int *flags,
               const void *entry, struct xt_entry_match **match)
 {
        struct ebt_vlan_info *vlaninfo = (struct ebt_vlan_info *) (*match)->data;
-       struct ethertypeent *ethent;
+       struct xt_ethertypeent *ethent;
        char *end;
        struct ebt_vlan_info local;
 
@@ -86,7 +86,7 @@ brvlan_parse(int c, char **argv, int invert, unsigned int *flags,
                        vlaninfo->invflags |= EBT_VLAN_ENCAP;
                local.encap = strtoul(optarg, &end, 16);
                if (*end != '\0') {
-                       ethent = getethertypebyname(optarg);
+                       ethent = xtables_getethertypebyname(optarg);
                        if (ethent == NULL)
                                xtables_error(PARAMETER_PROBLEM, "Unknown --vlan-encap value ('%s')", optarg);
                        local.encap = ethent->e_ethertype;
index 1683abe01987eb5f06659db0050b1cf7ef9688ff..08b433543c67dd4462522a52c54d72f191b2cbe4 100644 (file)
 #include <stdint.h>
 
 /* Absolute file name for network data base files.  */
-#ifndef        _PATH_ETHERTYPES
-#define        _PATH_ETHERTYPES        "/etc/ethertypes"
+#ifndef        _XT_PATH_ETHERTYPES
+#define        _XT_PATH_ETHERTYPES     "/etc/ethertypes"
 #endif                         /* _PATH_ETHERTYPES */
 
-struct ethertypeent {
+struct xt_ethertypeent {
        char *e_name;           /* Official ethernet type name.  */
        char **e_aliases;       /* Alias list.  */
        int e_ethertype;        /* Ethernet type number.  */
 };
 
-/* Open ethertype data base files and mark them as staying open even
-   after a later search if STAY_OPEN is non-zero.  */
-extern void setethertypeent(int __stay_open);
-
-/* Close ethertype data base files and clear `stay open' flag.  */
-extern void endethertypeent(void);
-
-/* Get next entry from ethertype data base file.  Open data base if
-   necessary.  */
-extern struct ethertypeent *getethertypeent(void);
-
 /* Return entry from ethertype data base for network with NAME.  */
-extern struct ethertypeent *getethertypebyname(__const char *__name);
+extern struct xt_ethertypeent *xtables_getethertypebyname(__const char *__name);
 
 /* Return entry from ethertype data base which number is PROTO.  */
-extern struct ethertypeent *getethertypebynumber(int __ethertype);
-
+extern struct xt_ethertypeent *xtables_getethertypebynumber(int __ethertype);
 
 #endif                         /* ethernetdb.h */
index 7e659bb554a4635c63c154d555fe706f304719b2..876981ac58623860629c751c19c6679b3e08766e 100644 (file)
@@ -421,7 +421,7 @@ static void print_mac(char option, const unsigned char *mac,
 
 static void print_protocol(uint16_t ethproto, bool invert, unsigned int bitmask)
 {
-       struct ethertypeent *ent;
+       struct xt_ethertypeent *ent;
 
        /* Dont print anything about the protocol if no protocol was
         * specified, obviously this means any protocol will do. */
@@ -437,7 +437,7 @@ static void print_protocol(uint16_t ethproto, bool invert, unsigned int bitmask)
                return;
        }
 
-       ent = getethertypebynumber(ntohs(ethproto));
+       ent = xtables_getethertypebynumber(ntohs(ethproto));
        if (!ent)
                printf("0x%x ", ntohs(ethproto));
        else
index 07d6177627df297047eeaff9fa08184ef002590e..44419751fc8571c6bba94269d5cc4021ae406682 100644 (file)
@@ -465,16 +465,16 @@ print_zero:
                                xtables_error(PARAMETER_PROBLEM,
                                              "Problem with the specified protocol");
                        if (*buffer != '\0') {
-                               struct ethertypeent *ent;
+                               struct xt_ethertypeent *ent;
 
                                if (!strcasecmp(optarg, "LENGTH")) {
                                        cs.eb.bitmask |= EBT_802_3;
                                        break;
                                }
-                               ent = getethertypebyname(optarg);
+                               ent = xtables_getethertypebyname(optarg);
                                if (!ent)
                                        xtables_error(PARAMETER_PROBLEM,
-                                                     "Problem with the specified Ethernet protocol '%s', perhaps "_PATH_ETHERTYPES " is missing", optarg);
+                                                     "Problem with the specified Ethernet protocol '%s', perhaps "_XT_PATH_ETHERTYPES " is missing", optarg);
                                cs.eb.ethproto = ent->e_ethertype;
                        } else
                                cs.eb.ethproto = i;
index 84d554e9b80e04449b97249b943fb24b94af28d5..ecb758c65c77afe29a96fe98cd2a97ff04fed0fc 100644 (file)
@@ -1120,16 +1120,16 @@ print_zero:
                                xtables_error(PARAMETER_PROBLEM,
                                              "Problem with the specified protocol");
                        if (*buffer != '\0') {
-                               struct ethertypeent *ent;
+                               struct xt_ethertypeent *ent;
 
                                if (!strcasecmp(optarg, "LENGTH")) {
                                        cs.eb.bitmask |= EBT_802_3;
                                        break;
                                }
-                               ent = getethertypebyname(optarg);
+                               ent = xtables_getethertypebyname(optarg);
                                if (!ent)
                                        xtables_error(PARAMETER_PROBLEM,
-                                                     "Problem with the specified Ethernet protocol '%s', perhaps "_PATH_ETHERTYPES " is missing", optarg);
+                                                     "Problem with the specified Ethernet protocol '%s', perhaps "_XT_PATH_ETHERTYPES " is missing", optarg);
                                cs.eb.ethproto = ent->e_ethertype;
                        } else
                                cs.eb.ethproto = i;
index 027ef4adafe45487dec8a72cba6e4206ad447a69..a4c1407cf87c0deef20464dfa24fc24bf3aeeb37 100644 (file)
 
 static FILE *etherf = NULL;
 static char line[BUFSIZ + 1];
-static struct ethertypeent et_ent;
+static struct xt_ethertypeent et_ent;
 static char *ethertype_aliases[MAXALIASES];
 static int ethertype_stayopen;
 
-void setethertypeent(int f)
+static void setethertypeent(int f)
 {
        if (etherf == NULL)
-               etherf = fopen(_PATH_ETHERTYPES, "r");
+               etherf = fopen(_XT_PATH_ETHERTYPES, "r");
        else
                rewind(etherf);
        ethertype_stayopen |= f;
 }
 
-void endethertypeent(void)
+static void endethertypeent(void)
 {
        if (etherf) {
                fclose(etherf);
@@ -71,14 +71,15 @@ void endethertypeent(void)
        ethertype_stayopen = 0;
 }
 
-struct ethertypeent *getethertypeent(void)
+
+static struct xt_ethertypeent *getethertypeent(void)
 {
        char *e;
        char *endptr;
        register char *cp, **q;
 
        if (etherf == NULL
-           && (etherf = fopen(_PATH_ETHERTYPES, "r")) == NULL) {
+           && (etherf = fopen(_XT_PATH_ETHERTYPES, "r")) == NULL) {
                return (NULL);
        }
 
@@ -127,10 +128,9 @@ again:
        return (&et_ent);
 }
 
-
-struct ethertypeent *getethertypebyname(const char *name)
+struct xt_ethertypeent *xtables_getethertypebyname(const char *name)
 {
-       register struct ethertypeent *e;
+       register struct xt_ethertypeent *e;
        register char **cp;
 
        setethertypeent(ethertype_stayopen);
@@ -147,9 +147,9 @@ found:
        return (e);
 }
 
-struct ethertypeent *getethertypebynumber(int type)
+struct xt_ethertypeent *xtables_getethertypebynumber(int type)
 {
-       register struct ethertypeent *e;
+       register struct xt_ethertypeent *e;
 
        setethertypeent(ethertype_stayopen);
        while ((e = getethertypeent()) != NULL)