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
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");
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;
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;
#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 */
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. */
return;
}
- ent = getethertypebynumber(ntohs(ethproto));
+ ent = xtables_getethertypebynumber(ntohs(ethproto));
if (!ent)
printf("0x%x ", ntohs(ethproto));
else
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;
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;
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);
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);
}
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);
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)