netfilter: ebtables: remove EBT_MATCH and EBT_NOMATCH
authorTaehee Yoo <ap420073@gmail.com>
Sun, 8 Apr 2018 15:00:57 +0000 (00:00 +0900)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 24 Apr 2018 08:29:16 +0000 (10:29 +0200)
EBT_MATCH and EBT_NOMATCH are used to change return value.
match functions(ebt_xxx.c) return false when received frame is not matched
and returns true when received frame is matched.
but, EBT_MATCH_ITERATE understands oppositely.
so, to change return value, EBT_MATCH and EBT_NOMATCH are used.
but, we can use operation '!' simply.

Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/linux/netfilter_bridge/ebtables.h
net/bridge/netfilter/ebtables.c

index 0773b5a032f1fc1cedaaef44c89f37c9344399f1..c6935be7c6ca3e9a33f2835a8dc10035bee43f1d 100644 (file)
 #include <linux/if_ether.h>
 #include <uapi/linux/netfilter_bridge/ebtables.h>
 
-/* return values for match() functions */
-#define EBT_MATCH 0
-#define EBT_NOMATCH 1
-
 struct ebt_match {
        struct list_head list;
        const char name[EBT_FUNCTION_MAXNAMELEN];
index 355410b13316970658c979836e7ef8a6dc6077b8..7c07221369c0cfffc25f7168166823f33ef10fbc 100644 (file)
@@ -101,7 +101,7 @@ ebt_do_match(struct ebt_entry_match *m, const struct sk_buff *skb,
 {
        par->match     = m->u.match;
        par->matchinfo = m->data;
-       return m->u.match->match(skb, par) ? EBT_MATCH : EBT_NOMATCH;
+       return !m->u.match->match(skb, par);
 }
 
 static inline int