Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The scapy sniff can not work correctly? #79

Open
ChengjunJia opened this issue Sep 28, 2020 · 0 comments
Open

The scapy sniff can not work correctly? #79

ChengjunJia opened this issue Sep 28, 2020 · 0 comments

Comments

@ChengjunJia
Copy link

ChengjunJia commented Sep 28, 2020

Hi, all. I want to use scapy to write my own client and server in multi_switch_mininet.p4app. However, I find that if I modify the echo_server.py to enable sniff() function and enable the pcap_dump in p4app.json. The pcap results will contain a strange packet: an IPv4+ICMP packet which container total IP+UDP packet in its payload! But from the sniff() result, the host received a UDP packet instead of IPv4+ICMP packet.

Here is the echo_server.py codes:

import socket, sys
from scapy.all import *
import time

print("Start to sniff packets...")
sniffed = sniff(iface="h1-eth0", filter="ip", prn=custom_action, count = 5)
for pkt in sniffed:
        pkt.show()
time.sleep(5)

And here is the echo_client.py codes:

import socket, sys
from scapy.all import *
import os

srv_addr = (sys.argv[1], int(sys.argv[2]))
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.sendto(sys.argv[3], srv_addr)

Anyone has any idea? Besides, the pcap result is a little confusing for me. s1-eth1_out.pcap means that the packets leave the s1 from eth1 or go into s1 from eth1?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant