summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4/nclient4
AgeCommit message (Collapse)Author
2023-08-16dragonfly: Initial porting workAntonio Huete Jimenez
Signed-off-by: Antonio Huete Jimenez <tuxillo@quantumachine.net>
2023-07-31stylistic changesKonnovKM
Signed-off-by: KonnovKM <boneyandoom@gmail.com>
2023-07-27isValid() methodKonnovKM
Signed-off-by: KonnovKM <boneyandoom@gmail.com>
2023-07-18no continueKonnovKM
Signed-off-by: KonnovKM <boneyandoom@gmail.com>
2023-07-18header size checkKonnovKM
Signed-off-by: KonnovKM <boneyandoom@gmail.com>
2023-04-13Fix errorsBrian Kemper
Signed-off-by: Brian Kemper <bkemper@gmail.com>
2023-04-13Remove mdlayher/raw depBrian Kemper
Signed-off-by: Brian Kemper <bkemper@gmail.com>
2023-03-27Merge branch 'master' into renew-from-ackPablo Mazzini
2023-03-27dhcpv4: change `NewRenewFromOffer` to `NewRenewFromAck`Dennis Marttinen
Signed-off-by: Dennis Marttinen <twelho@welho.tech>
2023-03-25dhcpv4: implement interface for sending INFORM requestsDennis Marttinen
Signed-off-by: Dennis Marttinen <twelho@welho.tech>
2022-10-01dhcpv4: return a new lease from Renew()Dennis Marttinen
Signed-off-by: Dennis Marttinen <twelho@welho.tech>
2022-07-27dhcpv4: add a client method to facilitate lease renewalsDennis Marttinen
Signed-off-by: Dennis Marttinen <twelho@welho.tech>
2022-01-19nclient4: support BSDsChris Koch
mdlayher/raw supports them, so why don't we support them, too. Signed-off-by: Chris Koch <chrisko@google.com>
2021-12-13fix: check IP/UDP header size before trying to access itAndrey Smirnov
This should fix the panic we've seen with the malformed packets on the wire. Remaining buffer size should be checked before trying to access the data, otherwise Go might panic on out of bounds slice operation. Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2021-05-28Break circular dependency on u-rootChris Koch
u-root -> dhcp -> u-root is the circular dependency. Which is fine, except we messed up modules in u-root big time. We need to break the circular dep for now. Signed-off-by: Chris Koch <chrisko@google.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-01-20nclient4: WithUnicast default port should be 68 (#403)Canwu Yao
Signed-off-by: yaocw2020 <yaocanwu@gmail.com>
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-16nclient4: unexport unnecessarily exported symbolsChris Koch
Signed-off-by: Chris Koch <chrisko@google.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-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-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>
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>
2019-09-24nclient6: copy & paste log infra to v6Chris Koch
Signed-off-by: Chris Koch <chrisko@google.com>
2019-09-12Increase DHCPv4 IP TTL from 30 to 64 (#314)Ross Hanson
RFC 1700 recommends a value of 64 for the default IP time to live (TTL) parameter. This is only necessary for the V4 client because it uses the net.PacketConn, while the IPv6 implementation uses a net.UDPConn instead. From https://tools.ietf.org/html/rfc1700: IP TIME TO LIVE PARAMETER The current recommended default time to live (TTL) for the Internet Protocol (IP) [45,105] is 64. Signed-off-by: Ross Hanson <rosshanson@google.com>
2019-08-14Bind interface fix (#310)borna-blazevic
Added a bind to interface functionality.
2019-07-29server4: set peer to broadcast if client IP is zeroChris Koch
Clients without an IP set their source address to 0.0.0.0, so the peer returned by ReadFrom may not actually be the address to send to. Clients without an IP should have their response broadcast. Signed-off-by: Chris Koch <chrisko@google.com>
2019-07-22Fixed unnecessary conversions (#304)Christian Muehlhaeuser
No need to convert these types.
2019-07-22Fixed typos in dhcpv4 (#303)Christian Muehlhaeuser
Simple, nit-picky typo fixes.
2019-06-19nclient4: add logging optionsChris Koch
Signed-off-by: Chris Koch <chrisko@google.com>
2019-05-22Ignore bytes after end of IP packet in BroadcastRawUDPConn.ReadFrom (#292)lprylli
When reading raw packets from the network, it can happen that the raw ethernet packet read has undefined bytes after the end of the ip packet (either from the network or in some cases from the local stack). Those bytes should not be passed to the dhcp-receiver otherwise the option parser which is picky about final padding byte will silently discard the dhcp-reply. Rename ipLen, udpLen variables with more explicit names to avoid confusion between header, payload, total length possibly considered in this function. Tested: ast2500 bmc reproducing the issue + existing go test for coverage. Signed-off-by: Loic Prylli <lprylli@netflix.com>
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-17nclient4: fix conn race conditionChristopher Koch
Why did I ever think this would work?? Signed-off-by: Christopher Koch <chrisko@google.com>
2019-04-07nclient4: simplify New interfaceChristopher Koch
Signed-off-by: Christopher Koch <chrisko@google.com>
2019-03-27client4: add a new DHCPv4 client.Christopher Koch
- Able to send UDP packets before interface is configured. - Able to use any net.PacketConn. - RFC2131-compliant retransmission logic. - Tests. - Race-condition-averse. Previous clients (both mine and the ones here) are prone to race condition errors. Having one and only one place that calls receive on the socket "continuously" without having to coordinate hand-offs makes the logic way easier to follow, and allows for multiple requests in flux at a time. Signed-off-by: Christopher Koch <chrisko@google.com>