aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmo-pcap/wireformat.h12
-rw-r--r--src/osmo_client_network.c9
2 files changed, 18 insertions, 3 deletions
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 @@ struct osmo_pcap_data {
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 @@ void osmo_client_send_data(struct osmo_pcap_client *client,
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 @@ void osmo_client_send_data(struct osmo_pcap_client *client,
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);