Live data from Hacker News

Linux maintains bugs: The real reason ifconfig on Linux is deprecated (2018)

blog.farhan.codes

11–20 of 141 posts

Re: Linux maintains bugs: The real reason ifconfig on Linux is deprecated (2018)

#11
> The only to prevent this would be to conduct regular massively coordinated updates to system utilities when the kernel changes, and properly version applications for specific kernel releases.

Well, no. What you do is create a new struct with correct behavior and let new applications use that. The old struct becomes deprecated but continues to exist until things stop using it. Which may be indefinitely, but that's not really a lot more work than maintaining a compatibility library to serve the same purpose.

The thing with ip vs. ifconfig was more to do with there being somebody interested in creating ip and nobody interested in maintaining ifconfig. If you want to go add support for multiple addresses on the same interface to ifconfig, nobody is stopping you -- in fact that has already happened now.

Re: Linux maintains bugs: The real reason ifconfig on Linux is deprecated (2018)

#12
Huh?!?

I use multiple addresses a lot, and recall having used them through ifconfig for years, probably well over a decade. Anyway, at least on Debian, the package net-tools brings ifconfig it back, again with full multiple addresses support.

  # uname -v
  #1 SMP Debian 5.4.19-1 (2020-02-13)


  # ifconfig
  enp2s0: flags=4163  mtu 1500
        inet 192.168.10.42  netmask 255.255.255.0  broadcast 192.168.10.255
        inet6 fe80::2e4d:54ff:fed8:7b59  prefixlen 64  scopeid 0x20
        ether 2c:4d:54:d8:7b:59  txqueuelen 1000  (Ethernet)
        RX packets 1162942  bytes 1627138668 (1.5 GiB)
        RX errors 0  dropped 42049  overruns 0  frame 0
        TX packets 546159  bytes 41181499 (39.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

  lo: flags=73  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 16  bytes 818 (818.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 16  bytes 818 (818.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


  # ifconfig enp2s0:1 192.168.1.42

  # ifconfig
  enp2s0: flags=4163  mtu 1500
        inet 192.168.10.42  netmask 255.255.255.0  broadcast 192.168.10.255
        inet6 fe80::2e4d:54ff:fed8:7b59  prefixlen 64  scopeid 0x20
        ether 2c:4d:54:d8:7b:59  txqueuelen 1000  (Ethernet)
        RX packets 1163011  bytes 1627147417 (1.5 GiB)
        RX errors 0  dropped 42089  overruns 0  frame 0
        TX packets 546185  bytes 41184061 (39.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

  enp2s0:1: flags=4163  mtu 1500
        inet 192.168.1.42  netmask 255.255.255.0  broadcast 192.168.1.255
        ether 2c:4d:54:d8:7b:59  txqueuelen 1000  (Ethernet)

  lo: flags=73  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 16  bytes 818 (818.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 16  bytes 818 (818.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Re: Linux maintains bugs: The real reason ifconfig on Linux is deprecated (2018)

#13
Indeed, ip is vastly superior. But it took me almost a year of working with internet gateways (i.e as a day job) to let old habits die. Learning the new output format takes time.

I've almost replaced route with "ip route" as well. arp isn't fully replaced yet in muscle memory.

Also, as a comment on the article, ip can now fully replace brctl. (and iw replaces iwconfig and iwlist).

Re: Linux maintains bugs: The real reason ifconfig on Linux is deprecated (2018)

#14
post #6

Here's an example from a decade ago (ifconfig was deprecated then too): - bonded interfaces - with vlans - with multiple IPs If this sounds unrealistic, it was the standard config for index arbitrage at an investment bank. The interfaces, added with distro scripts, will use `ip` and all the interfaces will show up in `ip addr` and work perfectly. ifconfig won't show about half of them - they won't be up, or down, the…

I don’t doubt that you’ve had problems but e.g. ‘ifconfig bond0.143’ references an ethernet interface that represents vlan 143 on the bonded interface bond0. This sort of setup has worked for at least a decade on Linux for me, probably longer.

Re: Linux maintains bugs: The real reason ifconfig on Linux is deprecated (2018)

#15
post #5

I don't buy it. Yes, Linux never breaks userland. Yes, ifconfig is deprecated. But I still don't see how these are related.

I still don't understand how this "Linux never breaks userland" thing holds up, it's been proven false. The 4.13 kernel introduced a change to effectively namespace sysctl settings (prevent the change from default from being copied to the host system into container processes). This broke any container runtimes that relied on host-wide sysctl settings. [1] https://github.com/aws/amazon-ecs-agent/issues/789 [2] https:/…

I use systemd-nspawn. It works on a 3.10.87 kernel on mips64.

That's pretty impressive.

Re: Linux maintains bugs: The real reason ifconfig on Linux is deprecated (2018)

#16
There's an assumption which this article makes which is not true; namely, that the only utilities which do (or should) use ioctl's are system programs like ipconfig which are shipped with the kernel. There are other programs, like for example Kerberos, who want to know what network addresses are used by the network, and requiring them to screen scrape ipconfig is not especially reasonable. So if you randomly change ioctls, then you randomly break other programs that might not be shipped with the kernel that need to use those ioctls. Maintaining proper backwards compatibility for userspace applications, and not labelling some set of interfaces as "can randomly change, and if you use them and you're aren't part of the privileged set of programs shipped with the kernel, well, it just sucks to be you", is not, in my opinion a professional way to run an OS.

Re: Linux maintains bugs: The real reason ifconfig on Linux is deprecated (2018)

#17

Huh?!? I use multiple addresses a lot, and recall having used them through ifconfig for years, probably well over a decade. Anyway, at least on Debian, the package net-tools brings ifconfig it back, again with full multiple addresses support. # uname -v #1 SMP Debian 5.4.19-1 (2020-02-13) # ifconfig enp2s0: flags=4163 mtu 1500 inet 192.168.10.42 netmask 255.255.255.0 broadcast 192.168.10.255 inet6 fe80::2e4d:54ff:fed…

    ifconfig enp2s0:1 192.168.1.42
Now try

    ip addr add dev enp2s0 192.168.42.1/24
and observe how ifconfig ignores the second IP on the same interface. enp2s0:1 is an alias to enp2s0, not enp2s0 itself. To replicate your ifconfig command, you'd use

    ip addr add dev enp2s0 192.168.1.42/32 label enp2s0:1
and then it shows up in ifconfig as well.

Re: Linux maintains bugs: The real reason ifconfig on Linux is deprecated (2018)

#18
post #10

It's not quite that simple. People actually tried to update net-tools ifconfig (one of the two ifconfigs back in 2018). In 2019, I simply wrote an ifconfig that uses the netlink API, because for portability I needed a Linux ifconfig that had a FreeBSD-like command-line syntax. It doesn't have the old interface aliasing mentioned in the headlined article, and has no problems setting up and reporting IPv6 addresses or…

> People actually tried to update net-tools ifconfig (one of the two ifconfigs back in 2018).

What happened?

Re: Linux maintains bugs: The real reason ifconfig on Linux is deprecated (2018)

#19
post #10

It's not quite that simple. People actually tried to update net-tools ifconfig (one of the two ifconfigs back in 2018). In 2019, I simply wrote an ifconfig that uses the netlink API, because for portability I needed a Linux ifconfig that had a FreeBSD-like command-line syntax. It doesn't have the old interface aliasing mentioned in the headlined article, and has no problems setting up and reporting IPv6 addresses or…

> People actually tried to update net-tools ifconfig (one of the two ifconfigs back in 2018). What happened?

See the StackExchange answer.

Re: Linux maintains bugs: The real reason ifconfig on Linux is deprecated (2018)

#20
post #17

Huh?!? I use multiple addresses a lot, and recall having used them through ifconfig for years, probably well over a decade. Anyway, at least on Debian, the package net-tools brings ifconfig it back, again with full multiple addresses support. # uname -v #1 SMP Debian 5.4.19-1 (2020-02-13) # ifconfig enp2s0: flags=4163 mtu 1500 inet 192.168.10.42 netmask 255.255.255.0 broadcast 192.168.10.255 inet6 fe80::2e4d:54ff:fed…

ifconfig enp2s0:1 192.168.1.42 Now try ip addr add dev enp2s0 192.168.42.1/24 and observe how ifconfig ignores the second IP on the same interface. enp2s0:1 is an alias to enp2s0, not enp2s0 itself. To replicate your ifconfig command, you'd use ip addr add dev enp2s0 192.168.1.42/32 label enp2s0:1 and then it shows up in ifconfig as well.

You're right, it's not exactly the same thing and both approaches (with an alias and without) have their uses. ifconfig forcing you to come up with a unique label can be annoying when you want some script to add a new address to an interface without having to go handle the error case of "but what if :1 is already used?".

Meanwhile having an explicit label can be nice in other situations if you want to replace an address instead of merely adding a new one.

I also seem to recall running into issues dealing with IPv6 with ifconfig that I worked around by switching to ip. I don't remember the specifics however.

Overall I wish ifconfig had been updated, I still find it a lot more user friendly that iproute. In particular the default output of a plain "ifconfig" is vastly more readable IMO: https://svkt.org/~simias/up/20200319-165513_ip.png

In general these days I use ip in scripts and ifconfig (when available) interactively. I don't love having to remember two ways of doing the same thing but I can't rely on ifconfig being available in scripts anymore and I just waste too much time parsing ip's bad output when I'm messing with networking interactively.

Post reply on HN