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 "icmp.h"
|
||||
#include <cstring>
|
||||
#include "eth.h"
|
||||
#include "ipv4.h"
|
||||
#include "net.h"
|
||||
#include "parse_buffer.h"
|
||||
#include "prepend_buffer.h"
|
||||
|
||||
@@ -24,7 +24,6 @@ void handle(std::span<const uint8_t> frame, span_writer& tx) {
|
||||
if (!icmp_pkt) return;
|
||||
if (icmp_pkt->type != 8) return;
|
||||
|
||||
const auto& ns = net::get_state();
|
||||
prepend_buffer<4096> buf;
|
||||
memcpy(buf.append(icmp_len), pb.remaining().data() - sizeof(echo), icmp_len);
|
||||
|
||||
@@ -33,8 +32,8 @@ void handle(std::span<const uint8_t> frame, span_writer& tx) {
|
||||
reply->checksum = 0;
|
||||
reply->checksum = ipv4::checksum(reply, icmp_len);
|
||||
|
||||
ipv4::prepend(buf, eth_hdr->src, ns.mac, ns.ip, ip->src, 1, icmp_len);
|
||||
net::send_raw(buf.span());
|
||||
ipv4::prepend(buf, eth_hdr->src, eth::get_mac(), ipv4::get_ip(), ip->src, 1, icmp_len);
|
||||
eth::send_raw(buf.span());
|
||||
}
|
||||
|
||||
__attribute__((constructor))
|
||||
|
||||
Reference in New Issue
Block a user