#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.83 2005-05-14 00:42:28 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.84 2005-07-11 20:15:31 hannes Exp $";
#endif
#ifdef HAVE_CONFIG_H
printf(" [invalid number of groups]");
return;
}
- TCHECK2(bp[group + 4], 16);
+ TCHECK2(bp[group + 4], sizeof(struct in6_addr));
printf(" [gaddr %s", ip6addr_string(&bp[group + 4]));
printf(" %s", tok2str(mldv2report2str, " [v2-report-#%d]",
bp[group]));
nsrcs = (bp[group + 2] << 8) + bp[group + 3];
/* Check the number of sources and print them */
- if (len < group + 20 + (nsrcs * 16)) {
+ if (len < group + 20 + (nsrcs * sizeof(struct in6_addr))) {
printf(" [invalid number of sources %d]", nsrcs);
return;
}
/* Print the sources */
(void)printf(" {");
for (j = 0; j < nsrcs; j++) {
- TCHECK2(bp[group + 20 + j * 16], 16);
- printf(" %s", ip6addr_string(&bp[group + 20 + j * 16]));
+ TCHECK2(bp[group + 20 + j * sizeof(struct in6_addr)],
+ sizeof(struct in6_addr));
+ printf(" %s", ip6addr_string(&bp[group + 20 + j * sizeof(struct in6_addr)]));
}
(void)printf(" }");
}
/* Next group record */
- group += 20 + nsrcs * 16;
+ group += 20 + nsrcs * sizeof(struct in6_addr);
printf("]");
}
}
if (vflag) {
(void)printf(" [max resp delay=%d]", mrt);
}
- TCHECK2(bp[8], 16);
+ TCHECK2(bp[8], sizeof(struct in6_addr));
printf(" [gaddr %s", ip6addr_string(&bp[8]));
if (vflag) {
TCHECK2(bp[26], 2);
nsrcs = ntohs(*(u_short *)&bp[26]);
if (nsrcs > 0) {
- if (len < 28 + nsrcs * 16)
+ if (len < 28 + nsrcs * sizeof(struct in6_addr))
printf(" [invalid number of sources]");
else if (vflag > 1) {
printf(" {");
for (i = 0; i < nsrcs; i++) {
- TCHECK2(bp[28 + i * 16], 16);
- printf(" %s", ip6addr_string(&bp[28 + i * 16]));
+ TCHECK2(bp[28 + i * sizeof(struct in6_addr)],
+ sizeof(struct in6_addr));
+ printf(" %s", ip6addr_string(&bp[28 + i * sizeof(struct in6_addr)]));
}
printf(" }");
} else
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.146 2005-07-11 12:58:12 hannes Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.147 2005-07-11 20:15:32 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
*/
static int
-isis_print_is_reach_subtlv (const u_int8_t *tptr,int subt,int subl,const char *ident) {
+isis_print_is_reach_subtlv (const u_int8_t *tptr,u_int subt,u_int subl,const char *ident) {
- int priority_level,bandwidth_constraint;
+ u_int priority_level,bandwidth_constraint;
union { /* int to float conversion buffer for several subTLVs */
float f;
u_int32_t i;
break;
case ISIS_SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR:
case ISIS_SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR:
- if (subl >= 4)
+ if (subl >= sizeof(struct in_addr))
printf(", %s", ipaddr_string(tptr));
break;
case ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW :
isis_print_extd_ip_reach (const u_int8_t *tptr, const char *ident, u_int16_t afi) {
char ident_buffer[20];
- u_int8_t prefix[16]; /* shared copy buffer for IPv4 and IPv6 prefixes */
+ u_int8_t prefix[sizeof(struct in6_addr)]; /* shared copy buffer for IPv4 and IPv6 prefixes */
u_int metric, status_byte, bit_length, byte_length, sublen, processed, subtlvtype, subtlvlen;
if (!TTEST2(*tptr, 4))
if (!TTEST2(*tptr, byte_length))
return (0);
- memset(prefix, 0, 16); /* clear the copy buffer */
+ memset(prefix, 0, sizeof(struct in6_addr)); /* clear the copy buffer */
memcpy(prefix,tptr,byte_length); /* copy as much as is stored in the TLV */
tptr+=byte_length;
processed+=byte_length;
break;
case ISIS_TLV_IP6ADDR:
- while (tmp>=16) {
- if (!TTEST2(*tptr, 16))
+ while (tmp>=sizeof(struct in6_addr)) {
+ if (!TTEST2(*tptr, sizeof(struct in6_addr)))
goto trunctlv;
printf("\n\t IPv6 interface address: %s",
ip6addr_string(tptr));
- tptr += 16;
- tmp -= 16;
+ tptr += sizeof(struct in6_addr);
+ tmp -= sizeof(struct in6_addr);
}
break;
#endif
break;
case ISIS_TLV_TE_ROUTER_ID:
- if (!TTEST2(*pptr, 4))
+ if (!TTEST2(*pptr, sizeof(struct in_addr)))
goto trunctlv;
printf("\n\t Traffic Engineering Router ID: %s", ipaddr_string(pptr));
break;
case ISIS_TLV_IPADDR:
- while (tmp>=4) {
- if (!TTEST2(*tptr, 4))
+ while (tmp>=sizeof(struct in_addr)) {
+ if (!TTEST2(*tptr, sizeof(struct in_addr)))
goto trunctlv;
printf("\n\t IPv4 interface address: %s", ipaddr_string(tptr));
- tptr += 4;
- tmp -= 4;
+ tptr += sizeof(struct in_addr);
+ tmp -= sizeof(struct in_addr);
}
break;
printf(", Flags: [%s]", ISIS_MASK_TLV_SHARED_RISK_GROUP(*tptr++) ? "numbered" : "unnumbered");
tmp--;
- if (tmp < 4)
+ if (tmp < sizeof(struct in_addr))
break;
- if (!TTEST2(*tptr,4))
+ if (!TTEST2(*tptr,sizeof(struct in_addr)))
goto trunctlv;
printf("\n\t IPv4 interface address: %s", ipaddr_string(tptr));
- tptr+=4;
- tmp-=4;
+ tptr+=sizeof(struct in_addr);
+ tmp-=sizeof(struct in_addr);
- if (tmp < 4)
+ if (tmp < sizeof(struct in_addr))
break;
- if (!TTEST2(*tptr,4))
+ if (!TTEST2(*tptr,sizeof(struct in_addr)))
goto trunctlv;
printf("\n\t IPv4 neighbor address: %s", ipaddr_string(tptr));
- tptr+=4;
- tmp-=4;
+ tptr+=sizeof(struct in_addr);
+ tmp-=sizeof(struct in_addr);
while (tmp>=4) {
if (!TTEST2(*tptr, 4))
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ldp.c,v 1.14 2005-06-16 01:10:21 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ldp.c,v 1.15 2005-07-11 20:15:32 hannes Exp $";
#endif
#ifdef HAVE_CONFIG_H
printf("IPv4, addresses:");
for (i=0; i<(tlv_tlen-2)/4; i++) {
printf(" %s",ipaddr_string(tptr));
- tptr+=4;
+ tptr+=sizeof(struct in_addr);
}
}
#ifdef INET6
printf("IPv6, addresses:");
for (i=0; i<(tlv_tlen-2)/16; i++) {
printf(" %s",ip6addr_string(tptr));
- tptr+=16;
+ tptr+=sizeof(struct in6_addr);
}
}
#endif
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.47 2005-04-20 22:08:27 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.48 2005-07-11 20:15:33 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
return;
}
- TCHECK2(bp[0], 4);
+ TCHECK2(bp[0], sizeof(struct in_addr));
if (vflag > 1)
(void)printf("\n");
(void)printf(" Upstream Nbr: %s", ipaddr_string(bp));
* XXX - does the address have length "addrlen" and the
* mask length "maddrlen"?
*/
- TCHECK2(bp[0], 4);
+ TCHECK2(bp[0], sizeof(struct in_addr));
(void)printf("\n\tGroup: %s", ipaddr_string(bp));
- TCHECK2(bp[4], 4);
+ TCHECK2(bp[4], sizeof(struct in_addr));
if (EXTRACT_32BITS(&bp[4]) != 0xffffffff)
(void)printf("/%s", ipaddr_string(&bp[4]));
TCHECK2(bp[8], 4);
break;
case 2:
(void)printf(" Register-Stop");
- TCHECK2(bp[12], 4);
+ TCHECK2(bp[12], sizeof(struct in_addr));
(void)printf(" for %s > %s", ipaddr_string(&bp[8]),
ipaddr_string(&bp[12]));
break;
break;
case 5:
(void)printf(" Assert");
- TCHECK2(bp[16], 4);
+ TCHECK2(bp[16], sizeof(struct in_addr));
(void)printf(" for %s > %s", ipaddr_string(&bp[16]),
ipaddr_string(&bp[8]));
if (EXTRACT_32BITS(&bp[12]) != 0xffffffff)
switch (bp[0]) {
case 1:
af = AF_INET;
- len = 4;
+ len = sizeof(struct in_addr);
break;
#ifdef INET6
case 2:
af = AF_INET6;
- len = 16;
+ len = sizeof(struct in6_addr);
break;
#endif
default:
hdrlen = 2;
} else {
switch (pimv2_addr_len) {
- case 4:
+ case sizeof(struct in_addr):
af = AF_INET;
break;
#ifdef INET6
- case 16:
+ case sizeof(struct in6_addr):
af = AF_INET6;
break;
#endif
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-rsvp.c,v 1.36 2005-06-16 00:49:55 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-rsvp.c,v 1.37 2005-07-11 20:15:33 hannes Exp $";
#endif
#ifdef HAVE_CONFIG_H
printf("%s IPv4 DestAddress: %s, Protocol ID: 0x%02x",
ident,
ipaddr_string(obj_tptr),
- *(obj_tptr+4));
+ *(obj_tptr+sizeof(struct in_addr)));
printf("%s Flags: [0x%02x], DestPort %u",
ident,
*(obj_tptr+5),
printf("%s IPv6 DestAddress: %s, Protocol ID: 0x%02x",
ident,
ip6addr_string(obj_tptr),
- *(obj_tptr+16));
+ *(obj_tptr+sizeof(struct in6_addr)));
printf("%s Flags: [0x%02x], DestPort %u",
ident,
- *(obj_tptr+17),
- EXTRACT_16BITS(obj_tptr+18));
+ *(obj_tptr+sizeof(struct in6_addr)+1),
+ EXTRACT_16BITS(obj_tptr+sizeof(struct in6_addr)+2));
obj_tlen-=20;
obj_tptr+=20;
break;
case RSVP_OBJ_CONFIRM:
switch(rsvp_obj_ctype) {
case RSVP_CTYPE_IPV4:
- if (obj_tlen < 4)
+ if (obj_tlen < sizeof(struct in_addr))
return -1;
printf("%s IPv4 Receiver Address: %s",
ident,
ipaddr_string(obj_tptr));
- obj_tlen-=4;
- obj_tptr+=4;
+ obj_tlen-=sizeof(struct in_addr);
+ obj_tptr+=sizeof(struct in_addr);
break;
#ifdef INET6
case RSVP_CTYPE_IPV6:
- if (obj_tlen < 16)
+ if (obj_tlen < sizeof(struct in6_addr))
return -1;
printf("%s IPv6 Receiver Address: %s",
ident,
ip6addr_string(obj_tptr));
- obj_tlen-=16;
- obj_tptr+=16;
+ obj_tlen-=sizeof(struct in6_addr);
+ obj_tptr+=sizeof(struct in6_addr);
break;
#endif
default:
case RSVP_OBJ_NOTIFY_REQ:
switch(rsvp_obj_ctype) {
case RSVP_CTYPE_IPV4:
- if (obj_tlen < 4)
+ if (obj_tlen < sizeof(struct in_addr))
return -1;
printf("%s IPv4 Notify Node Address: %s",
ident,
ipaddr_string(obj_tptr));
- obj_tlen-=4;
- obj_tptr+=4;
+ obj_tlen-=sizeof(struct in_addr);
+ obj_tptr+=sizeof(struct in_addr);
break;
#ifdef INET6
case RSVP_CTYPE_IPV6:
- if (obj_tlen < 16)
+ if (obj_tlen < sizeof(struct in6_addr))
return-1;
printf("%s IPv6 Notify Node Address: %s",
ident,
ip6addr_string(obj_tptr));
- obj_tlen-=16;
- obj_tptr+=16;
+ obj_tlen-=sizeof(struct in6_addr);
+ obj_tptr+=sizeof(struct in6_addr);
break;
#endif
default: