Skip to content

dhcpv4 OFFER message isn't received if empty interface #372

Open
@purpleidea

Description

@purpleidea

I've been working on a built-in dhcpv4 server in https://github.com/purpleidea/mgmt/
Thanks to your fine library, I don't need to do it all from scratch! (Many thanks!)
In order to learn more about the specific protocol requirements, I've been reading and trying code in: https://github.com/coredhcp/coredhcp

In any case, I start my server like this:

server, err := server4.NewServer(interface, addr, handler4())
if err != nil {
...
}
server.Serve()

As per the code, it seems that "interface" can be the empty string, eg:

However, it seems that if this is the case, at least one DHCPv4 client (stock NetworkManager in modern GNU+Linux Fedora 31) doesn't seem to ever receive the OFFER message.

My logs show:

"discover":

received DHCPv4 packet: DHCPv4 Message
  opcode: BootRequest
  hwtype: Ethernet
  hopcount: 0
  transaction ID: 0x55376c1a
  num seconds: 2
  flags: Unicast (0x00)
  client IP: 0.0.0.0
  your IP: 0.0.0.0
  server IP: 0.0.0.0
  gateway IP: 0.0.0.0
  client MAC: <SECRET>
  server hostname: 
  bootfile name: 
  options:
    DHCP Message Type: DISCOVER
    Parameter Request List: Subnet Mask, Time Offset, Router, Domain Name Server, Host Name, Domain Name, Root Path, Interface MTU, Broadcast Address, Static Routing Table, Network Information Service Domain, Network Information Servers, NTP Servers, Server Identifier, DNS Domain Search List, Classless Static Route, unknown (249), unknown (252)
    Maximum DHCP Message Size: 576
    Client identifier: [<SECRET>]

"offer"

DHCPv4 Message
  opcode: BootReply
  hwtype: Ethernet
  hopcount: 0
  transaction ID: 0x55376c1a
  num seconds: 0
  flags: Unicast (0x00)
  client IP: 0.0.0.0
  your IP: 192.168.42.101
  server IP: 192.168.42.13
  gateway IP: 0.0.0.0
  client MAC: <SECRET>
  server hostname: 
  bootfile name: 
  options:
    Subnet Mask: ffffff00
    Router: 192.168.42.13
    Domain Name Server: 8.8.8.8, 1.1.1.1
    IP Addresses Lease Time: 1m0s
    DHCP Message Type: OFFER
    Server Identifier: 192.168.42.13
    Client identifier: [<SECRET>]

You'll note that I would expect the flag to be Broadcast, and I think that seems to be a bug in the DHCPv4 server used by coredhcp, but even when I set that, it still doesn't seem to get received properly.

However, if I set the specific interface (eg: to "enp0s31f6") then everything starts working!

I don't know the specific reasons why, but without knowing anything about the low-level plumbing, perhaps this broadcast bit (

// Allow broadcasting.
) doesn't work when there isn't a specific interface chosen?

I'm assuming this is a bug in your NewIPv4UDPConn, but I'm happy to learn if it's something I'm doing wrong. Happy to provide anymore info or logs if necessary.

Thank you in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions