Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding extra scripts

  • Loading branch information...
commit f82fd14cb587a97806fdf0c963fb8b76e2716905 1 parent ecbef27
cr409 authored
View
4 client_tactics/get_local_dev_ip
@@ -1,3 +1,3 @@
-#!/usr/bin/rnv bash
+#!/usr/bin/env bash
-ip addr show | awk '/^[0-9]:/ {dev=$2;sub(/\:/,"", dev);} /inet / {split($2,a,"/"); print dev,a[1];}'
+ip addr show | awk '/^[0-9]*:/ {dev=$2;sub(/\:/,"", dev);} /inet / {split($2,a,"/"); print dev,a[1];}'
View
2  client_tactics/get_local_device
@@ -1,3 +1,3 @@
#!/usr/bin/env bash
-ifconfig -a | grep HWaddr | awk '{print $1,$5}'
+ifconfig -a | grep HWaddr | awk '{split($3,a,":"); print $1,$5,a[2];}'
View
28 lib/client.ml
@@ -140,6 +140,33 @@ let update_server_if_state_has_changed () =
return ()
let client_t () =
+ lwt _ = Net_cache.Routing.load_routing_table () in
+(*
+ let (ip, gw, dev) = Net_cache.Routing.get_next_hop (Uri_IP.string_to_ipv4 "192.168.1.1") in
+ Printf.printf "loukup 192.168.1.1 -> %s %s %s\n%!" (Uri_IP.ipv4_to_string ip)
+ (Uri_IP.ipv4_to_string gw) dev;
+ let (ip, gw, dev) = Net_cache.Routing.get_next_hop (Uri_IP.string_to_ipv4 "10.21.0.1") in
+ Printf.printf "loukup 10.20.0.1 -> %s %s %s\n%!" (Uri_IP.ipv4_to_string ip)
+ (Uri_IP.ipv4_to_string gw) dev;
+ let (ip, gw, dev) = Net_cache.Routing.get_next_hop (Uri_IP.string_to_ipv4 "10.20.1.1") in
+ Printf.printf "loukup 10.20.1.1 -> %s %s %s\n%!" (Uri_IP.ipv4_to_string ip)
+ (Uri_IP.ipv4_to_string gw) dev;
+ let (ip, gw, dev) = Net_cache.Routing.get_next_hop (Uri_IP.string_to_ipv4 "10.20.0.1") in
+ Printf.printf "loukup 10.20.0.1 -> %s %s %s\n%!" (Uri_IP.ipv4_to_string ip)
+ (Uri_IP.ipv4_to_string gw) dev;
+ *)
+ lwt _ = Net_cache.Switching.load_arp () in
+(*
+ let ret = Net_cache.Switching.mac_of_ip (Net_cache.Switching.mac_of_string "08:00:27:9f:bc:b6") in
+ let _ =
+ match ret with
+ | None -> Printf.printf "no entry found for 08:00:27:9f:bc:b6\n%!"
+ | Some((ip, dev_id, typ)) ->
+ Printf.printf "08:00:27:9f:bc:b6 %s %s %s \n%!"
+ (Uri_IP.ipv4_to_string ip) dev_id
+ (Net_cache.Switching.string_of_dev_type typ)
+ in
+ *)
let xmit_t =
while_lwt true do
update_server_if_state_has_changed ();
@@ -162,5 +189,6 @@ let _ =
client_t ();
signal_t ~port:!node_port;
dns_t ();
+ Sp_controller.listen ();
] in
Lwt_main.run daemon_t
Please sign in to comment.
Something went wrong with that request. Please try again.