diff --git a/include/netlink/netlink.h b/include/netlink/netlink.h index 1cfe220..099a83e 100644 --- a/include/netlink/netlink.h +++ b/include/netlink/netlink.h @@ -52,8 +52,11 @@ extern int nl_sendmsg(struct nl_sock *, struct nl_msg *, extern int nl_send(struct nl_sock *, struct nl_msg *); extern int nl_send_iovec(struct nl_sock *, struct nl_msg *, struct iovec *, unsigned); +extern void nl_complete_msg(struct nl_sock *, + struct nl_msg *); extern void nl_auto_complete(struct nl_sock *, - struct nl_msg *); + struct nl_msg *); +extern int nl_send_auto(struct nl_sock *, struct nl_msg *); extern int nl_send_auto_complete(struct nl_sock *, struct nl_msg *); extern int nl_send_simple(struct nl_sock *, int, int, diff --git a/lib/netfilter/queue_msg.c b/lib/netfilter/queue_msg.c index ab0a58b..c40f8c2 100644 --- a/lib/netfilter/queue_msg.c +++ b/lib/netfilter/queue_msg.c @@ -249,7 +249,7 @@ int nfnl_queue_msg_send_verdict_payload(struct nl_sock *nlh, iov[2].iov_base = (void *) payload_data; iov[2].iov_len = NLA_ALIGN(payload_len); - nl_auto_complete(nlh, nlmsg); + nl_complete_msg(nlh, nlmsg); err = nl_send_iovec(nlh, nlmsg, iov, 3); nlmsg_free(nlmsg); diff --git a/lib/nl.c b/lib/nl.c index d3fef04..cd6e6c7 100644 --- a/lib/nl.c +++ b/lib/nl.c @@ -288,7 +288,7 @@ int nl_send(struct nl_sock *sk, struct nl_msg *msg) return nl_send_iovec(sk, msg, &iov, 1); } -void nl_auto_complete(struct nl_sock *sk, struct nl_msg *msg) +void nl_complete_msg(struct nl_sock *sk, struct nl_msg *msg) { struct nlmsghdr *nlh; @@ -308,11 +308,19 @@ void nl_auto_complete(struct nl_sock *sk, struct nl_msg *msg) nlh->nlmsg_flags |= NLM_F_ACK; } +void nl_auto_complete(struct nl_sock *sk, struct nl_msg *msg) +{ + nl_complete_msg(sk, msg); +} + /** - * Send netlink message and check & extend header values as needed. + * Automatically complete and send a netlink message * @arg sk Netlink socket. * @arg msg Netlink message to be sent. * + * This function takes a netlink message and passes it on to + * nl_auto_complete() for completion. + * * Checks the netlink message \c nlh for completness and extends it * as required before sending it out. Checked fields include pid, * sequence nr, and flags. @@ -320,11 +328,11 @@ void nl_auto_complete(struct nl_sock *sk, struct nl_msg *msg) * @see nl_send() * @return Number of characters sent or a negative error code. */ -int nl_send_auto_complete(struct nl_sock *sk, struct nl_msg *msg) +int nl_send_auto(struct nl_sock *sk, struct nl_msg *msg) { struct nl_cb *cb = sk->s_cb; - nl_auto_complete(sk, msg); + nl_complete_msg(sk, msg); if (cb->cb_send_ow) return cb->cb_send_ow(sk, msg); @@ -332,6 +340,11 @@ int nl_send_auto_complete(struct nl_sock *sk, struct nl_msg *msg) return nl_send(sk, msg); } +int nl_send_auto_complete(struct nl_sock *sk, struct nl_msg *msg) +{ + return nl_send_auto(sk, msg); +} + /** * Send simple netlink message using nl_send_auto_complete() * @arg sk Netlink socket.