Commit Graph

1281 Commits

Author SHA1 Message Date
Yu Watanabe
e210f027e0 sd-dhcp6-client: rename dhcp6_lease_set_dns() -> dhcp6_lease_add_dns()
As it is allowed that multiple DNS server options appear in the message.
2021-09-29 15:29:41 +09:00
Yu Watanabe
e693e96961 sd-dhcp6-client: do not merge NTP and SNTP options
Previously, SNTP option is ignored when it appears after NTP option(s),
but merged later NTP options when it appears first.
This makes split the NTP and SNTP addresses, and use SNTP addresses only
when no NTP option is provided.
2021-09-29 15:29:41 +09:00
Yu Watanabe
9c3d46bf8d sd-dhcp6-client: support multiple NTP server options
Also, it is allowed that the suboption appears multiple times, and each
suboption contains one NTP server.
2021-09-29 15:29:41 +09:00
Yu Watanabe
41b14f0329 sd-dhcp6-client: support multiple domains 2021-09-29 15:29:41 +09:00
Yu Watanabe
5cf67bb407 sd-dhcp6-client: make dhcp6_lease_free() accepts NULL 2021-09-29 15:29:40 +09:00
Yu Watanabe
edeee50b3d sd-dhcp6-client: drop domains_count and ntp_fqdn_count 2021-09-29 15:29:40 +09:00
Yu Watanabe
548c33d712 sd-dhcp6-client: use dhcp6_option_parse() in client_parse_message() 2021-09-29 15:29:40 +09:00
Yu Watanabe
3f8227bf83 sd-dhcp6-client: constify several arguments 2021-09-29 15:29:40 +09:00
Yu Watanabe
b27dcf0813 sd-dhcp6-client: slightly modernize dhcp6_option_parse_domainname()/domainname_list() 2021-09-29 15:29:40 +09:00
Yu Watanabe
ad3c84204c sd-dhcp6-client: fix buffer size calculation in dhcp6_option_parse_ip6addrs()
GREEDY_REALLOC() takes number of elements, not buffer size.

This also rename dhcp6_option_parse_ip6addrs() to
dhcp6_option_parse_addresses().
2021-09-29 15:29:40 +09:00
Yu Watanabe
8a8955507a sd-dhcp6-client: modernize dhcp6_option_parse_ia()
This makes
- the function not update the arguments for storing results on error,
- use dhcp6_option_parse() to parse sub options,
- ignore all errors, except for -ENOMEM, in parsing sub options,
- update log messages.
2021-09-29 15:29:40 +09:00
Yu Watanabe
4af39cb8ec sd-dhcp6-client: make dhcp6_option_parse_status() also parse error message
This also introduce dhcp6_option_parse_ia_options(). Currently, it is
assumed that each IA address or PD prefix may contain a status sub-option.
But it is not prohibited that other sub-options or multiple status
options are contained.
2021-09-29 15:29:36 +09:00
Yu Watanabe
e620104956 test: add tests for reading unaligned data 2021-09-29 15:18:59 +09:00
Yu Watanabe
b89a3758e9 sd-dhcp6-client: modernize dhcp6_option_parse()
- merge dhcp6_option_parse() with option_parse_hdr().
- do not assign/update any values on error.
- use assert() instead of assert_return(), as the assertions cannot
  be triggered by a library user.
2021-09-29 15:18:59 +09:00
Yu Watanabe
dc95e21d33 sd-dhcp6-client: constify one argument 2021-09-29 15:18:59 +09:00
Yu Watanabe
5977b71f28 libsystemd-network: make sd_dhcp_client_get_ifname() or friends return negative errno on error 2021-09-29 03:37:09 +09:00
Yu Watanabe
01afd0f7f5 tree-wide: make format_ifname() or friends return negative errno on failure
Also,
- drop unnecessary +1 from buffer size, as IF_NAMESIZE or IFNAMSIZ
  includes the nul at the end.
