1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
$NetBSD: patch-ac,v 1.1.1.1 2004/02/24 23:41:56 cube Exp $
--- pinger.c.orig 2003-01-22 17:12:53.000000000 +0100
+++ pinger.c
@@ -27,6 +27,7 @@ ________________________________________
#include <sys/signal.h>
#include <netinet/in.h>
+#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
#include <arpa/inet.h>
@@ -220,42 +221,44 @@ static gchar *pr_icmph(struct icmp *icp)
g_string_assign(s, "Echo Reply");
/* XXX ID + Seq + Data */
break;
- case ICMP_DEST_UNREACH:
+ case ICMP_UNREACH:
switch (icp->icmp_code) {
- case ICMP_NET_UNREACH:
+ case ICMP_UNREACH_NET:
g_string_assign(s, "Destination Net Unreachable");
break;
- case ICMP_HOST_UNREACH:
+ case ICMP_UNREACH_HOST:
g_string_assign(s, "Destination Host Unreachable");
break;
- case ICMP_PROT_UNREACH:
+ case ICMP_UNREACH_PROTOCOL:
g_string_assign(s, "Destination Protocol Unreachable");
break;
- case ICMP_PORT_UNREACH:
+ case ICMP_UNREACH_PORT:
g_string_assign(s, "Destination Port Unreachable");
break;
- case ICMP_FRAG_NEEDED:
+ case ICMP_UNREACH_NEEDFRAG:
g_string_assign(s, "Frag needed and DF set");
break;
- case ICMP_SR_FAILED:
+ case ICMP_UNREACH_SRCFAIL:
g_string_assign(s, "Source Route Failed");
break;
- case ICMP_NET_UNKNOWN:
+ case ICMP_UNREACH_NET_UNKNOWN:
g_string_assign(s, "Network Unknown");
break;
- case ICMP_HOST_UNKNOWN:
+ case ICMP_UNREACH_HOST_UNKNOWN:
g_string_assign(s, "Host Unknown");
break;
- case ICMP_HOST_ISOLATED:
+ case ICMP_UNREACH_ISOLATED:
g_string_assign(s, "Host Isolated");
break;
- case ICMP_NET_UNR_TOS:
+ case ICMP_UNREACH_TOSNET:
g_string_assign(s,
"Destination Network Unreachable At This TOS");
break;
- case ICMP_HOST_UNR_TOS:
+ case ICMP_UNREACH_TOSHOST:
g_string_assign(s, "Destination Host Unreachable At This TOS");
break;
+ case ICMP_UNREACH_ADMIN_PROHIBIT:
+ g_string_assign(s, "Packet Prohibited");
#ifdef ICMP_PKT_FILTERED
case ICMP_PKT_FILTERED:
g_string_assign(s, "Packet Filtered");
@@ -277,21 +280,21 @@ static gchar *pr_icmph(struct icmp *icp)
break;
}
break;
- case ICMP_SOURCE_QUENCH:
+ case ICMP_SOURCEQUENCH:
g_string_assign(s, "Source Quench");
break;
case ICMP_REDIRECT:
switch (icp->icmp_code) {
- case ICMP_REDIR_NET:
+ case ICMP_REDIRECT_NET:
g_string_assign(s, "Redirect Network");
break;
- case ICMP_REDIR_HOST:
+ case ICMP_REDIRECT_HOST:
g_string_assign(s, "Redirect Host");
break;
- case ICMP_REDIR_NETTOS:
+ case ICMP_REDIRECT_TOSNET:
g_string_assign(s, "Redirect Type of Service and Network");
break;
- case ICMP_REDIR_HOSTTOS:
+ case ICMP_REDIRECT_TOSHOST:
g_string_assign(s, "Redirect Type of Service and Host");
break;
default:
@@ -305,12 +308,12 @@ static gchar *pr_icmph(struct icmp *icp)
g_string_assign(s, "Echo Request");
/* XXX ID + Seq + Data */
break;
- case ICMP_TIME_EXCEEDED:
+ case ICMP_TIMXCEED:
switch (icp->icmp_code) {
- case ICMP_EXC_TTL:
+ case ICMP_TIMXCEED_INTRANS:
g_string_assign(s, "Time to live exceeded");
break;
- case ICMP_EXC_FRAGTIME:
+ case ICMP_TIMXCEED_REASS:
g_string_assign(s, "Frag reassembly time exceeded");
break;
default:
@@ -319,23 +322,23 @@ static gchar *pr_icmph(struct icmp *icp)
break;
}
break;
- case ICMP_PARAMETERPROB:
+ case ICMP_PARAMPROB:
g_string_sprintf(s, "Parameter problem: IP address = %s",
inet_ntoa(icp->icmp_gwaddr));
break;
- case ICMP_TIMESTAMP:
+ case ICMP_TSTAMP:
g_string_assign(s, "Timestamp");
/* XXX ID + Seq + 3 timestamps */
break;
- case ICMP_TIMESTAMPREPLY:
+ case ICMP_TSTAMPREPLY:
g_string_assign(s, "Timestamp Reply");
/* XXX ID + Seq + 3 timestamps */
break;
- case ICMP_INFO_REQUEST:
+ case ICMP_IREQ:
g_string_assign(s, "Information Request");
/* XXX ID + Seq */
break;
- case ICMP_INFO_REPLY:
+ case ICMP_IREQREPLY:
g_string_assign(s, "Information Reply");
/* XXX ID + Seq */
break;
@@ -430,11 +433,11 @@ void pr_pack(char *buf, int cc, struct s
switch (icp->icmp_type) {
case ICMP_ECHO:
return;
- case ICMP_SOURCE_QUENCH:
+ case ICMP_SOURCEQUENCH:
case ICMP_REDIRECT:
- case ICMP_DEST_UNREACH:
- case ICMP_TIME_EXCEEDED:
- case ICMP_PARAMETERPROB:
+ case ICMP_UNREACH:
+ case ICMP_TIMXCEED:
+ case ICMP_PARAMPROB:
{
struct ip *iph = (struct ip *) (&icp->icmp_data);
struct icmp *icp1 =
@@ -447,7 +450,7 @@ void pr_pack(char *buf, int cc, struct s
icp1->icmp_id != ident)
return;
error_pkt = (icp->icmp_type != ICMP_REDIRECT &&
- icp->icmp_type != ICMP_SOURCE_QUENCH);
+ icp->icmp_type != ICMP_SOURCEQUENCH);
h = (host_data *) g_list_find_custom(hosts,
(int *) &icp1->
|