Yegor Alexeyev
c95df5879e
relay role implementation
2021-04-20 15:11:53 +02:00
Luca Boccassi
2d8c8549ab
Merge pull request #19317 from keszybz/check-return-values-from-log_errno-functions
...
Check return values from log_errno functions
2021-04-15 20:33:54 +01:00
Zbigniew Jędrzejewski-Szmek
828b603a79
libsystemd-network: fix dhcp option buffer confusion
...
We were writing to the wrong buffer with a wrong offset :(
Bug present since the original introduction of the code in
04b28be1a3 .
2021-04-15 13:46:48 +09:00
Zbigniew Jędrzejewski-Szmek
00dd6d7770
libsystemd-network: check that errno==0 is not passed to log functions
2021-04-14 23:32:10 +02:00
Zbigniew Jędrzejewski-Szmek
a0c2541b6b
libsystemd-network: use macro for definitions of log_{lldp,dhcp,…}_errno
...
No functional change.
2021-04-14 23:32:07 +02:00
Zbigniew Jędrzejewski-Szmek
f407219cd1
Check that errno passed log_{interface,link}_*_errno() is non-zero
2021-04-14 22:53:49 +02:00
Yu Watanabe
22bbba8444
sd-dhcp-client: introduce sd_dhcp_client_is_running()
2021-04-14 22:31:28 +02:00
Zbigniew Jędrzejewski-Szmek
2d359acda5
libsystemd-network: fix dhcp option buffer confusion
...
We were writing to the wrong buffer with a wrong offset :(
Bug present since the original introduction of the code in
04b28be1a3 .
2021-04-14 16:19:54 +02:00
Luca Boccassi
c2b2df604b
tree-wide: avoid uninitialized warning on _cleanup_ variables
...
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.
2021-04-14 12:25:06 +01:00
Yegor Alexeyev
21b6b87eb3
dhcp: Implemented BindToInterface= configuration option
2021-04-14 07:30:40 +09:00
Yu Watanabe
9bafb8d504
sd-dhcp-client: constify argument in sd_dhcp_lease_get_xxx()
2021-04-12 09:55:26 +02:00
Yu Watanabe
080e5c2fde
sd-dhcp6-client: do not use IN_SET() macro when only one target value
2021-04-10 13:24:56 +01:00
Zbigniew Jędrzejewski-Szmek
82a335db83
Merge pull request #18777 from yuwata/network-set-ifname-to-engines
...
network: set ifname to dhcp4 client or friends
2021-03-31 10:25:23 +02:00
Luca Boccassi
a9dd1010f0
test-dhcp6-client: add one more assert on memory mapping
...
Same as 7489d0640a , one more case
that was missed.
Coverity CID #1394277
2021-03-26 20:17:35 +01:00
Luca Boccassi
7489d0640a
test-dhcp6-client: add one more assert on memory mapping
...
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
2021-03-25 12:02:43 +00:00
Yu Watanabe
fa92d38428
dhcp6: fix wrong length for IA_PD dhcp6 option
...
Fixes an issue introduced by 73b49d433c .
When PrefixDelegationHint= is not set, dhcp6_option_append_pd() sets
wrong length for IA_PD option, as `r` is `-EINVAL`.
Fixes #19021 .
2021-03-16 21:29:49 +01:00
Zbigniew Jędrzejewski-Szmek
63dc82d378
Merge pull request #18852 from yuwata/tree-wide-use-UINT64_MAX
...
tree-wide: use UINT64_MAX or friends
2021-03-05 17:51:34 +01:00
Yu Watanabe
986c0edfcb
dhcp-server: also append specified additional options and vendor specific option on DHCP_OFFER
...
Fixes #15780 .
2021-03-05 11:34:32 +09:00
Yu Watanabe
f5fbe71d95
tree-wide: use UINT64_MAX or friends
2021-03-05 07:10:13 +09:00
Yu Watanabe
a7d757ec29
dhcp6: tighten T1 and T2 value check
...
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.
2021-03-04 05:51:56 +09:00
Yu Watanabe
353887831b
libsystemd-network: make log_dhcp_client() or friends include interface name
2021-03-04 05:51:28 +09:00
Yu Watanabe
61a9fa8f0c
libsystemd-network: introduce sd_xxx_{set,get}_ifname()
2021-03-04 05:24:54 +09:00
Yu Watanabe
ab7153b3f4
dhcp: use unlink_and_freep() in dhcp_lease_save()
2021-03-03 16:26:32 +09:00
Zbigniew Jędrzejewski-Szmek
d9a65c5976
Merge pull request #18730 from yuwata/dhcp6-client-do-not-set-t1-t2-18090
...
dhcp6: do not set T1 and T2 in IA_PD option or friends
2021-02-24 09:53:37 +01:00
Lennart Poettering
d9a650bbe8
icmp6-util: add missing variable initialization
...
Coverity 1446712
2021-02-23 15:45:15 +01:00
Yu Watanabe
73b49d433c
dhcp6: do not set T1 and T2 by dhcp6_option_append_pd() in client
...
Fixes #18090 .
2021-02-23 19:36:37 +09:00
Yu Watanabe
e7613578b4
dhcp6: do not set T1 and T2 by dhcp6_option_append_ia() in client
2021-02-23 19:36:37 +09:00
Yu Watanabe
1e84213a43
dhcp6: make dhcp6_option_parse_{address,pdprefix}() return -EINVAL when received address or prefix is refused
...
And then the caller ignores the error.
Otherwise, `ret_liftime_valid` is not set even if they succeeds.
2021-02-23 19:36:23 +09:00
Yu Watanabe
cf6c33bd6b
dhcp6: do not use input value before checking
2021-02-23 18:49:11 +09:00
Lennart Poettering
2324fd3a39
network: suffix types with _t in public headers
...
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.
2021-02-18 18:17:16 +01:00
Yu Watanabe
c633628daf
tree-wide: constify variables if possible
2021-02-18 03:48:07 +09:00
Yu Watanabe
5380707aba
network: use in_addr_prefix_to_string()
2021-02-18 03:48:07 +09:00
Yu Watanabe
94876904bb
tree-wide: use in_addr_is_set() or friends
2021-02-18 03:48:07 +09:00
Benjamin Robin
0979e4adb5
libsystemd-network: use -EINVAL for _DUID_TYPE_INVALID
...
Follow-up of #11484
2021-02-16 23:40:30 +01:00
Zbigniew Jędrzejewski-Szmek
75db809ae5
tree-wide: return NULL from freeing functions
...
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.
2021-02-16 17:15:10 +01:00
Zbigniew Jędrzejewski-Szmek
2d93c20e5f
tree-wide: use -EINVAL for enum invalid values
...
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.
2021-02-10 14:46:59 +01:00
Zbigniew Jędrzejewski-Szmek
ea3640ac96
Merge pull request #18320 from yuwata/network-reduce-trigger-network-events
...
network: do not trigger unnecessary network events
2021-01-30 15:30:17 +01:00
Susant Sahani
fe96c0f86d
treewide: tighten variable scope in loops ( #18372 )
...
Also use _cleanup_free_ in one more place.
2021-01-27 08:19:39 +01:00
Yu Watanabe
abcf60e730
dhcp: use conservative_rename()
2021-01-22 12:55:54 +09:00
Yu Watanabe
7e2757c42f
Merge pull request #18038 from yuwata/meson-split
...
meson: various cleanups
2021-01-19 12:22:34 +09:00
Yu Watanabe
e025c9dfe3
meson: move test or fuzzer definitions to relevant meson.build in subdirectories
2021-01-19 07:06:32 +09:00
Yu Watanabe
8d40961c3c
meson: slightly disentangle code dependencies
...
But, still sd-id128 is used in src/basic.
2021-01-19 07:06:32 +09:00
Yu Watanabe
09f7c7c668
fuzzers: move several fuzzers
2021-01-19 07:04:19 +09:00
Susant Sahani
02288f3ef8
network: sd-dhcp6-client - use ordered_hashmap_ensure_put
2021-01-18 21:53:19 +01:00
Susant Sahani
ebffea2a25
network: Use ordered_hashmap_ensure_put ( #18233 )
2021-01-17 20:07:02 +09:00
Yu Watanabe
019951ec97
dhcp6: refuse zero length vendor class
...
Also, fixes the maximum length of the vendor class to UINT16_MAX.
Moreover, a memory leak in sd_dhcp6_client_set_request_vendor_class().
2021-01-13 00:07:33 +09:00
Yu Watanabe
361eb4125d
dhcp6: add an assert()
2021-01-13 00:00:56 +09:00
Yu Watanabe
8b6ea477a7
dhcp: do not assign value twice
2021-01-13 00:00:56 +09:00
Yu Watanabe
5a99444e4f
dhcp6: refuse zero length dhcp user class
...
This also fixes a memory leak when
sd_dhcp6_client_set_request_user_class() is called multiple times.
2021-01-13 00:00:56 +09:00
Yu Watanabe
e4336c0a5d
dhcp: length of each user class field must be positive
...
This also fixes an memory leak when sd_dhcp_client_set_user_class()
is called multiple times.
2021-01-13 00:00:56 +09:00