dhcp4d: fix panic when receiving unsupported requests
This commit is contained in:
parent
cfbf52db6e
commit
c037bf9c5f
@ -158,6 +158,9 @@ func (h *Handler) canLease(reqIP net.IP, hwaddr string) int {
|
|||||||
|
|
||||||
func (h *Handler) ServeDHCP(p dhcp4.Packet, msgType dhcp4.MessageType, options dhcp4.Options) dhcp4.Packet {
|
func (h *Handler) ServeDHCP(p dhcp4.Packet, msgType dhcp4.MessageType, options dhcp4.Options) dhcp4.Packet {
|
||||||
reply := h.serveDHCP(p, msgType, options)
|
reply := h.serveDHCP(p, msgType, options)
|
||||||
|
if reply == nil {
|
||||||
|
return nil // unsupported request
|
||||||
|
}
|
||||||
buf := gopacket.NewSerializeBuffer()
|
buf := gopacket.NewSerializeBuffer()
|
||||||
opts := gopacket.SerializeOptions{
|
opts := gopacket.SerializeOptions{
|
||||||
ComputeChecksums: true,
|
ComputeChecksums: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user