Commit f64ded0a authored by Michael Graff's avatar Michael Graff
Browse files

set ISC_SOCKEVENTATTR_MULTICAST on packets received from a multicast address

parent 6c6a6293
......@@ -122,6 +122,7 @@ struct isc_socket_connev {
* all the data is valid.
* _TIMESTAMP: The timestamp member is valid.
* _PKTINFO: The pktinfo member is valid.
* _MULTICAST: The UDP packet was received via a multicast transmission.
*/
#define ISC_SOCKEVENTATTR_ATTACHED 0x80000000U /* internal */
#define ISC_SOCKEVENTATTR_FATALERROR 0x40000000U /* sock is dead */
......@@ -129,6 +130,7 @@ struct isc_socket_connev {
#define ISC_SOCKEVENTATTR_CTRUNC 0x00400000U /* public */
#define ISC_SOCKEVENTATTR_TIMESTAMP 0x00200000U /* public */
#define ISC_SOCKEVENTATTR_PKTINFO 0x00100000U /* public */
#define ISC_SOCKEVENTATTR_MULTICAST 0x00080000U /* public */
#define ISC_SOCKEVENT_ANYEVENT (0)
#define ISC_SOCKEVENT_RECVDONE (ISC_EVENTCLASS_SOCKET + 1)
......
......@@ -366,6 +366,12 @@ process_cmsg(isc_socket_t *sock, struct msghdr *msg, isc_socketevent_t *dev) {
dev->attributes |= ISC_SOCKEVENTATTR_CTRUNC;
#endif
/*
* Check for multicast.
*/
if (isc_sockaddr_ismulticast(&dev->address))
dev->attributes |= ISC_SOCKEVENTATTR_MULTICAST;
#ifndef USE_CMSG
return;
#else
......@@ -1171,6 +1177,15 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
"setsockopt(%d) failed: %s",
sock->fd, strerror(errno));
}
#ifdef IPV6_USE_MIN_MTU /*2292bis, not too common yet*/
/* use minimum MTU */
if (pf == AF_INET6) {
(void)setsockopt(sock->fd, IPPROTO_IPV6,
IPV6_USE_MIN_MTU,
(void *)&on, sizeof (on));
}
#endif
#endif /* ISC_PLATFORM_HAVEIPV6 */
}
......@@ -2667,6 +2682,9 @@ isc_socket_connect(isc_socket_t *sock, isc_sockaddr_t *addr,
REQUIRE(VALID_MANAGER(manager));
REQUIRE(addr != NULL);
if (isc_sockaddr_ismulticast(addr))
return (ISC_R_MULTICAST);
LOCK(&sock->lock);
REQUIRE(!sock->connecting);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment