netfilter: ebt: Use ebt_invalid_target instead of INVALID_TARGET
Subsystems (3)
PATCH 1/1 netfilter: ebt: Use ebt_invalid_target instead of INVALID_TARGET
From: Gao Feng <[email protected]>
Use the new helper function ebt_invalid_target instead of the old macro INVALID_TARGET to enhance the readability.
Signed-off-by Gao Feng <[email protected]>
--- include/linux/netfilter_bridge/ebtables.h | 2 -- net/bridge/netfilter/ebt_dnat.c | 2 +- net/bridge/netfilter/ebt_redirect.c | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-)
include/linux/netfilter_bridge/ebtables.h +0 -2
@@ -122,8 +122,6 @@ extern unsigned int ebt_do_table(struct sk_buff *skb,#define BASE_CHAIN (par->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 (par->hook_mask &= ~(1 << NF_BR_NUMHOOKS)) -/* True if the target is not a standard target */ -#define INVALID_TARGET (info->target < -NUM_STANDARD_TARGETS || info->target >= 0)static inline bool ebt_invalid_target (int target) {
net/bridge/netfilter/ebt_dnat.c +1 -1
@@ -61,7 +61,7 @@ static int ebt_dnat_tg_check(const struct xt_tgchk_param *par) (strcmp (par->table,"broute" ) !=0 || hook_mask & ~(1 << NF_BR_BROUTING))) return -EINVAL; -if (INVALID_TARGET ) +if (ebt_invalid_target (info->target))return -EINVAL ;return 0 ; }
net/bridge/netfilter/ebt_redirect.c +1 -1
@@ -47,7 +47,7 @@ static int ebt_redirect_tg_check(const struct xt_tgchk_param *par) (strcmp (par->table,"broute" ) !=0 || hook_mask & ~(1 << NF_BR_BROUTING))) return -EINVAL; -if (INVALID_TARGET ) +if (ebt_invalid_target (info->target))return -EINVAL ;return 0 ; }
Signature · 1 line
1.9.1
Pablo Neira Ayuso
maintainerQuoted 4 lines · On Wed, May 31, 2017 at 09:28:12AM +0800, [email protected] wrote:
From: Gao Feng <[email protected]>
Use the new helper function
ebt_invalid_targetinstead of the old macroINVALID_TARGETto enhance the readability.
ebt_mark and _snat can use this too. They seem to be opencoding this function.