mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 22:15:20 +00:00
set ISC_SOCKEVENTATTR_MULTICAST on packets received from a multicast address
This commit is contained in:
@@ -122,6 +122,7 @@ struct isc_socket_connev {
|
|||||||
* all the data is valid.
|
* all the data is valid.
|
||||||
* _TIMESTAMP: The timestamp member is valid.
|
* _TIMESTAMP: The timestamp member is valid.
|
||||||
* _PKTINFO: The pktinfo 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_ATTACHED 0x80000000U /* internal */
|
||||||
#define ISC_SOCKEVENTATTR_FATALERROR 0x40000000U /* sock is dead */
|
#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_CTRUNC 0x00400000U /* public */
|
||||||
#define ISC_SOCKEVENTATTR_TIMESTAMP 0x00200000U /* public */
|
#define ISC_SOCKEVENTATTR_TIMESTAMP 0x00200000U /* public */
|
||||||
#define ISC_SOCKEVENTATTR_PKTINFO 0x00100000U /* public */
|
#define ISC_SOCKEVENTATTR_PKTINFO 0x00100000U /* public */
|
||||||
|
#define ISC_SOCKEVENTATTR_MULTICAST 0x00080000U /* public */
|
||||||
|
|
||||||
#define ISC_SOCKEVENT_ANYEVENT (0)
|
#define ISC_SOCKEVENT_ANYEVENT (0)
|
||||||
#define ISC_SOCKEVENT_RECVDONE (ISC_EVENTCLASS_SOCKET + 1)
|
#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;
|
dev->attributes |= ISC_SOCKEVENTATTR_CTRUNC;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check for multicast.
|
||||||
|
*/
|
||||||
|
if (isc_sockaddr_ismulticast(&dev->address))
|
||||||
|
dev->attributes |= ISC_SOCKEVENTATTR_MULTICAST;
|
||||||
|
|
||||||
#ifndef USE_CMSG
|
#ifndef USE_CMSG
|
||||||
return;
|
return;
|
||||||
#else
|
#else
|
||||||
@@ -1171,6 +1177,15 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
|
|||||||
"setsockopt(%d) failed: %s",
|
"setsockopt(%d) failed: %s",
|
||||||
sock->fd, strerror(errno));
|
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 */
|
#endif /* ISC_PLATFORM_HAVEIPV6 */
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2667,6 +2682,9 @@ isc_socket_connect(isc_socket_t *sock, isc_sockaddr_t *addr,
|
|||||||
REQUIRE(VALID_MANAGER(manager));
|
REQUIRE(VALID_MANAGER(manager));
|
||||||
REQUIRE(addr != NULL);
|
REQUIRE(addr != NULL);
|
||||||
|
|
||||||
|
if (isc_sockaddr_ismulticast(addr))
|
||||||
|
return (ISC_R_MULTICAST);
|
||||||
|
|
||||||
LOCK(&sock->lock);
|
LOCK(&sock->lock);
|
||||||
|
|
||||||
REQUIRE(!sock->connecting);
|
REQUIRE(!sock->connecting);
|
||||||
|
Reference in New Issue
Block a user