intrig-unicamp / mininet-wifi

Emulator for Software-Defined Wireless Networks
https://mn-wifi.readthedocs.io/
Other
458 stars 245 forks source link

Generating RTS CTS Packets #553

Open lightningfasttt opened 1 week ago

lightningfasttt commented 1 week ago

Hello, I’ve been attempting to simulate a hidden terminal problem in mininet_wifi. However, I’ve encountered an issue where when I examine the packets captured on the hwsim interface, I can’t locate the RTS/CTS packets generated by the stations or anywhere else. I’ve provided the code below for your reference.

!/usr/bin/python

import sys from mininet.node import Controller from mininet.log import setLogLevel, info from mn_wifi.cli import CLI from mn_wifi.net import Mininet_wifi from mininet.term import makeTerm from mn_wifi.link import wmediumd from mn_wifi.wmediumdConnector import interference import time import os

def topology(): "Create a network." net = Mininet_wifi(controller=Controller, link=wmediumd, wmediumd_mode=interference)

info("*** Creating nodes\n")
# Stations and access point
sta1 = net.addStation('sta1', mac='00:00:00:00:00:01', ip='10.0.0.1/8', position='30,70,0')
sta2 = net.addStation('sta2', mac='00:00:00:00:00:02', ip='10.0.0.2/8', position='50,70,0')
sta3 = net.addStation('sta3', mac='00:00:00:00:00:03', ip='10.0.0.3/8', position='70,70,0')
#UDPS = net.addStation('UDPS', mac='00:00:00:00:00:04', ip='10.0.0.5/8', position='51,66,0', range=27)
ap1 = net.addAccessPoint('ap1', mac='00:00:00:00:10:02', ssid='handover', mode='g', channel='1', position='50,65,0')
c1 = net.addController('c1')

net.setPropagationModel(model="logDistance", exp=5)

info("*** Configuring wifi nodes\n")
net.configureWifiNodes()

# Set RTS/CTS threshold to 0 for all stations
sta1.cmd("iwconfig sta1-wlan0 rts 256")
#sta2.cmd("iwconfig sta2-wlan0 rts 256")
sta3.cmd("iwconfig sta3-wlan0 rts 256")
#UDPS.cmd("iwconfig UDPS-wlan0 rts 256")
#ap1.cmd("iwconfig ap1-wlan1 rts 256")

info("*** Bringing up hwsim0 interface\n")
os.system('ifconfig hwsim0 up')

info("*** Starting packet capture on hwsim0\n")
os.system('tcpdump -i hwsim0 -w sim1.pcap &')
net.plotGraph(min_x=-20, min_y=-10, nax_x=150, max_y=150)
info("*** Starting network\n")
net.build()
c1.start()
ap1.start([c1])

# Start iperf servers on UDPS
makeTerm(sta2, cmd="bash -c 'iperf -s -p 5566;'")
#makeTerm(sta2, cmd="bash -c 'iperf3 -s -p 5565;'")

time.sleep(5)

# Start iperf clients on sta1 and sta3
makeTerm(sta1, cmd="bash -c 'iperf -c 10.0.0.2 -t 25 -b 10m -p 5566;'")
#makeTerm(sta3, cmd="bash -c 'iperf3 -c 10.0.0.2 -u -t 25 -b 10m -p 5565;'")

info("*** Running CLI\n")
CLI(net)

info("*** Stopping network\n")
net.stop()

if name == 'main': setLogLevel('info') topology()

Dibyajyoti Deka

ramonfontes commented 1 week ago

In the context of mac80211_hwsim, the @MAC80211_HWSIM_TX_RC_USE_RTS_CTS flag indicates that the simulation can signal that data transmission should use the RTS/CTS exchange for media access control. This flag is used internally to instruct the mac80211_hwsim driver to simulate enabling RTS/CTS for certain transmissions, even if full RTS/CTS behavior is not supported as in physical hardware.

We can see that RTS/CTS is supported by mac80211_hwsim but it is not being sent through the simulated channel. However, it can be implemented in the same fashion as the broadcom stack. It could be a contribution to the hwsim kernel module.