Bug 1557470 - netstat -i cut's interface names
Summary: netstat -i cut's interface names
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: net-tools
Version: 27
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Michal Ruprich
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1568317 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-03-16 15:55 UTC by Harald Reindl
Modified: 2018-05-01 13:18 UTC (History)
5 users (show)

Fixed In Version: net-tools-2.0-0.50.20160912git.fc28 net-tools-2.0-0.47.20160912git.fc27 net-tools-2.0-0.45.20160912git.fc26
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-27 23:07:12 UTC
Type: Bug


Attachments (Terms of Use)

Description Harald Reindl 2018-03-16 15:55:29 UTC
[harry@srv-rhsoft:~]$ netstat -i
Kernel Schnittstellentabelle
Iface      MTU    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
br-guest  1500        0      0      0 0             0      0      0      0 BRU
br-lan    1500    92563      0      0 0        104801      0      0      0 BMRU
br-wan    1500  9020710      0      0 0       2188101      0      0      0 BRU
lan-gues  1500        0      0      0 0             0      0      0      0 BMU
lan-spar  1500        0      0      0 0             0      0      0      0 BMU
lan-spar  1500        0      0      0 0             0      0      0      0 BMU
lan-tv    1500      730      0      0 0          1153      0      0      0 BMU
lo       65536  1733318      0      0 0       1733318      0      0      0 LRU
poe-phon  1500    26338      0   1074 0         25089      0      0      0 BMRU
poe-spar  1500        0      0      0 0             0      0      0      0 BMU
vmnet1    1500    62600      0      0 0       2859911      0      0      0 BRU
vmnet8    1500  1421389      0      0 0       2723432      0      0      0 BMRU
vpn-clie  1472  3223758      0  14092 0       1781558      0      0      0 BMRU
vpn-serv  1500        0      0      0 0             0      0      0      0 MOPRU
wan       1500  9223356      0      0 0       2302645      0      0      0 BRU
wlan0     1500    66555      0      0 0         87345      0      0      0 BMRU
wlan1     1500        0      0      0 0             0      0      0      0 BRU

it is not helpful to cut names like "poe-phone", "vpn-client", "vpn-server"

[root@srv-rhsoft:~]$ for i in $(netstat -i | cut -f1 -d" " | tail -n+3) ; do echo "$i: $(ethtool "$i" | grep Speed | sed 's/Speed://g')" ; done
br-guest:
br-lan:
br-wan:
Cannot get device settings: No such device
Cannot get wake-on-lan settings: No such device
Cannot get message level: No such device
Cannot get link status: No such device
lan-gues:
Cannot get device settings: No such device
Cannot get wake-on-lan settings: No such device
Cannot get message level: No such device
Cannot get link status: No such device
lan-spar:
Cannot get device settings: No such device
Cannot get wake-on-lan settings: No such device
Cannot get message level: No such device
Cannot get link status: No such device
lan-spar:
lan-tv:          Unknown!
lo:
Cannot get device settings: No such device
Cannot get wake-on-lan settings: No such device
Cannot get message level: No such device
Cannot get link status: No such device
poe-phon:
Cannot get device settings: No such device
Cannot get wake-on-lan settings: No such device
Cannot get message level: No such device
Cannot get link status: No such device
poe-spar:
vmnet1:
vmnet8:
Cannot get device settings: No such device
Cannot get wake-on-lan settings: No such device
Cannot get message level: No such device
Cannot get link status: No such device
vpn-clie:
Cannot get device settings: No such device
Cannot get wake-on-lan settings: No such device
Cannot get message level: No such device
Cannot get link status: No such device
vpn-serv:
wan:     1000Mb/s
wlan0:
wlan1:

Comment 1 Michal Ruprich 2018-03-19 10:44:03 UTC
I believe that this is intentional. When you use -i, netstat calls function ife_print_short. So with -i the output should be as short as possible (possibly to fit 80 chars as the default terminal width?). 

I suggest that you use netstat -ie which gives you more much better output or you could use ip -s link from iprout2 package. This command is suggested in the netstat man page due to netstat being deprecated for a long time now.

Regards,
Michal

Comment 2 Harald Reindl 2018-03-19 10:52:06 UTC
"80 chars as the default terminal width" is somehow 1970 on a 32" screen at least when there is no option to disable that crazy behavior
_________________

> I suggest that you use netstat -ie which gives you more much better output

how that?
you have a ton of lines instzead one per interface
how would you run code like below aginast that?

for i in $(netstat -i | cut -f1 -d" " | tail -n+3) ; do echo "$i: $(ethtool "$i" | grep Speed | sed 's/Speed://g')" ; done
_________________

ip -s link - the same

14: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 00:e0:4c:80:5c:ca brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast
    2476773    20984    0       0       0       0
    TX: bytes  packets  errors  dropped carrier collsns
    7651953    17113    0       0       0       0
_________________

do you realize that "for i in $(netstat -i | cut -f1 -d" " | tail -n+3) ; do echo "$i: $(ethtool "$i" | grep Speed | sed 's/Speed://g')" ; done" is intended to get the current link speed of each interface?

Comment 3 Michal Ruprich 2018-03-19 11:17:30 UTC
for i in $(ip -o link | cut -f2 -d" " | sed 's/://g'); do echo "$i: $(ethtool "$i" | grep Speed | sed 's/Speed://g')" ; done

Comment 4 Harald Reindl 2018-03-19 11:22:00 UTC
ok, that works, but can we agree that "netstat -i" output is broken given that most cli software these days is aware about the dimensions of the terminal emulator instead hardcoded to 80 chars width

Comment 5 Michal Ruprich 2018-04-17 11:19:24 UTC
*** Bug 1568317 has been marked as a duplicate of this bug. ***

Comment 6 Fedora Update System 2018-04-25 10:06:01 UTC
net-tools-2.0-0.50.20160912git.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-991485057f

Comment 7 Fedora Update System 2018-04-25 10:06:14 UTC
net-tools-2.0-0.47.20160912git.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-20fa8b3193

Comment 8 Fedora Update System 2018-04-25 10:06:22 UTC
net-tools-2.0-0.45.20160912git.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2018-c31581a549

Comment 9 Fedora Update System 2018-04-25 19:43:34 UTC
net-tools-2.0-0.47.20160912git.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-20fa8b3193

Comment 10 Fedora Update System 2018-04-25 20:10:58 UTC
net-tools-2.0-0.45.20160912git.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-c31581a549

Comment 11 Fedora Update System 2018-04-26 04:52:50 UTC
net-tools-2.0-0.50.20160912git.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-991485057f

Comment 12 Fedora Update System 2018-04-27 23:07:12 UTC
net-tools-2.0-0.50.20160912git.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.

Comment 13 Fedora Update System 2018-04-30 04:37:39 UTC
net-tools-2.0-0.47.20160912git.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2018-05-01 13:18:12 UTC
net-tools-2.0-0.45.20160912git.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.