Commit graph

33 commits

Author SHA1 Message Date
Lubomir Rintel
2952953a48 initrd: skip ethernet hwtype in BOOTIF
Dracut documents the BOOTIF argument to be a MAC address and so we
accept one in any of the conventions we recognize. However, the PXE boot
loaders like to prepend a "01-" to denote an ethernet hardware type.
Accept that too.

https://bugzilla.redhat.com/show_bug.cgi?id=1726240
2019-07-03 09:16:52 +02:00
Lubomir Rintel
39d5c8c12f initrd/tests: ensure that nameserver= setting affects the correct connection 2019-07-02 13:43:06 +02:00
Lubomir Rintel
6da2058237 initrd: don't create a default connection if there's already one
Certain arguments (such as "nameserver") don't specify a connection they
apply to and using them would generate a default ethernet connection.
This is probably not the right thing to do.
2019-07-02 13:43:06 +02:00
Lubomir Rintel
77540b2a7c initrd/tests: ensure we accept a prefix in place of an IPv4 mask 2019-07-02 13:42:19 +02:00
Lubomir Rintel
390d79079e initrd: allow specifying the net mask in form of a prefix
This is not documented in dracut.cmdline(7), however it seems to have
worked and has users and Red Hat even seems to recommend this (thanks to
Dan Horak for the pointers):

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/installation_guide/chap-installer-booting-ipl-s390
https://bugzilla.redhat.com/show_bug.cgi?id=1725872
2019-07-02 13:42:19 +02:00
Lubomir Rintel
920e59016f initrd: remove an accidental backspace 2019-07-02 13:42:09 +02:00
Lubomir Rintel
4b097e314e initrd: fix error reporting on bad netmask
It says the address is bad, but what is wrong is the mask.
2019-07-02 10:29:23 +02:00
Beniamino Galvani
e6628fa27c ipv6: add 'disabled' method
Add a new ipv6.method value 'disabled' that completely disables IPv6
for the interface.

https://bugzilla.redhat.com/show_bug.cgi?id=1643841
2019-06-11 16:22:04 +02:00
Thomas Haller
c5e0e33b52 initrd/tests: increase test timeout for "initrd/test-cmdline-reader" with meson
The default timeout of 30 seconds may not be sufficient when running under valgrind
on a busy system.
2019-06-11 08:54:40 +02:00
Lubomir Rintel
04621c6c0f initrd/cmdline: add support for rd.neednet option
This is used to indicate the network dracut module should fall back to
configure network automatically (as with ip=dhcp was specified) if
there's no other network configuration present on the command line.

The option is documented in dracut.cmdline(7).

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/167
2019-05-28 11:26:17 +02:00
Thomas Haller
e7836cd151 build/meson: rename "nm_core_dep" to "libnm_core_dep"
The library is called "libnm_core". So the dependency should be called
"libnm_core_dep", like in all other cases.

(cherry picked from commit c27ad37c27)
2019-04-18 20:13:49 +02:00
Thomas Haller
d984b2ce4a shared: move most of "shared/nm-utils" to "shared/nm-glib-aux"
From the files under "shared/nm-utils" we build an internal library
that provides glib-based helper utilities.

Move the files of that basic library to a new subdirectory
"shared/nm-glib-aux" and rename the helper library "libnm-core-base.la"
to "libnm-glib-aux.la".

Reasons:

 - the name "utils" is overused in our code-base. Everything's an
   "utils". Give this thing a more distinct name.

 - there were additional files under "shared/nm-utils", which are not
   part of this internal library "libnm-utils-base.la". All the files
   that are part of this library should be together in the same
   directory, but files that are not, should not be there.

 - the new name should better convey what this library is and what is isn't:
   it's a set of utilities and helper functions that extend glib with
   funcitonality that we commonly need.

There are still some files left under "shared/nm-utils". They have less
a unifying propose to be in their own directory, so I leave them there
for now. But at least they are separate from "shared/nm-glib-aux",
which has a very clear purpose.

(cherry picked from commit 80db06f768)
2019-04-18 19:57:27 +02:00
Thomas Haller
8f62c76c0a license: re-license initrd-generator and ibft reader as LGPL
New code we want to add LGPL licensed to make it easier to share code
between libnm and the daemon.

The code in question was only recently added in commit b544f7243d
("initrd: add iBFT reader") and mostly written from scratch by Lubomir.

Some parts were adapted from earlier ibft code.

  $ git shortlog -s -e -- src/settings/plugins/ibft/  ':(exclude)*/meson.build'
       3    Beniamino Galvani <bgalvani@redhat.com>
       1    Colin Walters <walters@verbum.org>
       2    Dan Williams <dcbw@redhat.com>
      17    Dan Winship <danw@redhat.com>
       7    Lubomir Rintel <lkundrak@v3.sk>
      46    Thomas Haller <thaller@redhat.com>

  $ git log --no-merges -L '/^fill_ip4_setting_from_ibft/,/^}/:src/settings/plugins/ifcfg-rh/reader.c' fc9c1f1557b517e799d15802e8f3d0ea43b0daea~ | grep '^Author: ' | sort | uniq
  Author: Dan Williams <dcbw@redhat.com>
  Author: Dan Winship <danw@redhat.org>
  Author: Jiří Klimeš <jklimes@redhat.com>
  Author: Pavel Šimerda <psimerda@redhat.com>

