summaryrefslogtreecommitdiff
path: root/sysdep/bsd/sysio.h
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2014-10-14 17:23:34 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2014-10-14 17:23:34 +0200
commit78342404ff573e85e396f0611014b90cea9b4c0a (patch)
tree39fd70db506dc05d83528b7afab258b07b8ac482 /sysdep/bsd/sysio.h
parent178a197afb77770d8a90765e39065679936a45d1 (diff)
parentcfdea7b85f6c520cc5a62eb907d2190db14c9900 (diff)
Merge remote-tracking branch 'origin/master' into soft-int
Diffstat (limited to 'sysdep/bsd/sysio.h')
-rw-r--r--sysdep/bsd/sysio.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/sysdep/bsd/sysio.h b/sysdep/bsd/sysio.h
index fa3969bd..df5e0236 100644
--- a/sysdep/bsd/sysio.h
+++ b/sysdep/bsd/sysio.h
@@ -141,6 +141,7 @@ sk_prepare_cmsgs4(sock *s, struct msghdr *msg, void *cbuf, size_t cbuflen)
#ifdef IP_SENDSRCADDR
struct cmsghdr *cm;
struct in_addr *sa;
+ int controllen = 0;
msg->msg_control = cbuf;
msg->msg_controllen = cbuflen;
@@ -149,11 +150,12 @@ sk_prepare_cmsgs4(sock *s, struct msghdr *msg, void *cbuf, size_t cbuflen)
cm->cmsg_level = IPPROTO_IP;
cm->cmsg_type = IP_SENDSRCADDR;
cm->cmsg_len = CMSG_LEN(sizeof(*sa));
+ controllen += CMSG_SPACE(sizeof(*sa));
sa = (struct in_addr *) CMSG_DATA(cm);
*sa = ipa_to_in4(s->saddr);
- msg->msg_controllen = cm->cmsg_len;
+ msg->msg_controllen = controllen;
#endif
}