svn commit: r193199 - head/etc
John Baldwin
jhb at freebsd.org
Tue Jun 2 19:45:46 UTC 2009
On Tuesday 02 June 2009 3:22:23 pm Doug Barton wrote:
> John Baldwin wrote:
> > I think more specifically, if you don't set 'ifconfig_<if>' to "DHCP",
then
> > when you plug a <if> device in, nothing happens.
>
> That's actually not correct, as devd will try to dhcp an interface as
> soon as it comes up.
That is completely wrong. Checking the actual code would probably be helpful
here. From /etc/devd.conf:
#
# Try to start dhclient on Ethernet like interfaces when the link comes
# up. Only devices that are configured to support DHCP will actually
# run it. No link down rule exists because dhclient automaticly exits
# when the link goes down.
#
notify 0 {
match "system" "IFNET";
match "type" "LINK_UP";
media-type "ethernet";
action "/etc/rc.d/dhclient start $subsystem";
};
Note the comment. From /etc/rc.d/dhclient:
ifn="$2"
load_rc_config $name
load_rc_config network
if ! dhcpif $ifn; then
return 1
fi
run_rc_command "$1"
From /etc/network.subr:
# dhcpif if
# Returns 0 if the interface is a DHCP interface and 1 otherwise.
dhcpif()
{
_tmpargs=`_ifconfig_getargs $1`
for _arg in $_tmpargs; do
case $_arg in
[Dd][Hh][Cc][Pp])
return 0
;;
[Nn][Oo][Ss][Yy][Nn][Cc][Dd][Hh][Cc][Pp])
return 0
;;
[Ss][Yy][Nn][Cc][Dd][Hh][Cc][Pp])
return 0
;;
esac
done
return 1
}
Clearly if you do not have 'DHCP' set in your ifconfig_<if> variable, dhcpif
will be false, and /etc/rc.d/dhclient will be a nop.
> > DHCP is opt-in, not
> > opt-out. The only reason one would want to limit network_interfaces is if
> > you wanted to have an ifconfig_foo0 line in /etc/rc.conf but not have foo0
> > configured automatically.
>
> I've already said several times that I want to run through my own list
> of interfaces, configure the first one that comes up, and then stop.
> There is no support for that currently. Others have also chimed in
> with things that they do with the existing feature as well.
This is an interesting problem, though I think network_interfaces is a rather
odd way of going about it. Do you boot to single user and edit rc.conf all
the time? I don't see how else you are using network_interfaces to implement
this. I think a better solution to that problem would be to assign
interfaces priority (if_priority_<if>="N" perhaps). Also, note that
the /etc/rc.d/defaultroute script does only hold up the boot until at least
one interface gets a default route. For the common wireless vs. wired case
that works well, and even OS X will configure both wired and wireless
interfaces if both work, it simply uses the priority to determine whose
default route "wins".
--
John Baldwin
More information about the svn-src-head
mailing list