编写OS X内核扩展以实现Linux的SO_BINDTODEVICE套接字选项 [英] Writing an OS X kernel extension to implement Linux's SO_BINDTODEVICE socket option

查看:164
本文介绍了编写OS X内核扩展以实现Linux的SO_BINDTODEVICE套接字选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够通过特定的网络接口强制套接字.在Linux中,内核允许程序员通过设置所述套接字选项来实现这一目标-但在OS X中,我处于黑暗中.

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.

因此,我的标题问题-可能吗?完成了吗我不打算重新实现IP堆栈,而只是启用对接口绑定选项的使用.

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.

推荐答案

使用RFC 3542接口选择传出接口(IPV6_PKTINFO). http://tools.ietf.org/html/rfc3542#section-6

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

这篇关于编写OS X内核扩展以实现Linux的SO_BINDTODEVICE套接字选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