summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)Author
2020-09-16nclient4: respect NAKsChris Koch
Signed-off-by: Chris Koch <chrisko@google.com>
2020-09-16nclient4: remove unused functionsChris Koch
Signed-off-by: Chris Koch <chrisko@google.com>
2020-09-16docs: fix package commentsChris Koch
Signed-off-by: Chris Koch <chrisko@google.com>
2020-09-16dhcp: add go.mod fileChris Koch
Signed-off-by: Chris Koch <chrisko@google.com>
2020-09-16nclient4: unexport unnecessarily exported symbolsChris Koch
Signed-off-by: Chris Koch <chrisko@google.com>
2020-09-16Add Additional IANA Architecture TypesBenjamin S. Allen
Adds the additional architecture types as defined by IANA http://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xhtml#processor-architecture. Note, RFC4578 errata, https://www.rfc-editor.org/errata_search.php?rfc=4578 "The values for EFI BC and EFI x86-64 should be swapped. UEFI implementations use value 7 to report EFI x86-64, not value 9." IANA's list also agrees with this swap. Thus I've swapped these values here to match. I took some liberty with the new architecture's mnemonic names compared to the descriptions from IANA. This was an attempt to standardize wording, capitalization, and match the existing style. Signed-off-by: Benjamin S. Allen <bsallen@alcf.anl.gov>
2020-08-14Merge pull request #394 from mcphailtom/opt_information_refreshPablo Mazzini
Option: Information Refresh Time https://tools.ietf.org/html/rfc8415
2020-08-13Added structure, parsing and convenience fuctions for ↵Tom McPhail
OptInformationRefreshTime (32) https://tools.ietf.org/html/rfc8415#section-21.23 Signed-off-by: Tom McPhail <tom.mcphail@icloud.com>
2020-08-13Merge pull request #392 from pmazzini/macPablo Mazzini
ExtractMAC: use option 79
2020-08-08ExtractMAC: use option 79Pablo Mazzini
2020-08-06dhcpv6: Handle IA_TA optionsAnatole Denis
This creates support for IA_TA options, based on and reusing the blocks from IA_NA, to which it is extremely similar Signed-off-by: Anatole Denis <natolumin@unverle.fr>
2020-08-02Merge pull request #386 from hujun-open/dhcpv4_releasePablo Mazzini
add lease&release support for nclient4
2020-07-18- change to WithOptionCopied in NewReleaseFromACKHu Jun
Signed-off-by: Hu Jun <hujun.work@gmail.com>
2020-07-18move NewReleaseFromAck to where all NewXXFromYY areHu Jun
Signed-off-by: Hu Jun <hujun.work@gmail.com>
2020-07-17fix doc of NewReleaseFromACKHu Jun
Signed-off-by: Hu Jun <hujun.work@gmail.com>
2020-07-17- change NewRleaseFromLease to NewRleaseFromACK, and move it to dhcpv4Hu Jun
Signed-off-by: Hu Jun <hujun.work@gmail.com>
2020-07-16- remove Lease.IDOptions and update corresponding struct / functionHu Jun
- add NewReleaseFromLease and update Client.Release() accordingly - update lease_test.go accordingly - remove example_lease_test.go Signed-off-by: Hu Jun <hujun.work@gmail.com>
2020-07-14- fix a lint error in lease.goHu Jun
- fix a data race in lease_test.go Signed-off-by: Hu Jun <hujun.work@gmail.com>
2020-07-14Merge branch 'dhcpv4_release' of https://github.com/hujun-open/dhcp into ↵Hu Jun
dhcpv4_release
2020-07-14- use modifiers to build release msg in Client.Release()Hu Jun
- update lease_test.go make sure server side error is caught - some minor fixes based on PR discussion Signed-off-by: Hu Jun <hujun.work@gmail.com>
2020-07-11Merge branch 'master' into dhcpv4_releaseHu Jun
2020-07-11nclient6: optional dropped packet loggingChris Koch
Signed-off-by: Chris Koch <chrisko@google.com>
2020-07-10- add Offer into LeaseHu Jun
- change Client.Request so it now only return Lease - change test case and example accordingly Signed-off-by: Hu Jun <hujun.work@gmail.com>
2020-07-10Merge branch 'master' of https://github.com/insomniacslk/dhcp into ↵Hu Jun
dhcpv4_release
2020-07-10netconf: apply v6 addresses as /128Chris Koch
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=684009 "Note that the dhcpv6 protocol doesn't have an option for a netmask. So it is always /128 and routing is left to icmpv6 router advertisements." RFC 5942 is a good read here as well: An address could be acquired through the DHCPv6 identity association for non- temporary addresses (IA_NA) option from [RFC3315] (which does not include a prefix length), or through manual configuration (if no prefix length is specified). The host incorrectly assumes an invented prefix is on-link. This invented prefix typically is a /64 that was written by the developer of the operating system network module API to any IPv6 application as a "default" prefix length when a length isn't specified. As DHCP developers, we *HAVE* to assume that no prefix is on-link. The correct way to do that is to specify the netmask as /128. The kernel will RA/RS their way around to figure out what prefixes are indeed on-link. Signed-off-by: Chris Koch <chrisko@google.com>
2020-06-27remove a unused func in lease_test.goHu Jun
Signed-off-by: Hu Jun <hujun.work@gmail.com>
2020-06-27remove timeout code from Release(), since it is unnecessary after some more ↵Hu Jun
testing Signed-off-by: Hu Jun <hujun.work@gmail.com>
2020-06-27fix a broken test in server_test.go, caused by update of Client.Request() ↵Hu Jun
which now returns a lease instead of ack Signed-off-by: Hu Jun <hujun.work@gmail.com>
2020-06-26- Client.Release() now use existing conn to send packetHu Jun
- update example_lease_test.go accordingly - add lease_test.go, which contain some test cases for lease&release, using socketpair Signed-off-by: Hu Jun <hujun.work@gmail.com>
2020-06-24fix example_lease_test.go that caused import loopHu Jun
Signed-off-by: Hu Jun <hujun.work@gmail.com>
2020-06-23- make changes based on discussion on PR #386 of insomniacslk/dhcpHu Jun
Signed-off-by: Hu Jun <hujun.work@gmail.com>
2020-06-23Merge branch 'master' of https://github.com/insomniacslk/dhcp into ↵Hu Jun
dhcpv4_release
2020-06-20dhcpv4: Fix a panic in parsing of route optionsAnatole Denis
When parsing a route option with a mask size >32, there would be a panic at option_routes.go:47 as user-supplied data is used without verification for a slice bound, causing a read of masksize/8, whic is possibly >4 bytes. Instead reject the invalid route Signed-off-by: Anatole Denis <natolumin@unverle.fr>
2020-06-20dhcpv4: Also write out 0-length optionsAnatole Denis
When there was a 0-length generic option, it would be omitted. Rapid commit (option 80) is a 0-length option with a length tag. There could also be 0-length options in the vendor extensions, and the RFC states that they should be written out: > Any options defined subsequent to this document should contain a > length octet even if the length is fixed or zero. Signed-off-by: Anatole Denis <natolumin@unverle.fr>
2020-06-20dhcpv4: Remove hlen parameter special case in ToBytes()Anatole Denis
There is a special case for when ClientHwAddr is empty, which seems to only apply when creating a packet with New(), which defaults to HWType==Ethernet but doesn't assign the ClientHwAddr field. All the other New*() constructors assign a hardware address and don't use this codepath Remove this special case and instead make New() generate an almost-correct packet in the first place, so that ToBytes() can stay more generic Signed-off-by: Anatole Denis <natolumin@unverle.fr>
2020-06-20dhcpv4: Avoid a panic in ToBytes() with long stringsAnatole Denis
When BootFileName is longer than 128 bytes or ServerHostName is longer than 64 bytes, trying to null-terminate the strings when writing out the packet causes a panic. Since the ToBytes() function cannot return errors, silently truncate the string instead (we do the same with ClientHWAddr if it is longer than 16 bytes for example) Signed-off-by: Anatole Denis <natolumin@unverle.fr>
2020-06-20dhcpv4: Consolidate identical tests into 1Anatole Denis
Those 2 tests did the exact same thing: check that an invalid packet raises an error when parsed. Merge them into the same test, so that we can easily add more test cases to the list Signed-off-by: Anatole Denis <natolumin@unverle.fr>
2020-06-20dhcpv4: Add go-fuzz endpointAnatole Denis
Signed-off-by: Anatole Denis <natolumin@unverle.fr>
2020-06-18fix some lint complains in example_lease_test.goHu Jun
Signed-off-by: Hu Jun <hujun.work@gmail.com>
2020-06-18- move the example to a separate file example_lease_test.goHu Jun
- fix a few more lint complains Signed-off-by: Hu Jun <hujun.work@gmail.com>
2020-06-17fix some lint errorsHu Jun
Signed-off-by: Hu Jun <hujun.work@gmail.com>
2020-06-17add lease&release support for nclient4Hu Jun
Signed-off-by: Hu Jun <hujun.work@gmail.com>
2020-06-01Merge pull request #384 from mcphailtom/add_clientlinklayeraddress_rfc6939Pablo Mazzini
Add Client Link-Layer Address option for RFC6939 support
2020-06-01Merge branch 'master' into add_clientlinklayeraddress_rfc6939Pablo Mazzini
2020-06-01pin golangci-lint versionPablo Mazzini
Signed-off-by: Pablo Mazzini <pmazzini@gmail.com>
2020-06-01Add Client Link-Layer Address option for RFC 6939 support.Tom McPhail
Signed-off-by: Tom McPhail <tom.mcphail@icloud.com>
2020-04-21Generate new TransactionID for RequestTom McPhail
Signed-off-by: Tom McPhail <tom.mcphail@icloud.com>
2020-04-02adding fallback logic to remote id parsingakshay navale
Signed-off-by: akshay navale <akshaynawale@gmail.com>
2020-03-28update README and CONTRIBUTORSPablo Mazzini
Signed-off-by: Pablo Mazzini <pmazzini@gmail.com>
2020-03-28Merge pull request #371 from tanis2000/server-loggerPablo Mazzini
Support for custom logger in servers