configured_ifaces is a function that returns the names of each interface
that the user wanted configured.
Currently, this is accomplished by reading the list from
/tmp/net.ifaces. But if we want to allow the user to specify an
interface by its MAC address or IP or something, we need a function that
will read the cache and convert the MACs etc. to names.
(Obviously this conversion only works once udev starts, so it will warn
you if you try it too early.)
Now that we can use a MAC as a device identifier, we can just bring up
the device specified by BOOTIF as a normal interface.
So instead of ignoring everything but BOOTIF, we'll put BOOTIF in the
IFACES list and bring it up as normal, defaulting to DHCP if nothing
else is specified.
We can also handle anaconda-style 'ksdevice=bootif' this way.
Some network driver will take long time to initialize. We have an example
in a HP machine which take about one minute for this. The callback such as
"ip link set <dev> up" will fail, afterwards setup for network will also
fail.
Fix this by add a new function wait_for_if_link, wait the link ready before
use it.
Signed-off-by: Dave Young <dyoung@redhat.com>
set link up usually include two steps, ip link set <dev> up and
wait_for_if_up <dev>. Now do these two steps in one function linkup.
Later patch will add other code into it.
Signed-off-by: Dave Young <dyoung@redhat.com>
It looks like ip=ibft has been busted since
25aa3c5 network: refactor stuff from netroot/parse-ip-opts to net-lib
which moved ibft parsing code out to the ibft_to_cmdline function.
The use of ifname_mac was partially replaced by a local mac, but not
completely, causing ibft_to_cmdline to abort without generating network
configuration options.
Signed-off-by: Chris Leech <cleech@redhat.com>
We do not support renaming in the kernel namespace anymore (as udev does
that not anymore). So, if a user wants to use ifname, he has to rename
to a custom namespace. "eth[0-9]+" is not allowed anymore.
Anaconda used arguments of the form:
ip=<ip> gateway=<gw> netmask=<nm>
for static IP configuration. So if we get a value for "ip" that's an IP
address, look for gateway= and netmask= and related args to fill in the
ip config vars.
For NetworkManager to properly take over a NFS-root system, we need to
have the interface name(s) in /tmp/net.ifaces and save the dhclient
lease. This lets the ifcfg module do its magic.
save_netinfo should properly write out /tmp/net.ifaces when needed, and
copies the dhclient files into place.
This makes sure the network is active and ready to use during the
initqueue/online hook.
It also makes it so you can run setup_net repeatedly without causing
error messages.
Add new functions: all_ifaces_up, get_netroot_ip, ip_is_local, ifdown,
setup_net, set_ifname, ibft_to_cmdline
Use them in netroot.sh and parse-ip-opts.sh.
There's also a couple little unrelated cleanups.
net-lib.sh is a library of useful functions for network stuff.
More things may get added/moved here in the future.
Signed-off-by: Will Woods <wwoods@redhat.com>