summaryrefslogtreecommitdiffstats
path: root/src/network/netdev (follow)
Commit message (Collapse)AuthorAgeFilesLines
* network/netdev: do not update MAC address if netdev is already runningYu Watanabe2024-11-148-7/+74
| | | | | | | | | | | Follow-up for 17c5337f7b2993619d84acc2088b2ba1789e6477. Older kernels (older than v6.5) refuse RTM_NEWLINK messages with IFLA_ADDRESS attribute when the netdev already exists and is running, even if the MAC address is unchanged. So, let's not set IFLA_ADDRESS or IFLA_MTU if they are unchanged, and set the attributes only when we can update them.
* network/netdev: set interface name only when creating a new netdevYu Watanabe2024-11-141-3/+8
| | | | Otherwise, the kernel older than v6.2 will refuse the netlink message.
* network: update tunnel or vxlan interface if the local address is changedYu Watanabe2024-10-314-0/+44
| | | | | | | If a tunnel or vxlan is configured with Local=dhcp4 or so, then the local address needs to be changed when it is changed. Fixes #24854.
* network/netdev: replace old NetDev object with newer one on reloadYu Watanabe2024-10-302-1/+79
| | | | | | | | | | | | | | | | | | | Then, when a .netdev file of a stacked netdev is modified, the netdev can be reconfigured with the updated setting by something like the following way: ``` ip link del vlan99 networkctl reload ``` Note, removing the vlan interface in the above example may not be necessary, e.g. when only VLAN flags, egress mapping, or ingress mapping are updated. But, it is necessary when VLAN ID is updated. Closes #9627. Closes #27177. Closes #34907. Replaces #22557.
* network/netdev: reconfigure netdev if possibleYu Watanabe2024-10-301-8/+5
| | | | | Some netdev configs can be modified after the interface is created. Let's allow to reconfigure existing interfaces.
* network/netdev: move calls of netdev_attach() and netdev_request_to_create() ↵Yu Watanabe2024-10-302-21/+22
| | | | | | to netdev_load() No functional change, preparation for later commits.
* network/tunnel: reuse existing 6rd sit tunnel (#34938)Yu Watanabe2024-10-302-53/+42
|\ | | | | split-out of #34909.
| * network/tunnel: reuse existing 6rd SIT tunnelYu Watanabe2024-10-292-9/+16
| | | | | | | | | | The 6rd SIT tunnel configuration can be updated without recreating the interface. Let's reuse existing tunnel.
| * network/tunnel: merge dhcp4_pd_create_6rd_tunnel_message() into ↵Yu Watanabe2024-10-291-46/+28
| | | | | | | | | | | | | | dhcp4_pd_create_6rd_tunnel() No functional change, just refactoring and preparation for later commits.
* | network/netdev: do not try to update several parameters if the interface ↵Yu Watanabe2024-10-305-36/+98
|\ \ | | | | | | | | | | | | already exists (#34937) split-out of #34909.
| * | network/ipvlan: do not try to update MAC addressYu Watanabe2024-10-301-0/+9
| | |
| * | network/macsec: IFLA_MACSEC_PORT attribute cannot be changedYu Watanabe2024-10-301-6/+14
| | | | | | | | | | | | | | | | | | Also, though currently not supported by networkd, IFLA_MACSEC_CIPHER_SUITE, IFLA_MACSEC_ICV_LEN, IFLA_MACSEC_SCI cannot be updated.
| * | network/vxlan: do not try to update several parametersYu Watanabe2024-10-301-28/+42
| | | | | | | | | | | | | | | Currently, netdev->ifindex is always zero when this function is called. So, this does not change any behavior. Preparation for later commits.
| * | network/netdev: introduce netdev_can_set_mac/mtu() helper functionsYu Watanabe2024-10-302-2/+33
| | | | | | | | | | | | | | | | | | Several netdevs cannot set IFLA_ADDRESS or IFLA_MTU attribute on update. Currently, the vtable field is unused, as we do not support updating existing netdevs. Preparation for later commits.
* | | network: drop no-op cleanupYu Watanabe2024-10-302-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | - network_load() is always called with an empty OrderedHashmap, renamed the output parameter to 'ret'. - When netdev_load() is called on startup, the hashmap is NULL. When it is called on reloading, the hashmap is not cleaned up. Hence, then these cleanups are always no-op. Let's drop them.
* | | network/netdev: update state file when NetDev object assignment is changedYu Watanabe2024-10-301-6/+17
| | |
* | | network: swap asterisk and spaceYu Watanabe2024-10-301-2/+2
|/ /
* | network/tunnel: allow Local=/Remote=any for all tunnel typesYu Watanabe2024-10-301-21/+14
| | | | | | | | | | | | It seems there is no restriction for local and remote addresses. Fixes #34930.
* | sd-netlink,network: do not set NLM_F_CREATE and NLM_F_EXCL flags if an ↵Yu Watanabe2024-10-302-8/+0
| | | | | | | | | | | | | | | | interface index is specified If an ifindex is specified, we are modifying the existing interface. Hence, these flags should not be set. Otherwise, the request will be refused with -EEXIST.
* | network/netdev: skip processing netdev if it is already detachedYu Watanabe2024-10-299-0/+54
| | | | | | | | | | | | No functional change, as currently networkd detaches NetDev objects only on stop (or invalid .netdev file is loaded). Preparation for later commits.
* | network/netdev: split out netdev_attach_name_full()Yu Watanabe2024-10-291-4/+10
|/ | | | No functional change, preparation for later commits.
* tree-wide: drop doubled empty linesYu Watanabe2024-10-071-1/+0
|
* path-lookup: move NETWORK_DIRS to network-util.hMike Yuan2024-10-061-0/+1
|
* network: log loaded .network and .netdev filesYu Watanabe2024-09-171-1/+1
|
* network/wireguard: refuse default key if all zeroMike Yuan2024-09-121-1/+1
| | | | | | | Follow-up for fa724cd52c1335d6b3225b74c1a9c801389997ba We attempt to retrieve default key if eqzero(Wireguard.private_key), but a all zero default key should be refused too.
* network/vxcan: also manage peer interface name by managerYu Watanabe2024-09-102-0/+66
| | | | | Then, the Link object for the peer interface can have a reference to the corresponding NetDev object.
* network/vxcan: refuse when peer and the main interface names are equivalentYu Watanabe2024-09-101-0/+4
|
* network/l2tp: manage l2tp session name by ManagerYu Watanabe2024-09-102-0/+80
| | | | | Then, Link object for an L2TP session can have reference to the corresponding NetDev object.
* network/l2tp: refuse duplicated session nameYu Watanabe2024-09-101-2/+15
|
* network/l2tp: downgrade log level of several messagesYu Watanabe2024-09-101-21/+21
| | | | Also, use log_section_warning_errno() where applicable.
* network/veth: also manage peer name by ManagerYu Watanabe2024-09-102-0/+67
| | | | | Then, the Link object for the peer interface can have a reference to the corresponding NetDev object.
* network/veth: refuse when peer and the main interface names are equivalentYu Watanabe2024-09-101-0/+4
|
* network/netdev: add attach(), detach(), set_ifindex(), and get_ifindex() to ↵Yu Watanabe2024-09-102-3/+30
| | | | | | netdev vtable Currently no vtable sets these functions, but will be used later.
* network/netdev: split out netdev_set_ifindex_internal() and _impl()Yu Watanabe2024-09-102-21/+40
| | | | | No functional change, just refactoring and preparation for later commits.
* network/netdev: split out netdev_attach() and netdev_attach_name() from ↵Yu Watanabe2024-09-102-15/+44
| | | | | | | netdev_load_one() No functional change, just refactoring and preparation for later commits.
* network/netdev: use hashmap_remove_value() on detaching NetDev from managerYu Watanabe2024-09-102-11/+28
| | | | | | | | | Then, it is not necessary to free NetDev.ifname when a conflicting .netdev file is already loaded. This also split out netdev_detach_name() and netdev_detach_impl(). No functional change, just refactoring.
* network/netdev: downgrade log level in netdev_set_ifindex()Yu Watanabe2024-09-101-41/+26
| | | | | | This also makes netdev_enter_failed() called on caller side. No functional change, just refactoring.
* network/netdev: check family of received NEWLINK messageYu Watanabe2024-09-101-1/+8
| | | | | For safety. No functional change, just refactoring and preparation for later commits.
* network/netdev: also check ifindex, iftype, and kind when assigning NetDev ↵Yu Watanabe2024-09-102-0/+38
| | | | | | | to Link Even when a NetDev object with the same name found, its iftype or kind may be different. For safety, let's also check them.
* network: store netdev drop-in paths and dump into state fileMike Yuan2024-09-092-1/+5
|
* tree-wide: drop msg argument for DEFINE_CONFIG_PARSE() macro and friendsYu Watanabe2024-09-0112-27/+21
| | | | | This makes the macros use log_syntax_parse_error(), hopefully which provides more informative log message in general, and reduces binary size.
* conf-parser: move config_parse_ip_protocol() from network/netdev/fou-tunnel.cYu Watanabe2024-08-243-43/+1
| | | | | The function is generic enough. Currently it is used at only one place. But it will be used at another place.
* network: refuse files under API VFS specified in PrivateKeyFile= and friendsYu Watanabe2024-08-162-3/+3
| | | | Addresses https://github.com/systemd/systemd/pull/34013#discussion_r1719890231.
* network/wireguard: introduce [WireGuardPeer] PublicKeyFile=Yu Watanabe2024-08-163-5/+27
| | | | | | Similar to PresharedKeyFile=, but for public key. Closes #34012.
* network: netdev - BareUDP Add support for srcportminSusant Sahani2024-08-143-0/+8
| | | | Allows to configure the lowest value of the UDP tunnel source port range.
* network: make link_get_address() provide matching address with peerYu Watanabe2024-07-301-2/+2
| | | | | | | | As all callers do not care if the address has peer address. This also drops prefixlen argument as it is always zero. Fixes a bug introduced by 42f8b6a80878e688b821adfb315c0a1f0a7076ce. Fixes #31950.
* network: bridge: add support for IFLA_BR_FDB_MAX_LEARNEDGregor Herburger2024-07-223-0/+44
| | | | | | | | | | | | | Since Linux commit ddd1ad68826d ("net: bridge: Add netlink knobs for number / max learned FDB entries") [1] it is possible to limit to number of dynamically learned fdb entries per bridge. Add support to the systemd netdev bridge for the new netlink attribute IFLA_BR_FDB_MAX_LEARNED. [1] https://lore.kernel.org/all/20231016-fdb_limit-v5-0-32cddff87758@avm.de/ Signed-off-by: Gregor Herburger <gregor.herburger@ew.tq-group.com>
* various: move const ptr indicator to return valueZbigniew Jędrzejewski-Szmek2024-06-197-7/+7
|
* tree-wise: several cleanups for loggingYu Watanabe2024-04-301-4/+2
| | | | | | | | | | | - drop unnecessary SYNTHETIC_ERRNO() when the logger does not propagate error code, - drop unnecessary '%m' in error message when the error code is specified with SYNTHETIC_ERRNO(), - add missing full stop at the end of log message, - use RET_GATHER(), - add missing ", ignoring.", - upeercase the first letter, etc., etc...
* tree-wide: make sure net/if.h is included before any linux/ headerFrantisek Sumsal2024-04-0912-11/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The linux/ headers include linux/libc-compat.h that makes sure the linux/ headers won't redeclare symbols already declared by net/if.h, but glibc's net/if.h doesn't do that, so if the include order is reversed we'll end up with a bunch of errors about redeclared stuff: [3/519] Compiling C object test-network-tables.p/src_network_test-network-tables.c.o FAILED: test-network-tables.p/src_network_test-network-tables.c.o cc -Itest-network-tables.p -I. -I.. -Isrc/basic -I../src/basic -Isrc/fundamental -I../src/fundamental -Isrc/systemd -I../src/systemd -I../src/libsystemd/sd-bus -I../src/libsystemd/sd-device -I../src/libsystemd/sd-event -I../src/libsystemd/sd-hwdb -I../src/libsystemd/sd-id128 -I../src/libsystemd/sd-journal -I../src/libsystemd/sd-netlink -I../src/libsystemd/sd-network -I../src/libsystemd/sd-resolve -Isrc/shared -I../src/shared -Isrc/libsystemd-network -I../src/libsystemd-network -Isrc/network -I../src/network -I../src/network/netdev -I../src/network/tc -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O0 -g -Wno-missing-field-initializers -Wno-unused-parameter -Wno-nonnull-compare -Warray-bounds -Warray-bounds=2 -Wdate-time -Wendif-labels -Werror=format=2 -Werror=format-signedness -Werror=implicit-function-declaration -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Werror=missing-declarations -Werror=missing-prototypes -Werror=overflow -Werror=override-init -Werror=return-type -Werror=shift-count-overflow -Werror=shift-overflow=2 -Werror=strict-flex-arrays -Werror=undef -Wfloat-equal -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wsuggest-attribute=noreturn -Wunused-function -Wwrite-strings -Wzero-length-bounds -fdiagnostics-show-option -fno-common -fstack-protector -fstack-protector-strong -fstrict-flex-arrays --param=ssp-buffer-size=4 -Wno-unused-result -Werror=shadow -fno-strict-aliasing -fstrict-flex-arrays=1 -fvisibility=hidden -fno-omit-frame-pointer -include config.h -pthread -DTEST_CODE=1 -MD -MQ test-network-tables.p/src_network_test-network-tables.c.o -MF test-network-tables.p/src_network_test-network-tables.c.o.d -o test-network-tables.p/src_network_test-network-tables.c.o -c ../src/network/test-network-tables.c In file included from ../src/basic/linux/if_bonding.h:47, from ../src/network/netdev/bond.h:5, from ../src/network/test-network-tables.c:3: ../src/basic/linux/if.h:111:41: error: redeclaration of enumerator ‘IFF_UP’ 111 | #define IFF_UP IFF_UP | ^~~~~~ ../src/basic/linux/if.h:84:9: note: previous definition of ‘IFF_UP’ with type ‘enum net_device_flags’ 84 | IFF_UP = 1<<0, /* sysfs */ | ^~~~~~ ../src/basic/linux/if.h:112:41: error: redeclaration of enumerator ‘IFF_BROADCAST’ 112 | #define IFF_BROADCAST IFF_BROADCAST | ^~~~~~~~~~~~~ ... This also drops remaining workarounds from the last time this issue was brought up (6f270e6bd8) since they shouldn't be needed anymore if the order of the includes is the "correct" one. I also added a comment to each affected include when this is inevitably encountered again in the future. Resolves: #32160