hologram-io / hologram-python

Hologram device-side Python SDK - Send messages to the cloud in just 3 lines of code!
https://hologram.io/
MIT License
89 stars 47 forks source link

Reconnecting PPP after disconnecting fails with route error #31

Closed DomAmato closed 4 years ago

DomAmato commented 4 years ago

Describe the problem

2020-04-21 20:58:01,370 [INFO] Hologram.Network.Network (2990): Adding routes to Hologram cloud
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/pi/ftp/hologram/__main__.py", line 32, in <module>
    pinger.run()
  File "/home/pi/ftp/hologram/pinger.py", line 67, in run
    self.upload()
  File "/home/pi/ftp/hologram/pinger.py", line 101, in upload
    self.hologram.network.connect()
  File "/usr/local/lib/python3.7/dist-packages/Hologram/Network/Cellular.py", line 77, in connect
    self.__configure_routing()
  File "/usr/local/lib/python3.7/dist-packages/Hologram/Network/Cellular.py", line 170, in __configure_routing
    self._route.add('10.176.0.0/16', self.localIPAddress)
  File "/usr/local/lib/python3.7/dist-packages/Hologram/Network/Route.py", line 61, in add
    gateway=gateway)
  File "/usr/local/lib/python3.7/dist-packages/pyroute2/iproute/linux.py", line 1886, in route
    callback=callback)
  File "/usr/local/lib/python3.7/dist-packages/pyroute2/netlink/nlsocket.py", line 375, in nlm_request
    return tuple(self._genlm_request(*argv, **kwarg))
  File "/usr/local/lib/python3.7/dist-packages/pyroute2/netlink/nlsocket.py", line 867, in nlm_request
    callback=callback):
  File "/usr/local/lib/python3.7/dist-packages/pyroute2/netlink/nlsocket.py", line 378, in get
    return tuple(self._genlm_get(*argv, **kwarg))
  File "/usr/local/lib/python3.7/dist-packages/pyroute2/netlink/nlsocket.py", line 703, in get
    raise msg['header']['error']
pyroute2.netlink.exceptions.NetlinkError: (101, 'Network is unreachable')

Expected behavior

It should reestablish a connection without error

Actual behavior

the IP route in pyroute 2 is not removed, we tried work around in another branch because of an error reported in the forums but that still failed.

Steps to reproduce the behavior

disconnect from a PPP session and then try to reconnect

System information