python icon indicating copy to clipboard operation
python copied to clipboard

Tunnel: ifconfig are outdated

Open marek22k opened this issue 2 years ago • 7 comments

Hello,

ifconfig is obsolete on Linux and should be replaced by ip. On some Linux distributions, ifconfig is no longer (pre)installed.

$ sudo meshtastic --tunnel
Connected to radio
INFO file:tunnel.py __init__ line:83 Starting IP to mesh tunnel (you must be root for this *pre-alpha* feature to work).  Mesh members:
INFO file:tunnel.py __init__ line:95 Node !5687b499 has IP address None.180.153
INFO file:tunnel.py __init__ line:95 Node !148bfdc5 has IP address None.253.197
sh: line 1: ifconfig: command not found
Aborting due to: 

marek22k avatar Dec 04 '23 12:12 marek22k

This issue has been mentioned on Meshtastic. There might be relevant details there:

https://meshtastic.discourse.group/t/meshtastic-tunnel-sh-1-ifconfig-not-found/3818/4

geeksville avatar Dec 05 '23 09:12 geeksville

run: ip addr, some unix distro's require that.

Also have you installed "net-tools"

$ sudo apt-get install net-tools

OpenSource-For-Freedom avatar Dec 15 '23 23:12 OpenSource-For-Freedom

ifconfig is deprecated (see above) and should no longer be used on Linux systems. Therefore ip should be used.

Yes, installing net-tools solves the symptoms, but not the actual problem.

marek22k avatar Dec 16 '23 00:12 marek22k

Looking at the code in tunnel.py

it looks like its using the pytap2 library here https://github.com/meshtastic/python/blob/master/meshtastic/tunnel.py#L23

ifconfig from the pytap2 library is used here: https://github.com/meshtastic/python/blob/master/meshtastic/tunnel.py#L115

Looking at the pytap2 homepage it states a dependency on net-tools https://github.com/johnthagen/pytap2

I believe this third party dependency for net-tools should probably be included in the Meshtastic documentation.

could also raise this deprecation of ifconfig with the pytap2 library maintainers and get this fixed upstream

However looking at this comment it looks like they are well aware of this deprecation: https://github.com/johnthagen/pytap2/blob/master/src/pytap2/init.py#L162

        # TODO: New systems like Ubuntu 17.04 do not come with ifconfig pre-installed.
        ifconfig_cmd = "ifconfig {} ".format(self._name)

Issue raised with upstream pytap2 maintainers https://github.com/johnthagen/pytap2/issues/15

r-tierney avatar Jan 05 '24 03:01 r-tierney

Is this still out of date?

garthvh avatar Mar 16 '24 16:03 garthvh

Yes, it is legacy on Linux (i.e. not BSD).

marek22k avatar Mar 16 '24 16:03 marek22k

Just bumped the PR/issue I made on the pytap2 repo to make iproute2 the default instead of ifconfig

r-tierney avatar Mar 17 '24 06:03 r-tierney