Fixes bad retrun value in get_interface_index
This commit is contained in:
parent
ddfb35b5c9
commit
619cc13570
@ -102,7 +102,7 @@ int get_interface_index(const std::string& interface_name) {
|
|||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
ifr.ifr_addr.sa_family = AF_INET;
|
ifr.ifr_addr.sa_family = AF_INET;
|
||||||
strncpy(ifr.ifr_name, interface_name.c_str(), IFNAMSIZ - 1);
|
strncpy(ifr.ifr_name, interface_name.c_str(), IFNAMSIZ - 1);
|
||||||
if (ioctl(fd, SIOCGIFADDR, &ifr) < 0) {
|
if (ioctl(fd, SIOCGIFINDEX, &ifr) < 0) {
|
||||||
close(fd);
|
close(fd);
|
||||||
BOOST_LOG_TRIVIAL(warning)
|
BOOST_LOG_TRIVIAL(warning)
|
||||||
<< "Cannot retrieve index for interface " << interface_name;
|
<< "Cannot retrieve index for interface " << interface_name;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user