From owner-freebsd-bugs@FreeBSD.ORG  Thu Mar 13 19:40:01 2014
Return-Path: <owner-freebsd-bugs@FreeBSD.ORG>
Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id A8827ED3
 for <freebsd-bugs@smarthost.ysv.freebsd.org>;
 Thu, 13 Mar 2014 19:40:01 +0000 (UTC)
Received: from freefall.freebsd.org (freefall.freebsd.org
 [IPv6:2001:1900:2254:206c::16:87])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by mx1.freebsd.org (Postfix) with ESMTPS id 8500D6BA
 for <freebsd-bugs@smarthost.ysv.freebsd.org>;
 Thu, 13 Mar 2014 19:40:01 +0000 (UTC)
Received: from freefall.freebsd.org (localhost [127.0.0.1])
 by freefall.freebsd.org (8.14.8/8.14.8) with ESMTP id s2DJe1Yg033536
 for <freebsd-bugs@freefall.freebsd.org>; Thu, 13 Mar 2014 19:40:01 GMT
 (envelope-from gnats@freefall.freebsd.org)
Received: (from gnats@localhost)
 by freefall.freebsd.org (8.14.8/8.14.8/Submit) id s2DJe1MR033535;
 Thu, 13 Mar 2014 19:40:01 GMT (envelope-from gnats)
Resent-Date: Thu, 13 Mar 2014 19:40:01 GMT
Resent-Message-Id: <201403131940.s2DJe1MR033535@freefall.freebsd.org>
Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer)
Resent-To: freebsd-bugs@FreeBSD.org
Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org,
 Alan Somers <asomers@freebsd.org>
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 9C6BFC58
 for <freebsd-gnats-submit@FreeBSD.org>; Thu, 13 Mar 2014 19:36:22 +0000 (UTC)
Received: from cgiserv.freebsd.org (cgiserv.freebsd.org
 [IPv6:2001:1900:2254:206a::50:4])
 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mx1.freebsd.org (Postfix) with ESMTPS id 87E6466B
 for <freebsd-gnats-submit@FreeBSD.org>; Thu, 13 Mar 2014 19:36:22 +0000 (UTC)
Received: from cgiserv.freebsd.org ([127.0.1.6])
 by cgiserv.freebsd.org (8.14.8/8.14.8) with ESMTP id s2DJaM8S090924
 for <freebsd-gnats-submit@FreeBSD.org>; Thu, 13 Mar 2014 19:36:22 GMT
 (envelope-from nobody@cgiserv.freebsd.org)
Received: (from nobody@localhost)
 by cgiserv.freebsd.org (8.14.8/8.14.8/Submit) id s2DJaMvO090920;
 Thu, 13 Mar 2014 19:36:22 GMT (envelope-from nobody)
Message-Id: <201403131936.s2DJaMvO090920@cgiserv.freebsd.org>
Date: Thu, 13 Mar 2014 19:36:22 GMT
From: Alan Somers <asomers@freebsd.org>
To: freebsd-gnats-submit@FreeBSD.org
X-Send-Pr-Version: www-3.1
Subject: bin/187551: ifconfig should change its process fib when configuring
 an interface with nondefault fib
X-BeenThere: freebsd-bugs@freebsd.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: Bug reports <freebsd-bugs.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/freebsd-bugs>,
 <mailto:freebsd-bugs-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-bugs/>
List-Post: <mailto:freebsd-bugs@freebsd.org>
List-Help: <mailto:freebsd-bugs-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-bugs>,
 <mailto:freebsd-bugs-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 13 Mar 2014 19:40:01 -0000


>Number:         187551
>Category:       bin
>Synopsis:       ifconfig should change its process fib when configuring an interface with nondefault fib
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 13 19:40:01 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     Alan Somers
>Release:        11.0-CURRENT  r262867
>Organization:
Spectra Logic
>Environment:
FreeBSD alans-fbsd-head 11.0-CURRENT FreeBSD 11.0-CURRENT #39 r263109M: Thu Mar 13 11:31:56 MDT 2014     alans@ns1.eng.sldomain.com:/vmpool/obj/usr/home/alans/freebsd/head/sys/GENERIC  amd64
>Description:
When configuring an interface with a nondefault fib, ifconfig(8) should changes its process fib to match the interface fib.  If it does not, and the user does not think to, then the new interface's subnet route will appear in FIB 0.  Note that this only matters when net.add_addr_allfibs=0
>How-To-Repeat:
# ifconfig tap0 create
# ifconfig tap0 192.0.2.2/24 fib 2
# setfib 2 netstat -rn -f inet
Routing tables (fib: 2)
# setfib 0 netstat -rn -f inet
Routing tables

Internet:
Destination        Gateway            Flags    Netif Expire
default            10.1.0.1           UGS       em0
10.1.0.0/20        link#1             U         em0
10.1.3.220         link#1             UHS       lo0
127.0.0.1          link#2             UH        lo0
192.0.2.0/24       link#3             U        tap0
192.0.2.2          link#3             UHS       lo0

>Fix:
==== //SpectraBSD/stable/sbin/ifconfig/iffib.c#2 (text) ====

@@ -76,6 +76,8 @@
 
        strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name));
        ifr.ifr_fib = fib;
+       if (setfib(fib) != 0) 
+               warn("setfib");
        if (ioctl(s, SIOCSIFFIB, (caddr_t)&ifr) < 0)
                warn("ioctl (SIOCSIFFIB)");
 }

>Release-Note:
>Audit-Trail:
>Unformatted: