fix the log when devname is invalid
This commit is contained in:
13
deps/oblib/src/lib/net/ob_net_util.cpp
vendored
13
deps/oblib/src/lib/net/ob_net_util.cpp
vendored
@ -77,6 +77,13 @@ int ObNetUtil::get_local_addr_ipv6(const char *dev_name, char *ipv6, int len,
|
|||||||
} // if end
|
} // if end
|
||||||
ifa_tmp = ifa_tmp->ifa_next;
|
ifa_tmp = ifa_tmp->ifa_next;
|
||||||
} // while end
|
} // while end
|
||||||
|
|
||||||
|
// if dev_name is invalid, then level will keep its initial value(-1)
|
||||||
|
if (level == -1) {
|
||||||
|
ret = OB_INVALID_ARGUMENT;
|
||||||
|
LOG_WARN("invalid devname specified by -i", "devname", dev_name, "info",
|
||||||
|
"you may list devnames by shell command: ifconfig");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nullptr != ifa) {
|
if (nullptr != ifa) {
|
||||||
@ -111,6 +118,12 @@ uint32_t ObNetUtil::get_local_addr_ipv4(const char *dev_name)
|
|||||||
} // if end
|
} // if end
|
||||||
ifa_tmp = ifa_tmp->ifa_next;
|
ifa_tmp = ifa_tmp->ifa_next;
|
||||||
} // while end
|
} // while end
|
||||||
|
|
||||||
|
if (!has_found) {
|
||||||
|
ret = OB_INVALID_ARGUMENT;
|
||||||
|
LOG_WARN("invalid devname specified by -i", "devname", dev_name, "info",
|
||||||
|
"you may list devnames by shell command: ifconfig");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nullptr != ifa) {
|
if (nullptr != ifa) {
|
||||||
|
|||||||
Reference in New Issue
Block a user