; Tijmen Moerland, 2003 ; Traceroute From is essentially the same as Traceroute ; The difference is that this packets first moves to a specified ; starting point (initial dest, e.g. as specified when calling snap_exec) ; When arriving at this starting point an arrival message is sent back to ; source, and the real traceroute is started. dforw ; first go directly to starting point ; send a message back to source telling we've arrived at starting ; point push "arrived at start" here push msgback push -1 push 3 getsrc dsend pop ; pop 'arrived at start' pop ; pop local address ; start the traceroute push at_start push -1 getrb pull 3 ; pull the traceroute dest from stack (statically entered) push 0 store 5 ; overwrite dest address with zero send ; go there! exit ; and done ; below is the real traceroute code ; at next hop, send msg back to source at_start: getdst ishere ; are we at traceroute dest? bne send_arrivedmsg-pc push "next hop" here push msgback ; start code at msgback push -1 ; all the current stack push 3 ; resource bound (hops left) getsrc ; go to source dsend ; go directly to source ji traceroute-pc send_arrivedmsg: push "arrived at dest" getdst push msgback ; start code at msgback push -1 ; all the current stack getrb ; resource bound (hops left) getsrc dsend ; go straight to source, don't bother with intermediate SNAP deamons exit ; this code is executed when the message is back at source ; we have two things on stack, first the originating IP address, ; and then a string containing information on this IP address msgback: calls "testaddr2str" ; convert IP address to string calls "testconcatstr" ; concatenate the two strings push 7777 demux ; now we go to the next hop traceroute: forw ; specify the traceroute destination below (only 1 value!!) ;#data 172.17.8.1 ; nodeCope #data 172.18.8.1 ; nodeJasper