summaryrefslogtreecommitdiff
path: root/src/initrd
Commit message (Collapse)AuthorAgeFilesLines
* all: SPDX header conversionLubomir Rintel2019-09-108-120/+8
| | | | | $ find * -type f |xargs perl contrib/scripts/spdx.pl $ git rm contrib/scripts/spdx.pl
* initrd: add devicetree supportLubomir Rintel2019-09-1025-1/+580
| | | | | | | | | | | | This adds capability to hand over the network configuration from OpenFirmware (and potentially other boot loaders with openfirmware support such as U-Boot) to NetworkManager. It's done analogously to ACPI/iBFT. In fact, the same ip=ibft command line option is used, adding a more general ip=fw alias. This probably deserves some documentation, but I'm not adding any at this time. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/257
* shared,all: return boolean success from nm_utils_file_get_contents()Thomas Haller2019-08-081-1/+6
| | | | | | | | | | | | | | | | | | | | | | ... and nm_utils_fd_get_contents() and nm_utils_file_set_contents(). Don't mix negative errno return value with a GError output. Instead, return a boolean result indicating success or failure. Also, optionally - output GError - set out_errsv to the positive errno (or 0 on success) Obviously, the return value and the output arguments (contents, length, out_errsv, error) must all agree in their success/failure result. That means, you may check any of the return value, out_errsv, error, and contents to reliably detect failure or success. Also note that out_errsv gives the positive(!) errno. But you probably shouldn't care about the distinction and use nm_errno_native() either way to normalize the value.
* shared: let nm_utils_file_set_contents() return a errno error codeThomas Haller2019-08-081-1/+1
| | | | | | | | | | | | | | | | nm_utils_file_set_contents() is a re-implementation of g_file_set_contents(), as such it returned merely a boolean success value. It's sometimes interesting to get the native error code. Let the function deviate from glib's original g_file_set_contents() and return the error code (as negative value) instead. This requires all callers to change. Also, it's potentially a dangerous change, as this is easy to miss. Note that nm_utils_file_get_contents() also returns an errno, and already deviates from g_file_get_contents() in the same way. This patch resolves at least the inconsistency with nm_utils_file_get_contents().
* initrd: avoid coverity warning in parse_ip() about "Dereference before null ↵Thomas Haller2019-08-021-1/+1
| | | | | | | | | | | | check" get_word() only moves the "argument" pointer forward. It never sets it to %NULL. Also, above we already dereference argument, so Coverity thinks that this NULL check indicates a bug. Drop it to silence Coverity. (cherry picked from commit 4596d7793cee22228e68d102fa199ed1736a2050)
* initrd/tests: add some more variations of possible BOOTIF= variableslr/bootifLubomir Rintel2019-07-031-3/+11
| | | | | Test the form with a hwtype and color-separated as well as hyphen-separated.
* initrd: skip ethernet hwtype in BOOTIFLubomir Rintel2019-07-031-0/+10
| | | | | | | | | 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
* initrd/tests: ensure that nameserver= setting affects the correct connectionLubomir Rintel2019-07-021-2/+6
|
* initrd: don't create a default connection if there's already oneLubomir Rintel2019-07-021-2/+26
| | | | | | 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.
* initrd/tests: ensure we accept a prefix in place of an IPv4 maskLubomir Rintel2019-07-021-3/+23
|
* initrd: allow specifying the net mask in form of a prefixLubomir Rintel2019-07-021-3/+5
| | | | | | | | | 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
* initrd: remove an accidental backspaceLubomir Rintel2019-07-022-2/+2
|
* initrd: fix error reporting on bad netmaskLubomir Rintel2019-07-021-1/+1
| | | | It says the address is bad, but what is wrong is the mask.
* ipv6: add 'disabled' methodBeniamino Galvani2019-06-113-6/+6
| | | | | | | Add a new ipv6.method value 'disabled' that completely disables IPv6 for the interface. https://bugzilla.redhat.com/show_bug.cgi?id=1643841
* initrd/tests: increase test timeout for "initrd/test-cmdline-reader" with mesonThomas Haller2019-06-111-0/+1
| | | | | The default timeout of 30 seconds may not be sufficient when running under valgrind on a busy system.
* initrd/cmdline: add support for rd.neednet optionLubomir Rintel2019-05-281-0/+7
| | | | | | | | | | 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
* build/meson: rename "nm_core_dep" to "libnm_core_dep"Thomas Haller2019-04-181-2/+2
| | | | | | | The library is called "libnm_core". So the dependency should be called "libnm_core_dep", like in all other cases. (cherry picked from commit c27ad37c278461fd783b6db56844683ab3088345)
* shared: move most of "shared/nm-utils" to "shared/nm-glib-aux"Thomas Haller2019-04-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 80db06f768e47541eae7d66ef48fbe47bf1a69ce)
* license: re-license initrd-generator and ibft reader as LGPLThomas Haller2019-02-223-30/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* all: replace strerror() calls with nm_strerror_native()Thomas Haller2019-02-121-1/+1
|
* all: cache errno in local variable before using itThomas Haller2019-02-121-1/+3
|
* all: drop unnecessary includes of <errno.h> and <string.h>Thomas Haller2019-02-124-7/+1
| | | | | "nm-macros-interal.h" already includes <errno.h> and <string.h>. No need to include it everywhere else too.
* shared: avoid "-Wmissing-braces" warning initalizing NMIPAddrThomas Haller2019-02-081-2/+2
| | | | | | | | | | 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 }; ^ {}
* initrd/trivial: fix whitespaceThomas Haller2019-01-211-1/+1
|
* initrd: make the default connection activatable on multiple devicesLubomir Rintel2019-01-212-1/+24
| | | | | | | The ip=dhcp (without a device name given) and such should activate all possible devices. https://github.com/NetworkManager/NetworkManager/pull/284
* build: meson: Add trailing commasIñigo Martínez2018-12-202-3/+3
| | | | | | | 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
* initrd: actually use the constructed filenameLubomir Rintel2018-11-271-1/+1
| | | | | | | Otherwise the file gets dumped into CWD instead of the intended location in the connection dir. Fixes: 61717cc57553817ae5330e830195b64e42327098
* initrd: use keyfile util for creating filenameThomas Haller2018-10-231-6/+4
|
* initrd: use cleanup attribute and return early from output_conn()Thomas Haller2018-10-231-27/+23
|
* initrd: cmdline-reader: fix setting uint propertiesBeniamino Galvani2018-10-231-3/+11
| | | | | | | | | | 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: ecc074b2f8a6240d50f590c898b33158806b51a1 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/66
* initrd: add .nmconnection extension when writing keyfilesThomas Haller2018-10-191-1/+2
| | | | | | | | | | | | | | | | | 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: 648c256b9014198aac388097e410999c68c4b452
* all: remove \n endings from log callsLubomir Rintel2018-10-122-24/+24
| | | | | | The extra newlines look bad when logging to the console. https://github.com/NetworkManager/NetworkManager/pull/223
* initrd/cmdline-reader: fix whitespace errorsLubomir Rintel2018-09-241-36/+36
| | | | Detected by checkpatch.pl
* initrd: enable meson buildsBeniamino Galvani2018-09-192-18/+51
|
* initrd: adjust to the newer nm_utils_parse_inaddr_*bin() APILubomir Rintel2018-09-181-6/+5
|
* initrd-generator: add a missing includeLubomir Rintel2018-09-181-1/+1
|
* initrd: add configuration generatorLubomir Rintel2018-09-181-0/+138
| | | | | | 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.
* initrd: add command line parserLubomir Rintel2018-09-182-0/+1501
|
* initrd: add iBFT readerLubomir Rintel2018-09-18196-0/+986
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.