- format_ifname() does not update buffer on failure,
- introduces format_ifname_alloc(), FORMAT_IFNAME(), and their friends.
2021-09-29 03:37:06 +09:00
Yu Watanabe
35777f5178 sd-lldp-rx: make lldp_rx_free() and lldp_neighbor_free() accept NULL 2021-09-28 17:55:19 +09:00
Yu Watanabe
92466b8da2 sd-lldp-rx: sd_event should be attached when lldp_rx_start_timer() is called 2021-09-28 17:55:19 +09:00
Yu Watanabe
3e4a202519 sd-lldp-rx: do not enable timer event source in sd_lldp_rx_get_neighbors()
It must be just a simple getter.
2021-09-28 17:55:19 +09:00
Yu Watanabe
0cd7e072b4 sd-lldp-rx: use _cleanup_ attribute at one more place 2021-09-28 17:55:19 +09:00
Yu Watanabe
71c4f7e895 sd-lldp-rx: wrap long line 2021-09-28 17:55:19 +09:00
Yu Watanabe
90496cc68c sd-lldp-rx: add missing assertions 2021-09-28 17:55:19 +09:00
Yu Watanabe
b0a67b202d sd-lldp-rx: delay allocating hashmap and prioq to store neighbors 2021-09-28 17:55:16 +09:00
Yu Watanabe
aa3f8d4ca1 sd-lldp-rx: ensure no event will be triggered after sd_lldp_rx_detach_event() is called 2021-09-28 15:07:37 +09:00
Yu Watanabe
e9ea43136c sd-lldp-rx: add comments about the three multicast addresses 2021-09-28 15:07:13 +09:00
Yu Watanabe
b5dce07a5e sd-lldp-rx: introduce sd_lldp_rx_is_running() 2021-09-28 14:51:24 +09:00
Yu Watanabe
4be699a8db sd-lldp-rx: ignore all errors in processing datagram 2021-09-28 14:44:12 +09:00
Yu Watanabe
7df9656782 sd-lldp-tx: introduce sd-lldp-tx 2021-09-28 01:35:47 +09:00
Yu Watanabe
3be1e84fe9 sd-lldp: introduce SD_LLDP_OUI_IANA_MUD macro 2021-09-28 01:34:00 +09:00
Yu Watanabe
35778343ab sd-lldp-rx: rename sd_lldp -> sd_lldp_rx 2021-09-27 23:55:11 +09:00
Yu Watanabe
94832e6e55 test: also rename {test,fuzz}-lldp.c 2021-09-27 23:55:11 +09:00
Yu Watanabe
3a2ee8554e sd-lldp: rename sd-lldp.[ch] -> sd-lldp-rx.[ch] 2021-09-27 23:55:11 +09:00
Yu Watanabe
82e0689cd8 meson: sort files 2021-09-27 23:55:11 +09:00
Yu Watanabe
eb2f750242 libsystemd-network: disable event sources before unref them
Fixes #20825.
2021-09-24 17:26:41 +09:00
Yu Watanabe
469fd57f18 sd-dhcp6-client: ignore IAs whose IAID do not match client's IAID
But do not refuse whole message.

Fixes #20803.
2021-09-22 21:19:54 +01:00
Yu Watanabe
f782eee68a journal,network,timesync: fix segfault on 32bit timeval/timespec systems
Fixes #20741.
2021-09-16 11:47:44 +02:00
Alvin Šipraga
8e664ab6ec network: print Ethernet Link-Layer DHCP client ID with leading 0's
This is a small cosmetic change.

Before:

   Offered DHCP leases: 192.168.0.183 (to 0:9:a7:36:bc:89)

After:

   Offered DHCP leases: 192.168.0.183 (to 00:09:a7:36:bc:89)
2021-09-01 00:04:04 +09:00
Yu Watanabe
9365e296fe socket-util: introduce CMSG_SPACE_TIMEVAL/TIMESPEC macro to support additional 64bit timeval or timespec
Fixes #20482 and #20564.
2021-08-30 19:56:41 +09:00
Yu Watanabe
6da22a2fa5 icmp6: drop unnecessary assertion
Follow-up for 3691bcf3c5.
2021-08-20 08:44:31 +09:00
Yu Watanabe
b713a99b1a sd-dhcp-server: support static lease outside of address pool
Closes #20341.
2021-08-11 16:43:26 +09:00
Yu Watanabe
3dc8fb0eb8 sd-dhcp-server: fix possible double-free or use-after-free 2021-08-11 16:43:25 +09:00
Yu Watanabe
cedf6a8da5 sd-dhcp-server: use hashmap_ensure_put() 2021-08-11 16:43:25 +09:00
Yu Watanabe
0eec7f5ffa sd-dhcp6-client: use SYNTHETIC_ERRNO() 2021-08-10 21:57:42 +09:00
Yu Watanabe
de949e911e sd-dhcp6-client: cirtainly adjust T1 and T2
This fixes a bug introduced by 99f1d3fc50.
Note that in the information requesting mode, the lease has neither
addresses nor PD prefixes.
2021-08-10 21:39:30 +09:00
Yu Watanabe
0c42b61348 sd-dhcp6-client: fix copy-and-paste mistake
Fix bug introduced by b47fb949b3.
2021-08-10 21:36:07 +09:00
Yu Watanabe
d7799877a0 sd-dhcp6-client: do not ignore errors in client_receive_advertise()
This also adds several debug log messages.
2021-08-05 11:14:23 +01:00
Zbigniew Jędrzejewski-Szmek
04499a70fb Drop the text argument from assert_not_reached()
In general we almost never hit those asserts in production code, so users see
them very rarely, if ever. But either way, we just need something that users
can pass to the developers.

We have quite a few of those asserts, and some have fairly nice messages, but
many are like "WTF?" or "???" or "unexpected something". The error that is
printed includes the file location, and function name. In almost all functions
there's at most one assert, so the function name alone is enough to identify
the failure for a developer. So we don't get much extra from the message, and
we might just as well drop them.

Dropping them makes our code a tiny bit smaller, and most importantly, improves
development experience by making it easy to insert such an assert in the code
without thinking how to phrase the argument.
2021-08-03 10:05:10 +02:00
Yu Watanabe
e18f21e349 Merge pull request #20109 from keszybz/timestamp-macros
Add macros that define scratch buffer internally for timestamp/timespan formatting
2021-07-14 16:14:08 +09:00
Frantisek Sumsal
2f0927626a tree-wide: coccinelle fixes
Yet another batch of Coccinelle fixes.
2021-07-09 20:54:22 +01:00