print-ip6.c (313537) | print-ip6.c (327234) |
---|---|
1/* 2 * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that: (1) source code distributions 7 * retain the above copyright notice and this paragraph in its entirety, (2) 8 * distributions including binary code include the above copyright notice and --- 266 unchanged lines hidden (view full) --- 275 ipend = bp + len; 276 if (ipend < ndo->ndo_snapend) 277 ndo->ndo_snapend = ipend; 278 279 cp = (const u_char *)ip6; 280 advance = sizeof(struct ip6_hdr); 281 nh = ip6->ip6_nxt; 282 while (cp < ndo->ndo_snapend && advance > 0) { | 1/* 2 * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that: (1) source code distributions 7 * retain the above copyright notice and this paragraph in its entirety, (2) 8 * distributions including binary code include the above copyright notice and --- 266 unchanged lines hidden (view full) --- 275 ipend = bp + len; 276 if (ipend < ndo->ndo_snapend) 277 ndo->ndo_snapend = ipend; 278 279 cp = (const u_char *)ip6; 280 advance = sizeof(struct ip6_hdr); 281 nh = ip6->ip6_nxt; 282 while (cp < ndo->ndo_snapend && advance > 0) { |
283 if (len < (u_int)advance) 284 goto trunc; |
|
283 cp += advance; 284 len -= advance; 285 286 if (cp == (const u_char *)(ip6 + 1) && 287 nh != IPPROTO_TCP && nh != IPPROTO_UDP && 288 nh != IPPROTO_DCCP && nh != IPPROTO_SCTP) { 289 ND_PRINT((ndo, "%s > %s: ", ip6addr_string(ndo, &ip6->ip6_src), 290 ip6addr_string(ndo, &ip6->ip6_dst))); --- 26 unchanged lines hidden (view full) --- 317 * XXX - we don't use "advance"; RFC 3775 says that 318 * the next header field in a mobility header 319 * should be IPPROTO_NONE, but speaks of 320 * the possiblity of a future extension in 321 * which payload can be piggybacked atop a 322 * mobility header. 323 */ 324 advance = mobility_print(ndo, cp, (const u_char *)ip6); | 285 cp += advance; 286 len -= advance; 287 288 if (cp == (const u_char *)(ip6 + 1) && 289 nh != IPPROTO_TCP && nh != IPPROTO_UDP && 290 nh != IPPROTO_DCCP && nh != IPPROTO_SCTP) { 291 ND_PRINT((ndo, "%s > %s: ", ip6addr_string(ndo, &ip6->ip6_src), 292 ip6addr_string(ndo, &ip6->ip6_dst))); --- 26 unchanged lines hidden (view full) --- 319 * XXX - we don't use "advance"; RFC 3775 says that 320 * the next header field in a mobility header 321 * should be IPPROTO_NONE, but speaks of 322 * the possiblity of a future extension in 323 * which payload can be piggybacked atop a 324 * mobility header. 325 */ 326 advance = mobility_print(ndo, cp, (const u_char *)ip6); |
327 if (advance < 0) 328 return; |
|
325 nh = *cp; 326 return; 327 case IPPROTO_ROUTING: | 329 nh = *cp; 330 return; 331 case IPPROTO_ROUTING: |
332 ND_TCHECK(*cp); |
|
328 advance = rt6_print(ndo, cp, (const u_char *)ip6); | 333 advance = rt6_print(ndo, cp, (const u_char *)ip6); |
334 if (advance < 0) 335 return; |
|
329 nh = *cp; 330 break; 331 case IPPROTO_SCTP: 332 sctp_print(ndo, cp, (const u_char *)ip6, len); 333 return; 334 case IPPROTO_DCCP: 335 dccp_print(ndo, cp, (const u_char *)ip6, len); 336 return; 337 case IPPROTO_TCP: 338 tcp_print(ndo, cp, len, (const u_char *)ip6, fragmented); 339 return; 340 case IPPROTO_UDP: 341 udp_print(ndo, cp, len, (const u_char *)ip6, fragmented); 342 return; 343 case IPPROTO_ICMPV6: 344 icmp6_print(ndo, cp, len, (const u_char *)ip6, fragmented); 345 return; 346 case IPPROTO_AH: 347 advance = ah_print(ndo, cp); | 336 nh = *cp; 337 break; 338 case IPPROTO_SCTP: 339 sctp_print(ndo, cp, (const u_char *)ip6, len); 340 return; 341 case IPPROTO_DCCP: 342 dccp_print(ndo, cp, (const u_char *)ip6, len); 343 return; 344 case IPPROTO_TCP: 345 tcp_print(ndo, cp, len, (const u_char *)ip6, fragmented); 346 return; 347 case IPPROTO_UDP: 348 udp_print(ndo, cp, len, (const u_char *)ip6, fragmented); 349 return; 350 case IPPROTO_ICMPV6: 351 icmp6_print(ndo, cp, len, (const u_char *)ip6, fragmented); 352 return; 353 case IPPROTO_AH: 354 advance = ah_print(ndo, cp); |
355 if (advance < 0) 356 return; |
|
348 nh = *cp; 349 break; 350 case IPPROTO_ESP: 351 { 352 int enh, padlen; 353 advance = esp_print(ndo, cp, len, (const u_char *)ip6, &enh, &padlen); | 357 nh = *cp; 358 break; 359 case IPPROTO_ESP: 360 { 361 int enh, padlen; 362 advance = esp_print(ndo, cp, len, (const u_char *)ip6, &enh, &padlen); |
363 if (advance < 0) 364 return; |
|
354 nh = enh & 0xff; 355 len -= padlen; 356 break; 357 } 358 case IPPROTO_IPCOMP: 359 { 360 ipcomp_print(ndo, cp); 361 /* --- 51 unchanged lines hidden --- | 365 nh = enh & 0xff; 366 len -= padlen; 367 break; 368 } 369 case IPPROTO_IPCOMP: 370 { 371 ipcomp_print(ndo, cp); 372 /* --- 51 unchanged lines hidden --- |