diff options
author | Andreas Schneider <asn@samba.org> | 2014-06-03 15:04:45 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2014-06-05 23:57:10 +0200 |
commit | efe4eb2385b4fbbc6f38e62082336bf39820b416 (patch) | |
tree | 0c53f12ae1c117a85632675c520f56b76dab8b72 /lib/socket_wrapper | |
parent | 6a35c6777d65cedaac51ac96cc47223807b15592 (diff) | |
download | samba-efe4eb2385b4fbbc6f38e62082336bf39820b416.tar.gz |
swrap: Add swrap_msghdr_filter_cmsg_pktinfo().
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'lib/socket_wrapper')
-rw-r--r-- | lib/socket_wrapper/socket_wrapper.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/lib/socket_wrapper/socket_wrapper.c b/lib/socket_wrapper/socket_wrapper.c index 8cb924e282a..d1d73d9a732 100644 --- a/lib/socket_wrapper/socket_wrapper.c +++ b/lib/socket_wrapper/socket_wrapper.c @@ -3217,6 +3217,11 @@ static int swrap_sendmsg_copy_cmsg(struct cmsghdr *cmsg, return 0; } +static int swrap_sendmsg_filter_cmsg_pktinfo(struct cmsghdr *cmsg, + uint8_t *cm_data, + size_t *cm_data_space); + + static int swrap_sendmsg_filter_cmsg_socket(struct cmsghdr *cmsg, uint8_t *cm_data, size_t *cm_data_space) @@ -3226,17 +3231,16 @@ static int swrap_sendmsg_filter_cmsg_socket(struct cmsghdr *cmsg, switch(cmsg->cmsg_type) { #ifdef IP_PKTINFO case IP_PKTINFO: - /* TODO swrap_msghdr_filter_cmsg_pktinfo */ + rc = swrap_sendmsg_filter_cmsg_pktinfo(cmsg, + cm_data, + cm_data_space); break; #endif #ifdef IPV6_PKTINFO case IPV6_PKTINFO: - /* TODO swrap_msghdr_filter_cmsg_pktinfo */ - break; -#endif -#ifdef IP_RECVDSTADDR - case IP_RECVDSTADDR: - /* TODO swrap_msghdr_filter_cmsg_pktinfo */ + rc = swrap_sendmsg_filter_cmsg_pktinfo(cmsg, + cm_data, + cm_data_space); break; #endif default: @@ -3245,6 +3249,21 @@ static int swrap_sendmsg_filter_cmsg_socket(struct cmsghdr *cmsg, return rc; } + +static int swrap_sendmsg_filter_cmsg_pktinfo(struct cmsghdr *cmsg, + uint8_t *cm_data, + size_t *cm_data_space) +{ + (void)cmsg; /* unused */ + (void)cm_data; /* unused */ + (void)cm_data_space; /* unused */ + + /* + * Passing a IP pktinfo to a unix socket might be rejected by the + * Kernel, at least on FreeBSD. So skip this cmsg. + */ + return 0; +} #endif /* HAVE_STRUCT_MSGHDR_MSG_CONTROL */ static ssize_t swrap_sendmsg_before(int fd, |