layer2_tx: fixed packet size
This commit is contained in:
parent
bcbcf5aeff
commit
3b7d6baa74
|
@ -62,13 +62,14 @@ result_t layer2_tx_fill_packet_queue(layer2_tx_t *ctx)
|
||||||
// a packet is available -> move it to the queue
|
// a packet is available -> move it to the queue
|
||||||
header.tx_seq_nr = ctx->next_seq_nr;
|
header.tx_seq_nr = ctx->next_seq_nr;
|
||||||
|
|
||||||
uint8_t *packetbuf = malloc(2048);
|
static const size_t packetbuf_size = 2048;
|
||||||
|
uint8_t *packetbuf = malloc(packetbuf_size);
|
||||||
if(!packetbuf) {
|
if(!packetbuf) {
|
||||||
LOG(LVL_ERR, "malloc failed.");
|
LOG(LVL_ERR, "malloc failed.");
|
||||||
return ERR_NO_MEM;
|
return ERR_NO_MEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = read(ctx->tun_fd, packetbuf, sizeof(packetbuf));
|
ret = read(ctx->tun_fd, packetbuf, packetbuf_size);
|
||||||
if(ret < 0) {
|
if(ret < 0) {
|
||||||
LOG(LVL_ERR, "read: %s", strerror(errno));
|
LOG(LVL_ERR, "read: %s", strerror(errno));
|
||||||
free(packetbuf);
|
free(packetbuf);
|
||||||
|
|
Loading…
Reference in a new issue