Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't sync when device is on cellular/mobile connection #4808

Closed
dryo opened this issue May 7, 2016 · 38 comments · Fixed by #11305
Closed

Don't sync when device is on cellular/mobile connection #4808

dryo opened this issue May 7, 2016 · 38 comments · Fixed by #11305
Assignees
Labels
Enhancement Highlight p2-high Escalation, on top of current planning, release blocker
Milestone

Comments

@dryo
Copy link

dryo commented May 7, 2016

Tablets sometimes have mobile broadband onboard. The client should not sync over such connections or even better let the user define that.

IMO it would be best if the client asked upon detecting an unknown connection whether to automatically sync, not sync at all or ask every time for this network. This should be regardless of connection type (LAN, WiFi, Mobile, …) because some USB broadband devices emulate a LAN connection.

This would also solve #4309 and partially solve #1971

@danimo
Copy link
Contributor

danimo commented May 10, 2016

How would the client know that?

@stonerl
Copy link

stonerl commented May 12, 2016

Maybe, if possible only sync when connected to specific networks. I don't know whether or not this is doable.

On Android, the Podcatcher Antennapod has an option that let's the user specify the WiFi-Networks over which sync is allowed.

But to do such a check the ownCloud-client would have to know with which network it is connected. Is this even possible on OSX/Linux/Windows?

@jaykay2342
Copy link

On linux most distributions use the Network Manager. You can talk to it via a socket to know which connection is in use. Alternatively it would be nice if there is a way to do it the other way around. A interface (socket/cmd) i can talk to the ownCloud client to tell it to pause syncing, that would help to write a small plugin for the network manager to pause syncing when certain connections are in use.

@mikedolx
Copy link

This feature is for me more than an enhancement. I use a cellular modem in my laptop and due to the client i regulary wipe my data plan. This occurs very often to me. Of course, i regulary pause synching, but when I'm home i resume synching. Afterwards i forget it and my data plan is gone - its only 750MB.

I know at least in Windows 10 it is possible to define any network connection as "clocked" (thats the translation from german, i don't know how it's called on an english windows 10).

I wonder if the client could use this information and automatically pause synching when on a "clocked" network in windows 10.

@dragotin
Copy link
Contributor

Utilizing this function https://msdn.microsoft.com/en-us/library/windows/desktop/aa384702(v=vs.85).aspx we could detect at least if we are connected via LAN. With that, we could have a checkbox

  • Only sync when connected via LAN

however, we probably would like to include WLAN in that too, right? I wonder why the API does not allow that....

@mikedolx
Copy link

mikedolx commented Aug 5, 2016

I use my laptop on ethernet when i'm home, so such kind of checkbox would be sufficient for me.

@pako81
Copy link

pako81 commented Dec 2, 2016

@pmaier1 00006690

@hodyroff
Copy link

hodyroff commented Dec 5, 2016

@SamuAlfageme Please check for the API to be used on the Windows side for that. What about MAC?

@phil-davis
Copy link
Contributor

In Windows10 you can set a network connection as "metered". Windows will use that setting to not download updates... over a "metered" connection. The selection choice is shown in the UI for WiFi and directly-mobile connections, but not for network devices that look like a wired LAN.
For wired-LAN-looking devices you have to make a registry setting, instructions here that have worked for me:
http://www.windowscentral.com/how-set-ethernet-connection-metered-windows-10
In my case, I had and old iPhone3GS that plugged directly into my laptop to give internet to the laptop, but of course that looked like a LAN to Windows10 and it downloaded a heap of stuff automagically, using up my mobile data quota.
It seems this feature was added in Windows8, so for Windows8 and above, it would be possible to check if the connection is marked as "metered". So would not work for Windows7.

@SamuAlfageme
Copy link
Contributor

@hodyroff the support reference that @phil-davis links in his comment is a great place to start understanding the options that allow this behavior in Windows: it's a global OS option that wouldn't add logic to the client.

As for today; the convergence in Microsoft's OS (mobile and desktop) is making them the only folks offering these kind of options (Apple is almost always assuming his users on the move are working with iOS, which conveniently offers a comprehensive API for this).

There exist many apps designed to do this globally and establish some kind of while/black-list of apps that can access the network under some conditions. But they all still rely in the user input (selecting those networks/profiles and apps that are targeted). Some examples to see how they implement this behavior, are:

