projects
/
project
/
libnl-tiny.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
socket: change debug callbacks to pass struct nl_msg
[project/libnl-tiny.git]
/
nl.c
diff --git
a/nl.c
b/nl.c
index fee0529b3a73430994ba74624b94b707af5b9f4d..7ab882238e577955e4eb37695c635549fe7360ab 100644
(file)
--- a/
nl.c
+++ b/
nl.c
@@
-192,9
+192,6
@@
int nl_sendto(struct nl_sock *sk, void *buf, size_t size)
{
int ret;
{
int ret;
- if (sk->s_debug_tx_cb)
- sk->s_debug_tx_cb(sk->s_debug_tx_priv, buf, size);
-
ret = sendto(sk->s_fd, buf, size, 0, (struct sockaddr *)
&sk->s_peer, sizeof(sk->s_peer));
if (ret < 0)
ret = sendto(sk->s_fd, buf, size, 0, (struct sockaddr *)
&sk->s_peer, sizeof(sk->s_peer));
if (ret < 0)
@@
-230,8
+227,10
@@
int nl_sendmsg(struct nl_sock *sk, struct nl_msg *msg, struct msghdr *hdr)
if (nl_cb_call(cb, NL_CB_MSG_OUT, msg) != NL_OK)
return 0;
if (nl_cb_call(cb, NL_CB_MSG_OUT, msg) != NL_OK)
return 0;
- if (sk->s_debug_tx_cb)
- sk->s_debug_tx_cb(sk->s_debug_tx_priv, iov.iov_base, iov.iov_len);
+ if (sk->s_debug_tx_cb) {
+ nlmsg_set_proto(msg, sk->s_proto);
+ sk->s_debug_tx_cb(sk->s_debug_tx_priv, msg);
+ }
ret = sendmsg(sk->s_fd, hdr, 0);
if (ret < 0)
ret = sendmsg(sk->s_fd, hdr, 0);
if (ret < 0)
@@
-472,9
+471,6
@@
retry:
}
}
}
}
- if (sk->s_debug_rx_cb)
- sk->s_debug_rx_cb(sk->s_debug_rx_priv, *buf, n);
-
free(msg.msg_control);
return n;
free(msg.msg_control);
return n;
@@
-541,6
+537,9
@@
continue_reading:
if (creds)
nlmsg_set_creds(msg, creds);
if (creds)
nlmsg_set_creds(msg, creds);
+ if (sk->s_debug_rx_cb)
+ sk->s_debug_rx_cb(sk->s_debug_rx_priv, msg);
+
/* Raw callback is the first, it gives the most control
* to the user and he can do his very own parsing. */
if (cb->cb_set[NL_CB_MSG_IN])
/* Raw callback is the first, it gives the most control
* to the user and he can do his very own parsing. */
if (cb->cb_set[NL_CB_MSG_IN])