Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 501432 - net-analyzer/ethstatus-0.4.3 fails with interface names longer than 5 characters
Summary: net-analyzer/ethstatus-0.4.3 fails with interface names longer than 5 characters
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Netmon project
URL:
Whiteboard:
Keywords: PMASKED
Depends on:
Blocks:
 
Reported: 2014-02-15 23:37 UTC by Rabi
Modified: 2014-04-27 14:55 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
ifname_len.patch (ifname_len.patch,281 bytes, patch)
2014-02-19 11:34 UTC, Konstantin Ivanov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rabi 2014-02-15 23:37:32 UTC
net-analyzer/ethstatus-0.4.3 has a check (ethstatus.c: Line 639) which rejects interface names that exceed 5 characters. Since enp6s0 is a valid interface name, it rejects `ethstatus -i enp6s0` and quits printing the help message.

Reproducible: Always

Steps to Reproduce:
1. Install net-analyzer/ethstatus-0.4.3
2. ethstatus -i enp6s0
Actual Results:  
> ethstatus -i enp6s0

EthStatus v0.4a - Gabriel Montenegro / Christoph Haas
Usage: ethstatus
  [-i interface]                      interface name
  [-v [vga|mono]]                     video display mode
  [-S speed[k|m|g]]                   line speed in [K|M|G]bps
  [-s [10|100|64|128|256|768|1540]]   line speed (backward compatibility)


