From a506973d0f428516e9ee31516b70b589052f53ef Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Thu, 9 Jun 2016 05:51:28 -0500 Subject: [PATCH] Fixed behaviour of get_ip_address and get_mac_address for LWIPInterface per the socket API documentation: /** Get the local IP address * * @return Null-terminated representation of the local IP address * or null if not yet connected */ virtual const char *get_ip_address() = 0; LWIPInterface incorrectly returned "\0" if unconnected --- net/LWIPInterface/LWIPInterface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/LWIPInterface/LWIPInterface.cpp b/net/LWIPInterface/LWIPInterface.cpp index 94e72ece7c..a47cdbdbdf 100644 --- a/net/LWIPInterface/LWIPInterface.cpp +++ b/net/LWIPInterface/LWIPInterface.cpp @@ -124,12 +124,12 @@ int LWIPInterface::disconnect() const char *LWIPInterface::get_ip_address() { - return ip_addr; + return ip_addr[0] ? ip_addr : 0; } const char *LWIPInterface::get_mac_address() { - return mac_addr; + return mac_addr[0] ? mac_addr : 0; } struct lwip_socket {