From d9a518ee22cf90ddeb56a9df687aef953fda0fa0 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Wed, 7 Nov 2018 13:57:16 +0100 Subject: arptables: use ->save for arptables-save, like xtables arptables-save will show -A OUTPUT --h-length 6 --h-type 1 -j MARK --set-xmark 0x1/0xffffffff as --h-length 6 --h-type Ethernet -j MARK MARK set 0x1 Because it uses ->print() instead of ->save(). Switch it to use ->save, we can then also drop special handling of CLASSIFY target. Signed-off-by: Florian Westphal --- extensions/libxt_CLASSIFY.c | 47 +++++++++++++-------------------------------- 1 file changed, 13 insertions(+), 34 deletions(-) (limited to 'extensions/libxt_CLASSIFY.c') diff --git a/extensions/libxt_CLASSIFY.c b/extensions/libxt_CLASSIFY.c index ba88f758..f90082dc 100644 --- a/extensions/libxt_CLASSIFY.c +++ b/extensions/libxt_CLASSIFY.c @@ -73,13 +73,6 @@ CLASSIFY_save(const void *ip, const struct xt_entry_target *target) TC_H_MAJ(clinfo->priority)>>16, TC_H_MIN(clinfo->priority)); } -static void -arpCLASSIFY_print(const void *ip, const struct xt_entry_target *target, - int numeric) -{ - CLASSIFY_save(ip, target); -} - static int CLASSIFY_xlate(struct xt_xlate *xl, const struct xt_xlate_tg_params *params) { @@ -105,35 +98,21 @@ static int CLASSIFY_xlate(struct xt_xlate *xl, return 1; } -static struct xtables_target classify_target[] = { - { - .family = NFPROTO_UNSPEC, - .name = "CLASSIFY", - .version = XTABLES_VERSION, - .size = XT_ALIGN(sizeof(struct xt_classify_target_info)), - .userspacesize = XT_ALIGN(sizeof(struct xt_classify_target_info)), - .help = CLASSIFY_help, - .print = CLASSIFY_print, - .save = CLASSIFY_save, - .x6_parse = CLASSIFY_parse, - .x6_options = CLASSIFY_opts, - .xlate = CLASSIFY_xlate, - }, - { - .family = NFPROTO_ARP, - .name = "CLASSIFY", - .version = XTABLES_VERSION, - .size = XT_ALIGN(sizeof(struct xt_classify_target_info)), - .userspacesize = XT_ALIGN(sizeof(struct xt_classify_target_info)), - .help = CLASSIFY_help, - .print = arpCLASSIFY_print, - .x6_parse = CLASSIFY_parse, - .x6_options = CLASSIFY_opts, - .xlate = CLASSIFY_xlate, - }, +static struct xtables_target classify_target = { + .family = NFPROTO_UNSPEC, + .name = "CLASSIFY", + .version = XTABLES_VERSION, + .size = XT_ALIGN(sizeof(struct xt_classify_target_info)), + .userspacesize = XT_ALIGN(sizeof(struct xt_classify_target_info)), + .help = CLASSIFY_help, + .print = CLASSIFY_print, + .save = CLASSIFY_save, + .x6_parse = CLASSIFY_parse, + .x6_options = CLASSIFY_opts, + .xlate = CLASSIFY_xlate, }; void _init(void) { - xtables_register_targets(classify_target, ARRAY_SIZE(classify_target)); + xtables_register_target(&classify_target); } -- cgit v1.2.3