summaryrefslogtreecommitdiffstats
path: root/src/receive.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-08-07 02:30:23 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-08-07 02:30:23 +0200
commit5ca89b31210b249f79a1a5cd1a258c85fdb7970e (patch)
treee08c894ab12d68c215713317d841ac6de552e619 /src/receive.c
parentae90406453eb894400a25e0557bb2c7bf19f06a4 (diff)
downloadfastd-5ca89b31210b249f79a1a5cd1a258c85fdb7970e.tar
fastd-5ca89b31210b249f79a1a5cd1a258c85fdb7970e.zip
Guard socket options not available on FreeBSD
Diffstat (limited to 'src/receive.c')
-rw-r--r--src/receive.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/receive.c b/src/receive.c
index fc835eb..bf4b93e 100644
--- a/src/receive.c
+++ b/src/receive.c
@@ -40,6 +40,7 @@ static inline void handle_socket_control(fastd_context_t *ctx, struct msghdr *me
if ((char*)cmsg + sizeof(*cmsg) > end)
return;
+#ifdef USE_PKTINFO
if (cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_PKTINFO) {
struct in_pktinfo *pktinfo = (struct in_pktinfo*)CMSG_DATA(cmsg);
if ((char*)pktinfo + sizeof(*pktinfo) > end)
@@ -51,6 +52,7 @@ static inline void handle_socket_control(fastd_context_t *ctx, struct msghdr *me
return;
}
+#endif
if (cmsg->cmsg_level == IPPROTO_IPV6 && cmsg->cmsg_type == IPV6_PKTINFO) {
struct in6_pktinfo *pktinfo = (struct in6_pktinfo*)CMSG_DATA(cmsg);
@@ -173,11 +175,13 @@ void fastd_receive(fastd_context_t *ctx, fastd_socket_t *sock) {
handle_socket_control(ctx, &message, sock, &local_addr);
+#ifdef USE_PKTINFO
if (!local_addr.sa.sa_family) {
pr_error(ctx, "received packet without packet info");
fastd_buffer_free(buffer);
return;
}
+#endif
fastd_peer_address_simplify(&recvaddr);