summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/sd-dhcp6-lease.c
AgeCommit message (Collapse)Author
2017-01-23sd-network: fix memleak in dhcp6_lease_set_domains (#5113)Evgeny Vereshchagin
The simplest way to reproduce: ```diff diff --git a/src/libsystemd-network/test-dhcp6-client.c b/src/libsystemd-network/test-dhcp6-client.c index bd289fa..4e14d8f 100644 --- a/src/libsystemd-network/test-dhcp6-client.c +++ b/src/libsystemd-network/test-dhcp6-client.c @@ -286,6 +286,8 @@ static int test_advertise_option(sd_event *e) { assert_se(optlen == 11); assert_se(dhcp6_lease_set_domains(lease, optval, optlen) >= 0); + assert_se(dhcp6_lease_set_domains(lease, optval, + optlen) >= 0); break; case SD_DHCP6_OPTION_SNTP_SERVERS: ``` Fixes: ``` ==27369==ERROR: LeakSanitizer: detected memory leaks Direct leak of 10 byte(s) in 1 object(s) allocated from: #0 0x7f90e7d21160 in strdup (/lib64/libasan.so.3+0x5a160) #1 0x7f90e7467f69 in strv_extend src/basic/strv.c:552 #2 0x5612fcc19379 in dhcp6_option_parse_domainname src/libsystemd-network/dhcp6-option.c:399 #3 0x5612fcc1acdf in dhcp6_lease_set_domains src/libsystemd-network/sd-dhcp6-lease.c:225 #4 0x5612fcc06b95 in test_advertise_option src/libsystemd-network/test-dhcp6-client.c:287 #5 0x5612fcc0a987 in main src/libsystemd-network/test-dhcp6-client.c:761 #6 0x7f90e6d46400 in __libc_start_main (/lib64/libc.so.6+0x20400) SUMMARY: AddressSanitizer: 10 byte(s) leaked in 1 allocation(s). ```
2016-10-16tree-wide: use mfree moreZbigniew Jędrzejewski-Szmek
2016-02-10tree-wide: remove Emacs lines from all filesDaniel Mack
This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
2016-01-20libsystemd-network: avoid double free on errorZbigniew Jędrzejewski-Szmek
This could happen if the remote sent us a badly formatted option. CID #1317206.
2015-10-27util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering
2015-08-27tree-wide: we place the opening bracket on the same line as the function nameLennart Poettering
Let's do this everywhere the same way.
2015-08-26dhcp: stop using refcnt.hLennart Poettering
No need to invole atomic ops in single-threaded APIs, let's simplify this.
2015-08-21sd-dhcp6: Support deprecated SNTP Configuration OptionPatrik Flykt
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.
2015-08-21sd-dhcp6: Add support for DHCPv6 NTP Server OptionPatrik Flykt
Support NTP server and multicast addresses and NTP server domain names as specified in RFC 5908.
2015-08-21sd-dhcp6: Add support for DHCPv6 DNS Domain Search List optionPatrik Flykt
Support DHCPv6 DNS search list option as specified in RFC 3646. This option contains a list of DNS search domains encoded without compression as specified in Section 8. of RFC 3315.
2015-08-21sd-dhcp6: Add support for DHCPv6 DNS Recursive Name Server optionPatrik Flykt
Support DHCPv6 DNS server option as specified in RFC 3646. This option contains a list of IPv6 DNS server addresses.
2015-01-27sd-dhcp6-lease: Revise address iteration functionsPatrik Flykt
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.
2015-01-13refcnt: refcnt is unsigned, fix comparisonsTom Gundersen
This does not make a difference, but the code was confusing.
2014-12-10sd-dhcp6-lease: Return only -EINVAL when a NULL lease is suppliedPatrik Flykt
Suppyling a NULL lease is not a condition that needs to be asserted, returning -EINVAL is informative enough to the caller. This simplifies calling code and doesn't falsely indicate that something erroneous was attempted.
2014-10-09sd-dhcp6-lease: Name the structure containing IAADDR dataPatrik Flykt
With this change the DHCP6_OPTION_IAADDR_LEN define can be removed in favor of using sizeof(). Using the name of the struct and sizeof() makes it clearer how much and what data is being copied from the DHCPv6 message.
2014-06-26sd-dhcp6-client: Implement Rapid CommitPatrik Flykt
Add a Rapid Commit option to Solicit messages and expect a Reply to be received instead of an Advertise. When receiving a DHCPv6 message from the server in state Solicit, continue testing whether the message is a Reply. Ease up the message type checking, it's not fatal if the message is of a wrong type. Add helper functions to set/get the rapid commit of a lease. See RFC 3315, sections 17., 17.1.2., 17.1.4. and 18.1.8.
2014-06-26sd-dhcp6-lease: Add helper function to compute remaining expiry timePatrik Flykt
Create a helper function to compute the remaining time in seconds from time T2 to the IPv6 address with the longest lifetime. The computed time is used as the Maximum Retransmission Duration in Rebinding state. See RFC 3315, section 18.1.4. for details.
2014-06-19sd-dhcp6-lease: Add functions for accessing lease and addressesPatrik Flykt
Add support functions for accessing the current client lease as well as iterating over the addresses and get their preferred and valid lifetimes.
2014-06-19sd-dhcp6-lease: Add DHCPv6 lease handlingPatrik Flykt
Create a structure describing a DHCPv6 lease. Add internal functions for creating a new lease and accessing the server ID, preference and IAID. Provide functions for clearing addresses and associated timers. External users are initially given only the capabilities of referencing and unreferencing the lease structure.