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

pull/733/head
Brad Fitzpatrick 4 years ago
parent 09d56f54a7
commit 6d14678009

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

@ -50,7 +50,7 @@ func newUserspaceRouter(logf logger.Logf, _ *device.Device, tundev tun.Device) (
func cmd(args ...string) *exec.Cmd { func cmd(args ...string) *exec.Cmd {
if len(args) == 0 { 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:]...) return exec.Command(args[0], args[1:]...)
} }

@ -49,7 +49,7 @@ func newUserspaceBSDRouter(logf logger.Logf, _ *device.Device, tundev tun.Device
func cmd(args ...string) *exec.Cmd { func cmd(args ...string) *exec.Cmd {
if len(args) == 0 { 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:]...) return exec.Command(args[0], args[1:]...)
} }

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

Loading…
Cancel
Save