libnl 3.2.8
Justin Mayfield
jmayfield at cradlepoint.com
Tue May 8 16:47:25 EDT 2012
Hi Thomas,
So far this is working well for me. Testing mostly the route/link and
route/addr based cache mangers here btw.
Thanks!
Justin Mayfield
On 05/08/2012 07:07 AM, Thomas Graf wrote:
> On Mon, May 07, 2012 at 07:58:54PM -0600, Justin Mayfield wrote:
>> Thomas,
>>
>> If you don't want to revert the API change then you might try the
>> attached patch. It seemed to cover the main trouble spot as far as
>> my grep skills could uncover.
>>
>> Thanks,
>> Justin Mayfield
>> diff --git a/include/netlink-local.h b/include/netlink-local.h
>> index 01c611a..9544d29 100644
>> --- a/include/netlink-local.h
>> +++ b/include/netlink-local.h
>> @@ -194,8 +194,10 @@ static inline int wait_for_ack(struct nl_sock *sk)
>> {
>> if (sk->s_flags& NL_NO_AUTO_ACK)
>> return 0;
>> - else
>> - return nl_wait_for_ack(sk);
>> + else {
>> + int err = nl_wait_for_ack(sk);
>> + return (err< 0) ? err : 0;
>> + }
>> }
> Thanks Justin,
>
> I think the above won't be enough as the change also seems to have
> broken applications directly. I'm considering to push the following
> fix into the tree. Is this acceptable for everyone?
>
> diff --git a/include/netlink/netlink.h b/include/netlink/netlink.h
> index 0768708..a501eaa 100644
> --- a/include/netlink/netlink.h
> +++ b/include/netlink/netlink.h
> @@ -71,6 +71,7 @@ extern int nl_recv(struct nl_sock *,
> struct ucred **);
>
> extern int nl_recvmsgs(struct nl_sock *, struct nl_cb *);
> +extern int nl_recvmsgs_report(struct nl_sock *, struct nl_cb *);
>
> extern int nl_recvmsgs_default(struct nl_sock *);
>
> diff --git a/lib/cache_mngr.c b/lib/cache_mngr.c
> index dae8768..0f0df51 100644
> --- a/lib/cache_mngr.c
> +++ b/lib/cache_mngr.c
> @@ -359,7 +359,7 @@ int nl_cache_mngr_data_ready(struct nl_cache_mngr *mngr)
>
> nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, event_input, mngr);
>
> - while ((err = nl_recvmsgs(mngr->cm_sock, cb))> 0) {
> + while ((err = nl_recvmsgs_report(mngr->cm_sock, cb))> 0) {
> NL_DBG(2, "Cache manager %p, recvmsgs read %d messages\n",
> mngr, err);
> nread += err;
> diff --git a/lib/nl.c b/lib/nl.c
> index c41a3b9..7e59130 100644
> --- a/lib/nl.c
> +++ b/lib/nl.c
> @@ -763,6 +763,26 @@ out:
> }
>
> /**
> + * Receive a set of messages from a netlink socket and report parsed messages
> + * @arg sk Netlink socket.
> + * @arg cb set of callbacks to control behaviour.
> + *
> + * This function is identical to nl_recvmsgs() to the point that it will
> + * return the number of parsed messages instead of 0 on success.
> + *
> + * @see nl_recvmsgs()
> + *
> + * @return Number of received messages or a negative error code from nl_recv().
> + */
> +int nl_recvmsgs_report(struct nl_sock *sk, struct nl_cb *cb)
> +{
> + if (cb->cb_recvmsgs_ow)
> + return cb->cb_recvmsgs_ow(sk, cb);
> + else
> + return recvmsgs(sk, cb);
> +}
> +
> +/**
> * Receive a set of messages from a netlink socket.
> * @arg sk Netlink socket.
> * @arg cb set of callbacks to control behaviour.
> @@ -775,14 +795,18 @@ out:
> * A non-blocking sockets causes the function to return immediately if
> * no data is available.
> *
> - * @return Number of received messages or a negative error code from nl_recv().
> + * @see nl_recvmsgs_report()
> + *
> + * @return 0 on success or a negative error code from nl_recv().
> */
> int nl_recvmsgs(struct nl_sock *sk, struct nl_cb *cb)
> {
> - if (cb->cb_recvmsgs_ow)
> - return cb->cb_recvmsgs_ow(sk, cb);
> - else
> - return recvmsgs(sk, cb);
> + int err;
> +
> + if ((err = nl_recvmsgs_report(sk, cb))> 0)
> + err = 0;
> +
> + return err;
> }
>
> /**
>
> !SIG:4fa91a95171629579363684!
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/libnl/attachments/20120508/b4642be8/attachment.html>
More information about the libnl
mailing list