client: Deal with external representation for pcap files

We need to convert the 64bit timeval on a 64bit userspace (or on
OpenBSD) into a 32bit truncated value for being able to write the
file. This means we have 2038 issue here?
diff --git a/include/osmo-pcap/wireformat.h b/include/osmo-pcap/wireformat.h
index f094051..3f92ee8 100644
--- a/include/osmo-pcap/wireformat.h
+++ b/include/osmo-pcap/wireformat.h
@@ -43,4 +43,16 @@
 	uint8_t data[0];
 } __attribute__((packed));
 
+/**
+ * struct timeval is not the same across different
+ * architectures and for the external format it must
+ * be a 32bit value. We have a 2038 issue here?
+ */
+struct osmo_pcap_pkthdr {
+        uint32_t ts_sec;
+        uint32_t ts_usec;
+	uint32_t caplen;
+	uint32_t len;
+} __attribute__((packed));
+
 #endif
diff --git a/src/osmo_client_network.c b/src/osmo_client_network.c
index d4cde47..c488d65 100644
--- a/src/osmo_client_network.c
+++ b/src/osmo_client_network.c
@@ -100,7 +100,7 @@
 			   struct pcap_pkthdr *in_hdr, const uint8_t *data)
 {
 	struct osmo_pcap_data *om_hdr;
-	struct pcap_pkthdr *hdr;
+	struct osmo_pcap_pkthdr *hdr;
 	struct msgb *msg;
 
 	if (in_hdr->caplen > 9000) {
@@ -119,8 +119,11 @@
 	om_hdr->type = PKT_LINK_DATA;
 
 	msg->l2h = msgb_put(msg, sizeof(*hdr));
-	hdr = (struct pcap_pkthdr *) msg->l2h;
-	*hdr = *in_hdr;
+	hdr = (struct osmo_pcap_pkthdr *) msg->l2h;
+	hdr->ts_sec = in_hdr->ts.tv_sec;
+	hdr->ts_usec = in_hdr->ts.tv_usec;
+	hdr->caplen = in_hdr->caplen;
+	hdr->len = in_hdr->len;
 
 	msg->l3h = msgb_put(msg, in_hdr->caplen);
 	memcpy(msg->l3h, data, in_hdr->caplen);