diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/iface/list_interfaces.ml | 14 | 
1 files changed, 14 insertions, 0 deletions
diff --git a/src/iface/list_interfaces.ml b/src/iface/list_interfaces.ml index 2daa509..063e344 100644 --- a/src/iface/list_interfaces.ml +++ b/src/iface/list_interfaces.ml @@ -4,12 +4,14 @@ let intf_type = ref ""  let broadcast = ref false  let bridgeable = ref false  let bondable = ref false +let no_vlan = ref false  let args = [      ("--type", Arg.String (fun s -> intf_type := s), "List interfaces of specified type");      ("--broadcast", Arg.Unit (fun () -> broadcast := true), "List broadcast interfaces");      ("--bridgeable", Arg.Unit (fun () -> bridgeable := true), "List bridgeable interfaces");      ("--bondable", Arg.Unit (fun () -> bondable := true), "List bondable interfaces"); +    ("--no-vlan-subinterfaces", Arg.Unit (fun () -> no_vlan := true), "List only parent interfaces");  ]  let usage = Printf.sprintf "Usage: %s [OPTIONS] <number>" Sys.argv.(0) @@ -89,6 +91,14 @@ let filter_bondable s =          true      with Not_found -> false +let filter_no_vlan s = +    let pattern = {|^([^.]+)(\.\d+)+$|} +    in +    try +        let _ = Pcre.exec ~pat:pattern s in +        false +    with Not_found -> true +  let get_interfaces =      let intf_type = !intf_type in      let fltr = @@ -110,6 +120,10 @@ let get_interfaces =          if !bondable then List.filter filter_bondable res          else res      in +    let res = +        if !no_vlan then List.filter filter_no_vlan res +        else res +    in      let res = List.filter filter_section res in      match fltr with      | Some f -> List.filter f res  | 
