Could be a qsort bug too - I've seen things on the web about different versions of the glib giving different results. However, I think the long answer I just published should give you a much better feeling for what's wrong.
-----Burton > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Mark > Gibbons > Sent: Wednesday, February 18, 2004 5:00 PM > To: [EMAIL PROTECTED] > Subject: RE: [Ntop] Sorting > > > well... > > All I can confirm is that it is certainly failing to sort > properly on our windows machine... I cannot recall/remember if I > have seen it on linux or if it is only on win32. > > Mark > > -----Original Message----- > From: Pagel, Thomas [mailto:[EMAIL PROTECTED] > Sent: 18 February 2004 22:41 > To: [EMAIL PROTECTED] > Subject: AW: [Ntop] Sorting > > > Mark, > > so that's a Windows problem???!!! It's not a new issue, it's > there since - I > can't remember... > > Regards, > > > > Thomas Pagel > -----Urspr�ngliche Nachricht----- > Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Mark > Gibbons > Gesendet: Mittwoch, 18. Februar 2004 23:27 > An: [EMAIL PROTECTED] > Betreff: RE: [Ntop] Sorting > > Thomas > > Yes - just installed win32 3pre1 and also get sorting problem on > data column > that you have experienced. Indeed I don't think I have ever seen > it so bad! > > Mark > > -----Original Message----- > From: Pagel, Thomas [mailto:[EMAIL PROTECTED] > Sent: 18 February 2004 21:45 > To: [EMAIL PROTECTED] > Subject: AW: [Ntop] Sorting > > > Mark, > > when I look at "All Protocols"/"Traffic" and sort by data, there > are always > some errors in the sorting... I'll provide screenshots to everybody asking > for... > > > Thomas Pagel > -----Urspr�ngliche Nachricht----- > Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Mark > Gibbons > Gesendet: Mittwoch, 18. Februar 2004 22:22 > An: [EMAIL PROTECTED] > Betreff: RE: [Ntop] Sorting > > Hi > > In my current data set,I see no errors on the numeric "Data" sort on both > the "Total/IP" and "Total/Throughput" pages. > > Mark > > -----Original Message----- > From: Pagel, Thomas [mailto:[EMAIL PROTECTED] > Sent: 18 February 2004 20:57 > To: [EMAIL PROTECTED] > Subject: AW: [Ntop] Sorting > > > Mark, > > Perhaps you can confirm that: try sorting by data... I see errors in that > sorting, too! > > Thanks, > > > Thomas Pagel > > > -----Urspr�ngliche Nachricht----- > Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Mark > Gibbons > Gesendet: Mittwoch, 18. Februar 2004 21:27 > An: [EMAIL PROTECTED] > Betreff: RE: [Ntop] Sorting > > Adding More... > > It only happens with UNRESOLVED ip addresses. The resolved ones > (even with > same mac addresses) are correctly ordered further down the list. > > Mark > > -----Original Message----- > From: Mark Gibbons > Sent: 18 February 2004 20:21 > To: [EMAIL PROTECTED] > Subject: RE: [Ntop] Sorting > > > Ok > > I am helping to answer my own question!! > > It is sorting by mac address not by ip even though we have > specified not to > trust mac address AND chosen to sort by host column. i.e all the > hosts with > the same mac are lumped together and unsorted. > > Don't shout at me but I am running v.2.2.98 - has this been fixed since > then? > > FX: Covers head and waits for abuse > > > Mark > > -----Original Message----- > From: Mark Gibbons > Sent: 18 February 2004 20:07 > To: [EMAIL PROTECTED] > Subject: RE: [Ntop] Sorting > > > Herewith Data Dump: > <snip>ge----- > From: Burton M. Strauss III [mailto:[EMAIL PROTECTED] > Sent: 18 February 2004 19:33 > To: [EMAIL PROTECTED] > Subject: RE: [Ntop] Sorting > > > No clue - I've never seen a sort like that that didn't rapidly correct > itself... > > Thoughts > > 1. It's possible to get odd results with new hosts, since it's > possible for > the sort key value to be changed in the middle of the sort > because the mutex > is locked/unlocked in the actual compare function. It has to be, otherwise > the lock would have to be held for the duration of creating the > report. How > a particular implementation of qsort handles this is unknowable. > We accept > the temporary insanity vs. losing packet data. > > 2. As I discuss below, if there are unvalued entries, the sorting is not > always going to give rational results (the a vs null test). > > 3. It's a strcasecmp, so it's not a numerically 'correct' sort. 12 will > come AFTER 111. > > If it's confused for a long time, the best bet is to look at the > underlying > data. Choose the 'hosts' part of Admin | Dump data - the field > in question > is #4, hostSymIpAddress: > > key|index|hostNumIpAddress|hostSymIpAddress|firstSeen|lastSeen|... > ::|0|::||1077110202|1077118182|0|0|... > 192.168.3.2|0|192.168.3.2|pooh.burtonstrauss.us|1077026267|1077132229|... > 24.0.178.1|0|24.0.178.1|c-24-0-178-1.client.comcast.net|1077026258 > |107713251 > 2|... > > You can see the null entry, that's the BROADCAST one (which isn't > reported), > and then two entries with values. > > > -----Burton > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Mark > > Gibbons > > Sent: Wednesday, February 18, 2004 12:42 PM > > To: [EMAIL PROTECTED] > > Subject: RE: [Ntop] Sorting > > > > > > Hi > > > > I'm jumping in on the sorting *moan*... or should we say discrepency. > > > > I understand that you are trying to resolve the ip if possible if > > not take the ip address itself or netbios name etc. BUT what I > > do not understand is after all of that, ntop has a list of > > strings it has to sort SO how does the following SORTED list come about: > > > > 10.11.11.14 > > 10.11.11.13 > > 10.14.11.1 > > 10.11.11.53 > > 10.11.11.44 > > 10.12.11.77 > > 10.11.11.79 > > 10.11.11.73 > > 10.14.11.100 > > 10.11.11.196 > > > > I cannot see any logic to this "sorted" sequence taken directly > > from "Summary/IP" or Summary/Throughput" with "host downarrow" > > > > Whatever the resolution rules, how can this sorted order be justified? > > > > Sincerely > > > > Mark Gibbons > > > > > > -----Original Message----- > > From: Burton M. Strauss III [mailto:[EMAIL PROTECTED] > > Sent: 18 February 2004 18:24 > > To: [EMAIL PROTECTED] > > Subject: RE: [Ntop] Sorting > > > > > > > -----Original Message----- > > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of > > > Pagel, Thomas > > > Sent: Wednesday, February 18, 2004 11:37 AM > > > To: [EMAIL PROTECTED] > > > Subject: [Ntop] Sorting > > > > > > Hi, > > > > > > I just had a look at the version 3 for Windows... Looks very nice... > > > > > > But there's still that issue I reported months ago... The > sorting of the > > > columns IP Address and Host Name simply make no sense... At > > least I don't > > > understand it... > > > > > > Thomas Pagel > > > > Same answer as the last two times you asked, > > http://article.gmane.org/gmane.linux.ntop.general/3651 - it's > > based on which > > fields do and don't exist (are valued). As I recall (and memory > > is a fuzzy > > thing), you left that discussion mumbling about creating some > kind of rule > > to follow instead of leaving ntop to sort on nulled fields. > > > > Finding what ntop does is easy. Figuring out what it SHOULD do is hard. > > > > To figure out how ntop IS sorting, figure out which html page it > > is (status > > bar will usually show it to you). For each page, find the piece > in http.c > > for that specific _HTML constant and find the function it > calls. In that > > function - usually in report.c, find the qsort and see what the > > column # is > > and the specific function. > > > > You'll usually find them in reportUtils.c, and usually in cmpFctn(): > > > > The case statement shows you what field ntop is sorting on. > For example, > > here is the 'host' sort, used in printHostsTraffic() (used in > > CONST_SORT_DATA_HOST_TRAFFIC_HTML, e.g. dataHostTraffic.html): > > > > if(myGlobals.columnSort == FLAG_HOST_DUMMY_IDX) { > > int rc; > > > > /* Host name */ > > accessAddrResMutex("cmpFctn"); > > > > if((*a)->hostSymIpAddress[0] != '\0') { > > char *name1, *name2; > > > > name1 = (*a)->hostSymIpAddress; > > name2 = (*b)->hostSymIpAddress; > > > > rc = strcasecmp(name1, name2); > > } else > > rc = strcasecmp((*a)->ethAddressString, (*b)->ethAddressString); > > > > releaseAddrResMutex(); > > return(rc); > > } ... > > > > > > Reading that, it does a case insensitive compare of the address > previously > > stored as a string (e.g. "1.2.3.4"). That's pretty clealy sub-optimal, > > since what if b doesn't have a value (what does > > strcasecmp("1.2.3.4", NULL) > > give?)? It works fine if all hosts are resolved, but where it > breaks down > > is if one host is resolved and the other isn't, or if they're different > > types of hosts, such as a non-IP address. > > > > The function that sets this is in pbuf.c: > > > > void updateHostName(HostTraffic *el) { > > > > if((el->hostNumIpAddress[0] == '\0') > > || (el->hostSymIpAddress == NULL) > > || strcmp(el->hostSymIpAddress, el->hostNumIpAddress) == 0) { > > int i; > > > > if(el->nonIPTraffic == NULL) el->nonIPTraffic = > > (NonIPTraffic*)calloc(1, > > sizeof(NonIPTraffic)); > > > > if(el->nonIPTraffic->nbHostName != NULL) { > > /* > > Use NetBIOS name (when available) if the > > IP address has not been resolved. > > */ > > memset(el->hostSymIpAddress, 0, sizeof(el->hostSymIpAddress)); > > strcpy(el->hostSymIpAddress, el->nonIPTraffic->nbHostName); > > } else if(el->nonIPTraffic->ipxHostName != NULL) > > strcpy(el->hostSymIpAddress, el->nonIPTraffic->ipxHostName); > > else if(el->nonIPTraffic->atNodeName != NULL) > > strcpy(el->hostSymIpAddress, el->nonIPTraffic->atNodeName); > > > > if(el->hostSymIpAddress[0] != '\0') > > for(i=0; el->hostSymIpAddress[i] != '\0'; i++) > > el->hostSymIpAddress[i] = > (char)tolower(el->hostSymIpAddress[i]); > > } > > } > > > > What it's attempting to do is to set some kind of reasonable > value in that > > field for every type of host. > > > > So it's still the same problem as when you 1st asked in Oct 2002 > > (and April > > 2003 and Sept 2003) - and I still don't have a clue what the > > "RIGHT" answer > > is. > > > > If you can propose a reasonable set of rules, we can look at > it, but it's > > got to pass both the reality and sniff tests. > > > > Remember, you have NetBIOS names, AppleTalk names, > FibreChannel, iSCSI and > > normal IPs. Is just a simple alpha sort enough, if the function > in pbuf.c > > gets smarter??? You talked at one point about relative placement - do > > NetBIOS names get sorted in with tcp/ip dns, or are they at the > end. What > > about cross-compares?? > > > > Say you have this set: > > > > 192.168.1.1 -- no dns lookup > > 192.168.1.2 -- ftp.imahostingcompany.tld > > 92.99.9.888 - www.imahostingcompany.tld > > 92.99.9.999 -- no dns > > 02:00:00:00:00:01 -- MAC level only > > WINSTATION -- Win98 NetBIOS > > > > How do you sort 'em????? > > > > Is it > > > > 02:00:00:00:00:01 > > 192.168.1.1 > > 92.99.9.999 > > ftp.imahostingcompany.tld > > WINSTATION > > www.imahostingcompany.tld > > > > or is it > > > > 02:00:00:00:00:01 > > 92.99.9.999 > > 192.168.1.1 > > ftp.imahostingcompany.tld > > WINSTATION > > www.imahostingcompany.tld > > > > etc... > > > > > > (NB: The reality test is that I'm unlikely to make major changes > > having just > > pushed 3.0pre1 up for widespread testing). > > > > > > > > > > -----Burton > > > > > > > > > > > > _______________________________________________ > > Ntop mailing list > > [EMAIL PROTECTED] > > http://listgateway.unipi.it/mailman/listinfo/ntop > > _______________________________________________ > > Ntop mailing list > > [EMAIL PROTECTED] > > http://listgateway.unipi.it/mailman/listinfo/ntop > > > > _______________________________________________ > Ntop mailing list > [EMAIL PROTECTED] > http://listgateway.unipi.it/mailman/listinfo/ntop > _______________________________________________ > Ntop mailing list > [EMAIL PROTECTED] > http://listgateway.unipi.it/mailman/listinfo/ntop > _______________________________________________ > Ntop mailing list > [EMAIL PROTECTED] > http://listgateway.unipi.it/mailman/listinfo/ntop > _______________________________________________ > Ntop mailing list > [EMAIL PROTECTED] > http://listgateway.unipi.it/mailman/listinfo/ntop > _______________________________________________ > Ntop mailing list > [EMAIL PROTECTED] > http://listgateway.unipi.it/mailman/listinfo/ntop > > _______________________________________________ > Ntop mailing list > [EMAIL PROTECTED] > http://listgateway.unipi.it/mailman/listinfo/ntop > _______________________________________________ > Ntop mailing list > [EMAIL PROTECTED] > http://listgateway.unipi.it/mailman/listinfo/ntop > > _______________________________________________ > Ntop mailing list > [EMAIL PROTECTED] > http://listgateway.unipi.it/mailman/listinfo/ntop > _______________________________________________ > Ntop mailing list > [EMAIL PROTECTED] > http://listgateway.unipi.it/mailman/listinfo/ntop > > _______________________________________________ > Ntop mailing list > [EMAIL PROTECTED] > http://listgateway.unipi.it/mailman/listinfo/ntop > _______________________________________________ Ntop mailing list [EMAIL PROTECTED] http://listgateway.unipi.it/mailman/listinfo/ntop
