Commit Graph

440 Commits (b80ee080937ce364f7324c297f23e40af6d88892)

Author SHA1 Message Date
Harald Hoyer 36af0518b3 fix(network): correct regression in iface_has_carrier
Commit e25c536c70 introduced a regression in iface_has_carrier
due to unclear variable naming.
2021-03-31 21:29:52 +02:00
Harald Hoyer 09356085b6 ci: enable shellcheck for everything 2021-03-31 11:31:17 +02:00
Harald Hoyer e25c536c70 fix(network): shellcheck for modules.d/40network 2021-03-29 09:57:50 +02:00
Harald Hoyer 75d758e8f1 style: shfmt -s reformat
reproducible with:

```
$ shfmt_version=3.0.1
$ wget "https://github.com/mvdan/sh/releases/download/v${shfmt_version}/shfmt_v${shfmt_version}_linux_amd64" -O shfmt
$ chmod u+x shfmt
$ ./shfmt -w -s .
```
2021-03-13 20:10:43 +01:00
Harald Hoyer 9a52c3fdb0 style: shfmt reformat
reproducible with:

```
$ shfmt_version=3.0.1
$ wget "https://github.com/mvdan/sh/releases/download/v${shfmt_version}/shfmt_v${shfmt_version}_linux_amd64" -O shfmt
$ chmod u+x shfmt
$ ./shfmt -w .
```
2021-03-13 20:10:43 +01:00
Lukas Nykryn c17c5b7604 fix(network-manager): run as a service if systemd module is present
In the current state, services that depend on network need to
use dracut hooks, since nothing with pull in the network
targets into the transaction.

In the future, it would be nice to provide developers on systemd-only
systems the possibility to not use dracut hooks at all, but simply put
normal systemd services into the initrd.

Also, some modules even right now depend on systemd ordering, like
cryptsetup, so let's make sure, that the ordering inside systemd work
properly as well.
2021-02-19 11:20:59 +01:00
Harald Hoyer 10f3b19606 fix: shellcheck for modules.d/40network/net-lib.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer e7b4442cfc fix: shellcheck for modules.d/40network/module-setup.sh 2021-02-15 11:00:37 +01:00
Harald Hoyer 16efdfa25c fix: revise all module checks
1. no module checks for modules which are in depends()
2. no `derror` for optional (255) modules checking for dependencies
3. fix dbus meta module
2021-02-10 13:29:17 +01:00
Anjali Kulkarni 4026cd3b01 feat(network-legacy): send dhcp in parallel on all devices
We can drastically improve boot times on some machines, or BM or VM
shapes, if we send DHCP requests in parallel on all interfaces
Add ip=single-dhcp as a kernel boot parameter, to send DHCP requests in
parallel on all interfaces. Thus, DHCP on each interface is overlapped
thereby reducing boot times for multiple interface machines.
This can help reduce the boot time by 1 minute per interface.
In addition, we may also save another 40 secs delay per interface, if
the link on which we try to send DHCP is in DOWN state. This can be
reduced by giving the following kernel command line parameter while
booting - rd.net.timeout.carrier=<timeout>.
Added manpage for ip=single-dhcp with the caveat that it does not
apply to Network Manager or SUSE wicked.

Signed-off-by: Anjali Kulkarni <anjali.k.kulkarni@oracle.com>
2021-02-05 11:11:22 +01:00
Daniel Molkentin 5fc7c05321 40network: introduce wicked option 2020-11-25 18:21:39 +01:00
Kairui Song 5698258d30 90qemu-net: in hostonly mode, only install if network is needed
Signed-off-by: Kairui Song <kasong@redhat.com>
2020-10-30 10:13:37 +01:00
Thomas Blume 376ce85105 net-lib.sh: support infiniband network mac addresses
Infiniband MAC addresses have 20 octets.

Reference: bsc#996146
2020-08-07 12:00:59 +02:00
Lukas Nykryn 7069132ec7 network: fix glob matching ipv6 addresses
In this case we want to cover three cases
1) ip_address:ip_address
2) number:macaddress
3) :macaddress

