diff --git a/net/dns/manager_linux.go b/net/dns/manager_linux.go index b633d7fcf..843abca16 100644 --- a/net/dns/manager_linux.go +++ b/net/dns/manager_linux.go @@ -321,15 +321,15 @@ func resolvedIsActuallyResolver(bs []byte) error { } func dbusPing(name, objectPath string) error { - ctx, cancel := context.WithTimeout(context.Background(), time.Second) - defer cancel() - conn, err := dbus.SystemBus() if err != nil { // DBus probably not running. return err } + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + defer cancel() + obj := conn.Object(name, dbus.ObjectPath(objectPath)) call := obj.CallWithContext(ctx, "org.freedesktop.DBus.Peer.Ping", 0) return call.Err