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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user