Expected Results:  
Should accept interface names atleast upto 6 characters (like enp6s0, wlp3s0, etc.) or even more if thats common.
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2014-02-15 23:42:15 UTC
That looks like quite the arbitrary limit indeed. :)
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2014-02-16 00:15:06 UTC
Could you try net-analyzer/ifstatus instead, please? It's based on ethstatus and behaves largely the same way. If that works for you, then we can probably work toward removing ethstatus from the tree.
Comment 3 Rabi 2014-02-16 13:19:22 UTC
(In reply to Jeroen Roovers from comment #2)
> Could you try net-analyzer/ifstatus instead, please? It's based on ethstatus
> and behaves largely the same way. If that works for you, then we can
> probably work toward removing ethstatus from the tree.

Thanks for your suggestion. I tried net-analyzer/ifstatus and it did the work :)
Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2014-02-16 13:39:35 UTC
Masked for removal on or about 16 March 2014.
Comment 5 Konstantin Ivanov 2014-02-19 11:33:39 UTC
(In reply to Jeroen Roovers from comment #4)
> Masked for removal on or about 16 March 2014.

Here is a patch (ifname_len.patch) to work correctly with ethstatus interface names longer than 5 characters.

--- ethstatus_old.c     2014-02-19 15:22:55.493787869 +0400
+++ ethstatus.c 2014-02-19 15:24:49.685791811 +0400
@@ -636,11 +636,6 @@
                                break;
 
                        case 'i':
-                               if(strlen(optarg) > 5)
-                               {
-                                       show_usage(argv[0]);
-                                       exit(10);
-                               }
                                interface = optarg;
                                break;


I think Needless ethstatus removed from the tree.
Comment 6 Konstantin Ivanov 2014-02-19 11:34:26 UTC
Created attachment 370754 [details, diff]
ifname_len.patch

Removes the restriction on the length of the name of the interface.
Comment 7 Jeroen Roovers (RETIRED) gentoo-dev 2014-02-20 01:05:54 UTC
(In reply to Konstantin Ivanov from comment #5)
> I think Needless ethstatus removed from the tree.

I still think net-analyzer/ifstatus is a better alternative than patching up this abandoned software.
Comment 8 Konstantin Ivanov 2014-02-20 06:09:23 UTC
(In reply to Jeroen Roovers from comment #7)
> (In reply to Konstantin Ivanov from comment #5)
> > I think Needless ethstatus removed from the tree.
> 
> I still think net-analyzer/ifstatus is a better alternative than patching up
> this abandoned software.

net-analyzer/ifstatus not work. 

I have multiple interfaces using net-analyzer/ethstatus I can explicitly specify which interface would like to receive information. 

When using net-analyzer/ifstatus this is not possible. He always shows the data of the last interface. Check it out. 

About the patch, you looked ethstatus source code? This "patch" simply removes the check from the code on the length of the interface name. 

These lines: 
                                if (strlen (optarg)> 5) 
                                { 
                                        show_usage (argv [0]); 
                                        exit (10); 
                                } 

it will have no negative impact on the program. 

Here is my list of interfaces: 

eth1: flags = 4163 <UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 
        inet 192.168.16.42 netmask 255.255.255.0 broadcast 192.168.16.255 
        inet6 xx :: xx: xx: xx: xx prefixlen 64 scopeid 0x20 <link> 
        ether xx: xx: xx: xx: xx: xx txqueuelen 1000 (Ethernet) 
        RX packets 23810 bytes 5099551 (4.8 MiB) 
        RX errors 0 dropped 0 overruns 0 frame 0 
        TX packets 10811 bytes 2060195 (1.9 MiB) 
        TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 
        device interrupt 19 

lo: flags = 73 <UP,LOOPBACK,RUNNING> mtu 65536 
        inet 127.0.0.1 netmask 255.0.0.0 
        inet6 :: 1 prefixlen 128 scopeid 0x10 <host> 
        loop txqueuelen 0 (Local Loopback) 
        RX packets 626 bytes 98822 (96.5 KiB) 
        RX errors 0 dropped 0 overruns 0 frame 0 
        TX packets 626 bytes 98822 (96.5 KiB) 
        TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 

ppp0: flags = 4305 <UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500 
        inet 10.172.72.36 netmask 255.255.255.255 destination 10.64.64.64 
        ppp txqueuelen 3 (Point-to-Point Protocol) 
        RX packets 8114 bytes 4452013 (4.2 MiB) 
        RX errors 0 dropped 0 overruns 0 frame 0 
        TX packets 7184 bytes 1656976 (1.5 MiB) 
        TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 

vmnet1: flags = 4163 <UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 
        inet 192.168.97.1 netmask 255.255.255.0 broadcast 192.168.97.255 
        inet6 fe80 :: 250:56 ff: fec0: 1 prefixlen 64 scopeid 0x20 <link> 
        ether 00:50:56: c0: 00:01 txqueuelen 1000 (Ethernet) 
        RX packets 0 bytes 0 (0.0 B) 
        RX errors 0 dropped 0 overruns 0 frame 0 
        TX packets 61 bytes 0 (0.0 B) 
        TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 

vmnet8: flags = 4163 <UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 
        inet 192.168.115.1 netmask 255.255.255.0 broadcast 192.168.115.255 
        inet6 fe80 :: 250:56 ff: fec0: 8 prefixlen 64 scopeid 0x20 <link> 
        ether 00:50:56: c0: 00:08 txqueuelen 1000 (Ethernet) 
        RX packets 0 bytes 0 (0.0 B) 
        RX errors 0 dropped 0 overruns 0 frame 0 
        TX packets 61 bytes 0 (0.0 B) 
        TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 

net-analyzer/ifstatus always shows information vmnet8. 

Check net-analyzer/ifstatus work on a system with multiple interfaces. 

So it is better to use the old, time-tested program, simply written, but it works. Than broken code.

Leave net-analyzer/ethstatus in the tree, I don't think him soon problems arise.
Comment 9 Konstantin Ivanov 2014-02-20 06:15:48 UTC
(In reply to Jeroen Roovers from comment #7)
> (In reply to Konstantin Ivanov from comment #5)
> > I think Needless ethstatus removed from the tree.
> 
> I still think net-analyzer/ifstatus is a better alternative than patching up
> this abandoned software.

Not noticed these lines: 
         elog "You may want to configure ~ / .ifstatus / ifstatus.cfg" 
         elog "before running ifstatus. For example, you may add" 
         elog "Interfaces = eth0 there. Read the README file for" 
         elog "more information." 

In any case it is inconvenient. To view information about another interface to make any changes to the file, instead of what would have to use the key "-i".
Comment 10 Jeroen Roovers (RETIRED) gentoo-dev 2014-02-20 14:52:44 UTC
Comment on attachment 370754 [details, diff]
ifname_len.patch

That doesn't seem very helpful.

./ethstatus -i "tro$(for i in $(seq 1 10000); do echo -n "lololo"; done)"

[...]

│     IP Address:                                                                                                                  │
│     Interface name:      trolololololololololololololololololol9.77 MB/slololololololololololololololololololololololololololololo
lololololololololololololol0.00 KB/slolololololololololololololol0lololololololololololololololololololololololololololololololololo
lololololololololololololol0lolololololololololololololololololol0lololololololololololololololololololololololololololololololololo
lololoReceived:            0.00 B      olTransmitted:            0.00 B      olololololololololololololololololololololololololololo
lololololololololololololol0lolololololololololololololololololol0lololololololololololololololololololololololololololololololololo
[...]


It's a useful (if faulty) check so why throw out the baby with the bathwater?
Comment 11 Konstantin Ivanov 2014-02-21 06:03:24 UTC
(In reply to Jeroen Roovers from comment #10)
> Comment on attachment 370754 [details, diff] [details, diff]
> ifname_len.patch
> 
> That doesn't seem very helpful.
> 
> ./ethstatus -i "tro$(for i in $(seq 1 10000); do echo -n "lololo"; done)"
> 
> [...]
> 
> │     IP Address:                                                           
> │
> │     Interface name:      trolololololololololololololololololol9.77
> MB/slololololololololololololololololololololololololololololo
> lololololololololololololol0.00
> KB/
> slolololololololololololololol0lololololololololololololololololololololololo
> lolololololololololo
> lololololololololololololol0lolololololololololololololololololol0lololololol
> olololololololololololololololololololololololololololo
> lololoReceived:            0.00 B      olTransmitted:            0.00 B     
> olololololololololololololololololololololololololololo
> lololololololololololololol0lolololololololololololololololololol0lololololol
> olololololololololololololololololololololololololololo
> [...]
> 
> 
> It's a useful (if faulty) check so why throw out the baby with the bathwater?

Well I can tell, very intelligent response. That was sarcasm. 

And often you pass the program parameters is meaningless? 

Even your example will not cause problems in the ethstatus. This is the same as specifying the name is not an existing interface. 

Instead of clowning would check the work recommended you ifstatus with the same inputs. 



echo "Interfaces = tro $ (for i in $ (seq 1 10000); do echo-n" lololo "; done)"> ~ / .ifstatus / ifstatus.tsfg 
ifstatus 

Ifstatus aborts, its code is written worse. 

=====================================================
                ifstatus[0x40363a]
                                  /lib64/libc.so.6(__libc_start_main+0xed)[0x7f5c2feaa60d]
                                                                                          ifstatus[0x403701]
                                                                                                            ======= Memory map: ========
                                                                                                                                        00400000-00413000 r-xp 00000000 00:16 3724                               /usr/bin/ifstatus
                                                                     00612000-00613000 r--p 00012000 00:16 3724                               /usr/bin/ifstatus
  00613000-00614000 rw-p 00013000 00:16 3724                               /usr/bin/ifstatus
                                                                                            0086b000-0090b000 rw-p 00000000 00:00 0                                  [heap]
              7f5c2f98d000-7f5c2fa81000 r-xp 00000000 08:33 3601                       /lib64/libm-2.15.so
                                                                                                          7f5c2fa81000-7f5c2fc80000 ---p 000f4000 08:33 3601                       /lib64/libm-2.15.so
                                         7f5c2fc80000-7f5c2fc81000 r--p 000f3000 08:33 3601                       /lib64/libm-2.15.so
                                                                                                                                     7f5c2fc81000-7f5c2fc82000 rw-p 000f4000 08:33 3601                       /lib64/libm-2.15.so
                                                                    7f5c2fc82000-7f5c2fc84000 r-xp 00000000 08:33 3598                       /lib64/libdl-2.15.so
    7f5c2fc84000-7f5c2fe84000 ---p 00002000 08:33 3598                       /lib64/libdl-2.15.so
                                                                                                 7f5c2fe84000-7f5c2fe85000 r--p 00002000 08:33 3598                       /lib64/libdl-2.15.so
                                 7f5c2fe85000-7f5c2fe86000 rw-p 00003000 08:33 3598                       /lib64/libdl-2.15.so
                                                                                                                              7f5c2fe86000-7f5c30025000 r-xp 00000000 08:33 3985                       /lib64/libc-2.15.so
                                                             7f5c30025000-7f5c30224000 ---p 0019f000 08:33 3985                       /lib64/libc-2.15.so
                                                                                                                                                         7f5c30224000-7f5c30228000 r--p 0019e000 08:33 3985                       /lib64/libc-2.15.so
                                                                                        7f5c30228000-7f5c3022a000 rw-p 001a2000 08:33 3985                       /lib64/libc-2.15.so
                       7f5c3022a000-7f5c3022e000 rw-p 00000000 00:00 0 
                                                                       7f5c3022e000-7f5c30243000 r-xp 00000000 08:33 997                        /lib64/libgcc_s.so.1
       7f5c30243000-7f5c30442000 ---p 00015000 08:33 997                        /lib64/libgcc_s.so.1
                                                                                                    7f5c30442000-7f5c30443000 r--p 00014000 08:33 997                        /lib64/libgcc_s.so.1
                                    7f5c30443000-7f5c30444000 rw-p 00015000 08:33 997                        /lib64/libgcc_s.so.1
                                                                                                                                 7f5c30444000-7f5c3052c000 r-xp 00000000 00:16 775                        /usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.3/libstdc++.so.6.0.17
                                                                                                         7f5c3052c000-7f5c3072c000 ---p 000e8000 00:16 775                        /usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.3/libstdc++.so.6.0.17
                                                                                 7f5c3072c000-7f5c30734000 r--p 000e8000 00:16 775                        /usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.3/libstdc++.so.6.0.17
                                                         7f5c30734000-7f5c30736000 rw-p 000f0000 00:16 775                        /usr/lib64/gcc/x86_64-pc-linux-gnu/4.7.3/libstdc++.so.6.0.17
                                 7f5c30736000-7f5c3074b000 rw-p 00000000 00:00 0 
                                                                                 7f5c3074b000-7f5c3079a000 r-xp 00000000 08:33 7410                       /lib64/libncurses.so.5.9
                     7f5c3079a000-7f5c30999000 ---p 0004f000 08:33 7410                       /lib64/libncurses.so.5.9
                                                                                                                      7f5c30999000-7f5c3099d000 r--p 0004e000 08:33 7410                       /lib64/libncurses.so.5.9
                                                          7f5c3099d000-7f5c3099e000 rw-p 00052000lolololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololololo... Aborted
====================================================

If you have enough common sense, do not delete ethstatus. Certainly return patch that I attached or write your own.
Comment 12 Jeroen Roovers (RETIRED) gentoo-dev 2014-02-21 14:37:25 UTC
(In reply to Konstantin Ivanov from comment #11)
> > It's a useful (if faulty) check so why throw out the baby with the bathwater?
> 
> Well I can tell, very intelligent response. That was sarcasm. 

No, it was not. I was demonstrating that your patch is flawed.

> And often you pass the program parameters is meaningless? 

When you're trying to elevate your privileges, sure. Who knows?

> Instead of clowning would check the work recommended you ifstatus with the
> same inputs. 

I was being earnest.

> echo "Interfaces = tro $ (for i in $ (seq 1 10000); do echo-n" lololo ";
> done)"> ~ / .ifstatus / ifstatus.tsfg 
> ifstatus 
> 
> Ifstatus aborts, its code is written worse. 

So both should be removed from the tree.
Comment 13 Jeroen Roovers (RETIRED) gentoo-dev 2014-02-21 14:38:08 UTC
(In reply to Konstantin Ivanov from comment #11)
> If you have enough common sense, do not delete ethstatus. Certainly return
> patch that I attached or write your own.

You can keep the original ebuild and patch in your personal overlay, if you like.