summaryrefslogtreecommitdiff
path: root/lib/socket_wrapper/socket_wrapper.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/socket_wrapper/socket_wrapper.c')
-rw-r--r--lib/socket_wrapper/socket_wrapper.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/lib/socket_wrapper/socket_wrapper.c b/lib/socket_wrapper/socket_wrapper.c
index 1fe3832a17..d1508adbca 100644
--- a/lib/socket_wrapper/socket_wrapper.c
+++ b/lib/socket_wrapper/socket_wrapper.c
@@ -1870,6 +1870,32 @@ _PUBLIC_ int swrap_setsockopt(int s, int level, int optname, const void *o
}
}
+_PUBLIC_ int swrap_ioctl(int s, int r, void *p)
+{
+ int ret;
+ struct socket_info *si = find_socket_info(s);
+ int value;
+
+ if (!si) {
+ return real_ioctl(s, r, p);
+ }
+
+ ret = real_ioctl(s, r, p);
+
+ switch (r) {
+ case FIONREAD:
+ value = *((int *)p);
+ if (ret == -1 && errno != EAGAIN && errno != ENOBUFS) {
+ swrap_dump_packet(si, NULL, SWRAP_PENDING_RST, NULL, 0);
+ } else if (value == 0) { /* END OF FILE */
+ swrap_dump_packet(si, NULL, SWRAP_PENDING_RST, NULL, 0);
+ }
+ break;
+ }
+
+ return ret;
+}
+
_PUBLIC_ ssize_t swrap_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen)
{
struct sockaddr_un un_addr;
@@ -2026,32 +2052,6 @@ _PUBLIC_ ssize_t swrap_sendto(int s, const void *buf, size_t len, int flags, con
return ret;
}
-_PUBLIC_ int swrap_ioctl(int s, int r, void *p)
-{
- int ret;
- struct socket_info *si = find_socket_info(s);
- int value;
-
- if (!si) {
- return real_ioctl(s, r, p);
- }
-
- ret = real_ioctl(s, r, p);
-
- switch (r) {
- case FIONREAD:
- value = *((int *)p);
- if (ret == -1 && errno != EAGAIN && errno != ENOBUFS) {
- swrap_dump_packet(si, NULL, SWRAP_PENDING_RST, NULL, 0);
- } else if (value == 0) { /* END OF FILE */
- swrap_dump_packet(si, NULL, SWRAP_PENDING_RST, NULL, 0);
- }
- break;
- }
-
- return ret;
-}
-
_PUBLIC_ ssize_t swrap_recv(int s, void *buf, size_t len, int flags)
{
int ret;