wgengine/router: remove unnecessary newlines in log.Printf formats

This commit is contained in:
Brad Fitzpatrick 2020-09-01 13:27:42 -07:00
parent 09d56f54a7
commit 6d14678009
4 changed files with 14 additions and 14 deletions

View File

@ -70,7 +70,7 @@ func bindSocketRoute(family winipcfg.AddressFamily, device *device.Device, ourLu
return bind.BindSocketToInterface6(index, false)
}
} else {
log.Printf("WARNING: skipping windows socket binding.\n")
log.Printf("WARNING: skipping windows socket binding.")
}
return nil
}
@ -194,10 +194,10 @@ func setFirewall(ifcGUID *windows.GUID) (bool, error) {
return false, fmt.Errorf("nco.GetAdapterId: %v", err)
}
if aid != ifcGUID.String() {
log.Printf("skipping adapter id: %v\n", aid)
log.Printf("skipping adapter id: %v", aid)
continue
}
log.Printf("found! adapter id: %v\n", aid)
log.Printf("found! adapter id: %v", aid)
n, err := nco.GetNetwork()
if err != nil {
@ -216,7 +216,7 @@ func setFirewall(ifcGUID *windows.GUID) (bool, error) {
return false, fmt.Errorf("SetCategory: %v", err)
}
} else {
log.Printf("setFirewall: already category %v\n", cat)
log.Printf("setFirewall: already category %v", cat)
}
return true, nil
@ -228,7 +228,7 @@ func setFirewall(ifcGUID *windows.GUID) (bool, error) {
func configureInterface(cfg *Config, tun *tun.NativeTun) error {
const mtu = 0
guid := tun.GUID()
log.Printf("wintun GUID is %v\n", guid)
log.Printf("wintun GUID is %v", guid)
iface, err := winipcfg.InterfaceFromGUID(&guid)
if err != nil {
return err
@ -241,7 +241,7 @@ func configureInterface(cfg *Config, tun *tun.NativeTun) error {
for i := 0; i < 20; i++ {
found, err := setFirewall(&guid)
if err != nil {
log.Printf("setFirewall: %v\n", err)
log.Printf("setFirewall: %v", err)
// fall through anyway, this isn't fatal.
}
if found {
@ -328,21 +328,21 @@ func configureInterface(cfg *Config, tun *tun.NativeTun) error {
}
deduplicatedRoutes = append(deduplicatedRoutes, &routes[i])
}
log.Printf("routes: %v\n", routes)
log.Printf("routes: %v", routes)
var errAcc error
err = iface.SyncRoutes(deduplicatedRoutes)
if err != nil && errAcc == nil {
log.Printf("setroutes: %v\n", err)
log.Printf("setroutes: %v", err)
errAcc = err
}
ipif, err := iface.GetIpInterface(winipcfg.AF_INET)
if err != nil {
log.Printf("getipif: %v\n", err)
log.Printf("getipif: %v", err)
return err
}
log.Printf("foundDefault4: %v\n", foundDefault4)
log.Printf("foundDefault4: %v", foundDefault4)
if foundDefault4 {
ipif.UseAutomaticMetric = false
ipif.Metric = 0

View File

@ -50,7 +50,7 @@ func newUserspaceRouter(logf logger.Logf, _ *device.Device, tundev tun.Device) (
func cmd(args ...string) *exec.Cmd {
if len(args) == 0 {
log.Fatalf("exec.Cmd(%#v) invalid; need argv[0]\n", args)
log.Fatalf("exec.Cmd(%#v) invalid; need argv[0]", args)
}
return exec.Command(args[0], args[1:]...)
}

View File

@ -49,7 +49,7 @@ func newUserspaceBSDRouter(logf logger.Logf, _ *device.Device, tundev tun.Device
func cmd(args ...string) *exec.Cmd {
if len(args) == 0 {
log.Fatalf("exec.Cmd(%#v) invalid; need argv[0]\n", args)
log.Fatalf("exec.Cmd(%#v) invalid; need argv[0]", args)
}
return exec.Command(args[0], args[1:]...)
}

View File

@ -52,7 +52,7 @@ func (r *winRouter) Up() error {
var err error
r.routeChangeCallback, err = monitorDefaultRoutes(r.wgdev, true, r.nativeTun)
if err != nil {
log.Fatalf("MonitorDefaultRoutes: %v\n", err)
log.Fatalf("MonitorDefaultRoutes: %v", err)
}
return nil
}
@ -64,7 +64,7 @@ func (r *winRouter) Set(cfg *Config) error {
err := configureInterface(cfg, r.nativeTun)
if err != nil {
r.logf("ConfigureInterface: %v\n", err)
r.logf("ConfigureInterface: %v", err)
return err
}