When I wrote something like this, it ended up being very complex. I am a network guy, so you'll need to bear with me for a minute. There are protocols that allow a set of routers to act like one router (VRRP, HSRP). Cisco's HSRP happens to like flip-flopping, so traceroute likes to reports both addresses/routers on the same line. Names can change too easily, so I didn't do any processing with names, just on the IP addresses. But, when I got two addresses on a single line, I created a group and later considered any address within that group to be equivalent.
In my scheme, your example has one difference, the additional route toward the bottom. I don't remember the difference logic very well, but it was convoluted.
Well, months went by, I finally went in and did some sanity checking with the groups, and there were some major problems. It ended up having a very large group of like 30 addresses it considered equivalent. Unfortunately that made lots of the "hops" within a traceroute equivalent. ie a traceroute might end up looking like this after processing: hop1, hop2, group12, group12, group12, hop6, destination. Where those three group 12's in the middle were representative of different routers that had been grouped together as being equivalent by my code.
I'll try to dig that code up after lunch and either post some of it, or at least give you a better feel for the difference logic I'd used.
Update: Seems my difference code was very simplistic, aside from the "group" checking. Go through each traceroute in lockstep, and if they're different, add one to the difference count. I'd had a comment to improve that to make it more "diff-like", but I never got there, sorry.
-Scott
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.