Hence, all non-trival contributions were provided by Red Hat employees
and the copy-right is with Red Hat.

Acked-by: Dan Williams <dcbw@redhat.com>
Acked-by: Dan Winship <danw@redhat.com>
Acked-by: Lubomir Rintel <lkundrak@v3.sk>
2019-02-22 21:06:00 +01:00
Thomas Haller
9beed4f661 all: replace strerror() calls with nm_strerror_native() 2019-02-12 08:50:28 +01:00
Thomas Haller
047998f80a all: cache errno in local variable before using it 2019-02-12 08:50:28 +01:00
Thomas Haller
a3370af3a8 all: drop unnecessary includes of <errno.h> and <string.h>
"nm-macros-interal.h" already includes <errno.h> and <string.h>.
No need to include it everywhere else too.
2019-02-12 08:50:28 +01:00
Thomas Haller
395174f659 shared: avoid "-Wmissing-braces" warning initalizing NMIPAddr
NMIPAddr contains an unnamed union. We have to either explicitly
initialize one field, or omit it.

    ../shared/nm-utils/nm-shared-utils.c:38:36: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
    const NMIPAddr nm_ip_addr_zero = { 0 };
                                       ^
                                       {}
2019-02-08 20:14:50 +01:00
Thomas Haller
c4eadb709c initrd/trivial: fix whitespace 2019-01-21 14:18:54 +01:00
Lubomir Rintel
125b9a5a5d initrd: make the default connection activatable on multiple devices
The ip=dhcp (without a device name given) and such should activate all
possible devices.

https://github.com/NetworkManager/NetworkManager/pull/284
2019-01-21 13:00:04 +01:00
Iñigo Martínez
35171b3c3f build: meson: Add trailing commas
Add missing trailing commas that avoids getting noise when another
file/parameter is added and eases reviewing changes[0].

[0] https://gitlab.gnome.org/GNOME/dconf/merge_requests/11#note_291585
2018-12-20 13:50:34 +01:00
Lubomir Rintel
d6c2f23b9e initrd: actually use the constructed filename
Otherwise the file gets dumped into CWD instead of the intended location
in the connection dir.

Fixes: 61717cc575
2018-11-27 11:18:08 +01:00
Thomas Haller
c4a9f44aff initrd: use keyfile util for creating filename 2018-10-23 10:37:33 +02:00
Thomas Haller
61717cc575 initrd: use cleanup attribute and return early from output_conn() 2018-10-23 10:36:07 +02:00
Beniamino Galvani
d0a99176a7 initrd: cmdline-reader: fix setting uint properties
Previously a uint property was assigned with a guint64 value, which
has a different size. Fix this and add a warning when the read value
can't be converted.

Fixes: ecc074b2f8

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/66
2018-10-23 09:09:42 +02:00
Thomas Haller
4ca7fa7f4a initrd: add .nmconnection extension when writing keyfiles
initrd does not use keyfile API from "src/settings/plugins/keyfile",
hence it does not use nms_keyfile_utils_escape_filename() to add
the ".nmconnection" file extension.

I think that is problematic, because it also misses escapings which
are necessary so that NetworkManager will accept the file.

Anyway, the proper solution here would be to move the keyfile utility
functions to libnm-core, alongside base keyfile API. That way, it
could be used by initrd generator.

For now, just dirty fix the generated filename.

Fixes: 648c256b90
2018-10-19 11:55:06 +02:00
Lubomir Rintel
02958bba80 all: remove \n endings from log calls
The extra newlines look bad when logging to the console.

https://github.com/NetworkManager/NetworkManager/pull/223
2018-10-12 14:34:58 +02:00
Lubomir Rintel
ecde3e9034 initrd/cmdline-reader: fix whitespace errors
Detected by checkpatch.pl
2018-09-24 13:21:12 +02:00
Beniamino Galvani
470c5c0a82 initrd: enable meson builds 2018-09-19 16:03:32 +02:00
Lubomir Rintel
e4a5f0b900 initrd: adjust to the newer nm_utils_parse_inaddr_*bin() API 2018-09-18 18:14:09 +02:00
Lubomir Rintel
7c270f0860 initrd-generator: add a missing include 2018-09-18 18:12:34 +02:00
Lubomir Rintel
9f9609555d initrd: add configuration generator
nm-initrd-generator scans the command line for options relevant to network
configuration and creates configuration files for an early instance of
NetworkManager run from the initial ramdisk during early boot.
2018-09-18 17:40:47 +02:00
Lubomir Rintel
ecc074b2f8 initrd: add command line parser 2018-09-18 17:40:47 +02:00
Lubomir Rintel
b544f7243d initrd: add iBFT reader
This is loosely based on nms-ibft-reader, but with some significant
changes. Notably, it parses /sys/firmware/ibft directly instead of
iscsiadm output.

iscsiadm is not available on early boot (perhaps it's too large) and
turns out that parsing sysfs directly is easier and more
straightforwared anyways. A win-win situation.

It is not useful alone, it's in a separate commit just for the sake of
easier review.
2018-09-18 17:40:47 +02:00