Salt: Avoid use of deprecated net-tools

Created on 4 Jun 2020  路  19Comments  路  Source: saltstack/salt

Is your feature request related to a problem? Please describe.
The linux net-tools package has been deprecated since 2011, and provides commands including arp, ifconfig, iptunnel, iwconfig, nameif, netstat, and route.

Some salt modules make use of these commands, causing failures when they're not available (#57513).

Describe the solution you'd like
Code should be rewritten, preferring first native python (e.g. pyroute2) then the iproute2 tools (e.g. ip), then only falling back to net-tools if that's all that is available. If every supported platform has already migrated to iproute2 then the fallback is not required.

Describe alternatives you've considered
Continue to depend on systems providing the net-tools package. This won't work forever.

Additional context
Replacement commands:

net-tools | iproute2
-- | --
arp | ip neighbor
ifconfig | ip addr, ip link, ip -stats
iptunnel | ip tunnel
iwconfig | iw
nameif | ip link
netstat | ss
route | ip route

Aluminium Feature phase-plan severity-high status-in-prog

Most helpful comment

I think the whole of debian_ip needs rewriting. Every config file and tool it uses is obsolete (for Ubuntu).
Related: #54791

All 19 comments

The issue described here https://github.com/saltstack/salt/pull/55416

could probably be fixed at the same time.

I don't know if I would called this a feature - I see it as an enhancement to something that currently exists and is not working due to an upstream dependency deprecation some time ago (2011?!), but I don't have a template for enhancement :) so this works

@sagetherage the only options are Bug and Feature

yes, I put those in place, mostly putting notes for myself :)

Closely related: Ubuntu doesn't use ifupdown any more, but netplan. The file /etc/network/interfaces is also not used.

I think the whole of debian_ip needs rewriting. Every config file and tool it uses is obsolete (for Ubuntu).
Related: #54791

Note: the old net-tools cannot be totally removed since still have to support older OS's, for example: Solaris 10, some of the underlying OS's on some switch/routers, AIX. But as stated above, have the net-tools as a fall back for when more modern implementations are not available.

Capturing a thread from community slack here

From: @OrangeDog

also NetworkManager vs. systemd-networkd / ifupdown vs. netplat, etc.

From @terminalmage
@OrangeDog for a second I thought you were referring to network teaming for network.managed states on EL7 and 8 I actually have implemented that at work and plan to submit upstream soon

So, need to do a root and branch update of networking when handling replacement of net-tools, allowing for older OS's (Solaris, AIX) and what is available on older Linux platforms, for example: Debian 9, Ubuntu 16.04, and FreeBSD too.

I think you misread, @dmurphy18. I wasn't saying I did any of that, I was saying that I implemented network teaming already, which is entirely unrelated to this.

@dmurphy18 That should've been netplan.

Debian 9 and Ubuntu 16.04 also have iproute2. So does Debian 8. So did Debian 4.

More related: #13085, #49078, #57618

The PR #54572 was merged, but then reverted at some point. The Suggests: ifupdown was also not removed.

This is possibly the cause of errors (which used to also cause stacktraces) in #6922. Ubuntu 18.04 and netplan are mentioned.

@terminalmage sorry about that, was grouping network work together, or at least anything with the word network in it :)

likely we need an epic created in planning and listing out all the different tasks to track we don't miss something

I did a quick grep of the code and then checked the matching files. Here's what I found, though I welcome people doing their own analysis in case I missed something:

  • salt/modules/bridge.py - Seems to be used for BSD only. Not sure if this is a problem.
  • salt/modules/iwtools.py - Seems we can leave this alone since this module is specific to using iwtools
  • salt/modules/lxc.py - iproute2 already used here as well and is preferred
  • salt/modules/network.py - Both ss and netstat are supported, but netstat is preferred if both are present. Should ss be preferred moving forward?
  • salt/modules/nspawn.py - ifconfig is referenced in CLI examples in docstrings. Not sure if necessary to update.
  • salt/modules/ps.py - Both ss and netstat are supported here and are exposed as their own Salt functions, which are already conditionally loaded depending on whether either are installed. So, no change needs to be made here.
  • salt/modules/vagrant.py - ifconfig used in get_ssh_config(). No ip equivalent exists and we probably need to consider adding one (and preferring it).
  • salt/modules/win_network.py - netstat referenced, but this is Windows' version of it.
  • salt/modules/win_status.py - Same as win_network.py
  • salt/utils/network.py - Only a couple of the BSDs rely on ifconfig. Not sure if this is a problem.
  • salt/modules/network.py is using arp, which was the original issue I linked to
  • salt/modules/linux_ip.py is using ip, but using cmd strings instead of arg lists

There's also this changelog entry I'm not exactly sure what it refers to, but if arp isn't installed then ip should still be an option.

net.arp will no longer be made available unless arp is installed

let's break this down into smaller pieces if we can; @bryceml and perhaps this could be an epic that may span over more than one release

Still looking at this to plan out what can be accomplished in the Aluminium release cycle, so putting it into status-in-prog but is still in phase-planning until we can break this into pieces of work. I will attempt to get that done over the next few week and feedback is welcomed, as in what is most used and perhaps high priority that needs attention and work, first.

marking down here that although ubuntu doesn't use ifupdown anymore, debian 10 does by default, so we should keep that in mind when deprecating things. It also means we probably need to start handling debian and ubuntu networking much more separately. See https://github.com/saltstack/salt/pull/57637#issuecomment-758341701

btw, I'm fine with removing the Suggests: ifupdown from the ubuntu packages whenever that's wanted, that doesn't bother me either way.

It shouldn't be by what distribution it is, but by what networking system it's using. Both Debian and Ubuntu can use either, though the defaults are different. RHEL systems similarly are changing between NetworkManager and systemd-networkd.

Was this page helpful?
0 / 5 - 0 ratings