X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/aa15fc8b978767f45a06a30ba71bbd326ca27b81..ffa1470e5c7ff0e50028d085a481dc797b0b51ed:/print-hsrp.c diff --git a/print-hsrp.c b/print-hsrp.c index ccb6866b..21ec0540 100644 --- a/print-hsrp.c +++ b/print-hsrp.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2001 Julian Cowley * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -30,18 +30,17 @@ /* Cisco Hot Standby Router Protocol (HSRP). */ #ifndef lint -static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-hsrp.c,v 1.3 2002-05-07 18:31:49 fenner Exp $"; +static const char rcsid[] _U_ = + "@(#) $Header: /tcpdump/master/tcpdump/print-hsrp.c,v 1.9.2.1 2005-05-06 07:57:17 guy Exp $"; #endif #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include +#include #include -#include #include "interface.h" #include "addrtoname.h" @@ -86,20 +85,20 @@ static struct tok states[] = { /* HSRP protocol header. */ struct hsrp { - u_char hsrp_version; - u_char hsrp_op_code; - u_char hsrp_state; - u_char hsrp_hellotime; - u_char hsrp_holdtime; - u_char hsrp_priority; - u_char hsrp_group; - u_char hsrp_reserved; - u_char hsrp_authdata[HSRP_AUTH_SIZE]; + u_int8_t hsrp_version; + u_int8_t hsrp_op_code; + u_int8_t hsrp_state; + u_int8_t hsrp_hellotime; + u_int8_t hsrp_holdtime; + u_int8_t hsrp_priority; + u_int8_t hsrp_group; + u_int8_t hsrp_reserved; + u_int8_t hsrp_authdata[HSRP_AUTH_SIZE]; struct in_addr hsrp_virtaddr; }; void -hsrp_print(register const u_char *bp, register u_int len) +hsrp_print(register const u_int8_t *bp, register u_int len) { struct hsrp *hp = (struct hsrp *) bp; @@ -128,7 +127,11 @@ hsrp_print(register const u_char *bp, register u_int len) relts_print(hp->hsrp_holdtime); printf(" priority=%d", hp->hsrp_priority); printf(" auth=\""); - fn_printn(hp->hsrp_authdata, sizeof(hp->hsrp_authdata), NULL); + if (fn_printn(hp->hsrp_authdata, sizeof(hp->hsrp_authdata), + snapend)) { + printf("\""); + goto trunc; + } printf("\""); } return;