arptables-compat: add support for the CLASSIFY target
PATCH 1/1 arptables-compat: add support for the CLASSIFY target
This patch adds support to arptables-compat for the CLASSIFY target.
An extra space in the print path is deleted so the target is correctly printed.
Signed-off-by Arturo Borrero Gonzalez <[email protected]>
--- extensions/libxt_CLASSIFY.c | 44 +++++++++++++++++++++++++++++++------------ iptables/nft-arp.c | 2 +- 2 files changed, 33 insertions(+), 13 deletions(-)
extensions/libxt_CLASSIFY.c +32 -12
@@ -73,20 +73,40 @@ CLASSIFY_save(const void *ip, const struct xt_entry_target *target) TC_H_MAJ(clinfo->priority)>>16, TC_H_MIN(clinfo->priority)); } -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, +static void +arpCLASSIFY_print (const void *ip,const struct xt_entry_target *target, +int numeric) +{ +CLASSIFY_save (ip, target); +} + +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, + }, + { + .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, + }, };void _init (void ) { -xtables_register_target (&classify_target); +xtables_register_targets (classify_target,ARRAY_SIZE (classify_target)); }
iptables/nft-arp.c +1 -1
@@ -593,7 +593,7 @@ nft_arp_print_firewall(struct nft_rule *r, unsigned int num,if (cs.jumpto !=NULL &&strcmp (cs.jumpto,"" ) !=0 ) {printf ("-j %s" , cs.jumpto); }else if (cs.target) { -printf ("-j %s " , cs.target->name); +printf ("-j %s" , cs.target->name); cs.target->FMT_NUMERIC ); }