Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

AttributeError: 'mesh' object has no attribute 'ifb'

44 views
Skip to first unread message

Osama Abu Hamdan

unread,
Aug 28, 2024, 11:48:23 AM8/28/24
to mininet-wifi-discuss
I am trying to set up a network with 3 APs connected in a mesh setup to connect nodes to each other from all stations.

I have this code,
```
#!/usr/bin/python

from mininet.log import setLogLevel, info
from mininet.node import RemoteController
from mn_wifi.net import Mininet_wifi
from mn_wifi.node import Station, OVSKernelAP
from mn_wifi.cli import CLI
from mn_wifi.link import wmediumd, mesh
from mn_wifi.wmediumdConnector import interference
from subprocess import call


def myNetwork():
    controller = RemoteController('c0', ip='172.17.0.2', port=6653)
    net = Mininet_wifi(controller=controller, link=wmediumd, wmediumd_mode=interference)

    info('*** Adding controller\n')
    info('*** Add switches/APs\n')
    ap_configs = dict(protocols="OpenFlow13", channel='1', mode='g', cls=OVSKernelAP, range=500)

    ap1 = net.addAccessPoint('ap1', ssid='ap1-ssid', position='672.0,389.0,0', **ap_configs)
    ap2 = net.addAccessPoint('ap2', ssid='ap2-ssid', position='1120.0,391.0,0', **ap_configs)
    ap3 = net.addAccessPoint('ap3', ssid='ap3-ssid', position='894.0,745.0,0', **ap_configs)

    info('*** Add hosts/stations\n')
    sta1 = net.addStation('sta1', ip='10.0.0.1', position='503.0,-11.0,0')
    sta2 = net.addStation('sta2', ip='10.0.0.2', position='228.0,444.0,0')
    sta3 = net.addStation('sta3', ip='10.0.0.3', position='1364.0,22.0,0')
    sta4 = net.addStation('sta4', ip='10.0.0.4', position='1554.0,532.0,0')
    sta5 = net.addStation('sta5', ip='10.0.0.5', position='1218.0,1070.0,0')
    sta6 = net.addStation('sta6', ip='10.0.0.6', position='609.0,1085.0,0')

    info("*** Configuring Propagation Model\n")
    net.setPropagationModel(model="logDistance", exp=3)

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

    net.addLink(ap1, intf='ap1-wlan1', cls=mesh, ssid='mesh-ssid', mode='g', channel=1)
    net.addLink(ap2, intf='ap2-wlan1', cls=mesh, ssid='mesh-ssid', mode='g', channel=1)
    net.addLink(ap3, intf='ap3-wlan1', cls=mesh, ssid='mesh-ssid', mode='g', channel=1)

    net.plotGraph(max_x=2500, max_y=2500)

    info('*** Starting network\n')
    net.build()
    info('*** Starting controllers\n')

    controller.start()

    info('*** Starting switches/APs\n')
    net.get('ap1').start([controller])
    net.get('ap2').start([controller])
    net.get('ap3').start([controller])

    info('*** Post configure nodes\n')

    CLI(net)
    net.stop()


if __name__ == '__main__':
    setLogLevel('info')
    myNetwork()
```
when I run I get this error

```
Traceback (most recent call last):
  File "mn-wifi-2.py", line 64, in <module>
    myNetwork()
  File "mn-wifi-2.py", line 52, in myNetwork
    net.get('ap1').start([controller])
  File "/usr/local/lib/python3.10/dist-packages/mininet_wifi-2.6-py3.10.egg/mn_wifi/node.py", line 706, in start
    if self.wintfs[0].ifb: self.handle_ingress_data(self.wintfs[0], 0)
AttributeError: 'mesh' object has no attribute 'ifb'
```

Topology:
Screenshot 2024-08-28 at 9.56.56 AM.png

Ramon Fontes

unread,
Aug 28, 2024, 11:55:32 AM8/28/24
to Osama Abu Hamdan, mininet-wifi-discuss
You have APs but they are not working as AP. You have to add a 2nd interface (wlans=2) and set the second one as mesh.

Osama Abu Hamdan

unread,
Aug 30, 2024, 1:22:14 PM8/30/24
to mininet-wifi-discuss
Thanks for the response!

I have this code now

