register with local peers, broadcast mac

This commit is contained in:
asxalex 2024-10-26 11:33:15 +08:00
parent 7a75c1d171
commit f3cbc1def2
2 changed files with 5 additions and 4 deletions

View File

@ -13,6 +13,7 @@ use crate::{
};
use etherparse::Ethernet2Header;
use prost::Message;
use sdlan_sn_rs::utils::BROADCAST_MAC;
use sdlan_sn_rs::{
config::{AF_INET, AF_INET6},
peer::{is_sdlan_sock_equal, SdlanSock, V6Info},
@ -667,7 +668,7 @@ async fn register_with_new_peer(
}
async fn register_with_local_peers(eee: &Node) {
send_register(eee, &eee.multicast_sock, NULL_MAC, &None).await;
send_register(eee, &eee.multicast_sock, BROADCAST_MAC, &None).await;
}
async fn send_register(eee: &Node, sock: &SdlanSock, mac: Mac, _v6_info: &Option<V6Info>) {

View File

@ -256,11 +256,11 @@ impl TunTapPacketHandler for Iface {
let mut arp = ArpHdr::from_slice(&data);
let self_ip = edge.device_config.get_ip();
println!("self_ip: {:?}", self_ip.to_be_bytes());
// println!("self_ip: {:?}", self_ip.to_be_bytes());
let from_ip = ((arp.sipaddr[0] as u32) << 16) + arp.sipaddr[1] as u32;
println!("from_ip: {:?}", from_ip.to_be_bytes());
// println!("from_ip: {:?}", from_ip.to_be_bytes());
let dest_ip = ((arp.dipaddr[0] as u32) << 16) + arp.dipaddr[1] as u32;
println!("dest_ip: {:?}", dest_ip.to_be_bytes());
// println!("dest_ip: {:?}", dest_ip.to_be_bytes());
match arp.opcode {
ARP_REQUEST => {