summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2013-12-10 08:08:19 +0100
committerAndreas Schneider <asn@cryptomilk.org>2013-12-10 08:08:19 +0100
commita6bbc3867e96fb30a53ffacda28ee4e8344f8542 (patch)
tree3f0710a589bf8d439e00826c2b9fd01e6707db6a
parent5b7e8960a325e7c3a9c08b24ce1079c0faa3c12d (diff)
downloadsocket_wrapper-a6bbc3867e96fb30a53ffacda28ee4e8344f8542.zip
socket_wrapper-a6bbc3867e96fb30a53ffacda28ee4e8344f8542.tar.gz
socket_wrapper-a6bbc3867e96fb30a53ffacda28ee4e8344f8542.tar.xz
swrap: Add libc_sendto().
-rw-r--r--src/socket_wrapper.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index 7d92f95..2a23d19 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -735,6 +735,18 @@ static int libc_sendmsg(int sockfd, const struct msghdr *msg, int flags)
return swrap.fns.libc_sendmsg(sockfd, msg, flags);
}
+static int libc_sendto(int sockfd,
+ const void *buf,
+ size_t len,
+ int flags,
+ const struct sockaddr *dst_addr,
+ socklen_t addrlen)
+{
+ swrap_load_lib_function(SWRAP_LIBSOCKET, sendto);
+
+ return swrap.fns.libc_sendto(sockfd, buf, len, flags, dst_addr, addrlen);
+}
+
/*********************************************************
* SWRAP HELPER FUNCTIONS
*********************************************************/
@@ -2942,7 +2954,7 @@ static ssize_t swrap_sendto(int s, const void *buf, size_t len, int flags,
int bcast = 0;
if (!si) {
- return swrap.fns.libc_sendto(s, buf, len, flags, to, tolen);
+ return libc_sendto(s, buf, len, flags, to, tolen);
}
tmp.iov_base = discard_const_p(char, buf);
@@ -2979,12 +2991,12 @@ static ssize_t swrap_sendto(int s, const void *buf, size_t len, int flags,
if (stat(un_addr.sun_path, &st) != 0) continue;
/* ignore the any errors in broadcast sends */
- swrap.fns.libc_sendto(s,
- buf,
- len,
- flags,
- (struct sockaddr *)(void *)&un_addr,
- sizeof(un_addr));
+ libc_sendto(s,
+ buf,
+ len,
+ flags,
+ (struct sockaddr *)(void *)&un_addr,
+ sizeof(un_addr));
}
swrap_dump_packet(si, to, SWRAP_SENDTO, buf, len);
@@ -2992,12 +3004,12 @@ static ssize_t swrap_sendto(int s, const void *buf, size_t len, int flags,
return len;
}
- ret = swrap.fns.libc_sendto(s,
- buf,
- len,
- flags,
- (struct sockaddr *)msg.msg_name,
- msg.msg_namelen);
+ ret = libc_sendto(s,
+ buf,
+ len,
+ flags,
+ (struct sockaddr *)msg.msg_name,
+ msg.msg_namelen);
swrap_sendmsg_after(si, &msg, to, ret);