def myNetwork():
    controller = RemoteController('c0', ip='172.17.0.2', port=6653)
    net = Mininet_wifi(controller=controller, link=wmediumd, wmediumd_mode=interference)

    info('*** Adding controller\n')
    info('*** Add switches/APs\n')
    ap_configs = dict(protocols="OpenFlow13", channel='1', mode='g', cls=OVSKernelAP, range=500, wlans=2)


    ap1 = net.addAccessPoint('ap1', ssid='ap1-ssid', position='672.0,389.0,0', **ap_configs)
    ap2 = net.addAccessPoint('ap2', ssid='ap2-ssid', position='1120.0,391.0,0', **ap_configs)
    ap3 = net.addAccessPoint('ap3', ssid='ap3-ssid', position='894.0,745.0,0', **ap_configs)

    info('*** Add hosts/stations\n')
    sta1 = net.addStation('sta1', ip='10.0.0.1', position='503.0,-11.0,0')
    sta2 = net.addStation('sta2', ip='10.0.0.2', position='228.0,444.0,0')
    sta3 = net.addStation('sta3', ip='10.0.0.3', position='1364.0,22.0,0')
    sta4 = net.addStation('sta4', ip='10.0.0.4', position='1554.0,532.0,0')
    sta5 = net.addStation('sta5', ip='10.0.0.5', position='1218.0,1070.0,0')
    sta6 = net.addStation('sta6', ip='10.0.0.6', position='609.0,1085.0,0')

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

    net.configureWifiNodes()

    net.addLink(ap1, intf='ap1-wlan2', cls=mesh, ssid='mesh-ssid', mode='g', channel=5)
    net.addLink(ap2, intf='ap2-wlan2', cls=mesh, ssid='mesh-ssid', mode='g', channel=5)
    net.addLink(ap3, intf='ap3-wlan2', cls=mesh, ssid='mesh-ssid', mode='g', channel=5)

    net.plotGraph(min_x=-200, min_y=-200, max_x=2500, max_y=2500)

    net.build()

    controller.start()


    net.get('ap1').start([controller])
    net.get('ap2').start([controller])
    net.get('ap3').start([controller])

    info('*** Post configure nodes\n')

    CLI(net)
    net.stop()

But when I want to ping from sta1 (connected to ap1) to sta5 (connected to ap3) it doesn't work.
What am I missing here?
Notice that I am using ONOS controller, which is connected to each AP, and it's working fine with regular links.

Also, I tried to turn off mesh routing with this command
ap1 iw dev ap1-mp2 set mesh_param mesh_fwding=0
but it says
command failed: Operation not supported (-95)

Ramon Fontes

unread,
Aug 30, 2024, 1:44:30 PM8/30/24
to Osama Abu Hamdan, mininet-wifi-discuss
> But when I want to ping from sta1 (connected to ap1) to sta5 (connected to ap3) it doesn't work.
What am I missing here?

I suggest dissecate the packets. Hence, you will better comprehend the setup and find what you are missing there.

> Also, I tried to turn off mesh routing with this command
ap1 iw dev ap1-mp2 set mesh_param mesh_fwding=0
but it says
command failed: Operation not supported (-95)

Please check the iw doc!

--
You received this message because you are subscribed to the Google Groups "mininet-wifi-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mininet-wifi-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mininet-wifi-discuss/9e9e3fca-f9c1-4a2c-9a44-48a2f8be4611n%40googlegroups.com.

Osama Abu Hamdan

unread,
Aug 30, 2024, 8:18:16 PM8/30/24
to mininet-wifi-discuss
Hello,

I found out what is wrong here.

In this part of my code,
net.addLink(ap1, intf='ap1-wlan2', cls=mesh, ssid='mesh-ssid', mode='g', channel=5)
net.addLink(ap2, intf='ap2-wlan2', cls=mesh, ssid='mesh-ssid', mode='g', channel=5)
net.addLink(ap3, intf='ap3-wlan2', cls=mesh, ssid='mesh-ssid', mode='g', channel=5)

After It goes to mesh class in link.py. In lines1865-1908, it just ignores the interface that I pass "ap1-wlan2" and puts another name as in

if 'vIface' in params:
   self.name = '{}-mp{}.{}'.format(node, phyWlan, port)
else:
   self.name = '{}-mp{}'.format(node, port)
which becomes ap1-mp2

It disables the interface I am expecting to be connected to the mesh and creates this new interface, sets it to mesh type, and assign to a new mesh connection as in

self.node.cmd('ip link set {} down'.format(intf))
self.iwdev_cmd(self.set_mesh_type(intf, port))

then it calls this method, which causes another problem
self.prepareMeshIface(wlan, iface)
inside prepareMeshIface:  self.setMAC(intf.mac)

So now, we have ap1-wlan2 and ap1-mp2.
ap1-wlan2 is expected to get involved in a mesh connection, but in fact it doesn't. Instead, ap1-mp2 is created and it is assigned to the same MAC and ap1-wlan2.

