Not sure why it does not work here on my end
Here's the sendpacket command that I modify from
mn_wifi/cli.py:
def do_sendpacket(self, line):
"""Send a packet with content to a destination node by transferring through neighbor nodes until it reaches the destination.
Usage: sendpacket <source_node> <destination_node> <content>"""
args = line.split()
if len(args) != 3:
error('Usage: sendpacket <source_node> <destination_node> <content>\n')
return
ip_layer = IP(src="10.0.0.1", dst="10.0.0.2")
icmp_layer = ICMP(type='echo-request', id=1, seq=1) / "hello"
packet = ip_layer / icmp_layer
try:
print(packet.show())
sendp(packet, iface='sta1-wlan0')
except OSError as e:
print(f"Error: {e}")
mininet-wifi> sendpacket sta1 sta2 "hello"
###[ IP ]###
version = 4
ihl = None
tos = 0x0
len = None
id = 1
flags =
frag = 0
ttl = 64
proto = icmp
chksum = None
src = 10.0.0.1
dst = 10.0.0.2
\options \
###[ ICMP ]###
type = echo-request
code = 0
chksum = None
id = 0x1
seq = 0x1
###[ Raw ]###
load = 'hello'
None
An error occurred while sending packet: [Errno 19] No such device
Exception ignored in: <function SuperSocket.__del__ at 0x7f4b14f654e0>
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/scapy/supersocket.py", line 134, in __del__
self.close()
File "/usr/lib/python3/dist-packages/scapy/arch/linux.py", line 514, in close
set_promisc(self.ins, self.iface, 0)
File "/usr/lib/python3/dist-packages/scapy/arch/linux.py", line 165, in set_promisc
mreq = struct.pack("IHH8s", get_if_index(iff), PACKET_MR_PROMISC, 0, b"")
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/scapy/arch/linux.py", line 380, in get_if_index
return int(struct.unpack("I", get_if(iff, SIOCGIFINDEX)[16:20])[0])
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/scapy/arch/common.py", line 59, in get_if
ifreq = ioctl(sck, cmd, struct.pack("16s16x", iff.encode("utf8")))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 19] No such device