From ed6ee21953dac9c78383da00bc4514ece6b75ab5 Mon Sep 17 00:00:00 2001 From: Patrik Flykt Date: Wed, 25 Jun 2014 16:54:30 +0300 Subject: sd-dhcp6-client: Implement Rapid Commit 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. --- src/libsystemd-network/dhcp6-option.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/libsystemd-network/dhcp6-option.c') diff --git a/src/libsystemd-network/dhcp6-option.c b/src/libsystemd-network/dhcp6-option.c index f488832cf9..e9b382c170 100644 --- a/src/libsystemd-network/dhcp6-option.c +++ b/src/libsystemd-network/dhcp6-option.c @@ -58,13 +58,14 @@ int dhcp6_option_append(uint8_t **buf, size_t *buflen, uint16_t code, size_t optlen, const void *optval) { int r; - assert_return(optval, -EINVAL); + assert_return(optval || optlen == 0, -EINVAL); r = option_append_hdr(buf, buflen, code, optlen); if (r < 0) return r; - memcpy(*buf, optval, optlen); + if (optval) + memcpy(*buf, optval, optlen); *buf += optlen; *buflen -= optlen; -- cgit v1.2.3-54-g00ecf