Writing an OS X kernel extension to implement Linux's SO_BINDTODEVICE socket option

一世执手 提交于 2019-12-06 20:06:01

问题


I want to be able to force a socket through a specific network interface. In Linux the kernel allows a programmer to achieve this by setting said socket option - but in OS X I'm in the dark.

And hence my title question - is it possible? Has it been done? I'm not looking into re-implementing the IP stack, just enabling the usage of the bind-to-interface option.


回答1:


Use the RFC 3542 interface for selecting outgoing interfaces (IPV6_PKTINFO). http://tools.ietf.org/html/rfc3542#section-6



来源:https://stackoverflow.com/questions/12439973/writing-an-os-x-kernel-extension-to-implement-linuxs-so-bindtodevice-socket-opt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!