netstat truncates interface name. Please migrate to ifconfig or other tool

Bug #1668685 reported by Veron Rado on 2017-02-28
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Gufw
Undecided
costales

Bug Description

Hi
Ruinng Ubuntu 16.10.
My Ethernet device's correct ID is enp0s31f4.

Using the "Add a Firewall Rule" under "Advanced" and then "Interfaces" Gufw identifies it as enp0s31f (It drops the last digit.)
I only twigged it when I was troubleshooting an Ethernet rule that wouldn't work. When set to "All Interfaces" it worked fine.

All other tools I've use identify the interface correctly (ifconfig, ifstat etc.)

From a question I asked on Answers I learned Gufw uses netstat to get the interface name.[2]

Checking netstat I can confirm it is the cause of the error.

$ netstat -i
Kernel Interface table
Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
enp0s31f 1500 41477 0 0 0 18446 0 0 0 BMRU

$ ifconfig -a
enp0s31f4: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500

Apparently netstat is depreciated on Linux.[1]
Could you please migrate to a better tool like ifconfig?
Thanks.

[1] https://en.wikipedia.org/wiki/Netstat
[2] https://answers.launchpad.net/gui-ufw/+question/469053

Related branches

Veron Rado (junket) on 2017-02-28
summary: - netstat trucates interface name. Please migrate to ifconfig or other
+ netstat truncates interface name. Please migrate to ifconfig or other
tool
description: updated
description: updated
costales (costales) on 2017-02-28
Changed in gui-ufw:
status: New → Triaged
assignee: nobody → costales (costales)
milestone: none → 17.10
costales (costales) wrote :

Hi Veron,

Could you do me a test please?
Are OK these interfaces for your system?

costales@desktop:~$ ls /sys/class/net
enp0s22 lo wlp3s1
costales@desktop:~$

Thanks in advance!

Changed in gui-ufw:
status: Triaged → In Progress
costales (costales) wrote :

For my own information:
basename -a /sys/class/net/*

costales (costales) on 2017-05-21
Changed in gui-ufw:
status: In Progress → Fix Committed
costales (costales) on 2017-05-24
Changed in gui-ufw:
status: Fix Committed → Fix Released
Veron Rado (junket) wrote :

Sorry for missing your request, costales.
I have upgraded to Ubuntu 17.04 since posting this bug.

Here is what you were looking for:

$ ls /sys/calss/net/*
ls: cannot access '/sys/calss/net/*': No such file or directory

And then

$ basename -a /sys/class/net/*
enp0s31f4
lo
wlp3s1

Veron Rado (junket) wrote :

I think I did the first one wrong.
This is it without *

$ ls /sys/calss/net/
ls: cannot access '/sys/calss/net/': No such file or directory

Hi,

Thanks for the testing ;)

This improvements will be released in Ubuntu 17.10.

Please could you try that next Gufw version 17.10? (It works perfect in
another Ubuntu version, like 16.04 or 17.04):
wget
http://mirrors.kernel.org/ubuntu/pool/universe/g/gui-ufw/gufw_17.10.0-0ubuntu1_all.deb
&& dpkg -i gufw_17.10.0-0ubuntu1_all.deb

Thanks in advance!

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers