mirror of
				https://github.com/dndx/phantun.git
				synced 2025-11-04 03:45:35 +08:00 
			
		
		
		
	fix(fake_tcp) reduce log verbosity for bad SYN packets
This commit is contained in:
		@@ -1,7 +1,7 @@
 | 
				
			|||||||
pub mod packet;
 | 
					pub mod packet;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use bytes::{Bytes, BytesMut};
 | 
					use bytes::{Bytes, BytesMut};
 | 
				
			||||||
use log::info;
 | 
					use log::{info, trace};
 | 
				
			||||||
use packet::*;
 | 
					use packet::*;
 | 
				
			||||||
use pnet::packet::{tcp, Packet};
 | 
					use pnet::packet::{tcp, Packet};
 | 
				
			||||||
use rand::prelude::*;
 | 
					use rand::prelude::*;
 | 
				
			||||||
@@ -394,7 +394,7 @@ impl Stack {
 | 
				
			|||||||
                            assert!(shared.tuples.lock().unwrap().insert(tuple, Arc::new(incoming)).is_none());
 | 
					                            assert!(shared.tuples.lock().unwrap().insert(tuple, Arc::new(incoming)).is_none());
 | 
				
			||||||
                            tokio::spawn(sock.accept());
 | 
					                            tokio::spawn(sock.accept());
 | 
				
			||||||
                        } else {
 | 
					                        } else {
 | 
				
			||||||
                            info!("Bad TCP SYN packet from {}, sending RST", remote_addr);
 | 
					                            trace!("Bad TCP SYN packet from {}, sending RST", remote_addr);
 | 
				
			||||||
                            let buf = build_tcp_packet(
 | 
					                            let buf = build_tcp_packet(
 | 
				
			||||||
                                local_addr,
 | 
					                                local_addr,
 | 
				
			||||||
                                remote_addr,
 | 
					                                remote_addr,
 | 
				
			||||||
@@ -406,7 +406,7 @@ impl Stack {
 | 
				
			|||||||
                            shared.outgoing.try_send(buf).unwrap();
 | 
					                            shared.outgoing.try_send(buf).unwrap();
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    } else if (tcp_packet.get_flags() & tcp::TcpFlags::RST) == 0 {
 | 
					                    } else if (tcp_packet.get_flags() & tcp::TcpFlags::RST) == 0 {
 | 
				
			||||||
                        info!("Bad TCP packet from {}, sending RST", remote_addr);
 | 
					                        info!("Unknown TCP packet from {}, sending RST", remote_addr);
 | 
				
			||||||
                        let buf = build_tcp_packet(
 | 
					                        let buf = build_tcp_packet(
 | 
				
			||||||
                            local_addr,
 | 
					                            local_addr,
 | 
				
			||||||
                            remote_addr,
 | 
					                            remote_addr,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user