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

Bug #1668685 reported by Veron Rado
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Gufw
Fix Released
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)
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)
Changed in gui-ufw:
status: New → Triaged
assignee: nobody → costales (costales)
milestone: none → 17.10
Revision history for this message
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
Revision history for this message
costales (costales) wrote :

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

costales (costales)
Changed in gui-ufw:
status: In Progress → Fix Committed
costales (costales)
Changed in gui-ufw:
status: Fix Committed → Fix Released
Revision history for this message
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

Revision history for this message
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

Revision history for this message
costales (costales) wrote : Re: [Bug 1668685] Re: netstat truncates interface name. Please migrate to ifconfig or other tool

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  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.