Folks,

 

Has anyone figured out how to specify the outgoing interface for  IPv6  multicast  using the boost  asio  library socket options  on

Linux ?

 

See snippets below…

 

What value does one specify for  “unsigned int ipv6_interface”  in the network_interface constructor ?

 

Tried specifying the interface index (1..3 on my host)  but that did not work.

 

 

Thanks,
Jay ..

 

 

 

From multicast.hpp

* Implements the IPPROTO_IP/IP_MULTICAST_IF socket option.

*

* @par Examples

* Setting the option:

* @code

* boost::asio::ip::udp::socket socket(io_service);

 * ...

* boost::asio::ip::address_v4 local_interface =

*   boost::asio::ip::address_v4::from_string("1.2.3.4");

* boost::asio::ip::multicast::outbound_interface option(local_interface);

* socket.set_option(option);

* @endcode

*

* @par Concepts:

* SettableSocketOption.

*/

#if defined(GENERATING_DOCUMENTATION)

typedef implementation_defined outbound_interface;

#else

typedef boost::asio::ip::detail::socket_option::network_interface<

  IPPROTO_IP, IP_MULTICAST_IF, IPPROTO_IPV6, IPV6_MULTICAST_IF>

  outbound_interface;

#endif

 

==========================================================

From:  socket_options.hpp …

// Construct with IPv6 interface.

  explicit network_interface(unsigned int ipv6_interface)

  {

    ipv4_value_.s_addr =

      boost::asio::detail::socket_ops::host_to_network_long(

          boost::asio::ip::address_v4::any().to_ulong());

    ipv6_value_ = ipv6_interface;

  }