Skip to content
Snippets Groups Projects
Commit a894cf85 authored by Armin Luntzer's avatar Armin Luntzer
Browse files

fixed: usr_pkt_to_gresb() did not convert the raw buffer to a gresb data payload

parent dc4c6575
No related branches found
No related tags found
No related merge requests found
...@@ -234,6 +234,7 @@ static int usr_pkt_to_gresb(int fd, struct bridge_cfg *cfg) ...@@ -234,6 +234,7 @@ static int usr_pkt_to_gresb(int fd, struct bridge_cfg *cfg)
{ {
int ret; int ret;
ssize_t recv_bytes; ssize_t recv_bytes;
uint8_t *gresb_pkt;
unsigned char *recv_buffer; unsigned char *recv_buffer;
...@@ -248,13 +249,20 @@ static int usr_pkt_to_gresb(int fd, struct bridge_cfg *cfg) ...@@ -248,13 +249,20 @@ static int usr_pkt_to_gresb(int fd, struct bridge_cfg *cfg)
printf("%c", recv_buffer[i]); printf("%c", recv_buffer[i]);
} }
#endif #endif
gresb_pkt = gresb_create_host_data_pkt(recv_buffer, recv_bytes);
if (!gresb_pkt) {
printf("error creating packet\n");
exit(EXIT_FAILURE);
}
/* we SEND to the TX port */ /* we SEND to the TX port */
ret = send_all(cfg->gresb_tx->socket, ret = send_all(cfg->gresb_tx->socket, gresb_pkt,
recv_buffer, recv_bytes); gresb_get_host_data_pkt_size(gresb_pkt));
if (ret == -1) if (ret == -1)
perror("send"); perror("send");
gresb_destroy_host_data_pkt((struct host_to_gresb_pkt *) gresb_pkt);
free(recv_buffer); free(recv_buffer);
return recv_bytes; return recv_bytes;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment