This series converts do_commandeb() and do_commandeb_xlate() to call do_parse() from xshared.c instead of iterating over argv themselves. Patches 1-6 prepare the shared (parser) code for use by ebtables. Patches 7-11 prepare ebtables code for the following integration in patch 13. Patch 12 is a minor refactoring in xshared but fits fine right before the merge as the introduced helper function is called two more times by it. Phil Sutter (13): xshared: do_parse: Skip option checking for CMD_DELETE_NUM xshared: Perform protocol value parsing in callback xshared: Turn command_default() into a callback xshared: Introduce print_help callback (again) xshared: Support rule range deletion in do_parse() xshared: Support for ebtables' --change-counters command ebtables{,-translate}: Convert if-clause to switch() ebtables: Change option values to avoid clashes ebtables: Pass struct iptables_command_state to print_help() ebtables: Make 'h' case just a call to print_help() ebtables: Use struct xt_cmd_parse xshared: Introduce option_test_and_reject() ebtables: Use do_parse() from xshared iptables/ip6tables.c | 2 + iptables/iptables.c | 2 + iptables/nft-arp.c | 2 + iptables/nft-bridge.c | 121 +++++ iptables/nft-bridge.h | 13 +- iptables/nft-cmd.h | 7 - iptables/nft-ipv4.c | 2 + iptables/nft-ipv6.c | 2 + iptables/nft.h | 1 - iptables/xshared.c | 218 +++++++-- iptables/xshared.h | 36 +- iptables/xtables-eb-translate.c | 491 +++---------------- iptables/xtables-eb.c | 839 ++++++-------------------------- 13 files changed, 567 insertions(+), 1169 deletions(-) -- 2.41.0