| 123456789101112131415161718192021222324252627282930313233343536373839 |
- /* include mcast_set_loop */
- #include "unp.h"
- int
- mcast_set_loop(int sockfd, int onoff)
- {
- switch (sockfd_to_family(sockfd)) {
- case AF_INET: {
- u_char flag;
- flag = onoff;
- return(setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_LOOP,
- &flag, sizeof(flag)));
- }
- #ifdef IPV6
- case AF_INET6: {
- u_int flag;
- flag = onoff;
- return(setsockopt(sockfd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP,
- &flag, sizeof(flag)));
- }
- #endif
- default:
- errno = EAFNOSUPPORT;
- return(-1);
- }
- }
- /* end mcast_set_loop */
- void
- Mcast_set_loop(int sockfd, int onoff)
- {
- if (mcast_set_loop(sockfd, onoff) < 0)
- err_sys("mcast_set_loop error");
- }
|