The dhcp server address is the one to consider as remote address if
there is no gateway set.
---
src/peer.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/peer.c b/src/peer.c
index f48fb03..206b799 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -285,6 +285,7 @@ static void append_ipv4(DBusMessageIter *iter, void
*user_data)
char trans[INET_ADDRSTRLEN+1] = {};
const char *local = "";
const char *remote = "";
+ char *dhcp = NULL;
if (!is_connected(peer))
return;
@@ -299,13 +300,22 @@ static void append_ipv4(DBusMessageIter *iter, void
*user_data)
remote = trans;
} else if (peer->ipconfig) {
local = __connman_ipconfig_get_local(peer->ipconfig);
+
remote = __connman_ipconfig_get_gateway(peer->ipconfig);
+ if (!remote) {
+ remote = dhcp = __connman_dhcp_get_server_address(
+ peer->ipconfig);
+ if (!dhcp)
+ remote = "";
+ }
}
connman_dbus_dict_append_basic(iter, "Local",
DBUS_TYPE_STRING, &local);
connman_dbus_dict_append_basic(iter, "Remote",
DBUS_TYPE_STRING, &remote);
+ if (dhcp)
+ g_free(dhcp);
}
static void append_peer_service(DBusMessageIter *iter,
--
2.0.5
_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman