diff --git a/src/app/br_discover.cpp b/src/app/br_discover.cpp index 5edde091..c5818c0e 100644 --- a/src/app/br_discover.cpp +++ b/src/app/br_discover.cpp @@ -53,8 +53,9 @@ Error DiscoverBorderAgent(BorderAgentHandler aBorderAgentHandler, size_t aTimeou int socket = mdns_socket_open_ipv4(); VerifyOrExit(socket >= 0, error = ERROR_IO_ERROR("failed to open mDNS IPv4 socket")); - if (aNetIf != "" && setsockopt(socket, SOL_SOCKET, SO_BINDTODEVICE, &aNetIf[0], sizeof(aNetIf)) < 0) { - ExitNow(error = ERROR_IO_ERROR("failed to bind network interface: {}", aNetIf)); + if (aNetIf != "" && setsockopt(socket, SOL_SOCKET, SO_BINDTODEVICE, &aNetIf[0], sizeof(aNetIf)) < 0) + { + ExitNow(error = ERROR_SOCKET_BIND_ERROR("failed to bind network interface: {}", aNetIf)); } if (mdns_query_send(socket, kMdnsQueryType, kServiceName, strlen(kServiceName), buf, sizeof(buf)) != 0) diff --git a/src/app/cli/interpreter.cpp b/src/app/cli/interpreter.cpp index 722a8c96..afa1f751 100644 --- a/src/app/cli/interpreter.cpp +++ b/src/app/cli/interpreter.cpp @@ -1788,6 +1788,7 @@ Interpreter::Value Interpreter::ProcessBorderAgent(const Expression &aExpr) if (CaseInsensitiveEqual(aExpr[1], "discover")) { uint64_t timeout = 4000; + std::string netIf = ""; if (aExpr.size() >= 3) {