// If wildcard interface '*' was not specified, set all interfaces to
// inactive state. We will later enable them selectively using the
// interface names specified by the user. If wildcard interface was
- // specified, mark all interfaces active.
- setState(!wildcard_used_);
+ // specified, mark all interfaces active. In all cases, mark loopback
+ // inactive.
+ setState(!wildcard_used_, true);
// Remove selection of unicast addresses from all interfaces.
IfaceMgr::instance().clearUnicasts();
// If there is no wildcard interface specified, we will have to iterate
" exist");
}
iface->addUnicast(unicast->second);
+ iface->inactive6_ = false;
}
}
}
void
-IfaceCfg::setState(const bool inactive) {
+IfaceCfg::setState(const bool inactive, const bool loopback_inactive) {
IfaceMgr::IfaceCollection ifaces = IfaceMgr::instance().getIfaces();
for (IfaceMgr::IfaceCollection::iterator iface = ifaces.begin();
iface != ifaces.end(); ++iface) {
Iface* iface_ptr = IfaceMgr::instance().getIface(iface->getName());
if (getFamily() == V4) {
- iface_ptr->inactive4_ = inactive;
+ iface_ptr->inactive4_ = iface_ptr->flag_loopback_ ?
+ loopback_inactive : inactive;
} else {
- iface_ptr->inactive6_ = inactive;
+ iface_ptr->inactive6_ = iface_ptr->flag_loopback_ ?
+ loopback_inactive : inactive;
}
}
}
private:
- /// @brief Selects or deselects all interfaces.
+ /// @brief Selects or deselects interfaces.
///
/// This function selects all interfaces to receive DHCP traffic or
/// deselects all interfaces so as none of them receives a DHCP traffic.
///
/// @param inactive A boolean value which indicates if all interfaces
+ /// (except loopback) should be selected or deselected.
+ /// @param loopback_inactive A boolean value which indicates if loopback
+ /// interface should be selected or deselected.
/// should be deselected/inactive (true) or selected/active (false).
- void setState(const bool inactive);
+ void setState(const bool inactive, const bool loopback_inactive);
/// @brief Error handler for executed when opening a socket fail.
///