From f64ded0ac7e31cdda1cca5a42131f8bafadf7c28 Mon Sep 17 00:00:00 2001 From: Michael Graff Date: Thu, 15 Jun 2000 18:25:49 +0000 Subject: [PATCH] set ISC_SOCKEVENTATTR_MULTICAST on packets received from a multicast address --- lib/isc/include/isc/socket.h | 2 ++ lib/isc/unix/socket.c | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/lib/isc/include/isc/socket.h b/lib/isc/include/isc/socket.h index 81a6427fca..9cd4e15aef 100644 --- a/lib/isc/include/isc/socket.h +++ b/lib/isc/include/isc/socket.h @@ -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) diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index 4fa2ec2bbf..11657f267f 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -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);