2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 05:57:52 +00:00

set ISC_SOCKEVENTATTR_MULTICAST on packets received from a multicast address

This commit is contained in:
Michael Graff 2000-06-15 18:25:49 +00:00
parent 6c6a62933d
commit f64ded0ac7
2 changed files with 20 additions and 0 deletions

View File

@ -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)

View File

@ -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);