diff options
-rw-r--r-- | src/osmo_client_core.c | 2 | ||||
-rw-r--r-- | src/osmo_client_network.c | 11 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/osmo_client_core.c b/src/osmo_client_core.c index 721f881..fd8b342 100644 --- a/src/osmo_client_core.c +++ b/src/osmo_client_core.c @@ -228,7 +228,7 @@ int osmo_client_capture(struct osmo_pcap_client *client, const char *device) return 1; } - client->handle = pcap_open_live(client->device, 2000, 0, + client->handle = pcap_open_live(client->device, 9000, 0, 1000, client->errbuf); if (!client->handle) { LOGP(DCLIENT, LOGL_ERROR, diff --git a/src/osmo_client_network.c b/src/osmo_client_network.c index bd1b9db..d4cde47 100644 --- a/src/osmo_client_network.c +++ b/src/osmo_client_network.c @@ -103,7 +103,13 @@ void osmo_client_send_data(struct osmo_pcap_client *client, struct pcap_pkthdr *hdr; struct msgb *msg; - msg = msgb_alloc(4096, "data-data"); + if (in_hdr->caplen > 9000) { + LOGP(DCLIENT, LOGL_ERROR, + "Capture len too big %zu\n", in_hdr->caplen); + return; + } + + msg = msgb_alloc(9000 + sizeof(*om_hdr) + sizeof(*hdr), "data-data"); if (!msg) { LOGP(DCLIENT, LOGL_ERROR, "Failed to allocate.\n"); return; @@ -128,8 +134,9 @@ void osmo_client_send_link(struct osmo_pcap_client *client) { struct pcap_file_header *hdr; struct osmo_pcap_data *om_hdr; + struct msgb *msg; - struct msgb *msg = msgb_alloc(4096, "link-data"); + msg = msgb_alloc(9000 + sizeof(*om_hdr) + sizeof(*hdr), "link-data"); if (!msg) { LOGP(DCLIENT, LOGL_ERROR, "Failed to allocate data.\n"); return; |