@@ -142,14 +142,21 @@ def __call__(self, _parser, namespace, values, option_string=None):
142
142
help = 'interface list separated by spaces. ' )
143
143
argparser .add_argument ('-a' , '--all' , action = 'store_true' ,
144
144
help = 'process all interfaces (limited by --allow= filter)' )
145
- argparser .add_argument ('--allow' , dest = 'CLASS' , action = 'append' ,
145
+ allow_group = argparser .add_mutually_exclusive_group (required = False )
146
+ allow_group .add_argument ('--allow' , dest = 'CLASS' , action = 'append' ,
146
147
help = 'ignore non-"allow-CLASS" interfaces (default is [auto] when -a/--all else [])' )
148
+ # For ifupdown compatibility, '--all' implies '--allow auto'. '--allow-all' parameter offers
149
+ # a way to have all interfaces without implicit filter.
150
+ allow_group .add_argument ('--allow-all' , action = 'store_true' ,
151
+ help = 'ensure non-"allow-CLASS" is set to []' )
147
152
148
153
def argparser_interfaces_selection_post_validate (self ):
149
154
""" Set and validate interfaces selection options """
150
155
151
- # Default filter scope is auto/allow-auto when -a/--all option is set
152
- if self .args .all and not self .args .CLASS :
156
+ if self .args .allow_all :
157
+ self .args .CLASS = []
158
+ elif self .args .all and not self .args .CLASS :
159
+ # Default filter scope is auto/allow-auto when -a/--all option is set
153
160
self .args .CLASS = ['auto' ]
154
161
155
162
if self .args .iflist and self .args .all :
0 commit comments