summaryrefslogtreecommitdiffstats
path: root/src/network/netdev/vrf.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* network/netdev: do not try to update if not supportedYu Watanabe2024-11-141-0/+1
| | | | | Some netdevs cannot update there properties after created. Let's skip requests in that case.
* network/netdev: do not update MAC address if netdev is already runningYu Watanabe2024-11-141-0/+5
| | | | | | | | | | | 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.
* tree-wide: make sure net/if.h is included before any linux/ headerFrantisek Sumsal2024-04-091-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* network: make DEFINE_NETDEV_CAST() assert on input and outputZbigniew Jędrzejewski-Szmek2023-09-221-7/+2
| | | | | | | | | | The macro used to return NULL if input was NULL or had the wrong type. Now it asserts that input is nonnull and it has the expected type. There are a few places where a missing or mismatched type was OK, but in a majority of places, we would do both of the asserts. In various places we'd only do one, but that was by ommission/mistake. So moving the asserts into the macro allows us to save some lines.
* network: netdev: drop NETDEV_CREATE_MASTERYu Watanabe2022-02-261-1/+1
| | | | | As there is no deference between NETDEV_CREATE_MASTER and NETDEV_CREATE_INDEPENDENT.
* network: replace detailed netlink append messages with a single generic messageZbigniew Jędrzejewski-Szmek2022-01-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is the first in the series, and they generally follow the same idea: we had very detailed logging for message append operations which would only fail either with some type error or intrinsic limit (and then they would fail everywhere, so this would be noticed during development or in CI), or they would fail with ENOMEM, in which case the exact location is not very interesting since this is not repeatable. I am in general in favour of detailed logging messages, because it helps with diagnosis of errors, but I think case is an exception. Despite not being very useful, those messages required a lot of effort, because they were customized for each and every append operation. In fact some of the messages contained copy errors. The text of the messages (since they are generally unique) also added up to a considerable size. This removes the log messages after each sd_netlink_message_append_*() in fill_message_create() with a single line in netdev_create(). As described above, we are just appending fields to a message, so those calls would almost never fail. A forgotten 'return' was added in one place. $ size build/systemd-networkd{.0,} text data bss dec hex filename 1878634 394016 36 2272686 22adae build/systemd-networkd.0 1842450 394080 36 2236566 222096 build/systemd-networkd … so we save 30k too.
* network/netdev: introduce .iftype to netdev vtableYu Watanabe2021-11-261-0/+3
| | | | And disable .generate_mac flag for non-ether interfaces.
* network/netdev: fix typoYu Watanabe2021-11-091-1/+1
|
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* network: warn about unknown sections when parsing .netdev filesZbigniew Jędrzejewski-Szmek2019-11-251-1/+1
| | | | | | Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1774242. Now we'll emit the warning about unknown section [Netdev], making the issue much easier to diagnose.
* tree-wide: drop missing.hYu Watanabe2019-10-311-1/+0
|
* network: cleanup header inclusionYu Watanabe2019-10-301-2/+1
|
* network: add NetDevVTable::generate_mac flagYu Watanabe2019-05-281-0/+1
|
* network: add missing .sections element for vcan and vrfYu Watanabe2018-11-031-1/+1
| | | | Fixes #10629.
* Drop some more copyright headersZbigniew Jędrzejewski-Szmek2018-07-241-3/+0
| | | | Acks in https://github.com/systemd/systemd/issues/9320.
* tree-wide: beautify remaining copyright statementsLennart Poettering2018-06-141-1/+1
| | | | | | Let's unify an beautify our remaining copyright statements, with a unicode ©. This means our copyright statements are now always formatted the same way. Yay.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-15/+2
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* networkd: Renamed `table_id` field to `table`Andreas Rammhold2017-08-311-1/+1
| | | | | | Other parts of the code do just use `table` as identifier for the actual routing table id. This change should make it easier to read through the code since the meaning or rather the name stays the same.
* networkd: netdev - move to separate subdirectoryTom Gundersen2016-11-131-0/+50
This could (and should) be made into a separate daemon, at least move the sourcefiles out for now.