]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-rx.c
Avoiding conditional directives that break statements
[tcpdump] / print-rx.c
index db3ed4bc9029ec4e66e8f53bcacef86c77e7fde0..516c387ea6c08108a553757ec22178ad51163be7 100644 (file)
@@ -39,9 +39,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <tcpdump-stdinc.h>
+#include <netdissect-stdinc.h>
 
-#include "interface.h"
+#include "netdissect.h"
 #include "addrtoname.h"
 #include "extract.h"
 
@@ -688,8 +688,8 @@ rx_cache_insert(netdissect_options *ndo,
                rx_cache_next = 0;
 
        rxent->callnum = rxh->callNumber;
-       rxent->client = ip->ip_src;
-       rxent->server = ip->ip_dst;
+       UNALIGNED_MEMCPY(&rxent->client, &ip->ip_src, sizeof(uint32_t));
+       UNALIGNED_MEMCPY(&rxent->server, &ip->ip_dst, sizeof(uint32_t));
        rxent->dport = dport;
        rxent->serviceId = rxh->serviceId;
        rxent->opcode = EXTRACT_32BITS(bp + sizeof(struct rx_header));
@@ -708,8 +708,11 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, int sport,
 {
        int i;
        struct rx_cache_entry *rxent;
-       uint32_t clip = ip->ip_dst.s_addr;
-       uint32_t sip = ip->ip_src.s_addr;
+       uint32_t clip;
+       uint32_t sip;
+
+       UNALIGNED_MEMCPY(&clip, &ip->ip_dst, sizeof(uint32_t));
+       UNALIGNED_MEMCPY(&sip, &ip->ip_src, sizeof(uint32_t));
 
        /* Start the search where we last left off */
 
@@ -790,7 +793,7 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, int sport,
                        _t = (time_t) EXTRACT_32BITS(bp); \
                        bp += sizeof(int32_t); \
                        tm = localtime(&_t); \
-                       strftime(str, 256, "%Y/%m/%d %T", tm); \
+                       strftime(str, 256, "%Y/%m/%d %H:%M:%S", tm); \
                        ND_PRINT((ndo, " %s", str)); \
                }