We consider something an IPv6 address if it starts with number and
contains ":", but IPv6 addresses are in hexa.
2020-03-12 13:46:46 +01:00
Eugene S. Sobolev c7ee6b3dbb network/net-lib.sh: Configure all iBFT interfaces
Added boolean command line option rd.iscsi.mp
2020-02-14 10:42:34 +01:00
Lukas Nykryn 76f6566fd7 Revert "wait for IPv6 RA if using none/static IPv6 assignment"
This reverts commit c603419030.

wait_for_ipv6_dad_link is only called from dhclient script,
so the original intent "wait for IPv6 RA if using none/static IPv6 assignment"
does not seem to be correct.

Anyway, this brings an issue on isolated networks, where you don't
have any routes outside. dhclient-script hangs on this check
and after it times out, dhclient is able to set the address normally.
2020-02-11 14:23:27 +01:00
Lukas Nykryn 579fbb9fc4 40network: bump rd.net.timeout.carrier to 10 seconds
On some devices kernel currently takes 5.2 seconds to detect carrier,
so let's make the default in dracut bit more sensible.

See also https://bugzilla.redhat.com/show_bug.cgi?id=1772010
2020-02-10 14:37:15 +01:00
Böszörményi Zoltán a01204202b Allow running on a cross-compiled rootfs
For the shell scripts, new environment variables were introduced.

dracutsysrootdir is the root directory, file existence checks use it.

DRACUT_LDCONFIG can override ldconfig with a different one that works
on the sysroot with foreign binaries.

DRACUT_LDD can override ldd with a different one that works
with foreign binaries.

DRACUT_TESTBIN can override /bin/sh. A cross-compiled sysroot
may use symlinks that are valid only when running on the target
so a real file must be provided that exist in the sysroot.

DRACUT_INSTALL now supports debugging dracut-install in itself
when run by dracut but without debugging the dracut scripts.
E.g. DRACUT_INSTALL="valgrind dracut-install or
DRACUT_INSTALL="dracut-install --debug".

DRACUT_COMPRESS_BZIP2, DRACUT_COMPRESS_LBZIP2, DRACUT_COMPRESS_LZMA,
DRACUT_COMPRESS_XZ, DRACUT_COMPRESS_GZIP, DRACUT_COMPRESS_PIGZ,
DRACUT_COMPRESS_LZOP, DRACUT_COMPRESS_ZSTD, DRACUT_COMPRESS_LZ4,
DRACUT_COMPRESS_CAT: All of the compression utilities may be
overridden, to support the native binaries in non-standard places.

DRACUT_ARCH overrides "uname -m".

SYSTEMD_VERSION overrides "systemd --version".

The dracut-install utility was overhauled to support sysroot via
a new option -r and fixes for clang-analyze. It supports
cross-compiler-ldd from
https://gist.github.com/jerome-pouiller/c403786c1394f53f44a3b61214489e6f

DRACUT_INSTALL_PATH was introduced so dracut-install can work with
a different PATH. In a cross-compiled environment (e.g. Yocto), PATH
points to natively built binaries that are not in the host's /bin,
/usr/bin, etc. dracut-install still needs plain /bin and /usr/bin
that are relative to the cross-compiled sysroot.

The hashmap pool allocate_tile/deallocate_tile code was removed
because clang-analyze showed errors in it. hashmap_copy was removed
because it wasn't used and clang-analyze showed errors in it.

DRACUT_INSTALL_LOG_TARGET and DRACUT_INSTALL_LOG_LEVEL were
introduced so dracut-install can use different settings from
DRACUT_LOG_TARGET and DRACUT_LOG_LEVEL.

Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
2019-10-25 11:58:58 +02:00
Lukas Nykryn daa49cc221 net-lib: check if addr exists before checking for dad state
Before we check if dad is done we should first make sure,
that there is a link local address where we do the check.

