问题
I am working on project using libpcap. Now, I need to know the direction of packet (inbound or outbound) once I got the packet in callback function. I am going to write the methods to compare IP and MAC address between client and these information extract from packet. Am I right?
Could you please help me some comments or advices on this problem?
Thank you for your time.
回答1:
The source or target IP address is sufficient. If the source is local, it's outbound. If the target is local, it's inbound. If neither, it's a promiscuous sniff.
来源:https://stackoverflow.com/questions/21815485/how-to-determine-packet-direction-using-libpcap