From owner-freebsd-rc@FreeBSD.ORG Tue Dec 27 09:59:57 2011 Return-Path: Delivered-To: freebsd-rc@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23195106566C; Tue, 27 Dec 2011 09:59:57 +0000 (UTC) (envelope-from rea@codelabs.ru) Received: from 0.mx.codelabs.ru (0.mx.codelabs.ru [144.206.177.45]) by mx1.freebsd.org (Postfix) with ESMTP id A5CE88FC12; Tue, 27 Dec 2011 09:59:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=codelabs.ru; s=two; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=cL4FsuoX96rSmSXNIy1jJWvVlyATv0P+6aHeZm78c8o=; b=fOJczQZS8RSfPAhR6UcFHK/kvA7i6y4z56ZWdQCzZ2k3iqMZ7Y0VSLRXTKrqzlk/UDLZ1bfjruAiOeMPlrfgAyNKwqwK/TDSG4v+Ab3nFDQ0bwASStgBFNHsQQxiJ2EqwvkvMoNe2Knttlzg7NTwUPXARxnlZEKnPp30KxJEnW5qcc143CZor1+Zii44xJKD0YNof4rAg0PSyyf1qzGjbffoGFagOZv3dWsflk23IF9+BZvBAOuw4+CPDd96XcR3J9Rlw/Ui0Wp1z1yaY+PhrW9CHklfsFnG+3Bs8vKrAVoe6yIgG0hsNs17Y7xzZ8xHBT3g61PRs1ZM2StoIkGBRg==; Received: from void.codelabs.ru (void.codelabs.ru [144.206.177.25]) by 0.mx.codelabs.ru with esmtpsa (TLSv1:AES256-SHA:256) id 1RfTp4-000CEq-TO; Tue, 27 Dec 2011 12:59:55 +0300 Date: Tue, 27 Dec 2011 13:59:51 +0400 From: Eygene Ryabinkin To: Doug Barton Message-ID: References: <4EB6693F.2020102@delphij.net> <4EF93429.4020404@FreeBSD.org> <4EF96D7D.3030701@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="0ywUhQCikZ2Y3PNw" Content-Disposition: inline In-Reply-To: <4EF96D7D.3030701@FreeBSD.org> Sender: rea@codelabs.ru Cc: Brooks Davis , freebsd-rc@FreeBSD.ORG, Garrett Cooper , Dag-Erling Smorgrav , d@delphij.net, Xin LI Subject: Re: Annoying ERROR: 'wlan0' is not a DHCP-enabled interface X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2011 09:59:57 -0000 --0ywUhQCikZ2Y3PNw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Mon, Dec 26, 2011 at 11:02:21PM -0800, Doug Barton wrote: > On 12/26/2011 22:31, Garrett Cooper wrote: > > The only misgiving that I have about this is that it deletes the > > default route >=20 > Um, I'm not sure how it would do that. Can you fill me in? I can: {{{ # ifconfig nfe0 nfe0: flags=3D8802 metric 0 mtu 1500 options=3D82008 ether 00:18:f3:97:38:85 media: Ethernet autoselect (none) status: no carrier # ifconfig nfe0 inet 10.0.0.1 # route add -host 144.206.1.1 10.0.0.1 add host 144.206.1.1: gateway 10.0.0.1 # netstat -rn | grep 144.206.1.1 144.206.1.1 10.0.0.1 UHS 0 0 nfe0 # ifconfig nfe0 inet 10.0.0.1 # netstat -rn | grep 144.206.1.1 }}} and for interface in UP state {{{ $ ifconfig sk0 sk0: flags=3D8843 metric 0 mtu 1500 options=3D80009 ether 00:22:15:6e:9d:a9 inet 10.0.0.2 netmask 0xffffff00 broadcast 10.0.0.255 media: Ethernet autoselect (1000baseT ) status: active $ netstat -rn | grep 10.0.0.2 10.0.0.2 link#10 UHS 0 0 lo0 $ route add -host 144.206.1.1 10.0.0.2 add host 144.206.1.1: gateway 10.0.0.2 $ netstat -rn | grep 144.206.1.1 144.206.1.1 10.0.0.2 UHS 0 0 sk0 $ ifconfig sk0 inet 10.0.0.2/24 $ netstat -rn | grep 144.206.1.1 }}} All routes that are going through the interface are deleted from the routing table when we are assigning the address to the interface (not the alias, but the primary address). That happens because ifconfig's setifaddr() routine sets clearaddr to 1, http://svnweb.freebsd.org/base/head/sbin/ifconfig/ifconfig.c?revision=3D2= 28571&view=3Dmarkup#l636 ifconfig's ifconfig() function calls ioctl(SIOCDIFADDR) when clearaddr is non-zero, http://svnweb.freebsd.org/base/head/sbin/ifconfig/ifconfig.c?revision=3D2= 28571&view=3Dmarkup#l607 and SIOCDIFADDR scrubs the interface routes, http://svnweb.freebsd.org/base/head/sys/netinet/in.c?revision=3D228768&vi= ew=3Dmarkup#l601 for the natural reasons: we're deleting the interface address here. May I ask, if you tried to use the lone 'service netif start ' on your machine with all-static IP configuration and default route sitting on and what were the results of the test in respect to the state of the routing table and generall connectivity of your machine to the external networks after this test? Or, may be, you just tried your solution on the DHCP-enabled interface only? --=20 Eygene Ryabinkin ,,,^..^,,, [ Life's unfair - but root password helps! | codelabs.ru ] [ 82FE 06BC D497 C0DE 49EC 4FF0 16AF 9EAE 8152 ECFB | freebsd.org ] --0ywUhQCikZ2Y3PNw Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iF4EAREIAAYFAk75lxcACgkQFq+eroFS7PvxMgD9GhM9ekMLhgE7rHGZaXkXIoKq OpxdIlcK5mEt9/zME9wA/iJBUFAvX5CfMALfbICPbrkFRJ2Ol73reIhGstwTAhKo =4Kz4 -----END PGP SIGNATURE----- --0ywUhQCikZ2Y3PNw--