net::/ipv4:: namespace, mac/addr filter framework with default filters, dlog on registry overflow

This commit is contained in:
Ian Gulliver
2026-05-01 10:15:54 -07:00
parent ca624e0e70
commit b82c038091
12 changed files with 216 additions and 113 deletions

View File

@@ -11,7 +11,7 @@ static constexpr uint16_t ARP_OP_REQUEST = __builtin_bswap16(1);
static constexpr uint16_t ARP_OP_REPLY = __builtin_bswap16(2);
void handle(std::span<const uint8_t> frame, span_writer& tx) {
const auto& ns = net_get_state();
const auto& ns = net::get_state();
parse_buffer pb(frame);
pb.consume<eth::header>();
auto* arp_hdr = pb.consume<header>();
@@ -36,12 +36,12 @@ void handle(std::span<const uint8_t> frame, span_writer& tx) {
reply->tpa = arp_hdr->spa;
eth::prepend(buf, arp_hdr->sha, ns.mac, eth::ETH_ARP);
net_send_raw(buf.span());
net::send_raw(buf.span());
}
__attribute__((constructor))
static void register_ethertype() {
net_register_ethertype(eth::ETH_ARP, handle);
net::register_ethertype(eth::ETH_ARP, handle);
}
} // namespace arp