Skip to content

Commit

Permalink
router_frenzy: fix single router nets
Browse files Browse the repository at this point in the history
  • Loading branch information
rixed committed Oct 29, 2022
1 parent d5498fa commit d332ff2
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions examples/router_frenzy.ml
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,20 @@ let main =
(fun _ -> raise (Arg.Bad "Unknown parameter"))
"Hide a host behind routers" ;
if Hashtbl.length routers = 0 then (
Printf.printf "Example:\n\
router_frenzy -l router0:router1 -l router1:router2 -first router0 -last router2\n\n" ;
exit 0) ;
(* We might still have a single router mentioned in [fst_router_name]
* and [lst_router_name]: *)
if !fst_router_name <> "" then (
if !lst_router_name = "" then
lst_router_name := !fst_router_name ;
if !input_subnet = "" then set_subnet_seq 0 ;
let s = next_subnet () in
add_port !fst_router_name (next_cidr_of_subnet s) []
) else (
Printf.printf "Example:\n\
router_frenzy -l router0:router1 -l router1:router2 -first router0 -last router2\n\n" ;
exit 0
)
) ;
(* Add a port for entry, with input mac address. Must be the first port
* of that router: *)
if !fst_router_name = "" then
Expand Down

0 comments on commit d332ff2

Please sign in to comment.