From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 13 09:11:41 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF5E71065670 for ; Sun, 13 Feb 2011 09:11:41 +0000 (UTC) (envelope-from gujjenaveen@gmail.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id 649E18FC1E for ; Sun, 13 Feb 2011 09:11:41 +0000 (UTC) Received: by ywl2 with SMTP id 2so1721237ywl.13 for ; Sun, 13 Feb 2011 01:11:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=R2ev0ICyc+tPOWAXOZrCnJgOOhIaCElo+UbB+kPPuJw=; b=HCvEtGdF+zg9wRDubM4/j/3pntGpap24AHhsSxTFc19LWUgKNy5rX4jo/nAsmml87F Lh1yVaIqhJkpUM4RJ7mSSIiS4dh1dcGAJTY8LPAiezzShrpk6Diy1OEpZBETPVWgQGJP nm8jqnfnoU45ln2XvqGqUEMWkgnuTx66oxfCg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=dnnhb6GGw1lBiB7Yh6CHXJRYey+m3rYwO3ZGe0AAy46hmSnZcW77mjLHCwQiQmGj+g TV7mOY6rpxlI4ANmJN5rlrC6omr8Pasl8743c9wPqQBuwBPHVNjax3KXkkSg+f4Ttg52 21nIz/XdhD/7akrkUKfAsxdF7fK51RU5PDZoI= MIME-Version: 1.0 Received: by 10.236.105.226 with SMTP id k62mr4180319yhg.53.1297588300632; Sun, 13 Feb 2011 01:11:40 -0800 (PST) Received: by 10.236.110.52 with HTTP; Sun, 13 Feb 2011 01:11:40 -0800 (PST) In-Reply-To: <4D56F278.1060801@freebsd.org> References: <4D56F278.1060801@freebsd.org> Date: Sun, 13 Feb 2011 14:41:40 +0530 Message-ID: From: Naveen Gujje To: Julian Elischer Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Daniel Eischen , freebsd-hackers@freebsd.org Subject: Re: SO_SETFIB socket option X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Feb 2011 09:11:41 -0000 On Sun, Feb 13, 2011 at 2:20 AM, Julian Elischer 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.