1 |
eras 14/09/29 14:11:12 |
2 |
|
3 |
Added: squid-13173_13171.patch squid-12683_12681.patch |
4 |
Log: |
5 |
Security bump - bug #522498 |
6 |
|
7 |
(Portage version: 2.2.14_rc1/cvs/Linux x86_64, signed Manifest commit with key 0x77F1F175586A3B1F) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 net-proxy/squid/files/squid-13173_13171.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-proxy/squid/files/squid-13173_13171.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-proxy/squid/files/squid-13173_13171.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: squid-13173_13171.patch |
16 |
=================================================================== |
17 |
=== modified file 'src/snmp_core.cc' |
18 |
--- src/snmp_core.cc 2014-02-18 08:46:49 +0000 |
19 |
+++ src/snmp_core.cc 2014-09-15 04:58:34 +0000 |
20 |
@@ -362,7 +362,7 @@ |
21 |
void |
22 |
snmpHandleUdp(int sock, void *not_used) |
23 |
{ |
24 |
- LOCAL_ARRAY(char, buf, SNMP_REQUEST_SIZE); |
25 |
+ static char buf[SNMP_REQUEST_SIZE]; |
26 |
Ip::Address from; |
27 |
SnmpRequest *snmp_rq; |
28 |
int len; |
29 |
@@ -371,16 +371,11 @@ |
30 |
|
31 |
Comm::SetSelect(sock, COMM_SELECT_READ, snmpHandleUdp, NULL, 0); |
32 |
|
33 |
- memset(buf, '\0', SNMP_REQUEST_SIZE); |
34 |
+ memset(buf, '\0', sizeof(buf)); |
35 |
|
36 |
- len = comm_udp_recvfrom(sock, |
37 |
- buf, |
38 |
- SNMP_REQUEST_SIZE, |
39 |
- 0, |
40 |
- from); |
41 |
+ len = comm_udp_recvfrom(sock, buf, sizeof(buf)-1, 0, from); |
42 |
|
43 |
if (len > 0) { |
44 |
- buf[len] = '\0'; |
45 |
debugs(49, 3, "snmpHandleUdp: FD " << sock << ": received " << len << " bytes from " << from << "."); |
46 |
|
47 |
snmp_rq = (SnmpRequest *)xcalloc(1, sizeof(SnmpRequest)); |
48 |
|
49 |
=== modified file 'src/icmp/Icmp4.cc' |
50 |
--- src/icmp/Icmp4.cc 2013-06-03 14:05:16 +0000 |
51 |
+++ src/icmp/Icmp4.cc 2014-09-15 05:06:14 +0000 |
52 |
@@ -41,26 +41,38 @@ |
53 |
#include "IcmpPinger.h" |
54 |
#include "Debug.h" |
55 |
|
56 |
-const char *icmpPktStr[] = { |
57 |
- "Echo Reply", |
58 |
- "ICMP 1", |
59 |
- "ICMP 2", |
60 |
- "Destination Unreachable", |
61 |
- "Source Quench", |
62 |
- "Redirect", |
63 |
- "ICMP 6", |
64 |
- "ICMP 7", |
65 |
- "Echo", |
66 |
- "ICMP 9", |
67 |
- "ICMP 10", |
68 |
- "Time Exceeded", |
69 |
- "Parameter Problem", |
70 |
- "Timestamp", |
71 |
- "Timestamp Reply", |
72 |
- "Info Request", |
73 |
- "Info Reply", |
74 |
- "Out of Range Type" |
75 |
-}; |
76 |
+static const char * |
77 |
+IcmpPacketType(uint8_t v) |
78 |
+{ |
79 |
+ static const char *icmpPktStr[] = { |
80 |
+ "Echo Reply", |
81 |
+ "ICMP 1", |
82 |
+ "ICMP 2", |
83 |
+ "Destination Unreachable", |
84 |
+ "Source Quench", |
85 |
+ "Redirect", |
86 |
+ "ICMP 6", |
87 |
+ "ICMP 7", |
88 |
+ "Echo", |
89 |
+ "ICMP 9", |
90 |
+ "ICMP 10", |
91 |
+ "Time Exceeded", |
92 |
+ "Parameter Problem", |
93 |
+ "Timestamp", |
94 |
+ "Timestamp Reply", |
95 |
+ "Info Request", |
96 |
+ "Info Reply", |
97 |
+ "Out of Range Type" |
98 |
+ }; |
99 |
+ |
100 |
+ if (v > 17) { |
101 |
+ static char buf[50]; |
102 |
+ snprintf(buf, sizeof(buf), "ICMP %u (invalid)", v); |
103 |
+ return buf; |
104 |
+ } |
105 |
+ |
106 |
+ return icmpPktStr[v]; |
107 |
+} |
108 |
|
109 |
Icmp4::Icmp4() : Icmp() |
110 |
{ |
111 |
@@ -187,6 +199,12 @@ |
112 |
from->ai_addr, |
113 |
&from->ai_addrlen); |
114 |
|
115 |
+ if (n <= 0) { |
116 |
+ debugs(42, DBG_CRITICAL, HERE << "Error when calling recvfrom() on ICMP socket."); |
117 |
+ Ip::Address::FreeAddrInfo(from); |
118 |
+ return; |
119 |
+ } |
120 |
+ |
121 |
preply.from = *from; |
122 |
|
123 |
#if GETTIMEOFDAY_NO_TZP |
124 |
@@ -243,9 +261,15 @@ |
125 |
|
126 |
preply.psize = n - iphdrlen - (sizeof(icmpEchoData) - MAX_PKT4_SZ); |
127 |
|
128 |
+ if (preply.psize < 0) { |
129 |
+ debugs(42, DBG_CRITICAL, HERE << "Malformed ICMP packet."); |
130 |
+ Ip::Address::FreeAddrInfo(from); |
131 |
+ return; |
132 |
+ } |
133 |
+ |
134 |
control.SendResult(preply, (sizeof(pingerReplyData) - MAX_PKT4_SZ + preply.psize) ); |
135 |
|
136 |
- Log(preply.from, icmp->icmp_type, icmpPktStr[icmp->icmp_type], preply.rtt, preply.hops); |
137 |
+ Log(preply.from, icmp->icmp_type, IcmpPacketType(icmp->icmp_type), preply.rtt, preply.hops); |
138 |
Ip::Address::FreeAddrInfo(from); |
139 |
} |
140 |
|
141 |
|
142 |
=== modified file 'src/icmp/Icmp6.cc' |
143 |
--- src/icmp/Icmp6.cc 2013-06-03 14:05:16 +0000 |
144 |
+++ src/icmp/Icmp6.cc 2014-09-15 05:06:14 +0000 |
145 |
@@ -50,57 +50,61 @@ |
146 |
|
147 |
// Icmp6 OP-Codes |
148 |
// see http://www.iana.org/assignments/icmpv6-parameters |
149 |
-// NP: LowPktStr is for codes 0-127 |
150 |
-static const char *icmp6LowPktStr[] = { |
151 |
- "ICMP 0", // 0 |
152 |
- "Destination Unreachable", // 1 - RFC2463 |
153 |
- "Packet Too Big", // 2 - RFC2463 |
154 |
- "Time Exceeded", // 3 - RFC2463 |
155 |
- "Parameter Problem", // 4 - RFC2463 |
156 |
- "ICMP 5", // 5 |
157 |
- "ICMP 6", // 6 |
158 |
- "ICMP 7", // 7 |
159 |
- "ICMP 8", // 8 |
160 |
- "ICMP 9", // 9 |
161 |
- "ICMP 10" // 10 |
162 |
-}; |
163 |
- |
164 |
-// NP: HighPktStr is for codes 128-255 |
165 |
-static const char *icmp6HighPktStr[] = { |
166 |
- "Echo Request", // 128 - RFC2463 |
167 |
- "Echo Reply", // 129 - RFC2463 |
168 |
- "Multicast Listener Query", // 130 - RFC2710 |
169 |
- "Multicast Listener Report", // 131 - RFC2710 |
170 |
- "Multicast Listener Done", // 132 - RFC2710 |
171 |
- "Router Solicitation", // 133 - RFC4861 |
172 |
- "Router Advertisement", // 134 - RFC4861 |
173 |
- "Neighbor Solicitation", // 135 - RFC4861 |
174 |
- "Neighbor Advertisement", // 136 - RFC4861 |
175 |
- "Redirect Message", // 137 - RFC4861 |
176 |
- "Router Renumbering", // 138 - Crawford |
177 |
- "ICMP Node Information Query", // 139 - RFC4620 |
178 |
- "ICMP Node Information Response", // 140 - RFC4620 |
179 |
- "Inverse Neighbor Discovery Solicitation", // 141 - RFC3122 |
180 |
- "Inverse Neighbor Discovery Advertisement", // 142 - RFC3122 |
181 |
- "Version 2 Multicast Listener Report", // 143 - RFC3810 |
182 |
- "Home Agent Address Discovery Request", // 144 - RFC3775 |
183 |
- "Home Agent Address Discovery Reply", // 145 - RFC3775 |
184 |
- "Mobile Prefix Solicitation", // 146 - RFC3775 |
185 |
- "Mobile Prefix Advertisement", // 147 - RFC3775 |
186 |
- "Certification Path Solicitation", // 148 - RFC3971 |
187 |
- "Certification Path Advertisement", // 149 - RFC3971 |
188 |
- "ICMP Experimental (150)", // 150 - RFC4065 |
189 |
- "Multicast Router Advertisement", // 151 - RFC4286 |
190 |
- "Multicast Router Solicitation", // 152 - RFC4286 |
191 |
- "Multicast Router Termination", // 153 - [RFC4286] |
192 |
- "ICMP 154", |
193 |
- "ICMP 155", |
194 |
- "ICMP 156", |
195 |
- "ICMP 157", |
196 |
- "ICMP 158", |
197 |
- "ICMP 159", |
198 |
- "ICMP 160" |
199 |
-}; |
200 |
+static const char * |
201 |
+IcmpPacketType(uint8_t v) |
202 |
+{ |
203 |
+ // NP: LowPktStr is for codes 0-127 |
204 |
+ static const char *icmp6LowPktStr[] = { |
205 |
+ "ICMPv6 0", // 0 |
206 |
+ "Destination Unreachable", // 1 - RFC2463 |
207 |
+ "Packet Too Big", // 2 - RFC2463 |
208 |
+ "Time Exceeded", // 3 - RFC2463 |
209 |
+ "Parameter Problem", // 4 - RFC2463 |
210 |
+ }; |
211 |
+ |
212 |
+ // low codes 1-4 registered |
213 |
+ if (0 < v && v < 5) |
214 |
+ return icmp6LowPktStr[(int)(v&0x7f)]; |
215 |
+ |
216 |
+ // NP: HighPktStr is for codes 128-255 |
217 |
+ static const char *icmp6HighPktStr[] = { |
218 |
+ "Echo Request", // 128 - RFC2463 |
219 |
+ "Echo Reply", // 129 - RFC2463 |
220 |
+ "Multicast Listener Query", // 130 - RFC2710 |
221 |
+ "Multicast Listener Report", // 131 - RFC2710 |
222 |
+ "Multicast Listener Done", // 132 - RFC2710 |
223 |
+ "Router Solicitation", // 133 - RFC4861 |
224 |
+ "Router Advertisement", // 134 - RFC4861 |
225 |
+ "Neighbor Solicitation", // 135 - RFC4861 |
226 |
+ "Neighbor Advertisement", // 136 - RFC4861 |
227 |
+ "Redirect Message", // 137 - RFC4861 |
228 |
+ "Router Renumbering", // 138 - Crawford |
229 |
+ "ICMP Node Information Query", // 139 - RFC4620 |
230 |
+ "ICMP Node Information Response", // 140 - RFC4620 |
231 |
+ "Inverse Neighbor Discovery Solicitation", // 141 - RFC3122 |
232 |
+ "Inverse Neighbor Discovery Advertisement", // 142 - RFC3122 |
233 |
+ "Version 2 Multicast Listener Report", // 143 - RFC3810 |
234 |
+ "Home Agent Address Discovery Request", // 144 - RFC3775 |
235 |
+ "Home Agent Address Discovery Reply", // 145 - RFC3775 |
236 |
+ "Mobile Prefix Solicitation", // 146 - RFC3775 |
237 |
+ "Mobile Prefix Advertisement", // 147 - RFC3775 |
238 |
+ "Certification Path Solicitation", // 148 - RFC3971 |
239 |
+ "Certification Path Advertisement", // 149 - RFC3971 |
240 |
+ "ICMP Experimental (150)", // 150 - RFC4065 |
241 |
+ "Multicast Router Advertisement", // 151 - RFC4286 |
242 |
+ "Multicast Router Solicitation", // 152 - RFC4286 |
243 |
+ "Multicast Router Termination", // 153 - [RFC4286] |
244 |
+ }; |
245 |
+ |
246 |
+ // high codes 127-153 registered |
247 |
+ if (127 < v && v < 154) |
248 |
+ return icmp6HighPktStr[(int)(v&0x7f)]; |
249 |
+ |
250 |
+ // give all others a generic display |
251 |
+ static char buf[50]; |
252 |
+ snprintf(buf, sizeof(buf), "ICMPv6 %u", v); |
253 |
+ return buf; |
254 |
+} |
255 |
|
256 |
Icmp6::Icmp6() : Icmp() |
257 |
{ |
258 |
@@ -236,6 +240,12 @@ |
259 |
from->ai_addr, |
260 |
&from->ai_addrlen); |
261 |
|
262 |
+ if (n <= 0) { |
263 |
+ debugs(42, DBG_CRITICAL, HERE << "Error when calling recvfrom() on ICMPv6 socket."); |
264 |
+ Ip::Address::FreeAddrInfo(from); |
265 |
+ return; |
266 |
+ } |
267 |
+ |
268 |
preply.from = *from; |
269 |
|
270 |
#if GETTIMEOFDAY_NO_TZP |
271 |
@@ -291,8 +301,7 @@ |
272 |
|
273 |
default: |
274 |
debugs(42, 8, HERE << preply.from << " said: " << icmp6header->icmp6_type << "/" << (int)icmp6header->icmp6_code << " " << |
275 |
- ( icmp6header->icmp6_type&0x80 ? icmp6HighPktStr[(int)(icmp6header->icmp6_type&0x7f)] : icmp6LowPktStr[(int)(icmp6header->icmp6_type&0x7f)] ) |
276 |
- ); |
277 |
+ IcmpPacketType(icmp6header->icmp6_type)); |
278 |
} |
279 |
Ip::Address::FreeAddrInfo(from); |
280 |
return; |
281 |
@@ -331,7 +340,7 @@ |
282 |
|
283 |
Log(preply.from, |
284 |
icmp6header->icmp6_type, |
285 |
- ( icmp6header->icmp6_type&0x80 ? icmp6HighPktStr[(int)(icmp6header->icmp6_type&0x7f)] : icmp6LowPktStr[(int)(icmp6header->icmp6_type&0x7f)] ), |
286 |
+ IcmpPacketType(icmp6header->icmp6_type), |
287 |
preply.rtt, |
288 |
preply.hops); |
289 |
|
290 |
|
291 |
|
292 |
|
293 |
|
294 |
1.1 net-proxy/squid/files/squid-12683_12681.patch |
295 |
|
296 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-proxy/squid/files/squid-12683_12681.patch?rev=1.1&view=markup |
297 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-proxy/squid/files/squid-12683_12681.patch?rev=1.1&content-type=text/plain |
298 |
|
299 |
Index: squid-12683_12681.patch |
300 |
=================================================================== |
301 |
=== modified file 'src/snmp_core.cc' |
302 |
--- src/snmp_core.cc 2012-10-16 23:40:01 +0000 |
303 |
+++ src/snmp_core.cc 2014-09-15 04:59:19 +0000 |
304 |
@@ -362,7 +362,7 @@ |
305 |
void |
306 |
snmpHandleUdp(int sock, void *not_used) |
307 |
{ |
308 |
- LOCAL_ARRAY(char, buf, SNMP_REQUEST_SIZE); |
309 |
+ static char buf[SNMP_REQUEST_SIZE]; |
310 |
Ip::Address from; |
311 |
SnmpRequest *snmp_rq; |
312 |
int len; |
313 |
@@ -371,16 +371,11 @@ |
314 |
|
315 |
Comm::SetSelect(sock, COMM_SELECT_READ, snmpHandleUdp, NULL, 0); |
316 |
|
317 |
- memset(buf, '\0', SNMP_REQUEST_SIZE); |
318 |
+ memset(buf, '\0', sizeof(buf)); |
319 |
|
320 |
- len = comm_udp_recvfrom(sock, |
321 |
- buf, |
322 |
- SNMP_REQUEST_SIZE, |
323 |
- 0, |
324 |
- from); |
325 |
+ len = comm_udp_recvfrom(sock, buf, sizeof(buf)-1, 0, from); |
326 |
|
327 |
if (len > 0) { |
328 |
- buf[len] = '\0'; |
329 |
debugs(49, 3, "snmpHandleUdp: FD " << sock << ": received " << len << " bytes from " << from << "."); |
330 |
|
331 |
snmp_rq = (SnmpRequest *)xcalloc(1, sizeof(SnmpRequest)); |
332 |
|
333 |
=== modified file 'src/icmp/Icmp4.cc' |
334 |
--- src/icmp/Icmp4.cc 2013-01-09 00:19:44 +0000 |
335 |
+++ src/icmp/Icmp4.cc 2014-09-15 05:07:44 +0000 |
336 |
@@ -41,26 +41,38 @@ |
337 |
#include "IcmpPinger.h" |
338 |
#include "Debug.h" |
339 |
|
340 |
-const char *icmpPktStr[] = { |
341 |
- "Echo Reply", |
342 |
- "ICMP 1", |
343 |
- "ICMP 2", |
344 |
- "Destination Unreachable", |
345 |
- "Source Quench", |
346 |
- "Redirect", |
347 |
- "ICMP 6", |
348 |
- "ICMP 7", |
349 |
- "Echo", |
350 |
- "ICMP 9", |
351 |
- "ICMP 10", |
352 |
- "Time Exceeded", |
353 |
- "Parameter Problem", |
354 |
- "Timestamp", |
355 |
- "Timestamp Reply", |
356 |
- "Info Request", |
357 |
- "Info Reply", |
358 |
- "Out of Range Type" |
359 |
-}; |
360 |
+static const char * |
361 |
+IcmpPacketType(uint8_t v) |
362 |
+{ |
363 |
+ static const char *icmpPktStr[] = { |
364 |
+ "Echo Reply", |
365 |
+ "ICMP 1", |
366 |
+ "ICMP 2", |
367 |
+ "Destination Unreachable", |
368 |
+ "Source Quench", |
369 |
+ "Redirect", |
370 |
+ "ICMP 6", |
371 |
+ "ICMP 7", |
372 |
+ "Echo", |
373 |
+ "ICMP 9", |
374 |
+ "ICMP 10", |
375 |
+ "Time Exceeded", |
376 |
+ "Parameter Problem", |
377 |
+ "Timestamp", |
378 |
+ "Timestamp Reply", |
379 |
+ "Info Request", |
380 |
+ "Info Reply", |
381 |
+ "Out of Range Type" |
382 |
+ }; |
383 |
+ |
384 |
+ if (v > 17) { |
385 |
+ static char buf[50]; |
386 |
+ snprintf(buf, sizeof(buf), "ICMP %u (invalid)", v); |
387 |
+ return buf; |
388 |
+ } |
389 |
+ |
390 |
+ return icmpPktStr[v]; |
391 |
+} |
392 |
|
393 |
Icmp4::Icmp4() : Icmp() |
394 |
{ |
395 |
@@ -187,6 +199,12 @@ |
396 |
from->ai_addr, |
397 |
&from->ai_addrlen); |
398 |
|
399 |
+ if (n <= 0) { |
400 |
+ debugs(42, DBG_CRITICAL, HERE << "Error when calling recvfrom() on ICMP socket."); |
401 |
+ Ip::Address::FreeAddrInfo(from); |
402 |
+ return; |
403 |
+ } |
404 |
+ |
405 |
preply.from = *from; |
406 |
|
407 |
#if GETTIMEOFDAY_NO_TZP |
408 |
@@ -243,9 +261,15 @@ |
409 |
|
410 |
preply.psize = n - iphdrlen - (sizeof(icmpEchoData) - MAX_PKT4_SZ); |
411 |
|
412 |
+ if (preply.psize < 0) { |
413 |
+ debugs(42, DBG_CRITICAL, HERE << "Malformed ICMP packet."); |
414 |
+ Ip::Address::FreeAddrInfo(from); |
415 |
+ return; |
416 |
+ } |
417 |
+ |
418 |
control.SendResult(preply, (sizeof(pingerReplyData) - MAX_PKT4_SZ + preply.psize) ); |
419 |
|
420 |
- Log(preply.from, icmp->icmp_type, icmpPktStr[icmp->icmp_type], preply.rtt, preply.hops); |
421 |
+ Log(preply.from, icmp->icmp_type, IcmpPacketType(icmp->icmp_type), preply.rtt, preply.hops); |
422 |
preply.from.FreeAddrInfo(from); |
423 |
} |
424 |
|
425 |
|
426 |
=== modified file 'src/icmp/Icmp6.cc' |
427 |
--- src/icmp/Icmp6.cc 2013-01-09 00:19:44 +0000 |
428 |
+++ src/icmp/Icmp6.cc 2014-09-15 05:07:44 +0000 |
429 |
@@ -50,57 +50,61 @@ |
430 |
|
431 |
// Icmp6 OP-Codes |
432 |
// see http://www.iana.org/assignments/icmpv6-parameters |
433 |
-// NP: LowPktStr is for codes 0-127 |
434 |
-static const char *icmp6LowPktStr[] = { |
435 |
- "ICMP 0", // 0 |
436 |
- "Destination Unreachable", // 1 - RFC2463 |
437 |
- "Packet Too Big", // 2 - RFC2463 |
438 |
- "Time Exceeded", // 3 - RFC2463 |
439 |
- "Parameter Problem", // 4 - RFC2463 |
440 |
- "ICMP 5", // 5 |
441 |
- "ICMP 6", // 6 |
442 |
- "ICMP 7", // 7 |
443 |
- "ICMP 8", // 8 |
444 |
- "ICMP 9", // 9 |
445 |
- "ICMP 10" // 10 |
446 |
-}; |
447 |
- |
448 |
-// NP: HighPktStr is for codes 128-255 |
449 |
-static const char *icmp6HighPktStr[] = { |
450 |
- "Echo Request", // 128 - RFC2463 |
451 |
- "Echo Reply", // 129 - RFC2463 |
452 |
- "Multicast Listener Query", // 130 - RFC2710 |
453 |
- "Multicast Listener Report", // 131 - RFC2710 |
454 |
- "Multicast Listener Done", // 132 - RFC2710 |
455 |
- "Router Solicitation", // 133 - RFC4861 |
456 |
- "Router Advertisement", // 134 - RFC4861 |
457 |
- "Neighbor Solicitation", // 135 - RFC4861 |
458 |
- "Neighbor Advertisement", // 136 - RFC4861 |
459 |
- "Redirect Message", // 137 - RFC4861 |
460 |
- "Router Renumbering", // 138 - Crawford |
461 |
- "ICMP Node Information Query", // 139 - RFC4620 |
462 |
- "ICMP Node Information Response", // 140 - RFC4620 |
463 |
- "Inverse Neighbor Discovery Solicitation", // 141 - RFC3122 |
464 |
- "Inverse Neighbor Discovery Advertisement", // 142 - RFC3122 |
465 |
- "Version 2 Multicast Listener Report", // 143 - RFC3810 |
466 |
- "Home Agent Address Discovery Request", // 144 - RFC3775 |
467 |
- "Home Agent Address Discovery Reply", // 145 - RFC3775 |
468 |
- "Mobile Prefix Solicitation", // 146 - RFC3775 |
469 |
- "Mobile Prefix Advertisement", // 147 - RFC3775 |
470 |
- "Certification Path Solicitation", // 148 - RFC3971 |
471 |
- "Certification Path Advertisement", // 149 - RFC3971 |
472 |
- "ICMP Experimental (150)", // 150 - RFC4065 |
473 |
- "Multicast Router Advertisement", // 151 - RFC4286 |
474 |
- "Multicast Router Solicitation", // 152 - RFC4286 |
475 |
- "Multicast Router Termination", // 153 - [RFC4286] |
476 |
- "ICMP 154", |
477 |
- "ICMP 155", |
478 |
- "ICMP 156", |
479 |
- "ICMP 157", |
480 |
- "ICMP 158", |
481 |
- "ICMP 159", |
482 |
- "ICMP 160" |
483 |
-}; |
484 |
+static const char * |
485 |
+IcmpPacketType(uint8_t v) |
486 |
+{ |
487 |
+ // NP: LowPktStr is for codes 0-127 |
488 |
+ static const char *icmp6LowPktStr[] = { |
489 |
+ "ICMPv6 0", // 0 |
490 |
+ "Destination Unreachable", // 1 - RFC2463 |
491 |
+ "Packet Too Big", // 2 - RFC2463 |
492 |
+ "Time Exceeded", // 3 - RFC2463 |
493 |
+ "Parameter Problem", // 4 - RFC2463 |
494 |
+ }; |
495 |
+ |
496 |
+ // low codes 1-4 registered |
497 |
+ if (0 < v && v < 5) |
498 |
+ return icmp6LowPktStr[(int)(v&0x7f)]; |
499 |
+ |
500 |
+ // NP: HighPktStr is for codes 128-255 |
501 |
+ static const char *icmp6HighPktStr[] = { |
502 |
+ "Echo Request", // 128 - RFC2463 |
503 |
+ "Echo Reply", // 129 - RFC2463 |
504 |
+ "Multicast Listener Query", // 130 - RFC2710 |
505 |
+ "Multicast Listener Report", // 131 - RFC2710 |
506 |
+ "Multicast Listener Done", // 132 - RFC2710 |
507 |
+ "Router Solicitation", // 133 - RFC4861 |
508 |
+ "Router Advertisement", // 134 - RFC4861 |
509 |
+ "Neighbor Solicitation", // 135 - RFC4861 |
510 |
+ "Neighbor Advertisement", // 136 - RFC4861 |
511 |
+ "Redirect Message", // 137 - RFC4861 |
512 |
+ "Router Renumbering", // 138 - Crawford |
513 |
+ "ICMP Node Information Query", // 139 - RFC4620 |
514 |
+ "ICMP Node Information Response", // 140 - RFC4620 |
515 |
+ "Inverse Neighbor Discovery Solicitation", // 141 - RFC3122 |
516 |
+ "Inverse Neighbor Discovery Advertisement", // 142 - RFC3122 |
517 |
+ "Version 2 Multicast Listener Report", // 143 - RFC3810 |
518 |
+ "Home Agent Address Discovery Request", // 144 - RFC3775 |
519 |
+ "Home Agent Address Discovery Reply", // 145 - RFC3775 |
520 |
+ "Mobile Prefix Solicitation", // 146 - RFC3775 |
521 |
+ "Mobile Prefix Advertisement", // 147 - RFC3775 |
522 |
+ "Certification Path Solicitation", // 148 - RFC3971 |
523 |
+ "Certification Path Advertisement", // 149 - RFC3971 |
524 |
+ "ICMP Experimental (150)", // 150 - RFC4065 |
525 |
+ "Multicast Router Advertisement", // 151 - RFC4286 |
526 |
+ "Multicast Router Solicitation", // 152 - RFC4286 |
527 |
+ "Multicast Router Termination", // 153 - [RFC4286] |
528 |
+ }; |
529 |
+ |
530 |
+ // high codes 127-153 registered |
531 |
+ if (127 < v && v < 154) |
532 |
+ return icmp6HighPktStr[(int)(v&0x7f)]; |
533 |
+ |
534 |
+ // give all others a generic display |
535 |
+ static char buf[50]; |
536 |
+ snprintf(buf, sizeof(buf), "ICMPv6 %u", v); |
537 |
+ return buf; |
538 |
+} |
539 |
|
540 |
Icmp6::Icmp6() : Icmp() |
541 |
{ |
542 |
@@ -236,6 +240,12 @@ |
543 |
from->ai_addr, |
544 |
&from->ai_addrlen); |
545 |
|
546 |
+ if (n <= 0) { |
547 |
+ debugs(42, DBG_CRITICAL, HERE << "Error when calling recvfrom() on ICMPv6 socket."); |
548 |
+ Ip::Address::FreeAddrInfo(from); |
549 |
+ return; |
550 |
+ } |
551 |
+ |
552 |
preply.from = *from; |
553 |
|
554 |
#if GETTIMEOFDAY_NO_TZP |
555 |
@@ -291,8 +301,7 @@ |
556 |
|
557 |
default: |
558 |
debugs(42, 8, HERE << preply.from << " said: " << icmp6header->icmp6_type << "/" << (int)icmp6header->icmp6_code << " " << |
559 |
- ( icmp6header->icmp6_type&0x80 ? icmp6HighPktStr[(int)(icmp6header->icmp6_type&0x7f)] : icmp6LowPktStr[(int)(icmp6header->icmp6_type&0x7f)] ) |
560 |
- ); |
561 |
+ IcmpPacketType(icmp6header->icmp6_type)); |
562 |
} |
563 |
preply.from.FreeAddrInfo(from); |
564 |
return; |
565 |
@@ -331,7 +340,7 @@ |
566 |
|
567 |
Log(preply.from, |
568 |
icmp6header->icmp6_type, |
569 |
- ( icmp6header->icmp6_type&0x80 ? icmp6HighPktStr[(int)(icmp6header->icmp6_type&0x7f)] : icmp6LowPktStr[(int)(icmp6header->icmp6_type&0x7f)] ), |
570 |
+ IcmpPacketType(icmp6header->icmp6_type), |
571 |
preply.rtt, |
572 |
preply.hops); |