From b7bad775697d6abcb952c65cb1a259a366b0ea05 Mon Sep 17 00:00:00 2001 From: Teemu Kultala Date: Fri, 1 Jun 2018 13:17:09 +0300 Subject: [PATCH] random socket port number --- features/cellular/framework/common/CellularUtil.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/features/cellular/framework/common/CellularUtil.cpp b/features/cellular/framework/common/CellularUtil.cpp index 97ba9d7db9..2fc6805397 100644 --- a/features/cellular/framework/common/CellularUtil.cpp +++ b/features/cellular/framework/common/CellularUtil.cpp @@ -15,6 +15,7 @@ * limitations under the License. */ #include "CellularUtil.h" +#include "randLIB.h" #include #include @@ -315,12 +316,9 @@ int char_str_to_hex_str(const char* str, uint16_t len, char *buf, bool omit_lead uint16_t get_dynamic_ip_port() { - static uint16_t port; - port++; - if (port < 49152) { - port = 49152; - } - return port; + randLIB_seed_random(); + + return (randLIB_get_16bit() | 0xC000); } } // namespace mbed_cellular_util