Skip to content

Dhcp_wire.pkt_into_buf when the pkt.options is the empty list crashes #152

@hannesm

Description

@hannesm

The output is Invalid argument: Invalid options. It originates from the code in buf_of_options:

  match options with
  | [] -> invalid_arg "Invalid options"
  ..

Maybe pkt_into_buf should not call buf_of_options?

The log output of dnsvizor 862efdab914961ab846377c77223b956eeaf2230, charrua 3.1.1

console 2026-03-13T14:37:08-00:00:             |      ___|
console 2026-03-13T14:37:08-00:00:   __|  _ \  |  _ \ __ \
console 2026-03-13T14:37:08-00:00: \__ \ (   | | (   |  ) |
console 2026-03-13T14:37:08-00:00: ____/\___/ _|\___/____/
console 2026-03-13T14:37:08-00:00: Solo5: Bindings version v0.10.0
console 2026-03-13T14:37:08-00:00: Solo5: Memory map: 32 MB addressable:
console 2026-03-13T14:37:08-00:00: Solo5:   reserved @ (0x0 - 0xfffff)
console 2026-03-13T14:37:08-00:00: Solo5:       text @ (0x100000 - 0x4e5fff)
console 2026-03-13T14:37:08-00:00: Solo5:     rodata @ (0x4e6000 - 0x674fff)
console 2026-03-13T14:37:08-00:00: Solo5:       data @ (0x675000 - 0xa13fff)
console 2026-03-13T14:37:08-00:00: Solo5:       heap >= 0xa14000 < stack < 0x2000000
console 2026-03-13T14:37:08-00:00: 2026-03-13T14:37:08-00:00: [INFO] [netif] Plugging into service with mac 00:80:41:65:77:07 mtu 1500
console 2026-03-13T14:37:08-00:00: 2026-03-13T14:37:08-00:00: [INFO] [ethernet] Connected Ethernet interface 00:80:41:65:77:07
console 2026-03-13T14:37:08-00:00: 2026-03-13T14:37:08-00:00: [INFO] [ARP] Sending gratuitous ARP for 10.0.42.2 (00:80:41:65:77:07)
console 2026-03-13T14:37:08-00:00: 2026-03-13T14:37:08-00:00: [INFO] [ARP] Sending gratuitous ARP for 10.0.42.2 (00:80:41:65:77:07)
console 2026-03-13T14:37:08-00:00: 2026-03-13T14:37:08-00:00: [INFO] [ipv6] IP6: Starting
console 2026-03-13T14:37:08-00:00: 2026-03-13T14:37:08-00:00: [INFO] [application] Sending reply src MAC 00:80:41:65:77:07 dst MAC ff:ff:ff:ff:ff:ff
console 2026-03-13T14:37:08-00:00: src IP 10.0.42.2 dst IP 255.255.255.255
console 2026-03-13T14:37:08-00:00: src port 67 dst port 68
console 2026-03-13T14:37:08-00:00: operation BOOT REPLY
console 2026-03-13T14:37:08-00:00: htype Ethernet 10MB hlen 6 hops 0
console 2026-03-13T14:37:08-00:00: XID 1362796236 secs 0 flags Broadcast
console 2026-03-13T14:37:08-00:00: ciaddr 0.0.0.0 yiaddr 10.0.42.100
console 2026-03-13T14:37:08-00:00: siaddr 10.0.42.2 giaddr 0.0.0.0 chaddr 00:80:41:70:50:75
console 2026-03-13T14:37:08-00:00: sname charrua-dhcp-server file 
console 2026-03-13T14:37:08-00:00: options Message type DHCP OFFER, IP lease time 7200, Renewal T1 3600, Rebinding T2 5760, Server identifier 10.0.42.2, Subnet mask 255.255.255.0, Routers 10.0.42.1
console 2026-03-13T14:37:08-00:00: 2026-03-13T14:37:08-00:00: [INFO] [application] Handing out lease start 2047 end 9247 addr 10.0.42.100 client id MAC 00:80:41:70:50:75, received options Parameter request Subnet mask, Routers, Message type DHCP REQUEST, Request IP 10.0.42.100, Server identifier 10.0.42.2
console 2026-03-13T14:37:08-00:00: 2026-03-13T14:37:08-00:00: [INFO] [application] Sending reply src MAC 00:80:41:65:77:07 dst MAC ff:ff:ff:ff:ff:ff
console 2026-03-13T14:37:08-00:00: src IP 10.0.42.2 dst IP 255.255.255.255
console 2026-03-13T14:37:08-00:00: src port 67 dst port 68
console 2026-03-13T14:37:08-00:00: operation BOOT REPLY
console 2026-03-13T14:37:08-00:00: htype Ethernet 10MB hlen 6 hops 0
console 2026-03-13T14:37:08-00:00: XID 1362796236 secs 0 flags Broadcast
console 2026-03-13T14:37:08-00:00: ciaddr 0.0.0.0 yiaddr 10.0.42.100
console 2026-03-13T14:37:08-00:00: siaddr 10.0.42.2 giaddr 0.0.0.0 chaddr 00:80:41:70:50:75
console 2026-03-13T14:37:08-00:00: sname charrua-dhcp-server file 
console 2026-03-13T14:37:08-00:00: options 
console 2026-03-13T14:37:08-00:00: Fatal error: exception Invalid_argument("Invalid options")

It may as well be a DNSvizor that slightly early does some DHCP processing (which is a separate issue) -- but I think that charrua raising an exception isn't good either.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions