Try to fix CKR setup deadlock, fix some Windows output formatting

This commit is contained in:
Neil Alexander 2019-07-06 20:08:32 +01:00
parent a10c141896
commit 30c03369cd
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
3 changed files with 19 additions and 21 deletions

View file

@ -31,18 +31,18 @@ func (tun *TunAdapter) setup(ifname string, iftapmode bool, addr string, mtu int
}
// Disable/enable the interface to resets its configuration (invalidating iface)
cmd := exec.Command("netsh", "interface", "set", "interface", iface.Name(), "admin=DISABLED")
tun.log.Printf("netsh command: %v", strings.Join(cmd.Args, " "))
tun.log.Debugln("netsh command:", strings.Join(cmd.Args, " "))
output, err := cmd.CombinedOutput()
if err != nil {
tun.log.Errorf("Windows netsh failed: %v.", err)
tun.log.Errorln("Windows netsh failed:", err)
tun.log.Traceln(string(output))
return err
}
cmd = exec.Command("netsh", "interface", "set", "interface", iface.Name(), "admin=ENABLED")
tun.log.Printf("netsh command: %v", strings.Join(cmd.Args, " "))
tun.log.Debugln("netsh command:", strings.Join(cmd.Args, " "))
output, err = cmd.CombinedOutput()
if err != nil {
tun.log.Errorf("Windows netsh failed: %v.", err)
tun.log.Errorln("Windows netsh failed:", err)
tun.log.Traceln(string(output))
return err
}
@ -71,10 +71,10 @@ func (tun *TunAdapter) setupMTU(mtu int) error {
fmt.Sprintf("interface=%s", tun.iface.Name()),
fmt.Sprintf("mtu=%d", mtu),
"store=active")
tun.log.Debugln("netsh command: %v", strings.Join(cmd.Args, " "))
tun.log.Debugln("netsh command:", strings.Join(cmd.Args, " "))
output, err := cmd.CombinedOutput()
if err != nil {
tun.log.Errorf("Windows netsh failed: %v.", err)
tun.log.Errorln("Windows netsh failed:", err)
tun.log.Traceln(string(output))
return err
}
@ -88,10 +88,10 @@ func (tun *TunAdapter) setupAddress(addr string) error {
fmt.Sprintf("interface=%s", tun.iface.Name()),
fmt.Sprintf("addr=%s", addr),
"store=active")
tun.log.Debugln("netsh command: %v", strings.Join(cmd.Args, " "))
tun.log.Debugln("netsh command:", strings.Join(cmd.Args, " "))
output, err := cmd.CombinedOutput()
if err != nil {
tun.log.Errorf("Windows netsh failed: %v.", err)
tun.log.Errorln("Windows netsh failed:", err)
tun.log.Traceln(string(output))
return err
}