NEPacketTunnelProvider ignoring /etc/hosts file

My NEPacketTunnelProvider uses NSURLSession for certain communication with my server. It seems to ignore the /etc/hosts file, though.


I created a hosts entry for "vpn.example.com". This entry works great with Safari and with NSURLSession in my app, which are both able to access the server. But NSURLSession in my tunnel provider just times out. I can access the same server by its real hostname (not the /etc/hosts entry) or IP from the tunnel provider without issue.


Is this known/expected behavior?


Thanks

Mike



Edit: This behavior is on macOS 10.12.6.

Replies

My NEPacketTunnelProvider uses NSURLSession for certain communication with my server. It seems to ignore the

/etc/hosts
file, though.

Are you seeing any sandbox violations being logged in Console?

Share and Enjoy

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

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

Yes, I see these sandbox messages:


error 233: 0x93f95 10:34:52.819216 -0700 sandboxd SandboxViolation: fontd(402) deny file-issue-extension target: /Network/Library class: com.apple.app-sandbox.read [Duplicate; no report will be generated.]

default 32475: 0x942c5 10:34:53.455402 -0700 XPCKeychainSandboxCheck UNIX error exception: 17

default 32475: 0x942c5 10:34:53.455677 -0700 XPCKeychainSandboxCheck 0x7fc672200430 opened /private/var/db/mds/system/mdsDirectory.db: 50744 bytes

default 32475: 0x942c5 10:34:53.457022 -0700 XPCKeychainSandboxCheck UNIX error exception: 17

default 32475: 0x942c5 10:34:53.457346 -0700 XPCKeychainSandboxCheck UNIX error exception: 17

default 32475: 0x942c5 10:34:53.457600 -0700 XPCKeychainSandboxCheck UNIX error exception: 17

Well, I’m pretty sure that

fontd
isn’t involved here (-: Nor the Spotlight service (
mds
) for that matter.

I don’t know why this isn’t working. If this really matters to you I recommend you open a DTS tech support incident so I can look at this in more detail.

Share and Enjoy

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

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