Skip to content

Commit

Permalink
[proto_hep] fix bugs
Browse files Browse the repository at this point in the history
	* correctly calculate hepv1/2 space to be allocated. Ip
addresses weren't take into account;
	* initialise to null chunk to be freed in free hep message
function;
  • Loading branch information
ionutrazvanionita committed Sep 16, 2016
1 parent e5baa3c commit d617d5d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion modules/proto_hep/hep.c
Expand Up @@ -830,6 +830,7 @@ static trace_message create_hep12_message(union sockaddr_union* from_su, union s
hep_msg->u.hepv12.hep_time.captid = hep_capture_id;
}


switch (hep_msg->u.hepv12.hdr.hp_f) {
case AF_INET:
/* Source && Destination ipaddresses*/
Expand Down Expand Up @@ -1101,6 +1102,13 @@ static char* build_hep12_buf(struct hep_desc* hep_msg, int* len)
char* buf;

buflen = hep_msg->u.hepv12.hdr.hp_l + hep_msg->u.hepv12.payload.len;

if (hep_msg->u.hepv12.hdr.hp_f == AF_INET) {
buflen += sizeof(struct hep_iphdr);
} else {
buflen += sizeof(struct hep_ip6hdr);
}

if (hep_msg->version == 2) {
buflen += sizeof(struct hep_timehdr);
}
Expand Down Expand Up @@ -1403,7 +1411,7 @@ int send_hep_message(trace_message message, trace_dest dest, struct socket_info*

void free_hep_message(trace_message message)
{
generic_chunk_t *foo, *it;
generic_chunk_t *foo=NULL, *it;
struct hep_desc* hep_msg = message;

if (hep_msg->version == 3) {
Expand Down

0 comments on commit d617d5d

Please sign in to comment.