Skip to content

Commit

Permalink
Don't crash if we can't start the nl80211 listener.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathieu Trudel-Lapierre committed Dec 22, 2016
1 parent bc42538 commit 09c4491
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions probert/network.py
Expand Up @@ -334,13 +334,19 @@ def start(self):
self.rtlistener = _rtnetlink.listener(self)
self.rtlistener.start()

self.wlan_listener = _nl80211.listener(self)
self.wlan_listener.start()

self._fdmap = {
self.rtlistener.fileno(): self.rtlistener.data_ready,
self.wlan_listener.fileno(): self.wlan_listener.data_ready,
}

try:
self.wlan_listener = _nl80211.listener(self)
self.wlan_listener.start()
self._fdmap.update({
self.wlan_listener.fileno(): self.wlan_listener.data_ready,
})
except RuntimeError:
log.debug('could not start wlan_listener')

return list(self._fdmap)

def data_ready(self, fd):
Expand Down

2 comments on commit 09c4491

@longsleep
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can the nl80211 lister fail in the first place? I have the problem with porting snappy to Pine64. See https://bugs.launchpad.net/ubuntu/+source/subiquity/+bug/1652262 for the bug entry.

2016-12-23 08:05:59,789 subiquitycore.core:159 Exception in controller.run():
Traceback (most recent call last):
File "/usr/share/subiquity/subiquitycore/core.py", line 154, in run
self.common['controllers'][k] = klass(self.common)
File "/usr/share/subiquity/subiquitycore/controllers/network.py", line 327, in init
self.observer.start()
File "/usr/share/subiquity/subiquitycore/controllers/network.py", line 226, in start
fds = super().start()
File "/usr/lib/python3/dist-packages/probert/network.py", line 319, in start
self.wlan_listener.start()
RuntimeError: nl_get_multicast_ids failed: -2

I also tried to replicate the issue with a simple c program, but there it works just fine. See https://gist.github.com/longsleep/03e034a8cd27e112ed64968df8b37501 for the code.

@mwhudson
Copy link
Collaborator

@mwhudson mwhudson commented on 09c4491 Jan 1, 2017 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.