summaryrefslogtreecommitdiffstats
path: root/include/ebtables_u.h
diff options
context:
space:
mode:
authorBart De Schuymer <bdschuym@pandora.be>2002-08-13 16:08:08 +0000
committerBart De Schuymer <bdschuym@pandora.be>2002-08-13 16:08:08 +0000
commit9cfd654314d5718393b847758ded6ef86530e5c6 (patch)
tree5627fb56a1ba249a06561e8d47fc961560388ba8 /include/ebtables_u.h
parentb3dbdfb2b63c3f87edba502230b12e7daa5c354f (diff)
cosmetic improvements and some bugfixes (global description)
Diffstat (limited to 'include/ebtables_u.h')
-rw-r--r--include/ebtables_u.h28
1 files changed, 26 insertions, 2 deletions
diff --git a/include/ebtables_u.h b/include/ebtables_u.h
index 3fe6668..3e3c4ff 100644
--- a/include/ebtables_u.h
+++ b/include/ebtables_u.h
@@ -23,6 +23,7 @@
#ifndef EBTABLES_U_H
#define EBTABLES_U_H
+#include <netinet/in.h>
#include <linux/netfilter_bridge/ebtables.h>
struct ebt_u_entries
@@ -95,7 +96,7 @@ struct ebt_u_entry
{
unsigned int bitmask;
unsigned int invflags;
- __u16 ethproto;
+ uint16_t ethproto;
char in[IFNAMSIZ];
char logical_in[IFNAMSIZ];
char out[IFNAMSIZ];
@@ -197,7 +198,7 @@ struct ebt_u_watcher *find_watcher(const char *name);
struct ebt_u_table *find_table(char *name);
void deliver_counters(struct ebt_u_replace *repl);
void deliver_table(struct ebt_u_replace *repl);
-int name_to_number(char *name, __u16 *proto);
+int name_to_number(char *name, uint16_t *proto);
int number_to_name(unsigned short proto, char *name);
void check_option(unsigned int *flags, unsigned int mask);
int check_inverse(const char option[]);
@@ -215,4 +216,27 @@ void __print_bug(char *file, int line, char *format, ...);
#define CNT_END 3
#define CNT_ZERO 4
+extern char *standard_targets[NUM_STANDARD_TARGETS];
+// Transforms a target string into the right integer,
+// returns 0 on success.
+#define FILL_TARGET(_str, _pos) ({ \
+ int _i, _ret = 0; \
+ for (_i = 0; _i < NUM_STANDARD_TARGETS; _i++) \
+ if (!strcmp(_str, standard_targets[_i])) {\
+ _pos = -_i - 1; \
+ break; \
+ } \
+ if (_i == NUM_STANDARD_TARGETS) \
+ _ret = 1; \
+ _ret; \
+})
+
+// Transforms the target value to an index into standard_targets[]
+#define TARGET_INDEX(_value) (-_value - 1)
+// Returns a target string corresponding to the value
+#define TARGET_NAME(_value) (standard_targets[TARGET_INDEX(_value)])
+// True if the hook mask denotes that the rule is in a base chain
+#define BASE_CHAIN (hook_mask & (1 << NF_BR_NUMHOOKS))
+// Clear the bit in the hook_mask that tells if the rule is on a base chain
+#define CLEAR_BASE_CHAIN_BIT (hook_mask &= ~(1 << NF_BR_NUMHOOKS))
#endif /* EBTABLES_U_H */