@@ -5,6 +5,7 @@ use anyhow::{Context, Result, bail};
55use clap:: { Parser , ValueEnum } ;
66use log:: LevelFilter ;
77use serde:: { Deserialize , Deserializer } ;
8+ use shared:: nic:: { self , NicFilter } ;
89use shared:: parser:: { duration, integer_range} ;
910use shared:: types:: { Port , QuotaId } ;
1011use std:: fmt:: Debug ;
@@ -203,14 +204,33 @@ generate_structs! {
203204 #[ arg( value_name = "PATH" ) ]
204205 tls_key_file: PathBuf = "/etc/beegfs/key.pem" . into( ) ,
205206
206- /// Restricts network interfaces reported to other nodes for incoming BeeMsg communication.
207+ /// Restricts and prioritizes network interfaces reported to other nodes for incoming BeeMsg
208+ /// communication.
207209 ///
208- /// Accepts a comma separated list of interface names. They are reported in the given order. If
209- /// not given, all suitable interfaces can be used.
210+ /// Accepts a comma separated list of interface/nic filters. Interfaces can be filtered by
211+ /// name, address and protocol (ipv4 or ipv6). Each filter entry has the form `[!] [<name>|*]
212+ /// [<addr>|*] [<protocol>|*]`, where protocol can be "4" or "6". Each field can be set to
213+ /// "*" to match any value. Stars on the right can be omitted. The order of the filter entries
214+ /// determines the priority of the interfaces as they should be used by other nodes for BeeMsg
215+ /// communication. The first entry an interface matches is that interfaces priority - the
216+ /// earlier the match, the higher the priority. Any interface that doesn't match any entry is
217+ /// not reported and will thus not be contacted by other nodes. A single `!` before the entry
218+ /// blacklists the matching interfaces - it is not reported even if a later entry does match it.
219+ ///
220+ /// If not given, all suitable interfaces can be used and are reported in default order.
221+ ///
222+ /// EXAMPLES:
223+ ///
224+ /// * Prefer IPv6: `* * 6,* * 4`
225+ /// * IPv6 only: `* * 6`
226+ /// * Only the eth0 interface using IPv6: `eth0 * 6`
227+ /// * Prefer one IPv6 address, allow only IPv4 otherwise: `* fd00::1,* * 4`
228+ /// * Deny eth0 interface, allow everything else: `! eth0,*`
210229 #[ arg( long) ]
211- #[ arg( value_name = "NAMES " ) ]
230+ #[ arg( value_name = "FILTERS " ) ]
212231 #[ arg( value_delimiter = ',' ) ]
213- interfaces: Vec <String > = vec![ ] ,
232+ #[ arg( value_parser = nic:: NicFilter :: parse) ]
233+ interfaces: Vec <NicFilter > = vec![ ] ,
214234
215235 /// Maximum number of outgoing BeeMsg connections per node. [default: 12]
216236 #[ arg( long) ]
0 commit comments