Hallo, dies ist ein Test.
PWD: /www/data-lst1/unixsoft/unixsoft/kaempfer/.public_html
Running in File Mode
Relative path: ./../../../../../../usr/demo/dtrace/icmpsnoop.d
Real path: /usr/demo/dtrace/icmpsnoop.d
Zurück
#!/usr/sbin/dtrace -s /* * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. * * This D script is used as an example in the Oracle Solaris 11.4 * Dynamic Tracing Guide in the "icmp Provider" Chapter. * * On machines that have DTrace installed, this script is available as * icmpsnoop.d in /usr/demo/dtrace, a directory that contains all D scripts * used in the Solaris Dynamic Tracing Guide. A table of the scripts and their * corresponding chapters may be found here: * * file:///usr/demo/dtrace/index.html */ #pragma D option quiet #pragma D option switchrate=10hz dtrace:::BEGIN { printf("%15s %6s %15s %15s\n", "TIME", "PID", "LADDR", "RADDR"); } icmp:::send { printf("%15d %6d %15s -> %15s\n %-15s ", timestamp/1000, args[1]->cs_pid, args[2]->ip_saddr, args[2]->ip_daddr, args[2]->ip_ver == 4 ? icmp_type_string[args[4]->icmp_type] : icmp6_type_string[args[4]->icmp_type]); } icmp:::receive { printf("%15d %6d %15s <- %15s\n %-15s ", timestamp/1000, args[1]->cs_pid, args[2]->ip_daddr, args[2]->ip_saddr, args[2]->ip_ver == 4 ? icmp_type_string[args[4]->icmp_type] : icmp6_type_string[args[4]->icmp_type]); } icmp:::send, icmp:::receive / args[2]->ip_ver == 4 && args[4]->icmp_type == ICMP_ADDRESS_MASK_REPLY / { printf("address mask %x", args[4]->icmp_address_mask); } icmp:::send, icmp:::receive / (args[2]->ip_ver == 4 && (args[4]->icmp_type == ICMP_ECHO_REQUEST || args[4]->icmp_type == ICMP_ECHO_REPLY)) || (args[2]->ip_ver == 6 && (args[4]->icmp_type == ICMP6_ECHO_REQUEST || args[4]->icmp_type == ICMP6_ECHO_REPLY)) / { printf("id %d, seq %d", args[4]->icmp_echo_id, args[4]->icmp_echo_seq); } icmp:::send, icmp:::receive / ((args[2]->ip_ver == 4 && args[4]->icmp_type == ICMP_PARAM_PROBLEM) || (args[2]->ip_ver == 6 && args[4]->icmp_type == ICMP6_PARAM_PROBLEM)) / { printf("prob %s, ptr %d", args[2]->ip_ver == 4 ? icmp_param_problem_code_string[args[4]->icmp_code] : icmp6_param_problem_code_string[args[4]->icmp_code], args[4]->icmp_param_problem_ptr); } icmp:::send, icmp:::receive / (args[2]->ip_ver == 4 && args[4]->icmp_type == ICMP_DEST_UNREACHABLE) || (args[2]->ip_ver == 6 && args[4]->icmp_type == ICMP6_DEST_UNREACHABLE) / { printf("%s (ports %d -> %d)", args[2]->ip_ver == 4 ? icmp_dest_unreachable_code_string[args[4]->icmp_code] : icmp6_dest_unreachable_code_string[args[4]->icmp_code], args[4]->icmp_error_sport, args[4]->icmp_error_dport); } icmp:::send, icmp:::receive / (args[2]->ip_ver == 4 && args[4]->icmp_type == ICMP_DEST_UNREACHABLE && args[4]->icmp_code == ICMP_FRAGMENTATION_NEEDED) || (args[2]->ip_ver == 6 && args[4]->icmp_type == ICMP6_PACKET_TOO_BIG) / { printf("pmtu update %d", args[4]->icmp_pmtu_update); } icmp:::send, icmp:::receive / args[2]->ip_ver == 4 && args[4]->icmp_type == ICMP_ROUTER_ADVERTISEMENT / { printf("%d addrs, lifetime %d, first addr/pref %s/%d", args[4]->icmp_radv_num_addrs, args[4]->icmp_radv_lifetime, xlate <icmp_radvinfo_t>(args[4]->icmp_radv_addrs).icmp_radv_addr, xlate <icmp_radvinfo_t>(args[4]->icmp_radv_addrs).icmp_radv_pref ); } icmp:::send, icmp:::receive / args[2]->ip_ver == 4 && args[4]->icmp_type == ICMP_REDIRECT / { printf("type %s, addr %s", icmp_redirect_code_string[args[4]->icmp_code], args[4]->icmp_redirect_gateway); } icmp:::send, icmp:::receive / args[2]->ip_ver == 4 && (args[4]->icmp_type == ICMP_TIME_STAMP_REQUEST || args[4]->icmp_type == ICMP_TIME_STAMP_REPLY) / { printf("otime %d rtime %d ttime %d", args[4]->icmp_timestamp_otime, args[4]->icmp_timestamp_rtime, args[4]->icmp_timestamp_ttime); } icmp:::send, icmp:::receive / (args[2]->ip_ver == 4 && args[4]->icmp_type == ICMP_TIME_EXCEEDED) || (args[2]->ip_ver == 6 && args[4]->icmp_type == ICMP6_TIME_EXCEEDED) / { printf("%s", args[2]->ip_ver == 4 ? icmp_time_exceeded_code_string[args[4]->icmp_code] : icmp6_time_exceeded_code_string[args[4]->icmp_code]); } icmp:::send, icmp:::receive / args[2]->ip_ver == 6 && (args[4]->icmp_type == ICMP6_ND_NEIGHBOR_SOLICITATION || args[4]->icmp_type == ICMP6_ND_NEIGHBOR_ADVERTISEMENT || args[4]->icmp_type == ICMP6_ND_ROUTER_SOLICITATION || args[4]->icmp_type == ICMP6_ND_ROUTER_ADVERTISEMENT) / { printf("target %s ", args[4]->icmp6_nd_target); } icmp:::send, icmp:::receive / args[2]->ip_ver == 6 && args[4]->icmp_type == ICMP6_ND_REDIRECT / { printf("destination %s", args[4]->icmp6_nd_redirect_destination); } icmp:::send, icmp:::receive / args[2]->ip_ver == 6 && args[4]->icmp_type == ICMP6_ND_ROUTER_ADVERTISEMENT / { printf("reachable %d retransmit %d", args[4]->icmp6_nd_radv_reachable, args[4]->icmp6_nd_radv_retransmit); } icmp:::send, icmp:::receive / args[2]->ip_ver == 6 && args[4]->icmp_type == ICMP6_ROUTER_RENUMBERING / { printf("segnum %d flags 0x%x maxdelay %d", args[4]->icmp6_rr_segnum, args[4]->icmp6_rr_flags, args[4]->icmp6_rr_maxdelay); } icmp:::send, icmp:::receive / args[2]->ip_ver == 6 && (args[4]->icmp_type == ICMP6_MLD_LISTENER_QUERY || args[4]->icmp_type == ICMP6_MLD_LISTENER_REPORT || args[4]->icmp_type == ICMP6_MLD_LISTENER_REDUCTION) / { printf("multicast address %s", args[4]->icmp6_mld_addr); } icmp:::send, icmp:::receive { printf("\n"); }