Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

36 lines
698 B

  1. #include <sys/types.h>
  2. #include <sys/param.h>
  3. #include <sys/socket.h>
  4. #include <netinet/in.h>
  5. #include "socket.h"
  6. #include "byte.h"
  7. #include "haveip6.h"
  8. #include "errno.h"
  9. #include "ip6.h"
  10. #ifndef IPV6_DROP_MEMBERSHIP
  11. #ifdef IPV6_LEAVE_GROUP
  12. #define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
  13. #else
  14. #undef LIBC_HAS_IP6
  15. #endif
  16. #endif
  17. int socket_mcleave6(int s,const char ip[16])
  18. {
  19. #ifdef LIBC_HAS_IP6
  20. struct ipv6_mreq opt;
  21. #endif
  22. if (ip6_isv4mapped(ip))
  23. return socket_mcleave4(s,ip+12);
  24. #ifdef LIBC_HAS_IP6
  25. byte_copy(&opt.ipv6mr_multiaddr,16,ip);
  26. opt.ipv6mr_interface=0;
  27. return setsockopt(s,IPPROTO_IPV6,IPV6_DROP_MEMBERSHIP,&opt,sizeof opt);
  28. #else
  29. errno=EPROTO;
  30. return -1;
  31. #endif
  32. }