Re: [lnf-log RFC PATCH 1/2] introduce new functions to use without nflog_handle

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

 



On Mon, Aug 10, 2015 at 05:15:54PM +0900, Ken-ichirou MATSUZAWA wrote:
[...]
> diff --git a/src/libnetfilter_log.c b/src/libnetfilter_log.c
> index e92576b..422c550 100644
> --- a/src/libnetfilter_log.c
> +++ b/src/libnetfilter_log.c
> @@ -26,6 +26,7 @@
>  #include <errno.h>
>  #include <netinet/in.h>
>  #include <sys/socket.h>
> +#include <linux/netlink.h>
>  
>  #include <libnetfilter_log/linux_nfnetlink_log.h>
>  
> @@ -1067,5 +1068,47 @@ int nflog_snprintf_xml(char *buf, size_t rem, struct nflog_data *tb, int flags)
>  }
>  
>  /**
> + * nflog_data_alloc - allocate a new nflog data
> + *
> + * In case of success, this function returns a valid pointer to a memory blob,
> + * otherwise NULL is returned and errno is set appropiately.
> + */
> +struct nflog_data *nflog_data_alloc(void)
> +{
> +	struct nflog_data *nfad = calloc(1, sizeof(struct nflog_data));
> +	if (nfad == NULL)
> +		return NULL;
> +	nfad->nfa = (struct nfattr **)calloc(NFULA_MAX + 1,
> +					     sizeof(struct nlattr *));
> +	if (nfad->nfa == NULL) {
> +		free(nfad);
> +		return NULL;
> +	}
> +	return nfad;
> +}
[...]

The libnetfilter_log.c file contains the old API, its use is
discouraged since it depends on libnfnetlink.

> diff --git a/src/nlmsg.c b/src/nlmsg.c
> new file mode 100644
> index 0000000..8611b9d
> --- /dev/null
> +++ b/src/nlmsg.c

I like that you started the libmnl support for libnetfilter_log.

The idea is to provide a set of helper functions that we can use in
conjunction with libmnl, similar to what we have in
libnetfilter_queue/nlmsg.c

Thanks.
--
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