@@ -12,13 +12,13 @@ import (
1212 "github.com/google/gopacket/layers"
1313)
1414
15- // serveV4 handles the ethernet packet of IPv4 type. iface and pkt must not be
16- // nil. iface and fd must not be nil. pkt must be an IPv4 packet.
15+ // serveV4 handles the ethernet packet of IPv4 type. iface must not be nil, fd
16+ // must be valid, pkt must be an IPv4 packet.
1717func (srv * DHCPServer ) serveV4 (
1818 ctx context.Context ,
1919 iface * dhcpInterfaceV4 ,
2020 pkt gopacket.Packet ,
21- fd * frameData ,
21+ fd * frameData4 ,
2222) (err error ) {
2323 defer func () { err = errors .Annotate (err , "serving dhcpv4: %w" ) }()
2424
@@ -55,7 +55,7 @@ func (srv *DHCPServer) serveV4(
5555// messages are handled by all interfaces concurrently, as those offer addresses
5656// for the independent networks. The DHCPREQUEST, DHCPRELEASE, and DHCPDECLINE
5757// messages are handled by the appropriate interface according to the client's
58- // choice. req and fd must not be nil, typ should be one of:
58+ // choice. req must not be nil, fd must be valid , typ should be one of:
5959// - [layers.DHCPMsgTypeDiscover]
6060// - [layers.DHCPMsgTypeRequest]
6161// - [layers.DHCPMsgTypeRelease]
@@ -64,7 +64,7 @@ func (iface *dhcpInterfaceV4) handleDHCPv4(
6464 ctx context.Context ,
6565 typ layers.DHCPMsgType ,
6666 req * layers.DHCPv4 ,
67- fd * frameData ,
67+ fd * frameData4 ,
6868) (err error ) {
6969 switch typ {
7070 case layers .DHCPMsgTypeDiscover :
@@ -84,11 +84,11 @@ func (iface *dhcpInterfaceV4) handleDHCPv4(
8484}
8585
8686// handleDiscover handles messages of type DHCPDISCOVER. req must be a
87- // DHCPDISCOVER message, fd must not be nil .
87+ // DHCPDISCOVER message, fd must be valid .
8888func (iface * dhcpInterfaceV4 ) handleDiscover (
8989 ctx context.Context ,
9090 req * layers.DHCPv4 ,
91- fd * frameData ,
91+ fd * frameData4 ,
9292) {
9393 l := iface .common .logger
9494
@@ -125,15 +125,15 @@ func (iface *dhcpInterfaceV4) handleDiscover(
125125}
126126
127127// handleRequest handles the DHCPv4 message of DHCPREQUEST type. req must be a
128- // DHCPREQUEST message. req and fd must not be nil.
128+ // DHCPREQUEST message. req must not be nil, fd must be valid .
129129//
130130// See https://datatracker.ietf.org/doc/html/rfc2131#section-4.3.2.
131131//
132132// TODO(e.burkov): Remove allocated leases after client have chosen one.
133133func (iface * dhcpInterfaceV4 ) handleRequest (
134134 ctx context.Context ,
135135 req * layers.DHCPv4 ,
136- fd * frameData ,
136+ fd * frameData4 ,
137137) {
138138 srvID , hasSrvID := serverID4 (req )
139139 reqIP , hasReqIP := requestedIPv4 (req )
@@ -181,12 +181,12 @@ func (iface *dhcpInterfaceV4) handleRequest(
181181}
182182
183183// handleSelecting handles messages of type DHCPREQUEST in SELECTING state. req
184- // must be a DHCPREQUEST message, reqIP must be a valid IPv4 address, fd must
185- // not be nil .
184+ // must be a DHCPREQUEST message, reqIP must be a valid IPv4 address, fd must be
185+ // valid .
186186func (iface * dhcpInterfaceV4 ) handleSelecting (
187187 ctx context.Context ,
188188 req * layers.DHCPv4 ,
189- fd * frameData ,
189+ fd * frameData4 ,
190190 reqIP netip.Addr ,
191191) {
192192 l := iface .common .logger
@@ -235,11 +235,11 @@ func (iface *dhcpInterfaceV4) handleSelecting(
235235
236236// handleInitReboot handles messages of type DHCPREQUEST in INIT-REBOOT state.
237237// req must be a DHCPREQUEST message, reqIP must be a valid IPv4 address, fd
238- // must not be nil .
238+ // must be valid .
239239func (iface * dhcpInterfaceV4 ) handleInitReboot (
240240 ctx context.Context ,
241241 req * layers.DHCPv4 ,
242- fd * frameData ,
242+ fd * frameData4 ,
243243 reqIP netip.Addr ,
244244) {
245245 l := iface .common .logger
@@ -282,11 +282,11 @@ func (iface *dhcpInterfaceV4) handleInitReboot(
282282
283283// handleRenew handles messages of type DHCPREQUEST in RENEWING or REBINDING
284284// state. req must be a DHCPREQUEST message, ip should be a previously leased
285- // address, fd must not be nil .
285+ // address, fd must be valid .
286286func (iface * dhcpInterfaceV4 ) handleRenew (
287287 ctx context.Context ,
288288 req * layers.DHCPv4 ,
289- fd * frameData ,
289+ fd * frameData4 ,
290290 ip netip.Addr ,
291291) {
292292 l := iface .common .logger
0 commit comments