Manually selecting networks that are known to be mobile/tethered is the most effective way to do this. It would be even possible to give the illusion of doing this automatically with some workarounds: e.g. switching between different OS X profiles and Firewall settings to limit the traffic of the application when connecting to specific networks, trying the low level path and detect tethering in the bottom layers of the packages (e.g. checking the manufacturer part of the MAC address, etc.). But all these options add complexity to the client while not being 100% reliable.

At the end of the day there must be always some kind of user input about which networks/SSIDs are cellular connections (or need to be seen as such).

@michaelstingl
Copy link
Contributor

Using Tripmode would also be my recommended workaround. Works on Win and Mac and is only US$7.99.

@pmaier1
Copy link

pmaier1 commented Dec 14, 2016

For desktop we should suggest using a tool like @SamuAlfageme and @michaelstingl proposed since every other possibility will either require user input (which amounts to roughly the same as configuring such a tool) or won't be 100% reliable. Can we close here?

@sagamusix
Copy link

None of the suggested alternatives are free software or at least free (plus they require extra trust for doing questionable modifiactions to your operating system), and older Windows versions which are still supported do not have metered connections (but are aware of mobile broadband connections).

@hodyroff
Copy link

For me it sounds like the right approach is to do this outside of the ownCloud Desktop Client then. When users want to do this, its likely that oC is not the only application they should worry about. If there is currently no free tool, encouraging to develop one seems the best way, rather then try to put this into the ownCloud Client. We have plenty of corner cases to worry about first. We also have the "pause" as a workaround. If strong, new points come up, please don't hesitate to comment further.

@sagamusix
Copy link

When users want to do this, its likely that oC is not the only application they should worry about

Not really - ownCloud is pretty much the only application that can single-handedly create hundreds of MB of traffic without asking the user. This just happened to me last week, I accidentally used up 70% of my monthly mobile data quota in a few minutes because I didn't realize that ownCloud was running. In that case, "pause" is not a work-around, because at that point it's already too late.

@hodyroff
Copy link

I am getting that point - still can think of quite some other applications.
But which magic shall allow the Desktop Client to know that and react correctly?

@michaelstingl
Copy link
Contributor

@sagamusix Shouldn't it be possible with firewall configuration? Blocking the oC desktop sync client when connected within the IP range from the mobile provider? As far as I know, this is what Little Snitch does with a fancy UI.

@sagamusix
Copy link

sagamusix commented Dec 14, 2016

@hodyroff On a very basic level, this could be implemented in the way @dragotin suggested, at least on Windows. There are probably similar APIs on other platforms.

