Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Dec 2011 13:59:51 +0400
From:      Eygene Ryabinkin <rea@FreeBSD.ORG>
To:        Doug Barton <dougb@FreeBSD.org>
Cc:        Brooks Davis <brooks@freebsd.org>, freebsd-rc@FreeBSD.ORG, Garrett Cooper <yanegomi@gmail.com>, Dag-Erling Smorgrav <des@des.no>, d@delphij.net, Xin LI <delphij@delphij.net>
Subject:   Re: Annoying ERROR: 'wlan0' is not a DHCP-enabled interface
Message-ID:  <J9XW%2BPh34E7GL%2B70uagShBXktSM@g5jH1yj%2BTnAiSdLOy3xs5Jutvhc>
In-Reply-To: <4EF96D7D.3030701@FreeBSD.org>
References:  <4EB6693F.2020102@delphij.net> <4EF93429.4020404@FreeBSD.org> <CDCD86D3-AC1C-4C5F-8848-7BA25CEF63F2@gmail.com> <4EF96D7D.3030701@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--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<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=3D82008<VLAN_MTU,WOL_MAGIC,LINKSTATE>
        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<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=3D80009<RXCSUM,VLAN_MTU,LINKSTATE>
	ether 00:22:15:6e:9d:a9
	inet 10.0.0.2 netmask 0xffffff00 broadcast 10.0.0.255
	media: Ethernet autoselect (1000baseT <full-duplex>)
	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
<your-if>' on your machine with all-static IP configuration and
default route sitting on <your-if> 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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?J9XW%2BPh34E7GL%2B70uagShBXktSM>