summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/test-dhcp6-client.c
Commit message (Collapse)AuthorAgeFilesLines
* send dhcpv6 release when stoppingchris2023-01-171-4/+78
|
* tree-wide: introduce PIPE_EBADF macroYu Watanabe2022-12-201-1/+1
|
* tree-wide: use -EBADF also in pipe initializersZbigniew Jędrzejewski-Szmek2022-12-191-1/+1
| | | | In some places, initialization is dropped when unnecesary.
* sd-dhcp6-client: allow to build large packetYu Watanabe2022-10-021-18/+8
| | | | | | | | | | | | | | Previously, the maximum packet size was hardcoded with 512 + size of the DHCP header. This makes the packet size increased when necessary. See option_append_hdr(). Previously, all functions which append DHCP options took the head of the unused area of the packet, and the size of the free area. However, with this change, the buffer for the whole packet may be reallocated, hence now they take the head of the packet and the offset to the free area. Fixes #24851.
* sd-dhcp6-client: fix off-by-one error in parsing dhcp6 optionsYu Watanabe2022-07-141-0/+42
| | | | | | | This fixes error in parsing message when the rapid commit option is located at the end of the message. Fixes an issure reported in #24002.
* sd-dhcp6-client: request several optionsYu Watanabe2022-04-041-2/+5
| | | | | Even though these options are not currently used by sd-dhcp6-client, RFC 8415 states these options MUST be requested.
* network: dhcp6: request DNS servers or friends only when they will be usedYu Watanabe2022-04-031-6/+11
|
* dhcp: make option names singularYu Watanabe2022-04-031-23/+23
|
* sd-dhcp6-client: sort requesting optionsYu Watanabe2022-04-031-3/+3
|
* time-util: assume CLOCK_BOOTTIME always existsLennart Poettering2022-03-281-1/+1
| | | | | | | | Let's raise our supported baseline a bit: CLOCK_BOOTTIME started to work with timerfd in kernel 3.15 (i.e. back in 2014), let's require support for it now. This will raise our baseline only modestly from 3.13 → 3.15.
* test: Use TEST macros in more placesJan Janssen2022-03-161-30/+7
|
* test: fix memory and fd leak in test-dhcp6-clientYu Watanabe2022-02-221-2/+1
| | | | Fixes an issue reported in #22576.
* test: drop timeout handlersYu Watanabe2022-02-221-1/+1
| | | | Fixes file descriptor leak reported in #22576.
* test-dhcp6-client: add test for rapid commitYu Watanabe2022-02-141-2/+21
|
* test-dhcp6-client: cleanupsYu Watanabe2022-02-141-575/+560
| | | | | | | This does many cleanups. Most prominently, - check the sents packet more strictly, - make the packets used in the test more readable, - unify callbacks.
* sd-dhcp6-client: prohibit spurious state transitionYu Watanabe2022-02-141-1/+0
| | | | | Previously, `client_set_state(client, DHCP6_STATE_STOPPED)` might make the client enter the SOLICIT state.
* sd-dhcp6-client: introduce dhcp6_lease_new_from_message()Yu Watanabe2022-02-141-3/+1
|
* sd-dhcp6-client: always use ENODATA when a lease does not have requested dataYu Watanabe2022-02-141-5/+5
|
* sd-dhcp6-client: introduce dhcp6_ia_free()Yu Watanabe2022-02-141-26/+16
|
* sd-dhcp6-client: unify IA option headerYu Watanabe2022-02-141-3/+3
| | | | This also fixes possible unaligned read of message.
* sd-dhcp6-client: rename ia -> ia_na, pd -> ia_pd in sd_dhcp6_leaseYu Watanabe2022-02-141-2/+2
| | | | The previous naming is quite misleading.
* test: add testcase for broken NTP server optionYu Watanabe2022-01-131-0/+51
| | | | For issue #22099.
* test: voidify test functionsYu Watanabe2022-01-131-71/+30
| | | | This also drops unnecessary arguments, and unbreak several lines.
* sd-dhcp6-client: introduce dhcp6_option_can_request()Yu Watanabe2021-10-131-2/+6
|
* sd-dhcp6-client: add missing optionsYu Watanabe2021-10-121-2/+2
|
* sd-dhcp6-client: add missing message typesYu Watanabe2021-10-121-6/+6
| | | | This also changes the prefix: DHCP6_ -> DHCP6_MESSAGE_.
* sd-dhcp6-client: rename dhcp6_lease_set_dns() -> dhcp6_lease_add_dns()Yu Watanabe2021-09-291-2/+1
| | | | As it is allowed that multiple DNS server options appear in the message.
* sd-dhcp6-client: do not merge NTP and SNTP optionsYu Watanabe2021-09-291-2/+1
| | | | | | | 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.
* sd-dhcp6-client: support multiple domainsYu Watanabe2021-09-291-2/+1
|
* sd-dhcp6-client: drop domains_count and ntp_fqdn_countYu Watanabe2021-09-291-1/+1
|
* sd-dhcp6-client: modernize dhcp6_option_parse_ia()Yu Watanabe2021-09-291-23/+17
| | | | | | | | 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.
* sd-dhcp6-client: make dhcp6_option_parse_status() also parse error messageYu Watanabe2021-09-291-27/+34
| | | | | | | 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.
* test: add tests for reading unaligned dataYu Watanabe2021-09-291-8/+21
|
* sd-dhcp6-client: modernize dhcp6_option_parse()Yu Watanabe2021-09-291-25/+25
| | | | | | | - 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.
* sd-dhcp6-client: ignore IAs whose IAID do not match client's IAIDYu Watanabe2021-09-221-13/+26
| | | | | | But do not refuse whole message. Fixes #20803.
* Drop the text argument from assert_not_reached()Zbigniew Jędrzejewski-Szmek2021-08-031-12/+4
| | | | | | | | | | | | | | | | | 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.
* dhcp: do not use ifindex when generating iaid in testsYu Watanabe2021-06-121-1/+2
|
* Merge pull request #18777 from yuwata/network-set-ifname-to-enginesZbigniew Jędrzejewski-Szmek2021-03-311-9/+9
|\ | | | | network: set ifname to dhcp4 client or friends
| * libsystemd-network: make log_dhcp_client() or friends include interface nameYu Watanabe2021-03-041-9/+9
| |
* | 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: do not set T1 and T2 by dhcp6_option_append_ia() in clientYu Watanabe2021-02-231-11/+4
|
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* Merge pull request #16596 from poettering/event-time-relZbigniew Jędrzejewski-Szmek2020-08-041-4/+3
|\ | | | | | | Conflict in src/libsystemd-network/test-ndisc-rs.c fixed manually.
| * tree-wide: make use of new relative time events in sd-event.hLennart Poettering2020-07-281-4/+3
| |
* | dhcp6: parse the FQDN optionBeniamino Galvani2020-08-031-2/+57
|/ | | | | Parse option 39 (Client Fully Qualified Domain Name, RFC 4704) from the DHCP reply, which specifies the FQDN assigned by the server to the client.
* libsystemd-network: rename index -> ifindexYu Watanabe2020-07-021-4/+4
|
* dhcp6, radv: only accept valid ifindexYu Watanabe2020-07-021-1/+1
|
* sd-network: Rectify Advertise Message Processing by a ClientSusant Sahani2020-05-291-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need to fix RCC 2215 behaviour with rfc7550 errata and https://tools.ietf.org/html/rfc8415. [RFC3315] specifies that a client must ignore an Advertise message if a server will not assign any addresses to a client, and [RFC3633] specifies that a client must ignore an Advertise message if a server returns the NoPrefixAvail status to a requesting router. Thus, a client requesting both IA_NA and IA_PD, with a server that only offers either addresses or delegated prefixes, is not supported by the current protocol specifications. Solution: a client SHOULD accept Advertise messages, even when not all IA option types are being offered. And, in this case, the client SHOULD include the not offered IA option types in its Request. A client SHOULD only ignore an Advertise message when none of the requested IA options include offered addresses or delegated prefixes. Note that ignored messages MUST still be processed for SOL_MAX_RT and INF_MAX_RT options as specified in [RFC7083]. Replace Section 17.1.3 of RFC 3315: (existing errata) The client MUST ignore any Advertise message that includes a Status Code option containing the value NoAddrsAvail, with the exception that the client MAY display the associated status message(s) to the user. With the following text (which addresses the existing erratum [Err2471] and includes the changes made by [RFC7083]): The client MUST ignore any Advertise message that contains no addresses (IAADDR options encapsulated in IA_NA or IA_TA options) and no delegated prefixes (IAPREFIX options encapsulated in IA_PD options; see RFC 3633) with the exception that the client: - MUST process an included SOL_MAX_RT option (RFC 7083) and - MUST process an included INF_MAX_RT option (RFC 7083). A client can display any associated status message(s) to the user or activity log. The client ignoring this Advertise message MUST NOT restart the Solicit retransmission timer.
* sd-dhcp6: constify output arguments in get_{ntp,nds}_addrZbigniew Jędrzejewski-Szmek2020-05-261-3/+3
| | | | This matches what we do for ipv4 and is in general better.