@michaelstingl Interesting idea, I guess on a more simple level I could block ownCloud from accessing public networks, which is not quite the same but a good approximation (and possibly the only way in Windows 7, as you cannot differentiate rules by NIC: https://serverfault.com/questions/229545/how-to-configure-different-firewall-rules-on-2-different-network-cards-in-window). That way, I do not have to rely on specific IP ranges which could change without further notice.

@guruz
Copy link
Contributor

guruz commented Apr 11, 2018

I'll keep this open as a request / known issue after all.

@mihovilkolaric
Copy link

I would really appreciate the feature also for the Linux client - most desktops-linuxes are using NetworkManager which provides the information whethter a connection is metered using DBUS:
https://developer.gnome.org/NetworkManager/unstable/gdbus-org.freedesktop.NetworkManager.html#gdbus-property-org-freedesktop-NetworkManager.Metered
resp. there seems to be an API for Qt: https://api.kde.org/frameworks/networkmanager-qt/html/classNetworkManager_1_1Device.html

@paultjevdh
Copy link

Hi,
I agree this feature is sorely missed. Yesterday owncloud ate 1 GB of my dataplan while commuting. I don't want this to happen every day.
The competition (onedrive) immediately paused when I connected to my phone hotspot. I was disappointed that owncloud doesn't even offer the feature.

Paul

@michaelstingl
Copy link
Contributor

owncloud ate 1 GB of my dataplan while commuting

Do you use VFS feature? Then it shouldn't eat so much data?

@TheOneRing TheOneRing added this to the Desktop Client 6.0 milestone Jun 28, 2023
@TheOneRing TheOneRing added the p3-medium Normal priority label Jun 28, 2023
@TheOneRing TheOneRing added p2-high Escalation, on top of current planning, release blocker and removed p3-medium Normal priority labels Aug 29, 2023
@TheOneRing
Copy link
Member

Add new setting to the netwroking section to enable/disable upload when connection is metered.

Image

@erikjv
Copy link
Collaborator

erikjv commented Oct 24, 2023

Note: when a user forces a sync, pop up a dialog to confirm. (Forced syncs have a higher priority in the scheduler.)

@erikjv erikjv linked a pull request Oct 27, 2023 that will close this issue
erikjv added a commit that referenced this issue Oct 30, 2023
Add an advanced configuration setting to pause synchronization when a
metered internet connection is detected.

Fixes: #4808
erikjv added a commit that referenced this issue Nov 2, 2023
Add an advanced configuration setting to pause synchronization when a
metered internet connection is detected.

When the internet connection is metered, and the user chooses to
force-sync a folder, they will now be asked if they are sure that they
want to do this.

Fixes: #4808
@erikjv
Copy link
Collaborator

erikjv commented Nov 2, 2023

Test steps are in the PR.

@michaelstingl
Copy link
Contributor

In macOS Sonoma 14.1, users have the option to set a network connection to "Low data mode". Could this be respected?

CleanShot 2023-11-09 at 13 06 57@2x

erikjv added a commit that referenced this issue Nov 9, 2023
Add an advanced configuration setting to pause synchronization when a
metered internet connection is detected.

When the internet connection is metered, and the user chooses to
force-sync a folder, they will now be asked if they are sure that they
want to do this.

Fixes: #4808
@erikjv
Copy link
Collaborator

erikjv commented Nov 9, 2023

In macOS Sonoma 14.1, users have the option to set a network connection to "Low data mode". Could this be respected?

@michaelstingl I cannot find any documentation on how to query/listen for this. I could post a question on the dev forums, but we should probably open a separate ticket to track that.

@michaelstingl
Copy link
Contributor

michaelstingl commented Nov 9, 2023

@michaelstingl I cannot find any documentation on how to query/listen for this. I could post a question on the dev forums, but we should probably open a separate ticket to track that.

Works for me.

Does this help?

erikjv added a commit that referenced this issue Dec 13, 2023
Add an advanced configuration setting to pause synchronization when a
metered internet connection is detected.

When the internet connection is metered, and the user chooses to
force-sync a folder, they will now be asked if they are sure that they
want to do this.

Fixes: #4808
erikjv added a commit that referenced this issue Dec 14, 2023
Add an advanced configuration setting to pause synchronization when a
metered internet connection is detected.

When the internet connection is metered, and the user chooses to
force-sync a folder, they will now be asked if they are sure that they
want to do this.

Fixes: #4808
erikjv added a commit that referenced this issue Jan 2, 2024
Add an advanced configuration setting to pause synchronization when a
metered internet connection is detected.

When the internet connection is metered, and the user chooses to
force-sync a folder, they will now be asked if they are sure that they
want to do this.

Fixes: #4808
erikjv added a commit that referenced this issue Jan 3, 2024
Add an advanced configuration setting to pause synchronization when a
metered internet connection is detected.

When the internet connection is metered, and the user chooses to
force-sync a folder, they will now be asked if they are sure that they
want to do this.

Fixes: #4808
erikjv added a commit that referenced this issue Jan 4, 2024
Add an advanced configuration setting to pause synchronization when a
metered internet connection is detected.

When the internet connection is metered, and the user chooses to
force-sync a folder, they will now be asked if they are sure that they
want to do this.

Fixes: #4808
erikjv added a commit that referenced this issue Jan 5, 2024
Add an advanced configuration setting to pause synchronization when a
metered internet connection is detected.

When the internet connection is metered, and the user chooses to
force-sync a folder, they will now be asked if they are sure that they
want to do this.

Fixes: #4808
TheOneRing pushed a commit that referenced this issue Jan 5, 2024
Add an advanced configuration setting to pause synchronization when a
metered internet connection is detected.

When the internet connection is metered, and the user chooses to
force-sync a folder, they will now be asked if they are sure that they
want to do this.

Fixes: #4808
@saw-jan
Copy link
Member

saw-jan commented Jan 8, 2024

Tested with ownCloud 6.0.0.13062-daily20240108 [b46134]

_ _
Screenshot from 2024-01-08 11-38-47 1. Network option Screenshot from 2024-01-08 11-38-55 2. Enable pause on metered conn.
Screenshot from 2024-01-08 11-42-15 3. Metered conn. ON Screenshot from 2024-01-08 11-41-13 4. Force sync dialog
Screenshot from 2024-01-08 11-42-23 5. File syncs Screenshot from 2024-01-08 11-43-14 6. Metered conn. OFF

@michaelstingl
Copy link
Contributor

Please update the docs issue with the supported platforms:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Highlight p2-high Escalation, on top of current planning, release blocker
Projects
None yet
Development

Successfully merging a pull request may close this issue.