14 memset(&ifr, 0,
sizeof(ifr));
15 strncpy(ifr.ifr_name, name.c_str(), IF_NAMESIZE-1);
16 int fd = socket(AF_LOCAL, SOCK_STREAM, 0);
18 if (ioctl(fd, SIOCGIFHWADDR, (
void *)&ifr) < 0) {
19 LOG(ERROR,
"Error <" << errno <<
": " << strerror(errno) <<
20 "> querying mac-address for interface <" << name <<
"> " <<
21 "Agent-index <" <<
id_ <<
">");
26 if (ioctl(fd, SIOCGIFFLAGS, (
void *)&ifr) < 0) {
27 LOG(ERROR,
"Error <" << errno <<
": " << strerror(errno) <<
28 "> querying flags for interface <" << name <<
"> " <<
29 "Agent-index <" <<
id_ <<
">");
34 if ((ifr.ifr_flags & (IFF_UP | IFF_RUNNING)) == (IFF_UP | IFF_RUNNING)) {
38 #if defined(__linux__)
41 if (agent->
is_l3mh() && name.compare(
"vhost0") == 0) {
46 int idx = if_nametoindex(name.c_str());
virtual void ObtainOsSpecificParams(const std::string &name, Agent *agent)
virtual void ObtainOsSpecificParams(const std::string &name, Agent *agent)
virtual void ObtainOsSpecificParams(const std::string &name, Agent *agent)
virtual void ObtainOsSpecificParams(const std::string &name, Agent *agent)
#define LOG(_Level, _Msg)
struct InterfaceOsParams os_params_
static MacAddress FromString(const std::string &str, boost::system::error_code *error=NULL)