summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4
AgeCommit message (Collapse)Author
2021-04-20rearrange parse_circuitid test cases (#419)Hariharakumar Narasimhakumar
Signed-off-by: Hariharakumar Narasimhakumar <hhkumar@fb.com> Co-authored-by: Hariharakumar Narasimhakumar <hhkumar@fb.com>
2021-04-20Adding xe interface format for Juniper qfx to list of circuit regexes (#418)Hariharakumar Narasimhakumar
* Adding xe interface format for Juniper qfx to list of circuit regexes Signed-off-by: Hariharakumar Narasimhakumar <hhkumar@fb.com> * Consolidating regexes for et and xe into one entry Signed-off-by: Hariharakumar Narasimhakumar <hhkumar@fb.com> Co-authored-by: Hariharakumar Narasimhakumar <hhkumar@fb.com>
2021-03-14nclient4: fix buildChris Koch
Signed-off-by: Chris Koch <chrisko@google.com>
2021-03-13nclient4: Ensure server identifier matches (#410)Moritz Fischer
Ensure server identifier matches the offer server identifier when looking for ACKs or NAKs. This protects against rogue DHCP servers NAKing requests the shouldn't. Signed-off-by: Moritz Fischer <moritzf@google.com> Co-authored-by: Moritz Fischer <moritzf@google.com>
2021-03-10Improve ipv4 compatibilityEugene Burkov
Signed-off-by: Eugene Burkov <e.burkov@adguard.com>
2021-03-06Fix tests to match the change packetMarcel Moolenaar
Signed-off-by: Marcel Moolenaar <mmoolena@amazon.com>
2021-03-06Pad packets after the 'end' option to be more conformantMarcel Moolenaar
RFC 2131 gives two examples of padding in section 4.1. For both the examples, the 'end' option preceeds the padding with the 'pad' option. These examples relate to overloading pre-defined fields for options, not padding the packet for a minimal size. Older versions of the U-Boot firmware support DHCP, but do not expect the 'pad' option. The firmware logs the following warning for each occurence: *** Unhandled DHCP Option in OFFER/ACK: 0 This warning disappears when the 'end' option preceeds the 'pad' option. Signed-off-by: Marcel Moolenaar <mmoolena@amazon.com>
2021-01-20nclient4: WithUnicast default port should be 68 (#403)Canwu Yao
Signed-off-by: yaocw2020 <yaocanwu@gmail.com>
2020-09-20- rename raiValue to raiSubOptionValue to avoid confusion, and move it next ↵Hu Jun
to raiSubOptionCode - a few minor changes to address latest feedback Signed-off-by: Hu Jun <hujun.work@gmail.com>
2020-09-20Merge branch 'master' of https://github.com/insomniacslk/dhcpHu Jun
2020-09-16nclients: export serverAddr and ifaceHWAddrChris Koch
For any users to write their own Discover or Request methods, they need access to the ifaceHWAddr and serverAddr. Discovered while trying to move pinterest/bender to nclients. Signed-off-by: Chris Koch <chrisko@google.com>
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-16nclient4: unexport unnecessarily exported symbolsChris Koch
Signed-off-by: Chris Koch <chrisko@google.com>
2020-09-05- restore OptionGeneric.String()Hu Jun
- add raiValue in option_relay_agent_information.go to implement fmt.Stringer - change test cases accordingly Signed-off-by: Hu Jun <hujun.work@gmail.com>
2020-08-31- fixed some test cases broken by this PRHu Jun
- add a space in OptionGeneric.String() - move the indenting "\n" from OptionHumanizer.Stringify to RelayOptions.String() Signed-off-by: Hu Jun <hujun.work@gmail.com>
2020-08-09- fix relayHumanizer.CodeHumanizer so it uses raiSubOptionCodeHu Jun
- update OptionHumanizer.Stringify so it include an additional newline for option82 - update OptionGeneric.String so it include a string output in addition to existing byte slice output Signed-off-by: Hu Jun <hujun.work@gmail.com>
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-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-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-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-03-28remove some testsPablo Mazzini
Signed-off-by: Pablo Mazzini <pmazzini@gmail.com>
2020-03-19Added support for a custom logger when instantiating the server4 orValerio Santinelli
server6 object Signed-off-by: Valerio Santinelli <santinelli@altralogica.it>
2020-01-24Fix a compare in Serve() of IP4 Zero to use an IP4 addressRonald G. Minnich
Fixes, among other things, u-root pxeserver Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
2019-12-03dhcpv4: add Client Identifier option; respect RFC 6842Chris Koch
Signed-off-by: Chris Koch <chrisko@google.com>
2019-12-03dhcpv4: add max lease timeChris Koch
Signed-off-by: Chris Koch <chrisko@google.com>
2019-11-29Added option nclient4.WithHWAddrDmitrii Okunev
This option allows to receive answers DHCP with arbitrary client addresses Signed-off-by: Dmitrii Okunev <xaionaro@fb.com>
2019-11-28Simplified porting from client4 to nclient4Dmitrii Okunev
Signed-off-by: Dmitrii Okunev <xaionaro@fb.com>