From 48182486341d1de7892494f272e892c0b18ebef5 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 12 May 2015 15:04:48 +0200 Subject: lib/doc: clearify return value of send_simple() functions The return value of the *nl_send_simple() functions is inconsistent and not according to the documentation. nl_send_simple() is document to return the number of bytes sent. Other *nl_send_simple() functions are documented to return 0 on success -- for the most part. See also commit b70174668b9867de573cf51471bc98bfe7fd2bc3 which changed behavior of nl_rtgen_request() to be according to documenation. Don't change behavior again, only adjust the documentation. http://lists.infradead.org/pipermail/libnl/2015-May/001872.html Reported-by: Xiao Jia Signed-off-by: Thomas Haller --- lib/netfilter/ct.c | 7 +++++++ lib/netfilter/exp.c | 7 +++++++ lib/netfilter/nfnl.c | 3 ++- 3 files changed, 16 insertions(+), 1 deletion(-) (limited to 'lib/netfilter') diff --git a/lib/netfilter/ct.c b/lib/netfilter/ct.c index 903c584e..d589790e 100644 --- a/lib/netfilter/ct.c +++ b/lib/netfilter/ct.c @@ -413,6 +413,13 @@ static int ct_msg_parser(struct nl_cache_ops *ops, struct sockaddr_nl *who, return err; } +/** + * Send nfnl ct dump request + * @arg sk Netlink socket. + * + * @return 0 on success or a negative error code. Due to a bug, this function + * returns the number of bytes sent. Treat any non-negative number as success. + */ int nfnl_ct_dump_request(struct nl_sock *sk) { return nfnl_send_simple(sk, NFNL_SUBSYS_CTNETLINK, IPCTNL_MSG_CT_GET, diff --git a/lib/netfilter/exp.c b/lib/netfilter/exp.c index 9cfdd2bf..650127c8 100644 --- a/lib/netfilter/exp.c +++ b/lib/netfilter/exp.c @@ -305,6 +305,13 @@ static int exp_msg_parser(struct nl_cache_ops *ops, struct sockaddr_nl *who, return err; } +/** + * Send nfnl exp dump request + * @arg sk Netlink socket. + * + * @return 0 on success or a negative error code. Due to a bug, this function + * returns the number of bytes sent. Treat any non-negative number as success. + */ int nfnl_exp_dump_request(struct nl_sock *sk) { return nfnl_send_simple(sk, NFNL_SUBSYS_CTNETLINK_EXP, IPCTNL_MSG_EXP_GET, diff --git a/lib/netfilter/nfnl.c b/lib/netfilter/nfnl.c index f028a859..9b524470 100644 --- a/lib/netfilter/nfnl.c +++ b/lib/netfilter/nfnl.c @@ -102,7 +102,8 @@ int nfnl_connect(struct nl_sock *sk) * @arg family nfnetlink address family * @arg res_id nfnetlink resource id * - * @return Newly allocated netlink message or NULL. + * @return 0 on success or a negative error code. Due to a bug, this function + * returns the number of bytes sent. Treat any non-negative number as success. */ int nfnl_send_simple(struct nl_sock *sk, uint8_t subsys_id, uint8_t type, int flags, uint8_t family, uint16_t res_id) -- cgit v1.2.3