]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ahcp.c
CI: Add warning exemptions for Sun C (suncc-5.14) on Solaris 10
[tcpdump] / print-ahcp.c
index 8529b8602e37cf0c9a1886ed163f3a82648cbb9a..d2efc7f86bd80ee15a70e848b77a985c2143ed5b 100644 (file)
 
 /* Based on draft-chroboczek-ahcp-00 and source code of ahcpd-0.53 */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
 #include "netdissect-stdinc.h"
 
+#define ND_LONGJMP_FROM_TCHECK
 #include "netdissect.h"
 #include "extract.h"
 #include "addrtoname.h"
@@ -101,26 +100,19 @@ ahcp_time_print(netdissect_options *ndo,
                 const u_char *cp, uint8_t len)
 {
        time_t t;
-       struct tm *tm;
-       char buf[BUFSIZE];
+       char buf[sizeof("-yyyyyyyyyy-mm-dd hh:mm:ss UTC")];
 
        if (len != 4)
                goto invalid;
        t = GET_BE_U_4(cp);
-       if (NULL == (tm = gmtime(&t)))
-               ND_PRINT(": gmtime() error");
-       else if (0 == strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", tm))
-               ND_PRINT(": strftime() error");
-       else
-               ND_PRINT(": %s UTC", buf);
+       ND_PRINT(": %s",
+           nd_format_time(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S UTC",
+             gmtime(&t)));
        return;
 
 invalid:
        nd_print_invalid(ndo);
        ND_TCHECK_LEN(cp, len);
-       return;
-trunc:
-       nd_trunc(ndo);
 }
 
 static void
@@ -135,9 +127,6 @@ ahcp_seconds_print(netdissect_options *ndo,
 invalid:
        nd_print_invalid(ndo);
        ND_TCHECK_LEN(cp, len);
-       return;
-trunc:
-       nd_trunc(ndo);
 }
 
 static void
@@ -159,9 +148,6 @@ ahcp_ipv6_addresses_print(netdissect_options *ndo,
 invalid:
        nd_print_invalid(ndo);
        ND_TCHECK_LEN(cp, len);
-       return;
-trunc:
-       nd_trunc(ndo);
 }
 
 static void
@@ -183,9 +169,6 @@ ahcp_ipv4_addresses_print(netdissect_options *ndo,
 invalid:
        nd_print_invalid(ndo);
        ND_TCHECK_LEN(cp, len);
-       return;
-trunc:
-       nd_trunc(ndo);
 }
 
 static void
@@ -207,9 +190,6 @@ ahcp_ipv6_prefixes_print(netdissect_options *ndo,
 invalid:
        nd_print_invalid(ndo);
        ND_TCHECK_LEN(cp, len);
-       return;
-trunc:
-       nd_trunc(ndo);
 }
 
 static void
@@ -231,9 +211,6 @@ ahcp_ipv4_prefixes_print(netdissect_options *ndo,
 invalid:
        nd_print_invalid(ndo);
        ND_TCHECK_LEN(cp, len);
-       return;
-trunc:
-       nd_trunc(ndo);
 }
 
 static void
@@ -291,9 +268,6 @@ ahcp1_options_print(netdissect_options *ndo,
 invalid:
        nd_print_invalid(ndo);
        ND_TCHECK_LEN(cp, len);
-       return;
-trunc:
-       nd_trunc(ndo);
 }
 
 static void
@@ -338,9 +312,7 @@ ahcp1_body_print(netdissect_options *ndo,
 invalid:
        nd_print_invalid(ndo);
        ND_TCHECK_LEN(cp, len);
-       return;
-trunc:
-       nd_trunc(ndo);
+
 }
 
 void
@@ -407,7 +379,4 @@ ahcp_print(netdissect_options *ndo,
 invalid:
        nd_print_invalid(ndo);
        ND_TCHECK_LEN(cp, len);
-       return;
-trunc:
-       nd_trunc(ndo);
 }