X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/18c020c000d2cc939d52364e7812cb038e804838..4ee5f75b6c4c46d5e42ef8f633d9dfedd2401ac5:/print-pim.c diff --git a/print-pim.c b/print-pim.c index 82c19f2a..ba7d22ce 100644 --- a/print-pim.c +++ b/print-pim.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.44 2004-09-29 16:49:31 hannes 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 @@ -140,7 +140,7 @@ pimv1_join_prune_print(register const u_char *bp, register u_int len) 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)); @@ -161,9 +161,13 @@ pimv1_join_prune_print(register const u_char *bp, register u_int len) bp += 4; len -= 4; while (ngroups--) { - TCHECK2(bp[0], 4); + /* + * XXX - does the address have length "addrlen" and the + * mask length "maddrlen"? + */ + 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); @@ -243,7 +247,7 @@ pimv1_print(register const u_char *bp, register u_int len) 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; @@ -266,7 +270,7 @@ pimv1_print(register const u_char *bp, register u_int len) 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) @@ -507,7 +511,6 @@ static int pimv2_addr_print(const u_char *bp, enum pimv2_addrtype at, int silent) { int af; - const char *afstr; int len, hdrlen; TCHECK(bp[0]); @@ -517,14 +520,12 @@ pimv2_addr_print(const u_char *bp, enum pimv2_addrtype at, int silent) switch (bp[0]) { case 1: af = AF_INET; - afstr = "IPv4"; - len = 4; + len = sizeof(struct in_addr); break; #ifdef INET6 case 2: af = AF_INET6; - afstr = "IPv6"; - len = 16; + len = sizeof(struct in6_addr); break; #endif default: @@ -535,14 +536,12 @@ pimv2_addr_print(const u_char *bp, enum pimv2_addrtype at, int silent) hdrlen = 2; } else { switch (pimv2_addr_len) { - case 4: + case sizeof(struct in_addr): af = AF_INET; - afstr = "IPv4"; break; #ifdef INET6 - case 16: + case sizeof(struct in6_addr): af = AF_INET6; - afstr = "IPv6"; break; #endif default: @@ -743,7 +742,7 @@ pimv2_print(register const u_char *bp, register u_int len) switch (IP_V(ip)) { case 4: /* IPv4 */ printf(" "); - ip_print(bp, len); + ip_print(gndo, bp, len); break; #ifdef INET6 case 6: /* IPv6 */ @@ -1062,3 +1061,10 @@ pimv2_print(register const u_char *bp, register u_int len) trunc: (void)printf("[|pim]"); } + +/* + * Local Variables: + * c-style: whitesmith + * c-basic-offset: 8 + * End: + */