summaryrefslogtreecommitdiffstats
path: root/src/libsystemd-network/test-dhcp6-client.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* dhcpv6 tests: Update since we allow arbitrary options to be setSusant Sahani2020-05-171-2/+2
|
* tree-wide: drop socket.h when socket-util.h is includedYu Watanabe2019-11-031-1/+0
|
* tree-wide: drop netinet/ether.h from socket-util.h and sd-netlink.hYu Watanabe2019-07-241-0/+1
|
* util: split out memcmp()/memset() related calls into memory-util.[ch]Lennart Poettering2019-03-131-1/+2
| | | | Just some source rearranging.
* util: drop missing.h from socket-util.hYu Watanabe2018-12-061-0/+1
|
* libsystemd-network: set SOCK_CLOEXEC and SOCK_NONBLOCKYu Watanabe2018-11-111-1/+1
|
* test-dhcp6-client: normalize logsYu Watanabe2018-10-181-21/+15
|
* dhcp6-client: Add tests for address, information and prefix requestsPatrik Flykt2018-09-191-4/+35
| | | | | Add simple test cases to ensure the request for addresses, prefixes and information request are handled as expected.
* tests: use a helper function to parse environment and open loggingZbigniew Jędrzejewski-Szmek2018-09-141-3/+2
| | | | | The advantages are that we save a few lines, and that we can override logging using environment variables in more test executables.
* tree-wide: use proper unicode © instead of (C) where we canLennart Poettering2018-06-141-1/+1
| | | | | | Let's use a proper unicode copyright symbol where we can, it's prettier. This important patch is very important.
* 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: drop spurious newlines (#8764)Lennart Poettering2018-04-191-1/+0
| | | | | | | | Double newlines (i.e. one empty lines) are great to structure code. But let's avoid triple newlines (i.e. two empty lines), quadruple newlines, quintuple newlines, …, that's just spurious whitespace. It's an easy way to drop 121 lines of code, and keeps the coding style of our sources a bit tigther.
* 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.
* test: free memoryYu Watanabe2018-01-151-0/+3
| | | | Fixes #7882.
* dhpc6: Add PD and PD Prefix testsPatrik Flykt2018-01-041-1/+53
| | | | Add tests for IA PD and PD Prefix options.
* test-dhcp6-client: Add Status option testPatrik Flykt2018-01-041-0/+78
| | | | | Add Status option tests to verify that options with differently placed Status options are processed correctly.
* dhcp6: Sanitize DHCPv6 IA option parsingPatrik Flykt2018-01-041-45/+56
| | | | | | | | | | | | Sanitize code for parsing DHCPv6 IA NA and TA options and their nested Status options so that the options can be fully and properly ignored should they not be conformant to the specification. Do this by defining a proper DHCP6Option structure and sending that structure to the parsing function. The parsing function will then not manipulate either any option data pointers or their lengths in order to iterate over the current option. Needless to say, this affects a few files including the test program.
* 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.
* sd-dhcp6-client: Implement FQDN Option (#7309)Stefan Agner2017-11-161-2/+34
| | | | | | | | | | | | | | Implement DHCPv6 option to exchange information about the Fully Qualified Domain Name (FQDN) according to RFC 4704. The RFC 4704 describes two models of operations in section 3, currently only the second model is supported (DHCPv6 server updates both the AAAA and the PTR RRs). The existing DHCP Section Options SendHostname and Hostname are sent as FQDN to the server. According to section 4.2 sending only parts of its FQDN is allowed. Fixes #4682.
* sd-network: rename "index" field of the various clients to "ifindex"Lennart Poettering2016-05-261-5/+5
| | | | | | | A field "index" is not particularly precise and also might conflict with libc's index() function definition. Also, pretty much everywhere else we call this concept "ifindex", including in networkd, the primary user of these libraries. Hence, let's fix this up and call this "ifindex" everywhere here too.
* 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.
* dhcp: make DHCP6_OPTION_* enum publicBeniamino Galvani2016-01-201-29/+29
| | | | | | | | libsystemd-network provides the public function sd_dhcp6_client_set_request_option() to enable the request of a given DHCP option. However the enum defining such options is defined in the internal header dhcp6-protocol.h. Move the enum definition to the public header sd-dhcp6-client.h and properly namespace values.
* tree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easyLennart Poettering2015-11-271-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GLIB has recently started to officially support the gcc cleanup attribute in its public API, hence let's do the same for our APIs. With this patch we'll define an xyz_unrefp() call for each public xyz_unref() call, to make it easy to use inside a __attribute__((cleanup())) expression. Then, all code is ported over to make use of this. The new calls are also documented in the man pages, with examples how to use them (well, I only added docs where the _unref() call itself already had docs, and the examples, only cover sd_bus_unrefp() and sd_event_unrefp()). This also renames sd_lldp_free() to sd_lldp_unref(), since that's how we tend to call our destructors these days. Note that this defines no public macro that wraps gcc's attribute and makes it easier to use. While I think it's our duty in the library to make our stuff easy to use, I figure it's not our duty to make gcc's own features easy to use on its own. Most likely, client code which wants to make use of this should define its own: #define _cleanup_(function) __attribute__((cleanup(function))) Or similar, to make the gcc feature easier to use. Making this logic public has the benefit that we can remove three header files whose only purpose was to define these functions internally. See #2008.
* sd-dhcp6-client: bind to link-local addressTom Gundersen2015-11-171-0/+6
| | | | | This ensures that several DHCPv6 clients can run on separate interfaces simultaneously.
* util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering2015-10-251-0/+1
| | | | | There are more than enough to deserve their own .c file, hence move them over.
* sd-*.h: clean up exported (or to-be-exported) header filesLennart Poettering2015-10-241-1/+1
| | | | | | | | | | | | | | | | | Exported header files should not include internal headers. Fix that. Exported header files should not use the bool type. So far we opted to stick to C89 for exported headers, and hence use "int" for bools in them. Continue to do so. Exported header files should have #include lines for everything they use including inttypes.h and sys/types.h, so that they may be included in any order. Exported header files should have C++ guards, hence add them. Exported header files should not use gcc extensions like #pragma once, get rid of it.
* util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering2015-10-241-8/+8
| | | | | | | | | | | | | | string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
* test-dhcp6-client: Update test case due to changed semanticsPatrik Flykt2015-09-231-0/+4
| | | | | | Update the test case to stop the ongoing Information Request exchange before unsetting its state. To keep the test case callback verification simpler, temporarily unset the callback function before stopping.
* sd-dhcp6: fix namespacingDavid Herrmann2015-09-221-2/+2
| | | | | Prefix all exported constants with SD_DHCP6_CLIENT_* to avoid any namespacing conflicts.
* basic: rework virtualization detection APILennart Poettering2015-09-071-12/+0
| | | | | | Introduce a proper enum, and don't pass around string ids anymore. This simplifies things quite a bit, and makes virtualization detection more similar to architecture detection.
* tree-wide: we place the opening bracket on the same line as the function nameLennart Poettering2015-08-271-2/+1
| | | | Let's do this everywhere the same way.
* test-dhcp6-client: Add tests for DNS and NTP optionsPatrik Flykt2015-08-211-0/+63
| | | | | | Test option setting and getting in test_advertise_option(). Verify that the information provided in DHCPv6 Reply messages is also available in the Information and Solicit callbacks.
* sd-dhcp6: Support deprecated SNTP Configuration OptionPatrik Flykt2015-08-211-1/+1
| | | | | | | | Although the SNTP option specified in RFC 4075 has been deprecated, some servers are still sending NTP information with this option. Use the SNTP information provided only if the NTP option is not present. Update the test case as SNTP information is also requested.
* test-dhcp6-client: don't unref the event twiceThomas Hindoe Paaboel Andersen2015-04-141-2/+0
|
* sd-dhcp6-lease: Revise address iteration functionsPatrik Flykt2015-01-271-22/+23
| | | | | | | | Revise the address iteration functions so that one helper function resets the iterator to the start of the address list while the second one fetches addresses one by one. The test case is also updated.
* test-dhcp6-client: Add a simple Information Request test casePatrik Flykt2014-12-101-19/+107
| | | | | | | Start the DHCPv6 test case by sending an Information Request, verifying the reply and continuing at once with the normal address acquisition procedure. Reuse the DHCPv6 Solicit Reply so that the client code is verified to ignore any erroneously added IPv6 address information.
* sd-dhcp-client: support non-Ethernet hardware addressesDan Williams2014-10-111-2/+6
| | | | | | | Like Infiniband. See RFC 4390 section 2.1 for details on DHCP and Infiniband; chaddr is zeroed, hlen is set to 0, and htype is set to ARPHRD_INFINIBAND because IB hardware addresses are 20 bytes in length.
* test-dhcp6-client: Add checks for Elapsed Time optionPatrik Flykt2014-09-101-4/+28
| | | | Verify that the Elapsed Time option is present.
* sd-dhcp6-client: properly calculate buffer size when parsing optionsZbigniew Jędrzejewski-Szmek2014-08-311-1/+1
| | | | | Also make pointer calculations more explicit so they are easier to understand.
* test-dhcp6-client: Fix option lengthPatrik Flykt2014-08-311-1/+1
| | | | | | | | | | | | | | | | | | | | | The whole DHCPv6 test message length was incorrectly used as the length of DHCPv6 options causing the following bad memory access: $ build/test-dhcp6-client Assertion 'interface_index >= -1' failed at ../src/libsystemd-network/sd-dhcp6-client.c:129, function sd_dhcp6_client_set_index(). Ignoring. ================================================================= ==29135==ERROR: AddressSanitizer: global-buffer-overflow on address 0x7fe204aa9148 at pc 0x7fe204a5958f bp 0x7fff3e47d470 sp 0x7fff3e47d460 READ of size 1 at 0x7fe204aa9148 thread T0 #0 0x7fe204a5958e in option_parse_hdr ../src/libsystemd-network/dhcp6-option.c:145 #1 0x7fe204a59884 in dhcp6_option_parse ../src/libsystemd-network/dhcp6-option.c:165 #2 0x7fe204a4eb9c in test_advertise_option ../src/libsystemd-network/test-dhcp6-client.c:227 #3 0x7fe204a51c58 in main ../src/libsystemd-network/test-dhcp6-client.c:584 #4 0x7fe2031590df in __libc_start_main (/lib64/libc.so.6+0x200df) #5 0x7fe204a4cc5b (/home/test/systemd/build/test-dhcp6-client+0x25c5b) 0x7fe204aa9148 is located 2 bytes to the right of global variable 'msg_advertise' from '../src/libsystemd-network/test-dhcp6-client.c' (0x7fe204aa9080) of size 198 0x7fe204aa9148 is located 56 bytes to the left of global variable 'msg_reply' from '../src/libsystemd-network/test-dhcp6-client.c' (0x7fe204aa9180) of size 173 SUMMARY: AddressSanitizer: global-buffer-overflow ../src/libsystemd-network/dhcp6-option.c:145 option_parse_hdr
* libsystemd-network: use CLOCK_BOOTTIME instead of CLOCK_MONOTONIC where possibleTom Gundersen2014-07-241-2/+2
| | | | | | | The timeouts in the networking library (DHCP lease timeouts and similar) should not be affected by suspend. In the cases where CLOCK_BOOTTIME is not implemented, it is still safe to fallback to CLOCK_MONOTONIC, as the consumers of the library (i.e., networkd) _should_ renew the leases when coming out of suspend.
* sd-dhcp6-client: Add Option Request Option supportPatrik Flykt2014-06-261-0/+9
| | | | | | | | | Provide a function to request more options from the DHCPv6 server. Provide a sensible default set at startup and add test basic test cases for the intended usage. Define DNS and NTP related option codes and add comments for the unassigned codes.