Pull request: 4904 return dhcp msg size
Merge in DNS/adguard-home from 4904-rm-padding to master Updates #4904. Updates #4903. Squashed commit of the following: commit 85337402ad64395704028534f17ac1887cff64e8 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Fri Sep 9 19:38:09 2022 +0300 dhcpd: return dhcp msg size
This commit is contained in:
parent
c8ace868d4
commit
782de99a0a
|
@ -15,12 +15,18 @@ and this project adheres to
|
||||||
## [v0.108.0] - 2022-12-01 (APPROX.)
|
## [v0.108.0] - 2022-12-01 (APPROX.)
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- The minimum DHCP message size is reassigned back to BOOTP's constraint of 300
|
||||||
|
bytes ([#4904]).
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
|
|
||||||
- Weaker cipher suites that use the CBC (cipher block chaining) mode of
|
- Weaker cipher suites that use the CBC (cipher block chaining) mode of
|
||||||
operation have been disabled ([#2993]).
|
operation have been disabled ([#2993]).
|
||||||
|
|
||||||
[#2993]: https://github.com/AdguardTeam/AdGuardHome/issues/2993
|
[#2993]: https://github.com/AdguardTeam/AdGuardHome/issues/2993
|
||||||
|
[#4904]: https://github.com/AdguardTeam/AdGuardHome/issues/4904
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1086,12 +1086,6 @@ func (s *v4Server) packetHandler(conn net.PacketConn, peer net.Addr, req *dhcpv4
|
||||||
s.send(peer, conn, req, resp)
|
s.send(peer, conn, req, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
// minDHCPMsgSize is the minimum length of the encoded DHCP message in bytes
|
|
||||||
// according to RFC-2131.
|
|
||||||
//
|
|
||||||
// See https://datatracker.ietf.org/doc/html/rfc2131#section-2.
|
|
||||||
const minDHCPMsgSize = 576
|
|
||||||
|
|
||||||
// send writes resp for peer to conn considering the req's parameters according
|
// send writes resp for peer to conn considering the req's parameters according
|
||||||
// to RFC-2131.
|
// to RFC-2131.
|
||||||
//
|
//
|
||||||
|
@ -1133,16 +1127,6 @@ func (s *v4Server) send(peer net.Addr, conn net.PacketConn, req, resp *dhcpv4.DH
|
||||||
}
|
}
|
||||||
|
|
||||||
pktData := resp.ToBytes()
|
pktData := resp.ToBytes()
|
||||||
pktLen := len(pktData)
|
|
||||||
if pktLen < minDHCPMsgSize {
|
|
||||||
// Expand the packet to match the minimum DHCP message length. Although
|
|
||||||
// the dhpcv4 package deals with the BOOTP's lower packet length
|
|
||||||
// constraint, it seems some clients expecting the length being at least
|
|
||||||
// 576 bytes as per RFC 2131 (and an obsolete RFC 1533).
|
|
||||||
//
|
|
||||||
// See https://github.com/AdguardTeam/AdGuardHome/issues/4337.
|
|
||||||
pktData = append(pktData, make([]byte, minDHCPMsgSize-pktLen)...)
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Debug("dhcpv4: sending %d bytes to %s: %s", len(pktData), peer, resp.Summary())
|
log.Debug("dhcpv4: sending %d bytes to %s: %s", len(pktData), peer, resp.Summary())
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue