Commit 34280b1a authored by Marcin Siodelski's avatar Marcin Siodelski
Browse files

[3715] Interfaces in the IfaceMgr stored as pointers.

parent 43e2b383
......@@ -621,8 +621,7 @@ Dhcpv6Srv::generateServerID() {
const IfaceMgr::IfaceCollection& ifaces = IfaceMgr::instance().getIfaces();
// Let's find suitable interface.
for (IfaceMgr::IfaceCollection::const_iterator iface = ifaces.begin();
iface != ifaces.end(); ++iface) {
BOOST_FOREACH(IfacePtr iface, ifaces) {
// All the following checks could be merged into one multi-condition
// statement, but let's keep them separated as perhaps one day
// we will grow knobs to selectively turn them on or off. Also,
......
......@@ -86,7 +86,7 @@ public:
ADD_FAILURE() << "No interfaces detected.";
}
valid_iface_ = ifaces.begin()->getName();
valid_iface_ = (*ifaces.begin())->getName();
bogus_iface_ = "nonexisting0";
if (IfaceMgr::instance().getIface(bogus_iface_)) {
......
......@@ -146,7 +146,7 @@ public:
ADD_FAILURE() << "No interfaces detected.";
}
valid_iface_ = ifaces.begin()->getName();
valid_iface_ = (*ifaces.begin())->getName();
}
// Generate IA_NA or IA_PD option with specified parameters
......
// Copyright (C) 2012-2014 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012-2014,2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
......@@ -57,7 +57,7 @@ TestControl::TestControlSocket::TestControlSocket(const int socket) :
}
TestControl::TestControlSocket::~TestControlSocket() {
Iface* iface = IfaceMgr::instance().getIface(ifindex_);
IfacePtr iface = IfaceMgr::instance().getIface(ifindex_);
if (iface) {
iface->delSocket(sockfd_);
}
......@@ -65,19 +65,15 @@ TestControl::TestControlSocket::~TestControlSocket() {
void
TestControl::TestControlSocket::initSocketData() {
const IfaceMgr::IfaceCollection& ifaces =
IfaceMgr::instance().getIfaces();
for (IfaceMgr::IfaceCollection::const_iterator it = ifaces.begin();
it != ifaces.end();
++it) {
BOOST_FOREACH(IfacePtr iface, IfaceMgr::instance().getIfaces()) {
const Iface::SocketCollection& socket_collection =
it->getSockets();
iface->getSockets();
for (Iface::SocketCollection::const_iterator s =
socket_collection.begin();
s != socket_collection.end();
++s) {
if (s->sockfd_ == sockfd_) {
ifindex_ = it->getIndex();
ifindex_ = iface->getIndex();
addr_ = s->addr_;
return;
}
......@@ -784,7 +780,7 @@ TestControl::openSocket() const {
// If user specified interface name with '-l' the
// IPV6_MULTICAST_IF has to be set.
if ((ret >= 0) && options.isInterface()) {
Iface* iface =
IfacePtr iface =
IfaceMgr::instance().getIface(options.getLocalName());
if (iface == NULL) {
isc_throw(Unexpected, "unknown interface "
......@@ -2050,7 +2046,7 @@ TestControl::setDefaults4(const TestControlSocket& socket,
const Pkt4Ptr& pkt) {
CommandOptions& options = CommandOptions::instance();
// Interface name.
Iface* iface = IfaceMgr::instance().getIface(socket.ifindex_);
IfacePtr iface = IfaceMgr::instance().getIface(socket.ifindex_);
if (iface == NULL) {
isc_throw(BadValue, "unable to find interface with given index");
}
......@@ -2076,7 +2072,7 @@ TestControl::setDefaults6(const TestControlSocket& socket,
const Pkt6Ptr& pkt) {
CommandOptions& options = CommandOptions::instance();
// Interface name.
Iface* iface = IfaceMgr::instance().getIface(socket.ifindex_);
IfacePtr iface = IfaceMgr::instance().getIface(socket.ifindex_);
if (iface == NULL) {
isc_throw(BadValue, "unable to find interface with given index");
}
......
// Copyright (C) 2012-2013 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012-2013,2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
......@@ -217,11 +217,7 @@ public:
///
/// \return local loopback interface name.
std::string getLocalLoopback() const {
const IfaceMgr::IfaceCollection& ifaces =
IfaceMgr::instance().getIfaces();
for (IfaceMgr::IfaceCollection::const_iterator iface = ifaces.begin();
iface != ifaces.end();
++iface) {
BOOST_FOREACH(IfacePtr iface, IfaceMgr::instance().getIfaces()) {
if (iface->flag_loopback_) {
return (iface->getName());
}
......
......@@ -28,6 +28,8 @@
#include <exceptions/exceptions.h>
#include <util/io/pktinfo_utilities.h>
#include <boost/foreach.hpp>
#include <cstring>
#include <errno.h>
#include <fstream>
......@@ -270,16 +272,14 @@ Iface::countActive4() const {
}
void IfaceMgr::closeSockets() {
for (IfaceCollection::iterator iface = ifaces_.begin();
iface != ifaces_.end(); ++iface) {
BOOST_FOREACH(IfacePtr iface, ifaces_) {
iface->closeSockets();
}
}
void
IfaceMgr::closeSockets(const uint16_t family) {
for (IfaceCollection::iterator iface = ifaces_.begin();
iface != ifaces_.end(); ++iface) {
BOOST_FOREACH(IfacePtr iface, ifaces_) {
iface->closeSockets(family);
}
}
......@@ -372,8 +372,7 @@ IfaceMgr::setPacketFilter(const PktFilter6Ptr& packet_filter) {
bool
IfaceMgr::hasOpenSocket(const uint16_t family) const {
// Iterate over all interfaces and search for open sockets.
for (IfaceCollection::const_iterator iface = ifaces_.begin();
iface != ifaces_.end(); ++iface) {
BOOST_FOREACH(IfacePtr iface, ifaces_) {
const Iface::SocketCollection& sockets = iface->getSockets();
for (Iface::SocketCollection::const_iterator sock = sockets.begin();
sock != sockets.end(); ++sock) {
......@@ -391,8 +390,7 @@ IfaceMgr::hasOpenSocket(const uint16_t family) const {
bool
IfaceMgr::hasOpenSocket(const IOAddress& addr) const {
// Iterate over all interfaces and search for open sockets.
for (IfaceCollection::const_iterator iface = ifaces_.begin();
iface != ifaces_.end(); ++iface) {
BOOST_FOREACH(IfacePtr iface, ifaces_) {
const Iface::SocketCollection& sockets = iface->getSockets();
for (Iface::SocketCollection::const_iterator sock = sockets.begin();
sock != sockets.end(); ++sock) {
......@@ -439,21 +437,21 @@ void IfaceMgr::stubDetectIfaces() {
"Interface detection on this OS is not supported.");
}
Iface iface(ifaceName, if_nametoindex(ifaceName.c_str()));
iface.flag_up_ = true;
iface.flag_running_ = true;
IfacePtr iface(new Iface(ifaceName, if_nametoindex(ifaceName.c_str())));
iface->flag_up_ = true;
iface->flag_running_ = true;
// Note that we claim that this is not a loopback. iface_mgr tries to open a
// socket on all interaces that are up, running and not loopback. As this is
// the only interface we were able to detect, let's pretend this is a normal
// interface.
iface.flag_loopback_ = false;
iface.flag_multicast_ = true;
iface.flag_broadcast_ = true;
iface.setHWType(HWTYPE_ETHERNET);
iface->flag_loopback_ = false;
iface->flag_multicast_ = true;
iface->flag_broadcast_ = true;
iface->setHWType(HWTYPE_ETHERNET);
iface.addAddress(IOAddress(v4addr));
iface.addAddress(IOAddress(v6addr));
iface->addAddress(IOAddress(v4addr));
iface->addAddress(IOAddress(v6addr));
addInterface(iface);
}
......@@ -463,10 +461,7 @@ IfaceMgr::openSockets4(const uint16_t port, const bool use_bcast,
int count = 0;
int bcast_num = 0;
for (IfaceCollection::iterator iface = ifaces_.begin();
iface != ifaces_.end();
++iface) {
BOOST_FOREACH(IfacePtr iface, ifaces_) {
// If the interface is inactive, there is nothing to do. Simply
// proceed to the next detected interface.
if (iface->inactive4_) {
......@@ -577,10 +572,7 @@ IfaceMgr::openSockets6(const uint16_t port,
IfaceMgrErrorMsgCallback error_handler) {
int count = 0;
for (IfaceCollection::iterator iface = ifaces_.begin();
iface != ifaces_.end();
++iface) {
BOOST_FOREACH(IfacePtr iface, ifaces_) {
if (iface->inactive6_) {
continue;
......@@ -658,10 +650,7 @@ IfaceMgr::openSockets6(const uint16_t port,
void
IfaceMgr::printIfaces(std::ostream& out /*= std::cout*/) {
for (IfaceCollection::const_iterator iface=ifaces_.begin();
iface!=ifaces_.end();
++iface) {
BOOST_FOREACH(IfacePtr iface, ifaces_) {
const Iface::AddressCollection& addrs = iface->getAddresses();
out << "Detected interface " << iface->getFullName()
......@@ -684,28 +673,24 @@ IfaceMgr::printIfaces(std::ostream& out /*= std::cout*/) {
}
}
Iface*
IfacePtr
IfaceMgr::getIface(int ifindex) {
for (IfaceCollection::iterator iface=ifaces_.begin();
iface!=ifaces_.end();
++iface) {
BOOST_FOREACH(IfacePtr iface, ifaces_) {
if (iface->getIndex() == ifindex)
return (&(*iface));
return (iface);
}
return (NULL); // not found
return (IfacePtr()); // not found
}
Iface*
IfacePtr
IfaceMgr::getIface(const std::string& ifname) {
for (IfaceCollection::iterator iface=ifaces_.begin();
iface!=ifaces_.end();
++iface) {
BOOST_FOREACH(IfacePtr iface, ifaces_) {
if (iface->getName() == ifname)
return (&(*iface));
return (iface);
}
return (NULL); // not found
return (IfacePtr()); // not found
}
void
......@@ -715,8 +700,7 @@ IfaceMgr::clearIfaces() {
void
IfaceMgr::clearUnicasts() {
for (IfaceCollection::iterator iface=ifaces_.begin();
iface!=ifaces_.end(); ++iface) {
BOOST_FOREACH(IfacePtr iface, ifaces_) {
iface->clearUnicasts();
}
}
......@@ -724,7 +708,7 @@ IfaceMgr::clearUnicasts() {
int IfaceMgr::openSocket(const std::string& ifname, const IOAddress& addr,
const uint16_t port, const bool receive_bcast,
const bool send_bcast) {
Iface* iface = getIface(ifname);
IfacePtr iface = getIface(ifname);
if (!iface) {
isc_throw(BadValue, "There is no " << ifname << " interface present.");
}
......@@ -744,10 +728,7 @@ int IfaceMgr::openSocketFromIface(const std::string& ifname,
const uint16_t port,
const uint8_t family) {
// Search for specified interface among detected interfaces.
for (IfaceCollection::iterator iface = ifaces_.begin();
iface != ifaces_.end();
++iface) {
BOOST_FOREACH(IfacePtr iface, ifaces_) {
if ((iface->getFullName() != ifname) &&
(iface->getName() != ifname)) {
continue;
......@@ -788,10 +769,7 @@ int IfaceMgr::openSocketFromAddress(const IOAddress& addr,
const uint16_t port) {
// Search through detected interfaces and addresses to match
// local address we got.
for (IfaceCollection::iterator iface = ifaces_.begin();
iface != ifaces_.end();
++iface) {
BOOST_FOREACH(IfacePtr iface, ifaces_) {
Iface::AddressCollection addrs = iface->getAddresses();
for (Iface::AddressCollection::iterator addr_it = addrs.begin();
......@@ -898,7 +876,7 @@ IfaceMgr::openSocket4(Iface& iface, const IOAddress& addr,
bool
IfaceMgr::send(const Pkt6Ptr& pkt) {
Iface* iface = getIface(pkt->getIface());
IfacePtr iface = getIface(pkt->getIface());
if (!iface) {
isc_throw(BadValue, "Unable to send DHCPv6 message. Invalid interface ("
<< pkt->getIface() << ") specified.");
......@@ -911,7 +889,7 @@ IfaceMgr::send(const Pkt6Ptr& pkt) {
bool
IfaceMgr::send(const Pkt4Ptr& pkt) {
Iface* iface = getIface(pkt->getIface());
IfacePtr iface = getIface(pkt->getIface());
if (!iface) {
isc_throw(BadValue, "Unable to send DHCPv4 message. Invalid interface ("
<< pkt->getIface() << ") specified.");
......@@ -930,7 +908,7 @@ IfaceMgr::receive4(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */) {
" one million microseconds");
}
const SocketInfo* candidate = 0;
IfaceCollection::iterator iface;
IfacePtr iface;
fd_set sockets;
int maxfd = 0;
......@@ -939,8 +917,7 @@ IfaceMgr::receive4(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */) {
/// @todo: marginal performance optimization. We could create the set once
/// and then use its copy for select(). Please note that select() modifies
/// provided set to indicated which sockets have something to read.
for (iface = ifaces_.begin(); iface != ifaces_.end(); ++iface) {
BOOST_FOREACH(iface, ifaces_) {
const Iface::SocketCollection& socket_collection = iface->getSockets();
for (Iface::SocketCollection::const_iterator s = socket_collection.begin();
s != socket_collection.end(); ++s) {
......@@ -1013,7 +990,7 @@ IfaceMgr::receive4(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */) {
}
// Let's find out which interface/socket has the data
for (iface = ifaces_.begin(); iface != ifaces_.end(); ++iface) {
BOOST_FOREACH(iface, ifaces_) {
const Iface::SocketCollection& socket_collection = iface->getSockets();
for (Iface::SocketCollection::const_iterator s = socket_collection.begin();
s != socket_collection.end(); ++s) {
......@@ -1052,8 +1029,7 @@ Pkt6Ptr IfaceMgr::receive6(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */
/// @todo: marginal performance optimization. We could create the set once
/// and then use its copy for select(). Please note that select() modifies
/// provided set to indicated which sockets have something to read.
IfaceCollection::const_iterator iface;
for (iface = ifaces_.begin(); iface != ifaces_.end(); ++iface) {
BOOST_FOREACH(IfacePtr iface, ifaces_) {
const Iface::SocketCollection& socket_collection = iface->getSockets();
for (Iface::SocketCollection::const_iterator s = socket_collection.begin();
s != socket_collection.end(); ++s) {
......@@ -1128,7 +1104,7 @@ Pkt6Ptr IfaceMgr::receive6(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */
}
// Let's find out which interface/socket has the data
for (iface = ifaces_.begin(); iface != ifaces_.end(); ++iface) {
BOOST_FOREACH(IfacePtr iface, ifaces_) {
const Iface::SocketCollection& socket_collection = iface->getSockets();
for (Iface::SocketCollection::const_iterator s = socket_collection.begin();
s != socket_collection.end(); ++s) {
......@@ -1150,8 +1126,8 @@ Pkt6Ptr IfaceMgr::receive6(uint32_t timeout_sec, uint32_t timeout_usec /* = 0 */
}
uint16_t IfaceMgr::getSocket(const isc::dhcp::Pkt6& pkt) {
Iface* iface = getIface(pkt.getIface());
if (iface == NULL) {
IfacePtr iface = getIface(pkt.getIface());
if (!iface) {
isc_throw(IfaceNotFound, "Tried to find socket for non-existent interface");
}
......@@ -1207,7 +1183,7 @@ uint16_t IfaceMgr::getSocket(const isc::dhcp::Pkt6& pkt) {
SocketInfo
IfaceMgr::getSocket(isc::dhcp::Pkt4 const& pkt) {
Iface* iface = getIface(pkt.getIface());
IfacePtr iface = getIface(pkt.getIface());
if (iface == NULL) {
isc_throw(IfaceNotFound, "Tried to find socket for non-existent interface");
}
......
......@@ -159,7 +159,7 @@ struct SocketInfo {
/// returned by the OS kernel when the socket is opened. Hence, it is
/// convenient to allocate the buffer when the socket is being opened and
/// utilze it throughout the lifetime of the socket.
class Iface {
class Iface : public boost::noncopyable {
public:
/// Maximum MAC address length (Infiniband uses 20 bytes)
......@@ -500,6 +500,8 @@ private:
std::vector<uint8_t> read_buffer_;
};
typedef boost::shared_ptr<Iface> IfacePtr;
/// @brief This type describes the callback function invoked when error occurs
/// in the IfaceMgr.
///
......@@ -544,7 +546,7 @@ public:
// also hide it (make it public make tests easier for now)
/// Type that holds a list of interfaces.
typedef std::list<Iface> IfaceCollection;
typedef std::list<IfacePtr> IfaceCollection;
/// IfaceMgr is a singleton class. This method returns reference
/// to its sole instance.
......@@ -589,7 +591,7 @@ public:
/// @return interface with requested index (or NULL if no such
/// interface is present)
///
Iface* getIface(int ifindex);
IfacePtr getIface(int ifindex);
/// @brief Returns interface with specified interface name
///
......@@ -598,7 +600,7 @@ public:
/// @return interface with requested name (or NULL if no such
/// interface is present)
///
Iface* getIface(const std::string& ifname);
IfacePtr getIface(const std::string& ifname);
/// @brief Returns container with all interfaces.
///
......@@ -1031,7 +1033,7 @@ public:
/// @param iface reference to Iface object.
/// @note This function must be public because it has to be callable
/// from unit tests.
void addInterface(const Iface& iface) {
void addInterface(const IfacePtr& iface) {
ifaces_.push_back(iface);
}
......
......@@ -47,9 +47,9 @@ IfaceMgr::detectIfaces() {
isc_throw(Unexpected, "Network interfaces detection failed.");
}
typedef map<string, Iface> ifaceLst;
ifaceLst::iterator iface_iter;
ifaceLst ifaces;
typedef map<string, IfacePtr> IfaceLst;
IfaceLst::iterator iface_iter;
IfaceLst ifaces;
// First lookup for getting interfaces ...
for (ifptr = iflist; ifptr != 0; ifptr = ifptr->ifa_next) {
......@@ -66,9 +66,9 @@ IfaceMgr::detectIfaces() {
continue;
}
Iface iface(ifname, ifindex);
iface.setFlags(ifptr->ifa_flags);
ifaces.insert(pair<string, Iface>(ifname, iface));
IfacePtr iface(new Iface(ifname, ifindex));
iface->setFlags(ifptr->ifa_flags);
ifaces.insert(pair<string, IfacePtr>(ifname, iface));
}
// Second lookup to get MAC and IP addresses
......@@ -84,8 +84,8 @@ IfaceMgr::detectIfaces() {
reinterpret_cast<struct sockaddr_dl *>(ifptr->ifa_addr);
ptr = reinterpret_cast<uint8_t *>(LLADDR(ldata));
iface_iter->second.setHWType(ldata->sdl_type);
iface_iter->second.setMac(ptr, ldata->sdl_alen);
iface_iter->second->setHWType(ldata->sdl_type);
iface_iter->second->setMac(ptr, ldata->sdl_alen);
} else if(ifptr->ifa_addr->sa_family == AF_INET6) {
// IPv6 Addr
struct sockaddr_in6 * adata =
......@@ -93,7 +93,7 @@ IfaceMgr::detectIfaces() {
ptr = reinterpret_cast<uint8_t *>(&adata->sin6_addr);
IOAddress a = IOAddress::fromBytes(AF_INET6, ptr);
iface_iter->second.addAddress(a);
iface_iter->second->addAddress(a);
} else {
// IPv4 Addr
struct sockaddr_in * adata =
......@@ -101,16 +101,16 @@ IfaceMgr::detectIfaces() {
ptr = reinterpret_cast<uint8_t *>(&adata->sin_addr);
IOAddress a = IOAddress::fromBytes(AF_INET, ptr);
iface_iter->second.addAddress(a);
iface_iter->second->addAddress(a);
}
}
freeifaddrs(iflist);
// Interfaces registering
for(ifaceLst::const_iterator iface_iter = ifaces.begin();
for(IfaceLst::const_iterator iface_iter = ifaces.begin();
iface_iter != ifaces.end(); ++iface_iter) {
ifaces_.push_back(iface_iter->second);
addInterface(iface_iter->second);
}
}
......
......@@ -257,7 +257,7 @@ Pkt::getMACFromIPv6(const isc::asiolink::IOAddress& addr) {
// Let's get the interface this packet was received on. We need it to get
// hardware type
Iface* iface = IfaceMgr::instance().getIface(iface_);
IfacePtr iface = IfaceMgr::instance().getIface(iface_);
uint16_t hwtype = 0; // not specified
if (iface) {
hwtype = iface->getHWType();
......
......@@ -706,7 +706,7 @@ Pkt6::getMACFromRemoteIdRelayOption() {
// Let's get the interface this packet was received on. We need it to get
// the hardware type.
Iface* iface = IfaceMgr::instance().getIface(iface_);
IfacePtr iface = IfaceMgr::instance().getIface(iface_);
uint16_t hwtype = 0; // not specified
// If we get the interface HW type, great! If not, let's not panic.
......
......@@ -224,7 +224,7 @@ PktFilterInet6::receive(const SocketInfo& socket_info) {
pkt->setRemotePort(ntohs(from.sin6_port));
pkt->setIndex(ifindex);
Iface* received = IfaceMgr::instance().getIface(pkt->getIndex());
IfacePtr received = IfaceMgr::instance().getIface(pkt->getIndex());
if (received) {
pkt->setIface(received->getName());
} else {
......
......@@ -52,8 +52,8 @@ IfaceMgrTestConfig::~IfaceMgrTestConfig() {
void
IfaceMgrTestConfig::addAddress(const std::string& iface_name,
const IOAddress& address) {
Iface* iface = IfaceMgr::instance().getIface(iface_name);
if (iface == NULL) {
IfacePtr iface = IfaceMgr::instance().getIface(iface_name);
if (!iface) {
isc_throw(isc::BadValue, "interface '" << iface_name
<< "' doesn't exist");
}
......@@ -61,7 +61,7 @@ IfaceMgrTestConfig::addAddress(const std::string& iface_name,
}
void
IfaceMgrTestConfig::addIface(const Iface& iface) {
IfaceMgrTestConfig::addIface(const IfacePtr& iface) {
IfaceMgr::instance().addInterface(iface);
}
......@@ -70,27 +70,27 @@ IfaceMgrTestConfig::addIface(const std::string& name, const int ifindex) {
IfaceMgr::instance().addInterface(createIface(name, ifindex));
}
Iface
IfacePtr
IfaceMgrTestConfig::createIface(const std::string &name, const int ifindex) {
Iface iface(name, ifindex);
IfacePtr iface(new Iface(name, ifindex));
if (name == "lo") {
iface.flag_loopback_ = true;
iface->flag_loopback_ = true;
// Don't open sockets on the loopback interface.
iface.inactive4_ = true;
iface.inactive6_ = true;
iface->inactive4_ = true;
iface->inactive6_ = true;
} else {
iface.inactive4_ = false;
iface.inactive6_ = false;
iface->inactive4_ = false;
iface->inactive6_ = false;
}
iface.flag_multicast_ = true;
iface->flag_multicast_ = true;
// On BSD systems, the SO_BINDTODEVICE option is not supported.
// Therefore the IfaceMgr will throw an exception on attempt to
// open sockets on more than one broadcast-capable interface at
// the same time. In order to prevent this error, we mark all
// interfaces broadcast-incapable for unit testing.
iface.flag_broadcast_ = false;
iface.flag_up_ = true;
iface.flag_running_ = true;
iface->flag_broadcast_ = false;
iface->flag_up_ = true;
iface->flag_running_ = true;
return (iface);
}
......@@ -132,7 +132,7 @@ IfaceMgrTestConfig::setIfaceFlags(const std::string& name,
const FlagRunning& running,
const FlagInactive4& inactive4,
const FlagInactive6& inactive6) {
Iface* iface = IfaceMgr::instance().getIface(name);
IfacePtr iface = IfaceMgr::instance().getIface(name);
if (iface == NULL) {
isc_throw(isc::BadValue, "interface '" << name << "' doesn't exist");
}
......@@ -146,7 +146,7 @@ IfaceMgrTestConfig::setIfaceFlags(const std::string& name,
bool
IfaceMgrTestConfig::socketOpen(const std::string& iface_name,
const int family) const {
Iface* iface = IfaceMgr::instance().getIface(iface_name);
IfacePtr iface = IfaceMgr::instance().getIface(iface_name);
if (iface == NULL) {
isc_throw(Unexpected, "No such interface '" << iface_name << "'");
}
......@@ -164,8 +164,8 @@ IfaceMgrTestConfig::socketOpen(const std::string& iface_name,
bool
IfaceMgrTestConfig::socketOpen(const std::string& iface_name,
const std::string& address) const {
Iface* iface = IfaceMgr::instance().getIface(iface_name);