diff --git a/repos/os/include/net/arp.h b/repos/os/include/net/arp.h index 1feae1352e..3dc36566b2 100644 --- a/repos/os/include/net/arp.h +++ b/repos/os/include/net/arp.h @@ -123,6 +123,11 @@ class Net::Arp_packet && _protocol_address_size == Ipv4_packet::ADDR_LEN); } + Genode::size_t size(Genode::size_t max_size) const + { + return sizeof(Arp_packet) < max_size ? sizeof(Arp_packet) : max_size; + } + /********* ** Log ** diff --git a/repos/os/include/net/dhcp.h b/repos/os/include/net/dhcp.h index 2ab35b9db5..27a120caa0 100644 --- a/repos/os/include/net/dhcp.h +++ b/repos/os/include/net/dhcp.h @@ -333,7 +333,7 @@ class Net::Dhcp_packet template void append_param_req() { - _size_guard.add(sizeof(_base[0])); + _size_guard.consume_head(sizeof(_base[0])); _base[_size] = (Genode::uint8_t)OPTION::CODE; _size++; } @@ -351,7 +351,7 @@ class Net::Dhcp_packet template void append_option(ARGS &&... args) { - _size_guard.add(sizeof(OPTION)); + _size_guard.consume_head(sizeof(OPTION)); Genode::construct_at