Due to this issue, on ipv6 only setups sometimes dhclient started
asking for ip address, before the link local address was present
and failed immediately.
2019-10-23 10:44:26 +02:00
Harald Hoyer 5e7ef0ab3d
Merge branch 'fix_ipv2_for_busybox' of https://github.com/nolange/dracut into nolange-fix_ipv2_for_busybox 2019-10-21 14:41:12 +02:00
Lukas Nykryn 8084f3f66d net-lib: fix typo $li -> $_li 2019-08-29 12:41:11 +02:00
Lukas Nykryn b2616b5268 net-lib: strstr is not for globs 2019-07-19 16:25:33 +02:00
Lubomir Rintel 35efada5ec network: parse root=dhcp also with network-manager module
Move the logic from network-legacy to common network code.
2019-07-19 16:21:13 +02:00
Norbert Lange f9c96cf56f remove superfluous quotes in parameter expansion
as this breaks busybox hush shell.
offending functions can be found with
grep -r '${[^}]*"[^}]*}'
2018-12-13 15:13:03 +01:00
Norbert Lange a3ad33daf9 net-lib: remove calls to ip with -oneline option
busybox seems to not properly support this option,
and it can be be safely ommitted or replaced
with piping the output through head.

Rev 2:
*   rebased on master
*   addressed open points from review
2018-12-12 16:13:50 +01:00
Harald Hoyer f6e3b59e5e network: skip already enslaved interfaces 2018-12-04 08:50:42 +01:00
Kairui Song 83cbc06ab9 40network: Don't include 40network by default
commit 7347391 ('network-legacy: split off from network module')
splitted network function to network-legacy and removed check() function
of 40network. This caused 40network to be included even if network is
not needed.

Signed-off-by: Kairui Song <kasong@redhat.com>
2018-10-12 13:17:58 +02:00
Lubomir Rintel 08bdadbf31 network-manager: add module 2018-09-21 11:32:01 +02:00
Lubomir Rintel 734739187b network-legacy: split off from network module 2018-09-21 11:32:01 +02:00
Lubomir Rintel 1c4a51c39c network: fix an error message 2018-09-21 11:32:01 +02:00
Lubomir Rintel 0454dc247a network: configure NetworkManager to use dhclient
If the network module obtained a lease using dhclient, NetworkManager
must be configured to use it too, otherwise it would obtain a different
lease (and could potentially break a connection to the network volume).
2018-09-21 10:40:55 +02:00
Harald Hoyer efecf0a95e network: iface_has_carrier(): fixed logic 2018-07-05 09:37:10 +02:00
Hiroaki Mizuguchi c574c3f565 ifup.sh: don't wait linkup when set static ip explicitly
iface_has_carrier is skipped when set $dev. Fail curl fetch for root=live:<url>.
2018-07-05 09:37:01 +02:00
Pingfan Liu 67354eebbc 40network: introduce ip=either6 option
In kdump, if dump-target is ssh on ipv6, we need to sync until ipv6 addr
is ready. Currently ip=auto6/dhcp6 provides such function. But in 1st kernel,
it is hard to know whether the ipv6 addr is got by dhcpv6 or SLAAC.
E.g ifcfg-eth* contains DHCPV6C=yes direction, but there is no dhcpv6
server in the network, and then after the system is up, the user
echo 1 > /proc/sys/net/ipv6/conf/eth0/autoconf && accept_ra by manual
to obtain a ipv6 addr. Or vice.
So this patch suggests to make dhcpv6 as auto6 fallback

Signed-off-by: Pingfan Liu <piliu@redhat.com>
2018-05-29 10:07:19 +02:00
Pawel Wieczorkiewicz f0094476fd 40network: Fix race condition when wait for networks
If no network related params are specific, but rd.neednet=1 is set,
the default initqueue action is to wait until one of the network
interfaces is marked as setup properly.

This also help with initqueue's race condition when the network interface
shows up late

References: bnc#866771

