]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-hsrp.c
Handle very large -f files by rejecting them.
[tcpdump] / print-hsrp.c
index b72ac0a69fa610eb91ab8ec46f66fad4a7ed1686..35146460c8552d06344069b03a354c3f1f54c9be 100644 (file)
  * SUCH DAMAGE.
  */
 
+/* \summary: Cisco Hot Standby Router Protocol (HSRP) printer */
+
 /* Cisco Hot Standby Router Protocol (HSRP). */
 
-#define NETDISSECT_REWORKED
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#include <tcpdump-stdinc.h>
+#include <netdissect-stdinc.h>
 
-#include "interface.h"
+#include "netdissect.h"
 #include "addrtoname.h"
 
 /* HSRP op code types. */
@@ -79,22 +80,22 @@ static const struct tok states[] = {
 
 /* HSRP protocol header. */
 struct hsrp {
-       uint8_t hsrp_version;
-       uint8_t hsrp_op_code;
-       uint8_t hsrp_state;
-       uint8_t hsrp_hellotime;
-       uint8_t hsrp_holdtime;
-       uint8_t hsrp_priority;
-       uint8_t hsrp_group;
-       uint8_t hsrp_reserved;
-       uint8_t hsrp_authdata[HSRP_AUTH_SIZE];
+       uint8_t         hsrp_version;
+       uint8_t         hsrp_op_code;
+       uint8_t         hsrp_state;
+       uint8_t         hsrp_hellotime;
+       uint8_t         hsrp_holdtime;
+       uint8_t         hsrp_priority;
+       uint8_t         hsrp_group;
+       uint8_t         hsrp_reserved;
+       uint8_t         hsrp_authdata[HSRP_AUTH_SIZE];
        struct in_addr  hsrp_virtaddr;
 };
 
 void
 hsrp_print(netdissect_options *ndo, register const uint8_t *bp, register u_int len)
 {
-       struct hsrp *hp = (struct hsrp *) bp;
+       const struct hsrp *hp = (const struct hsrp *) bp;
 
        ND_TCHECK(hp->hsrp_version);
        ND_PRINT((ndo, "HSRPv%d", hp->hsrp_version));
@@ -116,9 +117,9 @@ hsrp_print(netdissect_options *ndo, register const uint8_t *bp, register u_int l
        ND_PRINT((ndo, "addr=%s", ipaddr_string(ndo, &hp->hsrp_virtaddr)));
        if (ndo->ndo_vflag) {
                ND_PRINT((ndo, " hellotime="));
-               relts_print(ndo, hp->hsrp_hellotime);
+               unsigned_relts_print(ndo, hp->hsrp_hellotime);
                ND_PRINT((ndo, " holdtime="));
-               relts_print(ndo, hp->hsrp_holdtime);
+               unsigned_relts_print(ndo, hp->hsrp_holdtime);
                ND_PRINT((ndo, " priority=%d", hp->hsrp_priority));
                ND_PRINT((ndo, " auth=\""));
                if (fn_printn(ndo, hp->hsrp_authdata, sizeof(hp->hsrp_authdata),