merge net into eth lib; ipv4 owns its IP via ipv4::init/get_ip; drop state struct in favor of eth::get_mac/ipv4::get_ip
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "igmp.h"
|
||||
#include <vector>
|
||||
#include "eth.h"
|
||||
#include "ipv4.h"
|
||||
#include "net.h"
|
||||
#include "parse_buffer.h"
|
||||
#include "prepend_buffer.h"
|
||||
|
||||
@@ -35,10 +35,9 @@ bool is_member_mac(const eth::mac_addr& mac) {
|
||||
}
|
||||
|
||||
static void send_report(const ipv4::ip4_addr& group) {
|
||||
const auto& ns = net::get_state();
|
||||
prepend_buffer<4096> buf;
|
||||
prepend_report(buf, ns.mac, ns.ip, group);
|
||||
net::send_raw(buf.span());
|
||||
prepend_report(buf, eth::get_mac(), ipv4::get_ip(), group);
|
||||
eth::send_raw(buf.span());
|
||||
}
|
||||
|
||||
void join(const ipv4::ip4_addr& group) {
|
||||
@@ -82,7 +81,7 @@ void handle(std::span<const uint8_t> frame, span_writer& tx) {
|
||||
__attribute__((constructor))
|
||||
static void register_protocol() {
|
||||
ipv4::register_protocol(2, handle);
|
||||
net::register_mac_filter(is_member_mac);
|
||||
eth::register_mac_filter(is_member_mac);
|
||||
ipv4::register_addr_filter(is_member);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user