Signed-off-by: Hannes Reinecke <hare@suse.de>
2018-01-30 10:18:37 +01:00
johannes 69acd20d4e 40network: install grep
since version 046 40network/net-lib.sh uses grep but the module does not install grep
2017-12-11 17:52:03 +01:00
Harald Hoyer 4e3833f6a2 Merge pull request #285 from rldleblanc/fix-typos
Fix a couple of typos.
2017-10-09 12:59:29 +02:00
Robert LeBlanc 4d60324757 Fix a couple of typos.
Signed-Off-By: Robert LeBlanc <robert@leblancnet.us>
2017-09-21 13:39:52 -06:00
Imran Haider 79926486a0 Set MTU on bond master as opposed to a bond slave
Prior to this commit, the MTU setting was applied to a bond slave
interface.  In older versions of the Linux kernel, this setting
propagated to the bond master and the other bond slaves associated with
the master.  In recent versions of the kernel (observed in Linux 4.12),
increasing the MTU of a slave does not automatically increase the MTU of
the master.  This allows for more flexibility but requires the MTU of
the master to be changed manually.

Ideally, the MTU setting should be applied to the bond master and the
setting will propagate to the bond slaves, since the slaves are required
to have a MTU that is greater than or equal to the bond master.
2017-09-03 00:15:37 -04:00
Javier Martinez Canillas 1792759721 network: Only bring up wired network interfaces
The dracut network module is only supposed to be used for wired interfaces
but if driver modules for wireless devices are wrongly copied, these will
be loaded and the available interfaces brought up.

If the rd.neednet=1 command line parameter is used, dhclient will attempt
to request an IP address for the interfaces and these requests will fail.

But other dracut modules that depend on the network to be settled, will
have to wait for the DHCP requests to timeout. Which can be a lot of time
since the dhclient default timeout value is 60 seconds.

Instead of trying to blacklist all possible kernel modules for wireless
devices, only bring up network interfaces if these are for wired devices.

Suggested-by: Harald Hoyer <harald@redhat.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2017-08-09 19:10:42 +02:00
Harald Hoyer 5abd692fe4 network/ifup: don't arping for point-to-point connections
https://bugzilla.redhat.com/show_bug.cgi?id=1477339
2017-08-07 15:09:36 +02:00
Harald Hoyer 017978f868 network: redirect stderr for arping test 2017-07-28 11:54:27 +02:00
Harald Hoyer 400a85ffaf install arping V2 as arping2 2017-07-24 10:03:42 +02:00
Harald Hoyer a430c3f7a6 Merge pull request #252 from landgraf/dhcp_option_21
dhclient: send client-identifier matching hardware address
2017-07-19 14:32:41 +02:00
Pavel Zhukov 4011b48c42 dhclient: send client-identifier matching hardware address
Forcing dhclient to use hardware address instead of DUID to make it
predictable and allows system installation in whitelist based networks.
2017-07-17 17:58:28 +02:00
Lukas Nykryn 62b7920ed1 40network/dhclient.conf: rename classless-routes to classless-static-routes
We tell dhclient to name 121 option "classless-routes",
but in dhclient-script we parse classless_static_routes.
So either have to change the configuration or the script.

And since dhclient uses by default classless_static_routes,
let's change the configuration
2017-07-13 16:46:19 +02:00
Lukas Nykryn 337a55eb2d network/dhclient-script: also parse dot separated $new_classless_static_routes
Previously our dhclient-script expected that $new_classless_static_routes
will have all values separated by a whitespace. But at least on F25
dhclient will put there the destination descriptor in the same format
as it is used by ISC dhcp-server.
For example:
new_classless_static_routes=32.10.198.122.47 192.168.78.4
while our current code expects
new_classless_static_routes=32 10 198 122 47 192 168 78 4

So let's just accept both of these formats by adding "." to IFS.

For details plesse see https://tools.ietf.org/html/rfc3442
"Classless Route Option Format"
2017-06-26 10:12:46 +02:00
Harald Hoyer cf9a4e0c73 network: fix dhcp classless_static_routes
removed copy&paste artifact "modify_routes add"

there is no modify_routes() function, and we simply want the output
of the parse function.

(cherry picked from commit 33710dfbfc)
2017-06-14 15:22:18 +02:00
pallotron 031e2f7bb8 more ipv6 improvements 2017-04-05 00:23:36 -07:00
pallotron a0545765e8 remove prints 2017-04-05 00:16:16 -07:00