Re: Missing rt_priority in user-space visibility into kernel routing state?
Re: Missing rt_priority in user-space visibility into kernel routing state?
- Subject: Re: Missing rt_priority in user-space visibility into kernel routing state?
- From: Philip Prindeville <email@hidden>
- Date: Tue, 26 Feb 2013 11:41:16 -0700
On Feb 21, 2013, at 2:56 PM, Philip Prindeville <email@hidden> wrote:
>
> On Feb 21, 2013, at 2:12 PM, Josh Graessley <email@hidden> wrote:
>
>>
>> On Feb 21, 2013, at 1:05 PM, Philip Prindeville <email@hidden> wrote:
>>
>>> I was porting some code (for the Poco toolkit) to examine kernel routing tables in a platform-independent way, and noticed that while OpenBSD, Linux, and even Win32 all expose routing metrics to user-space, this doesn't seem to happen in Darwin.
>>>
>>> For instance, in OpenBSD, the rt_msghdr includes the rt_priority field (as uint8_t):
>>>
>>> http://fxr.watson.org/fxr/source/net/route.h?v=OPENBSD#L123
>>>
>>> But the rt_msghdr2 in XNU 10.8.2 doesn't seem to include any priority (nor does the substructure rt_metrics):
>>>
>>> http://fxr.watson.org/fxr/source/bsd/net/route.h?v=xnu-2050.18.24#L264
>>>
>>> I've RTFM'd several times but can't figure out how to calculate, from within user-space, how route-selection happens in the kernel.
>>>
>>> Is there some out-of-band mechanism for getting this information? I was using sysctl() on CTL_NET.PF_ROUTE.0.0.NET_RT_DUMP2.0 but this seems to be a dead-end.
>>>
>>> I have some applications that rely on understanding kernel routing to operate correctly and I'm blocked on porting them to MacOS X until I can figure out, for instance, which interface on a multi homed host will the kernel use on an active (outbound) unbound connection when contacting a remote host (especially important in the case of NATting so I know which gateway's external address to advertise, for instance).
>>
>>
>> Why do you need a priority? When you perform a route lookup, that route that matches is the one that will be used.
>>
>> -josh
>>
>>
>
>
> If it's not an explicit match, and I have multiple default routes, then it might match more than one.
>
> This is the case if I'm using Ethernet, Wifi, and VPN tunneling all simultaneously for instance.
>
> -Philip
>
Ok, I'm guessing that there is no way to retrieve metric information from the kernel.
Too bad.
Odd that OpenBSD has that functionality but XNU doesn't.
-Philip
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden