summaryrefslogtreecommitdiffstats
path: root/src/network/networkd-util.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* network: drop REMOVING flag when a netlink message is sent to kernelYu Watanabe2022-12-061-1/+2
| | | | | | | | | | | | | | | | When an interface goes to down, the kernel drops several routes automatically, and at the same time networkd requests to remove them, but the kernel sometimes does not respond the requests. Hence, the routes cannot drop the REMOVING flag, and networkd will never try to configure other routes which depend on the previously removed routes even if they are already reconfigured. With this patch, when networkd sends a request to configure a route (or any other network settings), REMOVING flag for the route is dropped without waiting for the reply about the previous remove request, as we can expect it will appear even if it is already removed or under removing. Fixes #24999.
* network: add missing assertionYu Watanabe2022-11-301-0/+1
|
* network: make sec_to_usec() map 0sec -> 0usecYu Watanabe2022-10-031-4/+7
| | | | | | | | | | Zero lifetime in RA is special, and we should not assign possibly very short lifetime addresses or friends. This should not change anything at least now, preparation for later commits. Note, DHCPv4 and v6 code also uses it, but sd-dhcp-client and sd-dhcp6-client already filtered messages with zero lifetime. Hence, the change should not affect DHCP code.
* network: fix DHCPv4 address renewal with IPv4ACDYu Watanabe2022-08-181-6/+5
| | | | | | | | | | Previously, when a DHCP address is renewed and if the IPv4ACD for the address is enabled, the address will never drop the probing flag, thus the lifetime of the address will never be updated. This drops NETWORK_CONFIG_STATE_PROBING, and the IPv4ACD status is managed another bit, Address.acd_bound. And, the flag is updated only when the IPv4ACD announced the address or detects conflict.
* network: fix infinite lifetime handlingYu Watanabe2022-07-141-0/+12
|
* network: rename NetworkConfigSection -> ConfigSectionYu Watanabe2022-01-191-37/+0
| | | | And move it and relevant functions to conf-parser.[ch].
* network: dhcp-pd: rename [DHCPv6PrefixDelegation] -> [DHCPPrefixDelegation]Yu Watanabe2021-12-071-1/+1
| | | | | | | This just changes the names of settings, variables, functions, files, and so on. No functionality is changed. Preparation for supporting 6rd.
* network: introduce NETWORK_CONFIG_SOURCE_RUNTIMEYu Watanabe2021-11-261-0/+1
|
* Typos found by codespellDimitri Papadopoulos2021-10-201-2/+2
|
* network: route: drop kernel version check for route expirationYu Watanabe2021-10-191-2/+0
| | | | | | Even in newer kernel version, it seems that some route type does not support expiration, e.g. IPv4 route or unreachable route. Let's use timer event source for such routes.
* network: introduce NetworkConfigSource and NetworkConfigStateYu Watanabe2021-09-151-0/+97
| | | | These will be used in later commits.
* network: further unification of MUD url parsersYu Watanabe2021-07-141-11/+1
| | | | Follow-up for 89fa9a6b7b2505aa2ce18febf1e28e79510dfec2.
* networkd: add shared parser for mud urlsZbigniew Jędrzejewski-Szmek2021-07-091-0/+11
| | | | The same buggy code was triplicated…
* network: unify log_link_message_full_errno() and log_message_warning_errno()Yu Watanabe2021-04-291-6/+14
| | | | This also introduces log_message_error_errno() or friends.
* network: move AddressFamily into network-util for the use by wait-online laterLetzteInstanz2021-04-141-10/+1
|
* network: warn when any positive boolean string is specified for IPMasquerade=Yu Watanabe2021-02-191-1/+1
| | | | | | | | | | | | Previously, any positive boolean string for IPMasquerade= enables only IPv4 masquerade. The commit 48ed276647c754bfb3ed5c6c5af9404e073ffe54 adds IPv6 masquerade support. However, only "yes" is handled as "ipv4", and other positive boolean strings are handled as "both". This makes all positive boolean strings considered as "ipv4", warn that they are deprecated, and suggest to use "ipv4" or "both". Follow-up for 48ed276647c754bfb3ed5c6c5af9404e073ffe54.
* network: suffix types with _t in public headersLennart Poettering2021-02-181-2/+2
| | | | | | | | | | | | Apparently, in our current public headers (i.e. those called sd-*.h) we suffixed typedefs that we use as values with _t, but we didn't do this for enum typedefs. Fix that while this stuff is not actually public yet. With this scheme "value typedefs" now end systematically in _t, and "object typedefs" (i.e. structures that are typically passed around via pointers and not values) do not. No code changes, just some renaming.
* network: nexthop: introduce Family= setting in [NextHop] sectionYu Watanabe2021-02-171-0/+3
| | | | This is an alias of `Gateway=0.0.0.0` or `Gateway=::`.
* Merge pull request #18007 from fw-strlen/ipv6_masq_and_dnatLennart Poettering2021-02-161-0/+1
|\ | | | | Support ipv6 for masquerade and dnat in nspawn and networkd
| * networkd: extend IPMasquerade to cover ipv6Florian Westphal2021-01-191-0/+1
| | | | | | | | | | | | | | | | | | | | Extend IPMasquerade to also cover ipv6. For compatibility reasons with earlier releases IPMasquerade=yes is identical to IPMasquerade=ipv4. Use IPMasquerade=both to cover ipv6 as well as ipv4. IPForward will now also enable ipv6 forwarding if IPMasquerade for ipv6 is enabled.
* | tree-wide: return NULL from freeing functionsZbigniew Jędrzejewski-Szmek2021-02-161-3/+4
| | | | | | | | | | | | I started working on this because I wanted to change how DEFINE_TRIVIAL_CLEANUP_FUNC is defined. Even independently of that change, it's nice to make make things more consistent and predictable.
* | networkd: make network_config_section_free() inlineZbigniew Jędrzejewski-Szmek2021-02-161-2/+5
| |
* | network: dhcp: use string tableYu Watanabe2021-02-111-0/+2
| |
* | tree-wide: use -EINVAL for enum invalid valuesZbigniew Jędrzejewski-Szmek2021-02-101-1/+1
|/ | | | | | | | | As suggested in https://github.com/systemd/systemd/pull/11484#issuecomment-775288617. This does not touch anything exposed in src/systemd. Changing the defines there would be a compatibility break. Note that tests are broken after this commit. They will be fixed in the next one.
* networkd: merge ll addressing fallback modes into normal "boolean" valuesZbigniew Jędrzejewski-Szmek2020-11-301-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | They are not really boolean, because we have both ipv4 and ipv6, but for each protocol we have either unset, no, and yes. From https://github.com/systemd/systemd/issues/13316#issuecomment-582906817: LinkLocalAddressing must be a boolean option, at least for ipv4: - LinkLocalAddressing=no => no LL at all. - LinkLocalAddressing=yes + Static Address => invalid configuration, warn and interpret as LinkLocalAddressing=no, no LL at all. (we check that during parsing and reject) - LinkLocalAddressing=yes + DHCP => LL process should be subordinated to the DHCP one, an LL address must be acquired at start or after a short N unsuccessful DHCP attemps, and must not stop DHCP to keeping trying. When a DHCP address is acquired, drop the LL address. If the DHCP address is lost, re-adquire a new LL address. (next patch will move in this direction) - LinkLocalAddressing=fallback has no reason to exist, because LL address must always be allocated as a fallback option when using DHCP. Having both DHCP and LL address at the same time is an RFC violation, so LinkLocalAdressing=yes correctly implemented is already the "fallback" behavior. The fallback option must be deprecated and if present in older configs must be interpreted as LinkLocalAddressing=yes. (removed) - And for IPv6, the LinkLocalAddress option has any sense at all? IPv6-LL address aren't required to be always set for every IPv6 enabled interface (in this case, coexisting with static or dynamic address if any)? Shouldn't be always =yes? (good question) This effectively reverts 29e81083bd2fcb2dbf83f67ef358c7d25adf7e9d. There is no special "fallback" mode now, so the check doesn't make sense anymore.
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* network: introduce hashmap_find_free_section_line()Yu Watanabe2020-10-061-1/+2
|
* network: move log_message_warning_errno() to networkd-util.hYu Watanabe2020-10-061-0/+10
|
* sd-dhcp: clean-up of DHCP lease server codeLennart Poettering2020-05-301-2/+2
| | | | | | | | | | | | | | | | | | This is an attempt to clean-up the DHCP lease server type code a bit. We now strictly use the same enum everywhere, and store server info in an array. Moreover, we use the same nomenclature everywhere. This only makes the changes in the sd-dhcp code. The networkd code is untouched so far (but should be fixed up like this too. But it's more complicated since this would then touch actual settings in .network files). Note that this also changes some field names in serialized lease files. But given that these field names have not been part of a released version of systemd yet, such a change should be ok. This is pure renaming/refactoring, shouldn't actually change any behaviour.
* network: define string lookup table for the DHCP info bitsZbigniew Jędrzejewski-Szmek2020-04-101-0/+5
|
* network: introduce DAD for static addressSusant Sahani2019-12-061-0/+3
| | | | Closes #2527.
* network: add RoutingPolicyRule.Family= settingYu Watanabe2019-08-161-0/+3
| | | | Closes #13233.
* network: rename AddressFamilyBoolean -> AddressFamilyYu Watanabe2019-08-161-10/+10
| | | | We usually do not call an extended boolean as XxxBoolean.
* network: use DEFINE_STRING_TABLE_LOOKUP() macro for AddressFamilyBooleanYu Watanabe2019-05-041-2/+5
|
* networkd: Option to use LinkLocalAddressing only when DHCP failsSusant Sahani2019-05-041-4/+6
| | | | | | | When LinkLocalAddressing=fallback or LinkLocalAddressing=ipv4-fallback then IPv4LL will be started only when DHCP fails. Closes #9648.
* codespell: fix spelling errorsBen Boeckel2019-04-291-1/+1
|
* network: drop sections contain invalid settings in network_verify()Yu Watanabe2019-03-131-0/+22
| | | | | | | | | | | If e.g., an [Address] section has an invalid setting, then previously assigned settings in the section is freed, and only later settings are stored. That may cause partially broken section stored in Network object. This makes if an invalid setting is found, then set 'invalid' flag instead of freeing it. And invalid sections are dropped later by network_verify().
* network: move NetworkConfigSection and related functions to networkd-util.[ch]Yu Watanabe2019-03-131-0/+11
|
* network: update enum value assignments for AddressFamilyBooleanYu Watanabe2019-02-191-4/+4
|
* tree-wide: drop double newlineYu Watanabe2018-06-291-1/+0
|
* tree-wide: drop copyright headers from frequent contributorsZbigniew Jędrzejewski-Szmek2018-06-201-3/+0
| | | | | | | | Fixes #9320. for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms' done
* 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: port over all code to the new CONFIG_PARSER_PROTOTYPE() macroLennart Poettering2018-05-221-2/+3
| | | | | | | | | | | This makes most header files easier to look at. Also Emacs gets really slow when browsing through large sections of overly long prototypes, which is much improved by this macro. We should probably not do something similar with too many other cases, as macros like this might help readability for some, but make it worse for others. But I think given the complexity of this specific prototype and how often we use it, it's worth doing.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | 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.
* setup route expiration in kernel if supportedDaniel Dao2018-03-121-0/+2
| | | | | | | | | kernel >= 4.5 (with commit https://github.com/torvalds/linux/commit/32bc201e1974976b7d3fea9a9b17bb7392ca6394) supports RTA_EXPIRES netlink attribute to set router lifetime. This simply detect the kernel version (>=4.5) and set the lifetime properly, fallback to expiring route in userspace for kernel that doesnt support it. Signed-off-by: Daniel Dao <dqminh89@gmail.com>
* 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.
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* resolved,networkd: unify ResolveSupport enumLennart Poettering2016-01-051-12/+0
| | | | | | | | networkd previously knew an enum "ResolveSupport" for configuring per-interface LLMNR support, resolved had a similar enum just called "Support", with the same value and similar pasers. Unify this, call the enum ResolveSupport, and port both daemons to it.
* networkd: split up networkd.h into per-object header filesLennart Poettering2015-08-271-0/+52
No functional changes, just moving definitions into separate header files.