summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6
AgeCommit message (Collapse)Author
2020-01-02v6: give proper names to some common OptionCodesChris Koch
Signed-off-by: Chris Koch <chrisko@google.com>
2020-01-02v6: use time.Duration for duration fieldsChris Koch
Signed-off-by: Chris Koch <chrisko@google.com>
2019-12-12[dhcpv6] Add option BootfileParam to DHCPv6 clientDmitrii Okunev
Added support of option OptBootFileParam. See RFC5970 section 3.2. Signed-off-by: Dmitrii Okunev <xaionaro@fb.com>
2019-11-12[dhcpv6]Adding opt 16 when parsing vendor optionsAkshay Navale
Signed-off-by: Akshay Navale <navale@dhcp-172-27-23-219.dhcp.thefacebook.com>
2019-11-03dhcpv6: Add support for 4RD optionsAnatole Denis
IPv4 Residual Deployment (4RD) is a strategy for providing IPv4 connectivity in IPv6-only networks. The standard includes autoconfiguration via DHCPv6, as described in RFC7600. This adds support for the 3 options defined in that RFC Signed-off-by: Anatole Denis <natolumin@unverle.fr>
2019-11-03dhcpv6: Add all current option codes from IANAAnatole Denis
This updates the option codes list in dhcpv6/types.go to include all published option codes as of today. For better formatting of the table, replace comments indicating undefined options with assignments to the throwaway variable `_`, which avoids resetting alignment formatting compared to the comment option. Signed-off-by: Anatole Denis <natolumin@unverle.fr>
2019-10-08iana: HWType is 16 bitsAnatole Denis
In both ARP and DHCPv6, the hwtype field is 16bits, and the IANA table has allocated values >255. (Bootp however uses 1byte so it can't represent everything) This was discovered by fuzzing, as it causes round-trip mismatches; eg with this packet (quoted string): "0000\x00\x01\x00\x0e\x00\x01000000000000" Input: 303030300001000e0001303030303030303030303030 Round-trip: 303030300001000e0001003030303030303030303030 ^ The upper byte of the hwaddress is set to 0 Signed-off-by: Anatole Denis <natolumin@unverle.fr>
2019-10-08dhcpv6: Add error checks to message parsersAnatole Denis
There were missing error checks in the Message and RelayMessage parsers, so that truncated headers would be incorrectly accepted as valid messages. For example the single byte "0" (0x30) would be accepted as a valid message, then reserialized to 0x30,0x00,0x00,0x00,0x00 Signed-off-by: Anatole Denis <natolumin@unverle.fr>
2019-10-08dhcpv6: Reject empty messagesAnatole Denis
The uio library doesn't report errors on a per-operation basis, but accumulates them so they can be checked after a batch of operations in a separate Error() function. Unfortunately this makes it easy to forget, thus parse incorrect messages go-fuzz found immediately that an empty message would be parsed without error, and reserialize to a different message (one with some bytes of zeros) Signed-off-by: Anatole Denis <natolumin@unverle.fr>
2019-10-07dhcpv6: Add a fuzzing entrypoint for go-fuzzAnatole Denis
This adds the required function for running [go-fuzz](https://github.com/dvyukov/go-fuzz) on the dhcpv6 library. It tests the following behaviour: * Parsing messages doesn't crash * Parsed messages are identical after being serialized and deserialized Signed-off-by: Anatole Denis <natolumin@unverle.fr>
2019-10-01server{4,6}: Return UDPConn from NewIPv*UDPConnAnatole Denis
The concrete type under the interface is known here since we create the connection in the same function. Since *net.UDPConn implements net.PacketConn anyway, returning the concrete type here is more powerful and less risky than having downstream users cast the value themselves There should be no code change for downstream users, with the exception of explicit casts (`udpc := conn.(*net.UDPConn)`), which can simply be removed Signed-off-by: Anatole Denis <natolumin@unverle.fr>
2019-09-25dhcpv6: simplify boot file URLChris Koch
Signed-off-by: Chris Koch <chrisko@google.com>
2019-09-25server6: allow nil IP in addition to unspecifiedChris K
Signed-off-by: Chris Koch <chrisko@google.com>
2019-09-24nclient6: copy & paste log infra to v6Chris Koch
Signed-off-by: Chris Koch <chrisko@google.com>
2019-09-18server6: Create UDP conn manually for more controlAnatole Denis
Similar to server4 where the UDP connection is manually created using the socket interfaces, this creates a connection with adequate options: * SO_BINDTODEVICE or equivalent if an interface is requested * V6ONLY when supported by the operating system * Allows binding to a multicast address specifically instead of falling back to wildcard Signed-off-by: Anatole Denis <natolumin@unverle.fr>
2019-09-17server6: Fix listening on multicast addressesAnatole Denis
Joining a multicast group with an address that can't be received on a socket is ineffective, at least on linux. This updates the logic of NewServer in a mostly backwards-compatible way, to enable listening on arbitrary multicast addresses: * Unicast addresses see no user-visible change, but don't join a multicast group for which they don't receive traffic anyway * Multicast addresses start actually receiving traffic for the group they represent, and don't join the default group. **this is a behaviour change**: previously they would receive traffic for the default group if it was on the same port and **not** for the group they represent. I consider that previous behaviour a bug * Wildcard addresses, if on the proper port, will join both AllDHCPRelayAgentsAndServers and AllDHCPServers **this is a behaviour change**: previously only AllDHCPRelayAgentsAndServers was joined * Wildcard addresses on another port: no visible change, same as unicast case Signed-off-by: Anatole Denis <natolumin@unverle.fr>
2019-07-22Fixed unnecessary conversions in dhcpv6 (#305)Christian Muehlhaeuser
No need to convert here.
2019-05-09Adding RemoteID option while creating a Relayed Encapsulated Packet (#282)Akshay Navale
2019-05-08Addressed more linter warningsAndrea Barberio
Mostly addressed missing error checking. Signed-off-by: Andrea Barberio <insomniac@slackware.it>
2019-05-08Addressed various linter warningsAndrea Barberio
Mostly for dead code and potentially wrong comparisons. Signed-off-by: Andrea Barberio <insomniac@slackware.it>
2019-05-02[dhcpv6] Handle SOLICIT with rapid commit in NewReplyFromMessageAndrea Barberio
NewReplyFromMessage creates a reply from a message. With this patch it can handle Solicit messages with rapid-commit. RFC3315 states that: ``` If the client has included a Rapid Commit option in its Solicit message, the client terminates the waiting process as soon as a Reply message with a Rapid Commit option is received. ``` Signed-off-by: Andrea Barberio <insomniac@slackware.it>
2019-04-29[server6] Server should join multicast addressAndrea Barberio
The previous logic was wrong - there's no "listening" on multicast address, the server should listen on the given address, and join the multicast group. This PR fixes it. Also moved the multicast addresses to a common package. Tested with unit/integ tests, and with coredhcp. Signed-off-by: Andrea Barberio <insomniac@slackware.it>
2019-04-24[dhcpv6] Solicit messages derive default IAID from MAC addressAndrea Barberio
IAID must be set by the client. This patch generates the IAID from the MAC address of the interface. To do so, a new WithIAID modifier is added, the interface of NewSolicitWithCID now requires a hwaddr parameter, and NewAdvertiseFromSolicit copies the IA_NA option from the solicit if present. Signed-off-by: Andrea Barberio <insomniac@slackware.it>
2019-04-23Revert "[dhcpv6] Solicit messages derive default IAID from MAC address"Andrea Barberio
This reverts commit b071bdc86a58037f6c745647c97fca202f3caef9. Signed-off-by: Andrea Barberio <insomniac@slackware.it>
2019-04-23[dhcpv6] Solicit messages derive default IAID from MAC addressAndrea Barberio
IAID must be set by the client. This patch generates the IAID from the MAC address of the interface. To do so, a new WithIAID modifier is added, the interface of NewSolicitWithCID now requires a hwaddr parameter, and NewAdvertiseFromSolicit copies the IA_NA option from the solicit if present. Signed-off-by: Andrea Barberio <insomniac@slackware.it>
2019-04-17[server] Serve returns an error, and closes when doneAndrea Barberio
Server6 and Server4 had Serve methods that return without reporting an error, changed in this PR. Serve now also closes the connection when done. Signed-off-by: Andrea Barberio <insomniac@slackware.it>
2019-04-07nclient6: small fixesChristopher Koch
- RapidCommit solicits wait for Reply messages, not Advertise. - Default recipient should be all relay agents and servers, not just servers. - Make New() and NewWithConn() interface same as in nclient4. Signed-off-by: Christopher Koch <chrisko@google.com>
2019-04-04client6: new async DHCPv6 client like #250.Christopher Koch
- Race-condition-averse. - Supports multiple concurrent requests. - Tested. - Requires a fully compatible net.PacketConn. Signed-off-by: Christopher Koch <chrisko@google.com>
2019-04-03Use cancellable crypto RNG from u-rootAndrea Barberio
Fixes #246 Signed-off-by: Andrea Barberio <insomniac@slackware.it>
2019-03-14client: simulate relay (#259)Pablo Mazzini
2019-03-11dhcpv6: standardize GetInnerMessageChristopher Koch
2019-03-11dhcpv6: remove setters and getters.Christopher Koch
- Make members directly accessible.
2019-03-11dhcpv6: add explicit unmarshaling functions.Christopher Koch
2019-03-11dhcpv6: rename stuttering types.Christopher Koch
dhcpv6.DHCPv6Message -> dhcpv6.Message dhcpv6.DHCPv6Relay -> dhcpv6.RelayMessage
2019-01-28Created examples directory and adjusted READMEAndrea Barberio
2019-01-28dhcpv6: moved client into dhcpv6/client6Andrea Barberio
2019-01-26dhcpv6: remove unnecessary Length functionChristopher Koch
2019-01-26dhcpv6: move option code and length marshaling to Options.ToBytes.Christopher Koch
2019-01-26dhcpv6: easier option parsingChristopher Koch
- move option parsing to uio buffer library. - move option code and length reading into FromBytes rather than implementing it in each OptionParser.
2019-01-26dhcpv6: use uio buffer in DHCPv6 message parsingChristopher Koch
2019-01-26dhcpv6: move option code types; add Stringer.Christopher Koch
2019-01-26dhcpv6: introduce TransactionID typeChristopher Koch
2019-01-26dhcpv6: clean up MessageTypeChristopher Koch
- print unknown message type numbers. - unexport unneeded map of strings.
2019-01-26dhcpv6: introduce options type.Christopher Koch
2019-01-19dhcpv6: added Duid.EqualAndrea Barberio
2019-01-14iana: rename HwTypeType to HWType, add package comment.Christopher Koch
2019-01-14Rename iana.ArchType to iana.Arch.Christopher Koch
2018-12-12[dhcpv6/ztpv6] Adding Parsing Vendor Opts and Parsing Remote Id Opts lib for ↵Chris Gorham
ztpv6 (#208)
2018-12-09Addressed pmazzini's feedbackAndrea Barberio
2018-12-08Also simplified corresponding v6 modifiersAndrea Barberio