From 45e24d4682e8ffeeba69d13c6293c4506a6a1e8c Mon Sep 17 00:00:00 2001 From: Kevin Bracey Date: Thu, 7 Jun 2018 13:39:10 +0300 Subject: [PATCH] Correct PPPCellularInterface::get_gateway() Two cascading copy-paste errors stopped this working: * PPPCellularInterface::get_gateway() called nsapi_ppp_get_ip_address(); * nsapi_ppp_get_gateway() called the interface's get_netmask(). First bug has always been there - second one was introduced in 5.9. AT_CellularNetwork currently lacks calls to get both netmask and gateway - this patch would be needed for that when added. --- features/FEATURE_LWIP/lwip-interface/ppp_lwip.cpp | 2 +- .../cellular/generic_modem_driver/PPPCellularInterface.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/features/FEATURE_LWIP/lwip-interface/ppp_lwip.cpp b/features/FEATURE_LWIP/lwip-interface/ppp_lwip.cpp index c05e6c9e9ea..c2ef19169f4 100644 --- a/features/FEATURE_LWIP/lwip-interface/ppp_lwip.cpp +++ b/features/FEATURE_LWIP/lwip-interface/ppp_lwip.cpp @@ -434,7 +434,7 @@ const char *nsapi_ppp_get_gw_addr(FileHandle *stream) static char gwaddr[IPADDR_STRLEN_MAX]; if (stream == my_stream) { - if (my_interface->get_netmask(gwaddr, IPADDR_STRLEN_MAX)) { + if (my_interface->get_gateway(gwaddr, IPADDR_STRLEN_MAX)) { return gwaddr; } } diff --git a/features/netsocket/cellular/generic_modem_driver/PPPCellularInterface.cpp b/features/netsocket/cellular/generic_modem_driver/PPPCellularInterface.cpp index 76a5ed288f5..455ef42bb07 100644 --- a/features/netsocket/cellular/generic_modem_driver/PPPCellularInterface.cpp +++ b/features/netsocket/cellular/generic_modem_driver/PPPCellularInterface.cpp @@ -749,7 +749,7 @@ const char *PPPCellularInterface::get_netmask() const char *PPPCellularInterface::get_gateway() { - return nsapi_ppp_get_ip_addr(_fh); + return nsapi_ppp_get_gw_addr(_fh); } /** Power down modem