This behavior causes this problem:
>> ip a
3727: ap1-wlan2: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 02:00:00:00:07:00 brd ff:ff:ff:ff:ff:ff
3732: ap1-mp2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master ovs-system state DOWN group default qlen 1000
    link/ether 02:00:00:00:07:00 brd ff:ff:ff:ff:ff:ff permaddr 42:00:00:00:07:00

Notice that ap1-mp2 is DOWN and ap2-wlan2 is up. ap2-wlan2 is doing nothing in the topology.
Trying to set ap1-mp2 to UP will not work
>> sudo ip link set ap1-mp2 up
because ap1-wlan2 is up and they both have the same MAC address.

I've solved this by creating the mesh connection manually, and ignoring the way you have, using this code
for i, ap in enumerate([ap1, ap2, ap3]):
      mesh_intf = f"{ap}-wlan2"
      ap.cmd(f"ip link set {mesh_intf} down")
      ap.cmd(f"iw dev {mesh_intf} set type mp")
      ap.cmd(f"ip link set {mesh_intf} up")
      ap.cmd(f'iw dev {mesh_intf} mesh join mesh-ssid')

And it worked flawlessly.

Can you justify the behavior you created in link.py?

Ramon Fontes

unread,
Aug 30, 2024, 8:40:42 PM8/30/24
to Osama Abu Hamdan, mininet-wifi-discuss
It disables the interface I am expecting to be connected to the mesh and creates this new interface, sets it to mesh type, and assign to a new mesh connection as in

That's how mesh works on Linux! There is no problem with that. You cannot create a mesh interface from nothing.

> So now, we have ap1-wlan2 and ap1-mp2. ap1-wlan2 is expected to get involved in a mesh connection, but in fact it doesn't. Instead, ap1-mp2 is created and it is assigned to the same MAC and ap1-wlan2.

Again, that's how mesh works on Linux!

> This behavior causes this problem:
>> ip a
3727: ap1-wlan2: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 02:00:00:00
:07:00 brd ff:ff:ff:ff:ff:ff
3732: ap1-mp2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master ovs-system state DOWN group default qlen 1000
    link/ether 02:00:00:00:07:00 brd ff:ff:ff:ff:ff:ff permaddr 42:00:00:00:07:00
Notice that ap1-mp2 is DOWN and ap2-wlan2 is up. ap2-wlan2 is doing nothing in the topology.

You are probably not following one of the main recommendations: disabling network manager! Interfaces will probably be up without network manager.

>> Trying to set ap1-mp2 to UP will not work
>> sudo ip link set ap1-mp2 up
>> because ap1-wlan2 is up and they both have the same MAC address.

They must have the same MAC address! And ap1-wlan2 must be DOWN!

> I've solved this by creating the mesh connection manually, and ignoring the way you have, using this code

You don't have to do that!

> Can you justify the behavior you created in link.py?

Do I still have to do it?

Ramon Fontes

unread,
Aug 30, 2024, 8:43:18 PM8/30/24
to Osama Abu Hamdan, mininet-wifi-discuss

Osama Abu Hamdan

unread,
Aug 30, 2024, 10:19:34 PM8/30/24
to mininet-wifi-discuss
> That's how mesh works on Linux! There is no problem with that. You cannot create a mesh interface from nothing.
Can you provide me with a documentation, professor?
I don't see why I need to create 2 more interfaces (ap1-wlan2 and ap1-mp2) to get mesh network working, while it worked with ap1-wlan2 only with me. 

> You are probably not following one of the main recommendations: disabling network manager! Interfaces will probably be up without network manager.
> They must have the same MAC address! And ap1-wlan2 must be DOWN!

I deactivated it.
Now, ap1-mp2, ap2-mp2, and ap3-mp2 goes up automatically. Still, ping doesn't work between sta1 and sta4.

Can you guide me on how to debug this?
When I did it manually it worked well, so I expect with code it'll be better.

Thanks, professor, for being patient on me.

Ramon Fontes

unread,
Aug 30, 2024, 10:26:30 PM8/30/24
to Osama Abu Hamdan, mininet-wifi-discuss
> Can you provide me with a documentation, professor?

What do you think about the following command?

iw dev wlan0 interface add $MESH_IFACE

It doesn't replace wlan0.

> Can you guide me on how to debug this?

As I said, you have to dissecate the packets.

--
You received this message because you are subscribed to the Google Groups "mininet-wifi-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mininet-wifi-dis...@googlegroups.com.

Ramon Fontes

unread,
Aug 30, 2024, 10:28:28 PM8/30/24
to Osama Abu Hamdan, mininet-wifi-discuss
*dissect the packets.
Reply all
Reply to author
Forward
0 new messages