Commit | Line | Data |
---|---|---|
9319b3c3 C |
1 | function at_type(f) { |
2 | if (f in types) | |
3 | return types[f]; | |
4 | ||
5 | return (f ? f : "unknown"); | |
6 | } | |
7 | ||
8 | BEGIN { | |
9 | types[1] = "Other"; | |
10 | types[2] = "Invalid"; | |
11 | types[3] = "Dynamic"; | |
12 | types[4] = "Static"; | |
13 | ||
14 | printf "ARP table:\n"; | |
15 | didone = 0; | |
16 | for (i in ipNetToMediaIfIndex) { | |
17 | didone = 1; | |
18 | ||
19 | printf "%-15s at %s flags %s on interface #%d (%s)\n", | |
20 | ipNetToMediaNetAddress, ipNetToMediaPhysAddress, | |
21 | at_type(ipNetToMediaType), ipNetToMediaIfIndex, | |
22 | ifDescr[ipNetToMediaIfIndex]; | |
23 | } | |
24 | if (!didone && DIAGNOSTIC) | |
25 | printf "ipNetToMediaTable: %s\n", DIAGNOSTIC; | |
26 | if (!didone) { | |
27 | for (i in atIfIndex) { | |
28 | didone = 1; | |
29 | ||
30 | printf "%-15s at %s on interface #%d (%s)\n", | |
31 | atNetAddress, atPhysAddress, atIfIndex, | |
32 | ifDescr[atIfIndex]; | |
33 | } | |
34 | if (!didone && DIAGNOSTIC) | |
35 | printf "atTable: %s\n", DIAGNOSTIC; | |
36 | } | |
37 | if (!didone && !DIAGNOSTIC) | |
38 | printf "\tempty.\n"; | |
39 | ||
40 | if (!oflag) | |
41 | exit(0); | |
42 | ||
43 | printf "\nNet to media:\n"; | |
44 | didone = 0; | |
45 | for (i in clnpNetToMediaIfIndex) { | |
46 | didone = 1; | |
47 | ||
48 | printf "NS+%s at %s type %s age %d hold %d on interface #%d (%s)\n", | |
49 | clnpNetToMediaNetAddress, clnpNetToMediaPhysAddress, | |
50 | clnp_type(clnpNetToMediaType), clnpNetToMediaAge, | |
51 | clnpNetToMediaHoldTime, | |
52 | clnpNetToMediaIfIndex, ifDescr[clnpNetToMediaIfIndex]; | |
53 | } | |
54 | if (!didone) | |
55 | if (DIAGNOSTIC) | |
56 | printf "clnpNetToMediaTable: %s\n", DIAGNOSTIC; | |
57 | else | |
58 | printf "\tempty.\n"; | |
59 | } |