[Iftop-users] Re: find upload hogs

Paul Warren pdw at ex-parrot.com
Fri, 15 Oct 2010 00:31:38 +0100


On 15/10/2010 00:24, Gordon Gable wrote:
 > iftop, i mean. sorry.
 >
 > 2010/10/14 Gordon Gable <grdngable@gmail.com 
<mailto:grdngable@gmail.com>>
 >
 >     i help running a small wireless mesh. altough our p2pfilters at
 >     gateway nodes are fairly acurate, we sometimes find people resorting
 >     to all kinds of tricks to circumvent those.
 >
 >     to ease pinpointing villains, is there a way in iptraf to sort ip
 >     address by *upload* only?
 >
 >     /gordon
 >
 >


No - but it's an easy enough change to make if you want to hack it.  In 
ui.c find this bit of code:

int screen_line_bandwidth_compare(host_pair_line* aa, host_pair_line* 
bb, int start_div) {
     int i;
     for(i = start_div; i < HISTORY_DIVISIONS; i++) {
         if(aa->recv[i] + aa->sent[i] != bb->recv[i] + bb->sent[i]) {
             return(aa->recv[i] + aa->sent[i] < bb->recv[i] + bb->sent[i]);
         }
     }
     return 1;
}

and delete the "recv" part of each of the sums.  I guess it would be 
nice to sort based on what's on screen, but obviously that's a bit more 
involved.

Paul