summaryrefslogtreecommitdiffstats
path: root/src/libsystemd-network (follow)
Commit message (Collapse)AuthorAgeFilesLines
* sd-dhcp-server: support static address to DHCPv4 offerborna-blazevic2021-05-272-53/+183
|
* alloc-util: simplify GREEDY_REALLOC() logic by relying on malloc_usable_size()Lennart Poettering2021-05-1910-43/+26
| | | | | | | | | | | | | | | | | | | | | | | | We recently started making more use of malloc_usable_size() and rely on it (see the string_erase() story). Given that we don't really support sytems where malloc_usable_size() cannot be trusted beyond statistics anyway, let's go fully in and rework GREEDY_REALLOC() on top of it: instead of passing around and maintaining the currenly allocated size everywhere, let's just derive it automatically from malloc_usable_size(). I am mostly after this for the simplicity this brings. It also brings minor efficiency improvements I guess, but things become so much nicer to look at if we can avoid these allocation size variables everywhere. Note that the malloc_usable_size() man page says relying on it wasn't "good programming practice", but I think it does this for reasons that don't apply here: the greedy realloc logic specifically doesn't rely on the returned extra size, beyond the fact that it is equal or larger than what was requested. (This commit was supposed to be a quick patch btw, but apparently we use the greedy realloc stuff quite a bit across the codebase, so this ends up touching *a*lot* of code.)
* netlink,network: drop "const" from opaque object parameters in ↵Lennart Poettering2021-05-123-32/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | supposed-to-be-public APIs This drops the "const" specifier from the opaque object parameters to various functions in our API. This effectively reverts #19292 and more. Why drop this? Our public APIs should not leak too much information about how stuff is implemented internally. In our public APIs we shouldn't give too many guarantees we don#t want to necessarily keep. Specifically: in many cases it makes sense that getters actually generate/parse/allocate data on the fly, storing/caching the result internally, to speed things up, do things lazily or to track memory allocations so that they can be freed later. Doing this means we need to change the objects, even though the getters are semantically a read operation. We want to retain the freedom that we can change things around internally. By exposing the objects as "const" we remove a good chunk of that, for little gain. See sd_bus_creds_get_description() for a real example of a getter that implicitly caches and thus modifies the relevant object. This removes the "const" decorators from sd-dhcp and sd-netlink, two APIs that we intend to make public eventually even though they still are not, leaving us the chance to still fix this before it becomes set in stone.
* tree-wide: fix typoYu Watanabe2021-05-091-1/+1
|
* rfc3046 implementationYegor Alexeyev2021-05-085-25/+218
|
* relay role implementationYegor Alexeyev2021-04-202-21/+90
|
* Merge pull request #19317 from ↵Luca Boccassi2021-04-158-92/+76
|\ | | | | | | | | keszybz/check-return-values-from-log_errno-functions Check return values from log_errno functions
| * libsystemd-network: check that errno==0 is not passed to log functionsZbigniew Jędrzejewski-Szmek2021-04-148-16/+40
| |
| * libsystemd-network: use macro for definitions of log_{lldp,dhcp,…}_errnoZbigniew Jędrzejewski-Szmek2021-04-148-84/+44
| | | | | | | | No functional change.
| * Check that errno passed log_{interface,link}_*_errno() is non-zeroZbigniew Jędrzejewski-Szmek2021-04-148-8/+8
| |
| * libsystemd-network: fix dhcp option buffer confusionZbigniew Jędrzejewski-Szmek2021-04-141-1/+2
| | | | | | | | | | | | We were writing to the wrong buffer with a wrong offset :( Bug present since the original introduction of the code in 04b28be1a306fd2ba454d3ee333d63df71aa3873.
* | libsystemd-network: fix dhcp option buffer confusionZbigniew Jędrzejewski-Szmek2021-04-151-1/+2
| | | | | | | | | | | | We were writing to the wrong buffer with a wrong offset :( Bug present since the original introduction of the code in 04b28be1a306fd2ba454d3ee333d63df71aa3873.
* | sd-dhcp-client: introduce sd_dhcp_client_is_running()Yu Watanabe2021-04-141-0/+7
|/
* tree-wide: avoid uninitialized warning on _cleanup_ variablesLuca Boccassi2021-04-141-1/+1
| | | | | | | With some versions of the compiler, the _cleanup_ attr makes it think the variable might be freed/closed when uninitialized, even though it cannot happen. The added cost is small enough to be worth the benefit, and optimized builds will help reduce it even further.
* dhcp: Implemented BindToInterface= configuration optionYegor Alexeyev2021-04-144-40/+88
|
* sd-dhcp-client: constify argument in sd_dhcp_lease_get_xxx()Yu Watanabe2021-04-122-31/+31
|
* sd-dhcp6-client: do not use IN_SET() macro when only one target valueYu Watanabe2021-04-102-12/+9
|
* Merge pull request #18777 from yuwata/network-set-ifname-to-enginesZbigniew Jędrzejewski-Szmek2021-03-3123-326/+529
|\ | | | | network: set ifname to dhcp4 client or friends
| * dhcp6: tighten T1 and T2 value checkYu Watanabe2021-03-031-4/+4
| | | | | | | | | | Only when T1 and T2 are both 0, they are adjusted later based on address or prefix T1 and T2. So the first check must be changed.
| * libsystemd-network: make log_dhcp_client() or friends include interface nameYu Watanabe2021-03-0318-302/+342
| |
| * libsystemd-network: introduce sd_xxx_{set,get}_ifname()Yu Watanabe2021-03-0315-22/+185
| |
* | test-dhcp6-client: add one more assert on memory mappingLuca Boccassi2021-03-261-0/+1
| | | | | | | | | | | | | | Same as 7489d0640a4864d4b47fd8fda77f8eb7cf2e3fe8, one more case that was missed. Coverity CID #1394277
* | test-dhcp6-client: add one more assert on memory mappingLuca Boccassi2021-03-251-0/+1
| | | | | | | | | | | | | | | | | | | | Static analyzers need a hint that optval is not pointing off the end of the msg_advertise array, since pos can go up to the full length of it. The array is manually constructed so we know this won't happen, but adding one more assert should be enough to avoid false positives. Coverity CID #1394277
* | dhcp6: fix wrong length for IA_PD dhcp6 optionYu Watanabe2021-03-161-2/+2
| | | | | | | | | | | | | | | | | | Fixes an issue introduced by 73b49d433c2c8e6304c8b82538bd4231d070fce4. When PrefixDelegationHint= is not set, dhcp6_option_append_pd() sets wrong length for IA_PD option, as `r` is `-EINVAL`. Fixes #19021.
* | Merge pull request #18852 from yuwata/tree-wide-use-UINT64_MAXZbigniew Jędrzejewski-Szmek2021-03-058-14/+14
|\ \ | | | | | | tree-wide: use UINT64_MAX or friends
| * | tree-wide: use UINT64_MAX or friendsYu Watanabe2021-03-048-14/+14
| | |
* | | dhcp-server: also append specified additional options and vendor specific ↵Yu Watanabe2021-03-051-74/+42
|/ / | | | | | | | | | | option on DHCP_OFFER Fixes #15780.
* / dhcp: use unlink_and_freep() in dhcp_lease_save()Yu Watanabe2021-03-031-20/+11
|/
* Merge pull request #18730 from yuwata/dhcp6-client-do-not-set-t1-t2-18090Zbigniew Jędrzejewski-Szmek2021-02-244-116/+156
|\ | | | | dhcp6: do not set T1 and T2 in IA_PD option or friends
| * dhcp6: do not set T1 and T2 by dhcp6_option_append_pd() in clientYu Watanabe2021-02-233-58/+88
| | | | | | | | Fixes #18090.
| * dhcp6: do not set T1 and T2 by dhcp6_option_append_ia() in clientYu Watanabe2021-02-232-28/+31
| |
| * dhcp6: make dhcp6_option_parse_{address,pdprefix}() return -EINVAL when ↵Yu Watanabe2021-02-231-30/+36
| | | | | | | | | | | | | | received address or prefix is refused And then the caller ignores the error. Otherwise, `ret_liftime_valid` is not set even if they succeeds.
| * dhcp6: do not use input value before checkingYu Watanabe2021-02-231-3/+4
| |
* | icmp6-util: add missing variable initializationLennart Poettering2021-02-231-1/+1
|/ | | | Coverity 1446712
* network: suffix types with _t in public headersLennart Poettering2021-02-188-17/+17
| | | | | | | | | | | | 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.
* tree-wide: constify variables if possibleYu Watanabe2021-02-172-11/+11
|
* network: use in_addr_prefix_to_string()Yu Watanabe2021-02-171-34/+32
|
* tree-wide: use in_addr_is_set() or friendsYu Watanabe2021-02-176-18/+20
|
* libsystemd-network: use -EINVAL for _DUID_TYPE_INVALIDBenjamin Robin2021-02-161-1/+1
| | | | Follow-up of #11484
* tree-wide: return NULL from freeing functionsZbigniew Jędrzejewski-Szmek2021-02-161-3/+3
| | | | | | 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.
* 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.
* Merge pull request #18320 from yuwata/network-reduce-trigger-network-eventsZbigniew Jędrzejewski-Szmek2021-01-301-3/+3
|\ | | | | network: do not trigger unnecessary network events
| * dhcp: use conservative_rename()Yu Watanabe2021-01-221-3/+3
| |
* | treewide: tighten variable scope in loops (#18372)Susant Sahani2021-01-271-2/+1
|/ | | | Also use _cleanup_free_ in one more place.
* Merge pull request #18038 from yuwata/meson-splitYu Watanabe2021-01-199-0/+300
|\ | | | | meson: various cleanups
| * meson: move test or fuzzer definitions to relevant meson.build in subdirectoriesYu Watanabe2021-01-181-0/+68
| |
| * meson: slightly disentangle code dependenciesYu Watanabe2021-01-181-0/+2
| | | | | | | | But, still sd-id128 is used in src/basic.
| * fuzzers: move several fuzzersYu Watanabe2021-01-188-0/+230
| |
* | network: sd-dhcp6-client - use ordered_hashmap_ensure_putSusant Sahani2021-01-181-10/+2
|/
* network: Use ordered_hashmap_ensure_put (#18233)Susant Sahani2021-01-174-26/+15
|