SO_SETFIB socket option

Naveen Gujje gujjenaveen at gmail.com
Sun Feb 13 09:11:41 UTC 2011


On Sun, Feb 13, 2011 at 2:20 AM, Julian Elischer <julian at freebsd.org> wrote:

> On 2/12/11 8:40 AM, Daniel Eischen wrote:
>
>> On Sat, 12 Feb 2011, Naveen Gujje wrote:
>>
>>  Hi All,
>>>
>>> On my FreeBSD 7.2 box, I've two routing tables (FIBs). Fib 0 and Fib 1
>>> (net.fibs = 2).
>>>
>>> I have a simple echo client which is the counterpart of an echo server
>>> running somewhere.
>>> If I run this echo client against fib 0 as 'setfib 0 ./echo-client', it
>>> properly uses Fib 0.
>>> But, if I run this echo client against Fib 0 by using setsockopt &
>>> SO_SETFIB
>>> option, setsockopt fails with EINVAL.
>>>
>>> setsockopt & SO_SETFIB for Fib 1 succeeds. But it fails for Fib 0.
>>>
>>> By looking at the man page and /sys/kern/uipc_socket.c
>>>
>>
>> [ snip ]
>>
>>  Where as both Fib 0 and Fib 1 work fine if I use setfib() call.
>>>
>>
>> Looks like the code is wrong.  Have you tried patching the source
>> to see if it works for you?  Looks like you already know the fix,
>> but here is a patch if you'd like to rebuild your kernel to see
>> if it works.
>>
>>
> yeah looks like a braino on my part..  I probably only tested by going UP
> from fib0 to fib 1 and not
> teh other way around.
>
>
>
Thanks for the confirmation Daniel and Julian.

Tried with patched kernel and it fixes the problem.

Thanks,
Naveen G.


More information about the freebsd-hackers mailing list