Hello Sven-Haegar,

Very thanks for this patches. I will test and apply the most quickly
possible.

Regards,

2016-03-21 16:30 GMT-03:00 Sven-Haegar Koch <[email protected]>:

> Package: ethstatus
> Version: 0.4.5
> Severity: wishlist
> Tags: patch
>
> Dear Maintainer,
>
> I am using ethtool since years, but a slightly modified version - with the
> latest update to Debian Unstable I was reminded what the original is
> missing, and thought that I should submit my changes.
>
> 1.
> Allow longer network interface names (bug #803663):
>
> diff -ur ethstatus-0.4.5/ethstatus.c ethstatus-0.4.5+sdinetH1/ethstatus.c
> --- ethstatus-0.4.5/ethstatus.c 2006-10-20 00:09:56.000000000 +0200
> +++ ethstatus-0.4.5+sdinetH1/ethstatus.c        2016-03-21
> 20:16:05.983431525 +0100
> @@ -636,7 +644,7 @@
>                                 break;
>
>                         case 'i':
> -                               if(strlen(optarg) > 5)
> +                               if(strlen(optarg) > IFNAMSIZ)
>                                 {
>                                         show_usage(argv[0]);
>                                         exit(10);
>
>
> 2.
> ethstatus needs a huge amount of CPU, and especially required lots of
> bandwidth when used over ssh - restrict the screen updates to every
> 1/2 second:
>
> diff -ur ethstatus-0.4.5/ethstatus.c ethstatus-0.4.5+sdinetH1/ethstatus.c
> --- ethstatus-0.4.5/ethstatus.c 2006-10-20 00:09:56.000000000 +0200
> +++ ethstatus-0.4.5+sdinetH1/ethstatus.c        2016-03-21
> 20:16:05.983431525 +0100
> @@ -813,10 +821,10 @@
>               update_stat(0);
>               sec_value = localt.tm_sec;
>            }
> -        usleep(10L);
> +        usleep(500000L);
>        }
>        else
> -       usleep(100000L);
> +        sleep(1);
>
>        key_pressed = getch();
>        if(key_pressed != ERR && tolower(key_pressed) == 'q')
>
>
> 3.
> Show the currently used RX and TX bandwidth separately, not only the
> summary:
>
> diff -ur ethstatus-0.4.5/ethstatus.c ethstatus-0.4.5+sdinetH1/ethstatus.c
> --- ethstatus-0.4.5/ethstatus.c 2006-10-20 00:09:56.000000000 +0200
> +++ ethstatus-0.4.5+sdinetH1/ethstatus.c        2016-03-21
> 20:16:05.983431525 +0100
> @@ -76,7 +76,7 @@
>     if(display)
>       {
>         chcolor(colors.data[0], colors.data[1]);
> -       mvprintw(17, 27, "%s", stats.ip_addr_rtrn);
> +       mvprintw(18, 27, "%s", stats.ip_addr_rtrn);
>         refresh();
>       }
>  }
> @@ -107,16 +107,16 @@
>                   stats.email++;
>              }
>            if(stats.email < 10)
> -            mvprintw(17, 65, "0%d         ", stats.email);
> +            mvprintw(18, 65, "0%d         ", stats.email);
>            else
> -            mvprintw(17, 65, "%d           ", stats.email);
> +            mvprintw(18, 65, "%d           ", stats.email);
>            fclose(email_box);
>         }
>        else
> -       mvprintw(17, 65, "Can't check");
> +       mvprintw(18, 65, "Can't check");
>     }
>     else
> -     mvprintw(17, 65, "00         ");
> +     mvprintw(18, 65, "00         ");
>     refresh();
>  }
>
> @@ -216,23 +216,23 @@
>  void update_info(void)
>  {
>     chcolor(colors.data[0] ,colors.data[1]);
> -   mvprintw(20, 27, "%.0f", stats.rx_packets[0]);
> -   mvprintw(20, 65, "%.0f", stats.tx_packets[0]);
> -   mvprintw(22, 27, "%ld", stats.rx_errors[0]);
> -   mvprintw(22, 65, "%ld", stats.tx_errors[0]);
> +   mvprintw(21, 27, "%.0f", stats.rx_packets[0]);
> +   mvprintw(21, 65, "%.0f", stats.tx_packets[0]);
> +   mvprintw(23, 27, "%ld", stats.rx_errors[0]);
> +   mvprintw(23, 65, "%ld", stats.tx_errors[0]);
>
>         /* Calculate the measures automagically */
>     chcolor(colors.labels[0], colors.labels[1]);
>         autoscale(autoscalebytes, stats.rx_bytes[0]);
> -       mvprintw(21, 6, "Received:                        ");
> +       mvprintw(22, 6, "Received:                        ");
>         chcolor(colors.data[0], colors.data[1]);
> -       mvprintw(21, 27, "%sB", autoscalebytes);
> +       mvprintw(22, 27, "%sB", autoscalebytes);
>
>     chcolor(colors.labels[0], colors.labels[1]);
>         autoscale(autoscalebytes, stats.tx_bytes[0]);
> -       mvprintw(21,41, "Transmitted:                        ");
> +       mvprintw(22,41, "Transmitted:                        ");
>         chcolor(colors.data[0], colors.data[1]);
> -       mvprintw(21, 65, "%sB", autoscalebytes);
> +       mvprintw(22, 65, "%sB", autoscalebytes);
>  }
>
>
>  /*-------------------------------------------------------------------------*
> @@ -241,16 +241,16 @@
>  void clear_info(void)
>  {
>     chcolor(colors.background ,0);
> -   mvprintw(19, 65, "   ");
> -   mvprintw(19, 27, "            ");
> +   mvprintw(20, 65, "   ");
>     mvprintw(20, 27, "            ");
> -   mvprintw(20, 65, "              ");
> -   mvprintw(22, 27, "            ");
> -   mvprintw(22, 65, "              ");
>     mvprintw(21, 27, "            ");
>     mvprintw(21, 65, "              ");
> -   mvprintw(16, 22, "               ");
> -   mvprintw(17, 27, "            ");
> +   mvprintw(23, 27, "            ");
> +   mvprintw(23, 65, "              ");
> +   mvprintw(22, 27, "            ");
> +   mvprintw(22, 65, "              ");
> +   mvprintw(17, 22, "               ");
> +   mvprintw(18, 27, "            ");
>  }
>
>
> @@ -391,27 +391,35 @@
>     pps[1] = (stats.tx_packets[0] - stats.tx_packets_comp[1]);
>
>     /* ks variable gets the speed in k/s of the connection */
> +   ks = (float)(bps[0]);
> +   ks /= 1024;
> +   ps = pps[0];
> +   autoscale(autoscalebytes, ks * 1024);
> +   center(14, " RX %9sB/s   %4d Packets/s", autoscalebytes, ps);
> +
> +   ks = (float)(bps[1]);
> +   ks /= 1024;
> +   ps = pps[1];
> +   autoscale(autoscalebytes, ks * 1024);
> +   center(15, " TX %9sB/s   %4d Packets/s", autoscalebytes, ps);
> +
>     ks = (float)(bps[0] + bps[1]);
>     ks /= 1024;
>     ps = pps[0] + pps[1];
> -
> -       autoscale(autoscalebytes, ks * 1024);
> -   center(14, "%sB/s   %d Packets/s", autoscalebytes, ps);
> -       /*
> -   center(14, "%.2f KB/s   %d Packets/s", ks, ps);
> -       */
> +   autoscale(autoscalebytes, ks * 1024);
> +   center(16, "SUM %9sB/s   %4d Packets/s", autoscalebytes, ps);
>
>     if(ks > stats.top_speed)
>       {
> -       mvprintw(19, 27, "             ");
> -       mvprintw(19, 27, "%sB/s", autoscalebytes);
> +       mvprintw(20, 27, "             ");
> +       mvprintw(20, 27, "%sB/s", autoscalebytes);
>         /* mvprintw(19, 27, "%.2f KB/s", ks); */
>         stats.top_speed = ks;
>       }
>     if(ps > stats.top_packet)
>       {
> -       mvprintw(19, 65, "             ");
> -       mvprintw(19, 65, "%d", ps);
> +       mvprintw(20, 65, "             ");
> +       mvprintw(20, 65, "%d", ps);
>         stats.top_packet = ps;
>       }
>     stats.rx_bytes_comp = stats.rx_bytes[0];
> @@ -566,34 +574,34 @@
>     /*center(24, ".Author : Gabriel Montenegro <
> [email protected]>.");*/
>     refresh();
>     chcolor(colors.labels[0], colors.labels[1]);
> -   mvprintw(17, 6,"IP Address:");
> +   mvprintw(18, 6,"IP Address:");
>         /*
>     if(check)
> -     mvprintw(17, 41, "New email(s):");
> +     mvprintw(18, 41, "New email(s):");
>           */
> -   mvprintw(20, 6, "Received Packets:");
> -   mvprintw(22, 6, "Errors on Receiving:");
> -   mvprintw(20, 41,"Transmited Packets:");
> -   mvprintw(22, 41,"Errors on Transmission:");
> +   mvprintw(21, 6, "Received Packets:");
> +   mvprintw(23, 6, "Errors on Receiving:");
> +   mvprintw(21, 41,"Transmited Packets:");
> +   mvprintw(23, 41,"Errors on Transmission:");
>     mvprintw(13, 37,"RX");
>     mvprintw(13, 41,"TX");
> -   mvprintw(18, 6,"Interface name:");
> -   mvprintw(18, 41, "Graphic Using Speed:");
> +   mvprintw(19, 6,"Interface name:");
> +   mvprintw(19, 41, "Graphic Using Speed:");
>     mvprintw(13, 9, "ON/OFF");
> -   mvprintw(19, 6, "Top Speed:");
> -   mvprintw(19, 41, "Top Packets/s:");
> +   mvprintw(20, 6, "Top Speed:");
> +   mvprintw(20, 41, "Top Packets/s:");
>     refresh();
>     chcolor(colors.version[0], colors.version[1]);
>     mvprintw(00, 31,".EthStatus v" VERSION ".");
>     refresh();
>     chcolor(colors.data[0], colors.data[1]);
> -   mvprintw(18, 27, "%s", interface);
> +   mvprintw(19, 27, "%s", interface);
>         /* technically incorrect - should be 1024 */
>         autoscale(autoscalebytes, SPEED[0] * (double) 1000 );
> -   mvprintw(18, 65, "%sB/s", autoscalebytes);
> -   mvprintw(19, 27, "0.00 KB/s");
> -   mvprintw(19, 65, "0");
> -   refresh();
> +   mvprintw(19, 65, "%sB/s", autoscalebytes);
> +   mvprintw(20, 27, "0.00 KB/s");
> +   mvprintw(20, 65, "0");
> +   refresh();
>  }
>
>
> Thanks for considering these,
> Sven-Haegar
>
>
> -- System Information:
> Debian Release: stretch/sid
>   APT prefers unstable
>   APT policy: (500, 'unstable'), (500, 'stable'), (101, 'experimental')
> Architecture: i386 (x86_64)
> Foreign Architectures: amd64
>
> Kernel: Linux 4.3.0-1-amd64 (SMP w/2 CPU cores)
> Locale: LANG=en_US.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/bash
> Init: systemd (via /run/systemd/system)
>
> Versions of packages ethstatus depends on:
> ii  libc6        2.22-3
> ii  libncurses5  6.0+20160213-1
> ii  libtinfo5    6.0+20160213-1
>
> ethstatus recommends no packages.
>
> ethstatus suggests no packages.
>
> -- no debconf information
>



-- 
Marcio de Souza Oliveira
http://www.respirandoti.com.br
-----------------------------------------------------------------------------------------------
Cansou de vírus, pragas virtuais, travamentos e falta de desempenho?
O melhor anti vírus é usar Linux :)
Debian (http://www.debian.org/)

Reply via email to