Cellular data usage double counted when using an NEPacketTunnelProvider

Hi,


We notice with our app which we ship with an NEPacketTunnelProvider Network Extension that iOS does not correctly track the device and apps’ data usage over cellular networks when the traffic is going through an NEPacketTunnelProvider. All data going through the NEPacketTunnelProvider to the VPN tunnel server is counted towards the total cellular usage of the originating app as well as that of the app containing the NEPacketTunnelProvider. This leads to the containing app seeming to be responsible for 50% of all data usage and it also inflates the displayed total cellular data usage to 200% of the actual usage.

It seems all data in packets read from and written to the NEPacketFlow as well as all data read from and written to the BSD sockets used to forward all traffic to the tunnel server are counted towards the containing app’s total cellular data usage.


Example:

Let’s say we reset our cellular usage tracking and use 500 MB with Safari, 2 GB with Youtube and maybe 100KB for the PacketTunnelApp. We expect to end up with the following usage summary:

  • Safari: 500 MB
  • Youtube: 2 GB
  • PacketTunnelApp: 100 KB

Total cellular usage: ~2,5 GB (= 500 MB + 2 GB + 100 KB)


But the actual summary looks like this:

  • Safari: 500 MB
  • Youtube: 2 GB
  • PacketTunnelApp: ~2,5 GB (= 50% of displayed total)

Total cellular usage: ~5 GB (= 200% of actual usage)

Note that the PacketTunnelApp’s cellular usage is equal to all the other apps combined.



Does anyone else also have this problem?

Replies

Does anyone else also have this problem?

I’ve not seen this before but it doesn’t surprise me given how all the various parts fit together. You should definitely file a bug about this. Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thanks for replying to quickly! I reported the bug along with this thread, the bug number is 37598258.

Hey Eskimo, sorry I'm new to this. I got the same issue and noticed the bug number, but how do I actually track it? I was not able to search the number in the bug report system.

I got the same issue and noticed the bug number, but how do I actually track it? I was not able to search the number in the bug report system.

Apple Bug Reporter, alas, only lets you see bug reports that you filed (hence the existence of this). One option here is to file your own bug asking it to be closed as a duplicate of the existing bug. That duplicate relationship will allow you to see the status of the original (but only the status).

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thanks Eskimo. I came across the open radar but this particular one is not there. I'll take your advise and file my own bug.

Question for anyone who is experiencing this problem: do you observe your wireless carrier billing you for double the actual data usage, or is the problem just the double-counting in Settings?

It’s hard to imagine how this could result in twice the number of packets going out on the ‘wire’. If you want to check that yourself, you can do that using an RVI packet trace (per QA1176 Getting a Packet Trace). The packet metadata includes the interface, allowing you to set up a filter for the traffic going over the WWAN interface.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

It does not affect the billing, at least for me. My operator (Singtel) has an app that can track your data usage in real time. While I see 200MB data usage from Setting's statistics (~100 from the app and another ~100 from the VPN), I only see 100 real data usage in the Singtel app.

I have not observed double-billing either, just the double-counting in the iOS Settings.