Allow dynamic loading of extentions in ebtables (-m option)
iptables command allows to dynamically load an "extension" shared object by specifying the -m option, and thus new extensions can be added without recompiling the command. In contrast, ebtables does not have -m option. It still dynamically loads its extensions, but the list of extenstions is hardcoded.
Proposed patch adds the option -m to ebtables command that works the same way as in iptables. Note that
1. Hardcoded list of "standard" extentions is _not_ removed by this patch. It is not strictly necessary after this patch, but removing
it would break backwards compatibility, mandating addition of -m ext-name option to existing scripts.
2. Dynamic loading of _target_ extensions already works automatically, no change is needed.
Please consider adding this.
Thank you,
Eugene
PATCH 1/1 ebtables-nft: introduce '-m <match_ext>' option
From: Eugene Crosser <[email protected]>
iptables command has an option '-m' to dynamically load match extentions (shared objects in the <lib-path>/xtables directory). ebtables command has no such option, making it impossible to add new extentions without recompiling the program.
This patch adds functionality of dynamic loading of match extentions, bringing ebtables command on par with iptables command. (Note that dynamic loading of _target_ extentions works in ebtables the same way as in iptables out of the box.)
--- iptables/ebtables-nft.8 | 6 +++--- iptables/xtables-eb.c | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-)
iptables/ebtables-nft.8 +3 -3
@@ -504,9 +504,9 @@ If used with the .IR pcnt ", resp. " bcnt " will match." .SS MATCH EXTENSIONS -Ebtables extensions are dynamically loaded into the userspace tool, -there is therefore no need to explicitly load them with a --m option like is done in iptables. +Standard ebtables extensions are dynamically loaded into the userspace tool, +while custom extentions need to explicitly loaded with a +-m option like it is done in iptables. These extensions deal with functionality supported by kernel modules supplemental to the core ebtables code. .SS 802_3
iptables/xtables-eb.c +4 -1
@@ -800,7 +800,7 @@ int do_commandeb(struct nft_handle *h, int argc, char *argv[], char **table,/* Getopt saves the day */ while ((c =getopt_long (argc, argv, -"-A:D:C:I:N:E:X::L::Z::F::P:Vhi:o:j:c:p:s:d:t:M:" , opts,NULL )) !=-1 ) { +"-A:D:C:I:N:E:X::L::Z::F::P:Vhi:o:j:c:p:s:d:t:M:m:" , opts,NULL )) !=-1 ) { cs.c = c; cs.invert = ebt_invert;switch (c) {
@@ -1100,6 +1100,9 @@ print_zero:xtables_error (PARAMETER_PROBLEM ,"Sorry, protocols have values above or equal to 0x0600" );break ; +case 'm' : +ebt_load_match (optarg); +break ;case 4 :/* Lc */ ebt_check_option2 (&flags,LIST_C );if (command !='L' )
Signature · 1 line
2.25.1