Skip to content

Commit 1cdf738

Browse files
authored
Merge pull request intrig-unicamp#292 from JAHorcajo/master
Upgrade Link.Py
2 parents 406cf0f + 6933417 commit 1cdf738

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

mn_wifi/link.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Mininet-WiFi: A simple networking testbed for Wireless OpenFlow/SDWN!
33
@author: Ramon Fontes ([email protected])
4+
@Contributor: Joaquin Alvarez ([email protected])
45
"""
56

67
import os
@@ -61,15 +62,14 @@ def iwdev_cmd(self, *args):
6162
def iwdev_pexec(self, *args):
6263
return self.pexec('iw dev', *args)
6364

64-
def join_ibss(self):
65-
return self.iwdev_cmd('{} ibss join {} {} {} 02:CA:FF:EE:BA:01'.
66-
format(self.name, self.ssid,
67-
self.format_freq(), self.ht_cap))
65+
def join_ibss(self, *args):
66+
return self.iwdev_cmd('{} ibss join'.format(self.name), *args)
67+
68+
def remove_ibss(self): #uah
69+
return self.iwdev_cmd('{} ibss leave'. format(self.name))
6870

69-
def join_mesh(self):
70-
return self.iwdev_cmd('{} mesh join {} freq {} {}'.
71-
format(self.name, self.ssid,
72-
self.format_freq(), self.ht_cap))
71+
def join_mesh(self, ssid, *args):
72+
return self.iwdev_cmd('{} mesh join'.format(self.name), ssid, 'freq', *args)
7373

7474
def get_pid_filename(self):
7575
pidfile = 'mn{}_{}_{}_wpa.pid'.format(os.getpid(), self.node.name, self.id)
@@ -1318,7 +1318,7 @@ class adhoc(IntfWireless):
13181318

13191319
def __init__(self, node, intf=None, ssid='adhocNet',
13201320
channel=1, mode='g', passwd=None, ht_cap='',
1321-
proto=None, **params):
1321+
proto=None, ibss="02:CA:FF:EE:BA:01", **params):
13221322
"""Configure AdHoc
13231323
node: name of the node
13241324
self: custom association class/constructor
@@ -1335,7 +1335,6 @@ def __init__(self, node, intf=None, ssid='adhocNet',
13351335
self.ip6 = intf.ip6
13361336
self.ip = intf.ip
13371337
self.mac = intf.mac
1338-
self.ip6 = intf.ip6
13391338
self.link = intf.link
13401339
self.encrypt = intf.encrypt
13411340
self.antennaGain = intf.antennaGain
@@ -1344,6 +1343,8 @@ def __init__(self, node, intf=None, ssid='adhocNet',
13441343
self.channel = channel
13451344
self.ht_cap = ht_cap
13461345
self.associatedTo = 'adhoc'
1346+
self.ibss = ibss
1347+
13471348
if wmediumd_mode.mode:
13481349
self.wmIface = intf.wmIface
13491350

@@ -1374,7 +1375,8 @@ def configureAdhoc(self):
13741375
if self.passwd:
13751376
self.setSecuredAdhoc()
13761377
else:
1377-
self.join_ibss()
1378+
self.join_ibss(self.ssid, self.format_freq(),
1379+
self.ht_cap, self.ibss)
13781380

13791381
def get_sta_confname(self):
13801382
fileName = '%s.staconf' % self.name
@@ -1398,7 +1400,6 @@ def setSecuredAdhoc(self):
13981400
fileName = self.get_sta_confname()
13991401
os.system('echo \'%s\' > %s' % (cmd, fileName))
14001402

1401-
14021403
class mesh(IntfWireless):
14031404

14041405
node = None
@@ -1471,7 +1472,7 @@ def configureMesh(self):
14711472
if self.passwd:
14721473
self.setSecuredMesh()
14731474
else:
1474-
self.join_mesh()
1475+
self.join_mesh(self.ssid, self.format_freq(), self.ht_cap)
14751476

14761477
def get_sta_confname(self):
14771478
fileName = '%s.staconf' % self.name
@@ -1519,7 +1520,7 @@ def __init__(self, node, intf=None, channel=1, ssid='meshNet',
15191520
self.setPhysicalMeshIface(node, wlan, intf)
15201521
self.freq = self.format_freq()
15211522

1522-
self.join_mesh()
1523+
self.join_mesh(self.ssid, self.format_freq(), self.ht_cap)
15231524

15241525
def ipLink(self, state=None):
15251526
"Configure ourselves using ip link"

0 commit comments

Comments
 (0)