extract icmp into its own static library; replace all __attribute__((constructor)) self-registrations with explicit init() calls in dispatch_init

This commit is contained in:
Ian Gulliver
2026-05-01 13:44:53 -07:00
parent 2d7ff98b82
commit a56e034bfb
12 changed files with 30 additions and 23 deletions

View File

@@ -31,6 +31,8 @@ bool default_addr_filter(const ip4_addr& dst) {
void init() {
const auto& mac = eth::get_mac();
g_ip = {169, 254, mac[4], mac[5]};
eth::register_ethertype(eth::ETH_IPV4, handle);
register_addr_filter(default_addr_filter);
}
const ip4_addr& get_ip() {
@@ -101,10 +103,4 @@ void handle(std::span<const uint8_t> frame, span_writer& tx) {
}
}
__attribute__((constructor))
static void register_self() {
eth::register_ethertype(eth::ETH_IPV4, handle);
register_addr_filter(default_addr_filter);
}
} // namespace ipv4