summaryrefslogtreecommitdiff
path: root/src/network/netdev
Commit message (Collapse)AuthorAgeFilesLines
* conf-parser: Add root argument to config_parse_many()Daan De Meyer2023-05-121-2/+2
|
* network: geneve: add InheritInnerProtocol flagJosef Miegl2023-03-063-0/+9
|
* network/l2tp: parse address or address type from correct stringYu Watanabe2023-01-111-3/+3
| | | | | | Fixes a bug introduced by 8b49ee2dcda04f8147650f7d9fb93662caf3ea2e. Fixes #26011.
* network/l2tp: fix error code in log messageYu Watanabe2023-01-111-2/+2
|
* tree-wide: use -EBADF for fd initializationZbigniew Jędrzejewski-Szmek2022-12-191-2/+2
| | | | | | | | | | | | | | | | -1 was used everywhere, but -EBADF or -EBADFD started being used in various places. Let's make things consistent in the new style. Note that there are two candidates: EBADF 9 Bad file descriptor EBADFD 77 File descriptor in bad state Since we're initializating the fd, we're just assigning a value that means "no fd yet", so it's just a bad file descriptor, and the first errno fits better. If instead we had a valid file descriptor that became invalid because of some operation or state change, the other errno would fit better. In some places, initialization is dropped if unnecessary.
* basic: rename util.h to logarithm.hZbigniew Jędrzejewski-Szmek2022-11-084-4/+0
| | | | | util.h is now about logarithms only, so we can rename it. Many files included util.h for no apparent reason… Those includes are dropped.
* tree-wide: use ASSERT_PTR moreDavid Tardon2022-09-1310-44/+22
|
* tree-wide: Mark some constants as unsignedJan Janssen2022-08-301-2/+2
| | | | | All these are really unsigned and used as such. This silences some -Wformat-signedness warnings with gcc.
* tree-wide: Use correct format specifiersJan Janssen2022-08-301-1/+1
| | | | gcc will complain about all these with -Wformat-signedness.
* network/tuntap: save tun or tap file descriptor in fd storeYu Watanabe2022-08-164-2/+100
|
* network/tuntap: introduce KeepCarrier= settingYu Watanabe2022-08-163-0/+20
| | | | Closes #24267.
* network/tuntap: code cleanupsYu Watanabe2022-08-161-62/+39
| | | | | | | - merge unnecessarily split functions, - drop unnecessary initializations, - tighten variable scopes, - introduce TUNTAP() helper function.
* config-parser: Add list of drop-in files as return argument of config_parse_manyRichard Phibel2022-08-121-1/+2
| | | | This will be used to save the list of drop-in files for each partition
* network: also check SR-IOV PF port and other VF ports before configuringYu Watanabe2022-08-051-2/+11
| | | | | | | | | | | | | | When a PF port becomes down (this can happens e.g. the PF port is joining a bond interface), some drivers make its VF ports also become down, and may cause failures in configuring VF ports. Similary, when a VF port become down, some drivers make its PF port and other VF ports down. Let's configure SR-IOV ports (both PF and VFs) after all link-layer settings of all ports being applied. Fixes #23315.
* network: split out link_is_ready_to_create_stacked_netdev()Yu Watanabe2022-08-051-12/+19
| | | | Preparation for later commits.
* network: check link state with link_is_ready_to_configure() before ↵Yu Watanabe2022-08-052-3/+3
| | | | | | | configuring DHCP client or friends Otherwise, DHCP client or friends may started before link-layer properties, e.g. MAC address, being configured or the link being activated.
* pid1: add mechanism for conditionalizing units/network/netdev/link based on ↵Lennart Poettering2022-07-151-0/+1
| | | | | | | credentials passed in This is useful when provisioning systems via nspawn/qemu and running specific services only if specific data is passed into the system.
* network: drop redundant warningYu Watanabe2022-07-092-4/+0
| | | | | If file is world readable, then `read_full_file_full()` will warn about that.
* sd-event: allow sd_event_source_is_enabled() to return false for NULLZbigniew Jędrzejewski-Szmek2022-06-301-1/+1
| | | | | | | | | | | This is a natural use case, and instead of defining a wrapper to do this for us, let's just make this part of the API. Calling with NULL was not allowed, so this is not a breaking change to the interface. (After sd_event_source_is_enabled was originally added, we introduced sd_event_source_disable_unref() and other similar functions which accept NULL. So not accepting NULL here is likely to confuse people. Let's just make the API usable with minimal fuss.)
* network: l2tp: initialize a to NULLShreenidhi Shedi2022-06-131-1/+1
| | | | Fixes: CID#1475788
* basic/in-addr-util: add IN_ADDR_PREFIX_TO_STRINGZbigniew Jędrzejewski-Szmek2022-06-061-6/+4
|
* basic/in-addr-util: add IN_ADDR_TO_STRINGZbigniew Jędrzejewski-Szmek2022-06-061-6/+3
| | | | | | | | | | | | | | | Since we don't need the error value, and the buffer is allocated with a fixed size, the whole logic provided by in_addr_to_string() becomes unnecessary, so it's enough to wrap inet_ntop() directly. inet_ntop() can only fail with ENOSPC. But we specify a buffer that is supposed to be large enough, so this should never fail. A bunch of tests of this are added. This allows all the wrappers like strna(), strnull(), strempty() to be dropped. The guard of 'if (DEBUG_LOGGING)' can be dropped from around log_debug(), because log_debug() implements the check outside of the function call. But log_link_debug() does not, so it we need it to avoid unnecessary evaluation of the formatting.
* network/erspan: support erspan version 0 and 2Yu Watanabe2022-06-013-6/+179
| | | | | | This also makes networkd accepts erspan index 0. Closes #23570.
* network: l2tp: refuse null addressYu Watanabe2022-04-171-12/+36
|
* network: tunnel: handle null address as "any"Yu Watanabe2022-04-171-20/+39
| | | | | | Fixes oss-fuzz#44881 (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=44881). Fixes #23098.
* Move path_simplify_and_warn() to new shared/parse-helpers.cZbigniew Jędrzejewski-Szmek2022-04-072-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a high-level function, and it belongs in libsystemd-shared. This way we don't end up linking a separate copy into various binaries. It would even end up in libsystemd, where it is not needed. (Maybe it'd be removed in some optimization phase, but it's better to not rely on that.) $ grep -l -r -a 'path is not absolute%s' build/ build/libnss_systemd.so.2 build/pam_systemd_home.so build/test-dlopen build/src/basic/libbasic.a.p/path-util.c.o build/src/basic/libbasic.a build/src/shared/libsystemd-shared-249.so build/test-bus-error build/libnss_mymachines.so.2 build/pam_systemd.so build/libnss_resolve.so.2 build/libnss_myhostname.so.2 build/libsystemd.so.0.32.0 build/libudev.so.1.7.2 $ grep -l -r -a 'path is not absolute%s' build/ build/src/shared/libsystemd-shared-251.a.p/parse-helpers.c.o build/src/shared/libsystemd-shared-251.a build/src/shared/libsystemd-shared-251.so No functional change.
* network: always log error in network_load_one() and netdev_load_one()Yu Watanabe2022-04-051-25/+15
|
* time-util: assume CLOCK_BOOTTIME always existsLennart Poettering2022-03-281-1/+1
| | | | | | | | Let's raise our supported baseline a bit: CLOCK_BOOTTIME started to work with timerfd in kernel 3.15 (i.e. back in 2014), let's require support for it now. This will raise our baseline only modestly from 3.13 → 3.15.
* network: rename netdev kind virtual-wlan -> wlanYu Watanabe2022-03-284-6/+6
| | | | | | The Kind= setting in [Match] section of .network files takes "wlan". This makes the same setting in .netdev files matches the one in .network files.
* strv: make iterator in STRV_FOREACH() declaread in the loopYu Watanabe2022-03-191-1/+0
| | | | This also avoids multiple evaluations in STRV_FOREACH_BACKWARDS()
* list: make LIST_FOREACH() and LIST_FOREACH_BACKWARDS() saferYu Watanabe2022-03-191-1/+1
|
* list: declare iterator of LIST_FOREACH() in the loopYu Watanabe2022-03-191-11/+12
|
* Merge pull request #22631 from yuwata/network-redesign-request-queueLuca Boccassi2022-03-112-37/+19
|\ | | | | network: re-design request queue
| * network: re-design request queueYu Watanabe2022-03-112-11/+10
| | | | | | | | | | | | | | | | This makes Request object takes hash, compare, free, and process functions. With this change, the logic in networkd-queue.c can be mostly independent of the type of the request or the object (e.g. Address) assigned to the request, and it becomes simpler.
| * network: introduce request_call_netlink_async()Yu Watanabe2022-03-111-12/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In most netlink handlers, we do the following, 1. decrease the message counter, 2. check the link state, 3. error handling, 4. update link state via e.g. link_check_ready(). The first two steps are mostly common, hence let's extract it. Moreover, this is not only extracting the common logic, but provide a strong advantage; `request_call_netlink_async()` assigns the relevant Request object to the userdata of the netlink slot, and the request object has full information about the message we sent. Hence, in the future, netlink handler can print more detailed error message. E.g. when an address is failed to configure, then currently we only show an address is failed to configure, but with this commit, potentially we can show which address is failed explicitly. This does not change such error handling yet. But let's do that later.
| * network: make request_process_address() and friends take Link and ↵Yu Watanabe2022-03-112-15/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | corresponding object This also renames e.g. request_process_address() -> address_process_request(). Also, this drops type checks such as `assert(req->type == REQUEST_TYPE_ADDRESS)`, as in the later commits, the function of processing request, e.g. `address_process_request()`, will be assigned to the Request object when it is created. And the request type will be used to distinguish and to avoid deduplicating requests which do not have any assigned objects, like REQUEST_TYPE_DHCP4_CLIENT. Hence, the type checks in process functions are mostly not necessary and redundant. This is mostly cleanups and preparation for later commits, and should not change any behavior.
| * network: make address_configure() and friends take Request objectYu Watanabe2022-03-111-5/+4
| | | | | | | | | | | | This should not change any behavior. Just a preparation for a later commit which introduces request_call_netlink_async().
* | conf-parser: merge config_parse_string() and config_parse_safe_string()Yu Watanabe2022-03-101-4/+4
|/ | | | | This also makes unsafe strings escaped when logged. Otherwise, journalctl may not show the log message unless '--all' is specified.
* network: netdev: drop unused creation type NETDEV_CREATE_AFTER_CONFIGUREDYu Watanabe2022-02-272-47/+12
|
* network: l2tp: change create type to independentYu Watanabe2022-02-271-3/+3
| | | | | L2TP tunnel does not have underlying interface. Let's change its type to independent.
* network: l2tp: make Local= optionally take interface nameYu Watanabe2022-02-273-46/+198
|
* network: netdev: drop NETDEV_CREATE_MASTERYu Watanabe2022-02-265-5/+4
| | | | | As there is no deference between NETDEV_CREATE_MASTER and NETDEV_CREATE_INDEPENDENT.
* network: netdev: use netdev_is_stacked() at one more placeYu Watanabe2022-02-261-2/+1
|
* network: netdev: make link_get_local_address() refuse non-ready links and ↵Yu Watanabe2022-02-261-1/+4
| | | | addresses
* network: drop unused flag and counterYu Watanabe2022-02-261-19/+2
|
* network: split netdev_create() into twoYu Watanabe2022-02-262-63/+67
|
* network: assign corresponding NetDev object to LinkYu Watanabe2022-02-261-8/+5
|
* network/netdev: drop unused argumentYu Watanabe2022-02-266-6/+6
|
* network/netdev: do not assign value on failureYu Watanabe2022-02-261-3/+1
|
* network: create stacked netdevs after the underlying link is activatedYu Watanabe2022-02-241-0/+5
| | | | | | Otherwise, the activation policy for the netdevs are ignored. Fixes #22593.