Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
From:
r := GetRouter(d.Options)
To:
r := d.Router()
|
|
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}, ...))
|
|
Also drop unnecessary return value of Modifier.
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
As @insomiacslk pointed out in #161, it's probably better to return a
pointer rather than a (MessageType, bool) combo.
|
|
This is a helper function to extract the BSDP message type from a given
`dhcpv4.DHCPv4` packet structure. It's useful in helping to identify
what kind of BSDP packet you're dealing with (since the distinction is
only made in one of the vendor-specific options encapsulated in Option
43).
|
|
|
|
|
|
|
|
|
|
Adds new `OptionGetter` interface that helps when asserting that certain
packets/vendor-specific opts contain specific options.
|
|
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.
|
|
Refactors BSDP code to use `dhcpv4.GetOneOption` instead of manually
searching through the list of options.
|
|
Removes build tags from BSDP and breaks vendor class identifier into
OS-specific implementations so it is easier to integrate bsdp with other
libs.
|
|
Add some more specific options + vendor specific implementation
|
|
|
|
|
|
|
|
|
|
stretchr/testify/assert for nicer asserts
|