"Hashar" posted a comment on MediaWiki.r111829.
URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/111829#c31233

Commit summary for MediaWiki.r111829:

Add support to tablesorter to handle IP/CIDR notation

This fixes bug 34475

Hashar's comment:

I would keep the host sort this way but sort the CIDR in reverse order.  A /8 
represents roughly 16Millions IP, way more IP than a /32:

Ascending:
 10.0.0.0
 10.0.0.0/32
 10.0.0.0/16
 10.0.0.0/8
 10.5.5.5
 10.5.5.5/8
 192.168.0.0
 192.168.0.0/32
 192.168.0.0/8

The next funny case is were to insert 10.255.0.0/16 in the above list ?  It 
should be between 10.0.0.0/16 and 10.0.0.0/8 since it has the same size has 
10.0.0.0/16 but it is contained by 10.0.0.0/8.

 10.0.0.0
 10.0.0.0/32
 10.0.0.0/16
 10.255.0.0/16 <-----
 10.0.0.0/8

That is not going to help you devising a smart CIDR sorter :-]


Since you normalize an IP to /32, you can not guarantee yet that an IP will be 
placed before its /32 representation. One way to verify it is to try sorting:

 10.0.0.0
 10.0.0.0/32

And sort

 10.0.0.0/32
 10.0.0.0

And verify that both give the same output for consistence.

_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to