netsh
This commit is contained in:
parent
7bd99d346a
commit
4a2bcb89cc
@ -51,7 +51,8 @@ impl Iface {
|
||||
let ip = ip_to_string(&ip);
|
||||
let netbit = ip_to_string(&net_bit_len_to_mask(netbit));
|
||||
|
||||
let res = Command::new("netsh")
|
||||
let mut cmd = Command::new("netsh");
|
||||
let command = cmd
|
||||
.arg("interface")
|
||||
.arg("ip")
|
||||
.arg("set")
|
||||
@ -59,11 +60,13 @@ impl Iface {
|
||||
.arg(&format!("name=\"{}\"", self.name))
|
||||
.arg("source=static")
|
||||
.arg(&format!("addr={}", ip))
|
||||
.arg(&format!("mask={}", netbit))
|
||||
.output();
|
||||
.arg(&format!("mask={}", netbit));
|
||||
|
||||
let res = command.output();
|
||||
|
||||
match res {
|
||||
Ok(_) => {
|
||||
debug!("netsh ok");
|
||||
Ok(r) => {
|
||||
debug!("netsh ok: {:?}", r);
|
||||
}
|
||||
Err(e) => {
|
||||
error!("failed to run netsh: {}", e.to_string());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user