summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4/dhcpv4_test.go
AgeCommit message (Collapse)Author
2019-05-14Improve compatibility with some ipv4 networks.Loic Prylli
- dnsmasq has been seen to null-terminate the bootfile option, similar treament can occur for tftp-servername (although tftp-servername option usage is less common). - for the gateway information to be present in final packet, the Router option should be queried again in request as in discover (which matches behavior of udhcpc/dhclient). Tested: pxeboot with u-root on dnsmask/ipv4 client. Signed-off-by: Loic Prylli <lprylli@netflix.com>
2019-05-09NewReplyFromRequest: copy gw ipPablo Mazzini
2019-05-09[dhcpv4] Do not Gateway IP address on packets sent by clients (#287)Marco Guerri
Relays might drop packets coming from clients if they have the Gateway IP set. This modifier is supposed to be used by relays: `WithReply` is used only by clients.
2019-05-08[CI] Added lintersAndrea Barberio
Now the CI will also run golangci-lint Signed-off-by: Andrea Barberio <insomniac@slackware.it>
2019-04-03Modifying the writeIP function to always write IPv4 in 4 byte long format.Akshay Navale
2019-03-29dhcpv4: pad v4 messages to a 300 byte minimumChristopher Koch
Certain older DHCP servers and relay agents follow the RFC 951 BOOTP standard in which BOOTP/DHCP messages have a 300 byte minimum length. Signed-off-by: Christopher Koch <chrisko@google.com>
2019-03-13[dhcpv4] simplify userclass handling (#249)Pablo Mazzini
2019-01-24dhcpv4: nicer API for option parsing.Christopher Koch
From: r := d.GetOneOption(OptionRouter).(*OptRouter).Routers d.UpdateOption(&OptRouter{Routers: []net.IP{net.IP{192, 168, 0, 1}}}) To: r := GetRouter(d.Options) d.UpdateOption(OptRouter(net.IP{192, 168, 0, 1}, ...))
2019-01-15dhcpv4: conform to RFC 2131 with respect to options.Christopher Koch
Removes AddOption and GetOption. RFC 2131 specifies that options may only appear once (Section 4.1). If an option does appear more than once, its byte values must be concatenated. RFC 3396 further specifies that to send options longer than 255 bytes, one option may be split into multiple option codes, which must be concatenated back together by the receiver. Both of these are concerned with the byte representation of options. Fact is, based on both RFCs one can say that an option may only appear once, but may be composed of multiple values. Because an option may appear only once logically in any case, we remove the AddOption and GetOption functions and leave only UpdateOption and GetOneOption. Also remove all additions & checks of the End option - the marshaling and unmarshaling code is exclusively responsible for that now.
2019-01-14iana: rename HwTypeType to HWType, add package comment.Christopher Koch
2019-01-10dhcpv4: remote OptionGetter interface in favor of Options type.Christopher Koch
2019-01-10dhcpv4: simplify option parsing.Christopher Koch
option's codes and lengths were being parsed twice: once in ParseOption and once in each option type's Parse implementation. Consolidate such that it only happens once. Additionally, only pass data to options that they should parse -- we know the length before the Parse function is called, so the option only gets to see the data it needs to see. Also, use uio.Lexer to simplify parsing code in general. Easier to read and reason about.
2019-01-09dhcpv4: export packet members; remove setters and getters.Christopher Koch
2019-01-09dhcpv4: simplify host name and boot file handling.Christopher Koch
2019-01-09dhcpv4: simplify handling of client MAC.Christopher Koch
2019-01-09dhcpv4: nicer (un-)marshaling of DHCP messages.Christopher Koch
2019-01-09dhcpv4: introduce TransactionID type.Christopher Koch
2018-12-08Added netconf v4 tests and required modifiersAndrea Barberio
2018-08-19Added String methods for types (#140)insomniac
* Added String methods for types * Reverted change on bsdp.OptionCode
2018-08-15Merge branch 'master' into dhcpv4-moar-testsSean Karlage
2018-08-13add IsOptionRequested (#122)insomniac
2018-08-11Merge branch 'master' into dhcpv4-moar-testsSean Karlage
2018-08-10rename IsRequested to IsRequestedOptionPablo Mazzini
2018-08-10rename RequestFromOffer to NewRequestFromOfferPablo Mazzini
2018-08-10Added modifier for netbootv4 (#124)Owen Mooney
2018-08-02OptUserClass: use only the flag as authoritativePablo Mazzini
2018-07-29Add some helper tools for testsSean Karlage
Adds new `OptionGetter` interface that helps when asserting that certain packets/vendor-specific opts contain specific options.
2018-07-29Add modifier support to NewReplyFromRequestOwen Mooney
2018-07-29DHCPv4: Refactor methods for easier testingSean Karlage
This refactors the input parameters for construction DISCOVER/INFORM* packets so that it's easier to write unit tests for DHCPv4 and BSDP methods. It also adds a bunch of unit tests for both packages and rounds out their test coverage.
2018-07-29add NewReplyFromRequest (#100)Pablo Mazzini
2018-07-27[DHCPv4] BroadcastSendReceive now can wait for specific reply types (#95)insomniac
2018-05-11add dhcpv4.GetOption and dhcpv4.GetSingleOption methods (#63)Brandon Bennett
GetOption and GetOneOption are convenience methods for getting a DHCPv4 option from its Option Code. GetOption returns a list of options that match since the DHCP RFC allows for an option to be present multiple times with its values appended together. (Note: I am not sure I've ever seen this done and it's not clear if how option parsing would work for more complex values. Is appending done at the byte level? ) GetOneOption will return the first found option that matches a code.
2018-03-13Add OptionGeneric, comment out other code so tests compile/passSean Karlage
2018-03-06Refactor tests to use stretchr/testify/requireSean Karlage
2018-03-05Move bsdp functionality to its own subpackage. Bring in ↵Sean Karlage
stretchr/testify/assert for nicer asserts
2018-03-03Add BSDP supportSean Karlage
Adds support for constructing INFORM/ACK messages from Apple's Boot Service Discovery Protocol for netbooting (pxebooting) Apple hardware. The canonical reference for BSDP is: http://opensource.apple.com/source/bootp/bootp-198.1/Documentation/BSDP.doc
2017-12-05Initial commitAndrea Barberio