From f382b8eae1527e8abab106436bb8ff54d137d6c6 Mon Sep 17 00:00:00 2001 From: Bart De Schuymer Date: Tue, 20 Aug 2002 17:06:14 +0000 Subject: cleanups --- .../linux/include/linux/netfilter_bridge/ebt_arp.h | 18 +++++------ .../linux/include/linux/netfilter_bridge/ebt_ip.h | 16 +++++----- .../linux/include/linux/netfilter_bridge/ebt_log.h | 6 ++-- .../include/linux/netfilter_bridge/ebt_mark_m.h | 4 +-- .../include/linux/netfilter_bridge/ebt_vlan.h | 10 +++---- .../include/linux/netfilter_bridge/ebtables.h | 35 ++++++++++++++-------- 6 files changed, 50 insertions(+), 39 deletions(-) (limited to 'kernel/linux/include/linux') diff --git a/kernel/linux/include/linux/netfilter_bridge/ebt_arp.h b/kernel/linux/include/linux/netfilter_bridge/ebt_arp.h index a29f926..8967dda 100644 --- a/kernel/linux/include/linux/netfilter_bridge/ebt_arp.h +++ b/kernel/linux/include/linux/netfilter_bridge/ebt_arp.h @@ -12,15 +12,15 @@ struct ebt_arp_info { - __u16 htype; - __u16 ptype; - __u16 opcode; - __u32 saddr; - __u32 smsk; - __u32 daddr; - __u32 dmsk; - __u8 bitmask; - __u8 invflags; + uint16_t htype; + uint16_t ptype; + uint16_t opcode; + uint32_t saddr; + uint32_t smsk; + uint32_t daddr; + uint32_t dmsk; + uint8_t bitmask; + uint8_t invflags; }; #endif diff --git a/kernel/linux/include/linux/netfilter_bridge/ebt_ip.h b/kernel/linux/include/linux/netfilter_bridge/ebt_ip.h index f4f9ed1..b2791e0 100644 --- a/kernel/linux/include/linux/netfilter_bridge/ebt_ip.h +++ b/kernel/linux/include/linux/netfilter_bridge/ebt_ip.h @@ -11,14 +11,14 @@ // the same values are used for the invflags struct ebt_ip_info { - __u32 saddr; - __u32 daddr; - __u32 smsk; - __u32 dmsk; - __u8 tos; - __u8 protocol; - __u8 bitmask; - __u8 invflags; + uint32_t saddr; + uint32_t daddr; + uint32_t smsk; + uint32_t dmsk; + uint8_t tos; + uint8_t protocol; + uint8_t bitmask; + uint8_t invflags; }; #endif diff --git a/kernel/linux/include/linux/netfilter_bridge/ebt_log.h b/kernel/linux/include/linux/netfilter_bridge/ebt_log.h index 9343d11..d3e7377 100644 --- a/kernel/linux/include/linux/netfilter_bridge/ebt_log.h +++ b/kernel/linux/include/linux/netfilter_bridge/ebt_log.h @@ -9,9 +9,9 @@ struct ebt_log_info { - __u8 loglevel; - __u8 prefix[EBT_LOG_PREFIX_SIZE]; - __u32 bitmask; + uint8_t loglevel; + uint8_t prefix[EBT_LOG_PREFIX_SIZE]; + uint32_t bitmask; }; #endif diff --git a/kernel/linux/include/linux/netfilter_bridge/ebt_mark_m.h b/kernel/linux/include/linux/netfilter_bridge/ebt_mark_m.h index b6cb4ed..301524f 100644 --- a/kernel/linux/include/linux/netfilter_bridge/ebt_mark_m.h +++ b/kernel/linux/include/linux/netfilter_bridge/ebt_mark_m.h @@ -7,8 +7,8 @@ struct ebt_mark_m_info { unsigned long mark, mask; - __u8 invert; - __u8 bitmask; + uint8_t invert; + uint8_t bitmask; }; #define EBT_MARK_MATCH "mark_m" diff --git a/kernel/linux/include/linux/netfilter_bridge/ebt_vlan.h b/kernel/linux/include/linux/netfilter_bridge/ebt_vlan.h index 8dc5bd9..cb1fcc4 100644 --- a/kernel/linux/include/linux/netfilter_bridge/ebt_vlan.h +++ b/kernel/linux/include/linux/netfilter_bridge/ebt_vlan.h @@ -8,12 +8,12 @@ #define EBT_VLAN_MATCH "vlan" struct ebt_vlan_info { - __u16 id; /* VLAN ID {1-4095} */ - __u8 prio; /* VLAN User Priority {0-7} */ - __u16 encap; /* VLAN Encapsulated frame code {0-65535} */ - __u8 bitmask; /* Args bitmask bit 1=1 - ID arg, + uint16_t id; /* VLAN ID {1-4095} */ + uint8_t prio; /* VLAN User Priority {0-7} */ + uint16_t encap; /* VLAN Encapsulated frame code {0-65535} */ + uint8_t bitmask; /* Args bitmask bit 1=1 - ID arg, bit 2=1 User-Priority arg, bit 3=1 encap*/ - __u8 invflags; /* Inverse bitmask bit 1=1 - inversed ID arg, + uint8_t invflags; /* Inverse bitmask bit 1=1 - inversed ID arg, bit 2=1 - inversed Pirority arg */ }; diff --git a/kernel/linux/include/linux/netfilter_bridge/ebtables.h b/kernel/linux/include/linux/netfilter_bridge/ebtables.h index ef7f2d4..6660af1 100644 --- a/kernel/linux/include/linux/netfilter_bridge/ebtables.h +++ b/kernel/linux/include/linux/netfilter_bridge/ebtables.h @@ -40,9 +40,13 @@ #define EBT_RETURN -4 #define NUM_STANDARD_TARGETS 4 +// return values for match() functions +#define EBT_MATCH 0 +#define EBT_NOMATCH 1 + struct ebt_counter { - __u64 pcnt; + uint64_t pcnt; }; struct ebt_entries { @@ -135,7 +139,7 @@ struct ebt_entry { // this needs to be the first field unsigned int bitmask; unsigned int invflags; - __u16 ethproto; + uint16_t ethproto; // the physical in-dev char in[IFNAMSIZ]; // the logical in-dev @@ -183,7 +187,7 @@ struct ebt_match // 0 == it matches int (*match)(const struct sk_buff *skb, const struct net_device *in, const struct net_device *out, const void *matchdata, - unsigned int datalen, const struct ebt_counter *c); + unsigned int datalen); // 0 == let it in int (*check)(const char *tablename, unsigned int hookmask, const struct ebt_entry *e, void *matchdata, unsigned int datalen); @@ -197,7 +201,7 @@ struct ebt_watcher const char name[EBT_FUNCTION_MAXNAMELEN]; void (*watcher)(const struct sk_buff *skb, const struct net_device *in, const struct net_device *out, const void *watcherdata, - unsigned int datalen, const struct ebt_counter *c); + unsigned int datalen); // 0 == let it in int (*check)(const char *tablename, unsigned int hookmask, const struct ebt_entry *e, void *watcherdata, unsigned int datalen); @@ -210,12 +214,9 @@ struct ebt_target struct list_head list; const char name[EBT_FUNCTION_MAXNAMELEN]; // returns one of the standard verdicts - int (*target)(struct sk_buff **pskb, - unsigned int hooknr, - const struct net_device *in, - const struct net_device *out, - const void *targetdata, - unsigned int datalen); + int (*target)(struct sk_buff **pskb, unsigned int hooknr, + const struct net_device *in, const struct net_device *out, + const void *targetdata, unsigned int datalen); // 0 == let it in int (*check)(const char *tablename, unsigned int hookmask, const struct ebt_entry *e, void *targetdata, unsigned int datalen); @@ -271,6 +272,16 @@ extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff **pskb, const struct net_device *in, const struct net_device *out, struct ebt_table *table); + // Used in the kernel match() functions +#define FWINV(bool,invflg) ((bool) ^ !!(info->invflags & invflg)) +// True if the hook mask denotes that the rule is in a base chain, +// used in the check() functions +#define BASE_CHAIN (hookmask & (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 (hookmask &= ~(1 << NF_BR_NUMHOOKS)) +// True if the target is not a standard target +#define INVALID_TARGET (info->target < -NUM_STANDARD_TARGETS || info->target >= 0) + #endif /* __KERNEL__ */ // blatently stolen from ip_tables.h @@ -333,9 +344,9 @@ extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff **pskb, if (__ret != 0) \ break; \ if (__entry->bitmask != 0) \ - __i += __entry->next_offset; \ + __i += __entry->next_offset; \ else \ - __i += sizeof(struct ebt_entries); \ + __i += sizeof(struct ebt_entries); \ } \ if (__ret == 0) { \ if (__i != (size)) \ -- cgit v1.2.3