Metadata in a packet tunnel

Hello!


I was wondering why NEPacket's metadata was always nil in a packet tunnel.


In writing a packet tunnel, it could be very interesting to know which app is making the request, not only for some good visualisation and understanding of where traffic is originating from, but also to potentially implement blacklists/whitelists through the VPN.

I am aware of the Per-App VPN as well, but that is not enough because that only includes traffic from a whitelist, and that would also need to be set-up through MDM.


What is a bit puzzling is that the documentation doesn't say when metadata could be set, although the headers actually do, stating:

This property will only be non-nil when the routing method for the NEPacketTunnelProvider is NETunnelProviderRoutingMethodSourceApplication.


However, NEPacket doesn't seem to be used anywhere else other than in a Packet Tunnel, so it is a bit confusing (although I guess it could be used internally by the Per-App VPN mechanism?)


Am I doing something wrong? As in, is there a way for me to be able to get that metadata, that I may not be doing?


If it isn't possible, I assume that'd be worth creating an enhancement request so that it's at least considered for future versions?

Replies

I was wondering why

NEPacket
’s metadata was always nil in a packet tunnel.

The metadata is there to support per-app VPN, that is, source application routing mode. You won’t get it in destination IP routing mode.

If that would be useful to you, you should file an enhancement request describing your requirements. 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"

As usual, thank you for your prompt response (and sorry for my slow one).


I have filled rdar://48182065

I am also looking for this feature,Please let me know if this feature has been implmented or not ?