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