Fix TCP accept and accept packet from null mac address
This commit is contained in:
@@ -31,6 +31,8 @@ enum ArpState {
|
||||
|
||||
type PacketBuffer = smoltcp::storage::PacketBuffer<'static, IpAddress>;
|
||||
|
||||
const EMPTY_MAC: EthernetAddress = EthernetAddress([0;6]);
|
||||
|
||||
pub struct EthernetLink {
|
||||
name: Rc<str>,
|
||||
neighbor_cache: BTreeMap<IpAddress, Neighbor>,
|
||||
@@ -333,11 +335,14 @@ impl LinkDevice for EthernetLink {
|
||||
continue;
|
||||
};
|
||||
|
||||
if !repr.dst_addr.is_broadcast() && repr.dst_addr != self.hardware_address {
|
||||
// We let EMPTY_MAC pass because somehow this is the mac used when net=redir is used
|
||||
if !repr.dst_addr.is_broadcast() && repr.dst_addr != EMPTY_MAC && repr.dst_addr != self.hardware_address {
|
||||
// Drop packets which are not for us
|
||||
continue;
|
||||
}
|
||||
|
||||
error!("Incomming packet {}, {}", repr.dst_addr, repr.ethertype);
|
||||
|
||||
match repr.ethertype {
|
||||
EthernetProtocol::Ipv4 => {
|
||||
self.input_buffer = input_buffer;
|
||||
|
||||
@@ -226,10 +226,7 @@ impl<'a> SchemeSocket for TcpSocket<'a> {
|
||||
{
|
||||
let tcp_socket = socket_set.get_mut::<TcpSocket>(new_socket_handle);
|
||||
tcp_socket
|
||||
.listen(
|
||||
local_endpoint
|
||||
.expect("Socket was active so local endpoint must be set"),
|
||||
)
|
||||
.listen(listen_enpoint)
|
||||
.expect("Can't listen on local endpoint");
|
||||
}
|
||||
// We got a new connection to the socket so acquire the port
|
||||
|
||||
Reference in New Issue
Block a user