Re: [PATCH 5/8] ipfix: add function for ipfix message creation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On Sat, 2014-03-08 at 10:13 +0900, Ken-ichirou MATSUZAWA wrote:
> This function creates ipfix message, template and data part but not scope.
> Header sequence is kept by struct ipfix_instance, domain id is specified
> by config file. The returned value has no export time so caller set this
> and free the value after using it.
> 
> ---
>  include/ulogd/ipfix_protocol.h |  8 ++++-
>  output/ulogd_output_IPFIX.c    | 71 +++++++++++++++++++++++++++++++++++++++++-
>  2 files changed, 77 insertions(+), 2 deletions(-)
> 
> diff --git a/include/ulogd/ipfix_protocol.h b/include/ulogd/ipfix_protocol.h
> index 5d7e46a..266897e 100644
> --- a/include/ulogd/ipfix_protocol.h
> +++ b/include/ulogd/ipfix_protocol.h
> @@ -15,7 +15,13 @@ struct ipfix_msg_hdr {

...

> +
> +	msglen = sizeof(struct ipfix_msg_hdr) + sizeof(struct ipfix_set_hdr)
> +		+ template->data_length;
> +	if (need_template)
> +		msglen = msglen + sizeof(struct ipfix_set_hdr)
> +			+ (template->tmpl_cur - (void *)&template->tmpl);
> +	buf = malloc(msglen);


I don't like this malloc because ulogd will do an allocation for each
messages. If the size of the message has a global limit (looks like it
should be the case) it is possible to use a buffer attached to the ulogd
instance and to write the message in this buffer.

BR,
-- 
Eric Leblond <eric@xxxxxxxxx>

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux