{
PingerStatus = ping_status;
}
+
- /**
- * Avoid the socket to drop to another network interface if the destination
- * is unreachable through the binded interface. Packets are sent only from
- * this interface.
- *
- * @param source_network_interface The network interface to bind the pinger.
- *
- * @return false if the bind failed.
- */
- bool IcmpPinger::select_source_network_interface(
- const string &source_network_interface
- )
- {
- BOOST_ASSERT( !source_network_interface.empty() );
-
- int ret = ::setsockopt(
- Socket.native(),
- SOL_SOCKET,
- SO_BINDTODEVICE,
- source_network_interface.c_str(),
- source_network_interface.size()
- );
- if ( ret == -1 )
- {
- GlobalLogger.error() << "Error: could not bind pinger to interface "
- << source_network_interface << endl;
- return false;
- }
-
- return true;
- }