diff options
| author | Andreas Schneider <asn@samba.org> | 2014-05-23 14:35:34 +0200 |
|---|---|---|
| committer | Andreas Schneider <asn@samba.org> | 2014-05-26 16:45:16 +0200 |
| commit | 4849b2ebbfca6176e685ac9c6c933aad8470295f (patch) | |
| tree | 4fd52de14040628e5f93ecdc8730419a7e898b46 /src | |
| parent | 69f22c94b4ad061263c40c8c271a86f444cee72d (diff) | |
| download | socket_wrapper-4849b2ebbfca6176e685ac9c6c933aad8470295f.tar.gz socket_wrapper-4849b2ebbfca6176e685ac9c6c933aad8470295f.tar.xz socket_wrapper-4849b2ebbfca6176e685ac9c6c933aad8470295f.zip | |
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 'src')
| -rw-r--r-- | src/socket_wrapper.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c index 8cb924e..d1d73d9 100644 --- a/src/socket_wrapper.c +++ b/src/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, |
