From 79defbb2aae052319bc827008b11578752cda5b9 Mon Sep 17 00:00:00 2001 From: Ramon Fontes Date: Wed, 13 May 2020 14:25:56 -0300 Subject: [PATCH] fix for 802.11p --- examples/ieee80211p.py | 26 ++++++++++---------------- mn_wifi/link.py | 3 ++- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/examples/ieee80211p.py b/examples/ieee80211p.py index b7a18bfb1..d9beaa425 100755 --- a/examples/ieee80211p.py +++ b/examples/ieee80211p.py @@ -1,9 +1,9 @@ #!/usr/bin/python -"""You can use this code to work with IEEE 802.11p. - *** You have to install wireless-regdb and CRDA. - *** Please refer to the user manual for further information - *** Tested with 5805 Mhz""" +""" +NOTE: you have to install wireless-regdb and CRDA + please refer to https://mininet-wifi.github.io/80211p/ +""" from mininet.log import setLogLevel, info from mn_wifi.link import wmediumd, ITSLink @@ -17,26 +17,20 @@ def topology(): net = Mininet_wifi(link=wmediumd, wmediumd_mode=interference) info("*** Creating nodes\n") - sta1 = net.addStation('sta1', ip='10.0.0.1/8', - position='10,10,0') - sta2 = net.addStation('sta2', ip='10.0.0.2/8', - position='20,20,0') + sta1 = net.addStation('sta1', ip='10.0.0.1/8', position='25,50,0') + sta2 = net.addStation('sta2', ip='10.0.0.2/8', position='50,50,0') info("*** Configuring Propagation Model\n") - net.setPropagationModel(model="logDistance", exp=3.5) - - net.setModule('./mac80211_hwsim.ko') + net.setPropagationModel(model="logDistance", exp=4.5) info("*** Configuring wifi nodes\n") net.configureWifiNodes() - net.plotGraph(max_x=50, max_y=50) + net.plotGraph(max_x=100, max_y=100) info("*** Starting ITS Links\n") - net.addLink(sta1, intf='sta1-wlan0', - cls=ITSLink, channel='161') - net.addLink(sta2, intf='sta2-wlan0', - cls=ITSLink, channel='161') + net.addLink(sta1, intf='sta1-wlan0', cls=ITSLink, channel='181') + net.addLink(sta2, intf='sta2-wlan0', cls=ITSLink, channel='181') info("*** Starting network\n") net.build() diff --git a/mn_wifi/link.py b/mn_wifi/link.py index eb62e8470..ea56f4cef 100644 --- a/mn_wifi/link.py +++ b/mn_wifi/link.py @@ -1541,13 +1541,14 @@ def __init__(self, node, intf=None, channel=161): "configure ieee80211p" intf = node.getNameToWintf(intf) wlan = node.params['wlan'].index(intf.name) + LinkAttrs.__init__(self, node, intf, wlan) if isinstance(self, master): self.kill_hostapd() self.node = node self.channel = channel - self.freq = self.get_freq() + self.freq = str(self.get_freq()).replace('.', '') self.range = intf.range self.name = intf.name self.mac = intf.mac