Skip to content

Commit fbfdbb1

Browse files
committed
Network: Add networkUseDefaultInterface routine
1 parent 8344c82 commit fbfdbb1

File tree

5 files changed

+23
-0
lines changed

5 files changed

+23
-0
lines changed

Firmware/RTK_Everywhere/HTTP_Client.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ void httpClientUpdate()
356356
// Connect to the HTTP server
357357
case HTTP_CLIENT_CONNECTING_2_SERVER: {
358358
// Allocate the httpSecureClient structure
359+
networkUseDefaultInterface();
359360
httpSecureClient = new NetworkClientSecure();
360361
if (!httpSecureClient)
361362
{

Firmware/RTK_Everywhere/MQTT_Client.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,7 @@ void mqttClientUpdate()
884884
// Connect to the MQTT broker
885885
case MQTT_CLIENT_CONNECTING_2_BROKER: {
886886
// Allocate the mqttSecureClient structure
887+
networkUseDefaultInterface();
887888
mqttSecureClient = new NetworkClientSecure();
888889
if (!mqttSecureClient)
889890
{

Firmware/RTK_Everywhere/Network.ino

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2451,6 +2451,25 @@ void networkUpdate()
24512451
}
24522452
}
24532453

2454+
//----------------------------------------
2455+
// Set the default network interface
2456+
//----------------------------------------
2457+
void networkUseDefaultInterface()
2458+
{
2459+
NetIndex_t index;
2460+
bool isDefault;
2461+
2462+
// Get the network index
2463+
index = networkGetCurrentInterfaceIndex();
2464+
if (index < NETWORK_OFFLINE)
2465+
{
2466+
// Get the default network interface
2467+
isDefault = networkInterfaceTable[index].netif->isDefault();
2468+
if (!isDefault)
2469+
networkInterfaceTable[index].netif->setDefault();
2470+
}
2471+
}
2472+
24542473
//----------------------------------------
24552474
// Add a network user
24562475
//----------------------------------------

Firmware/RTK_Everywhere/NtripClient.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,7 @@ void ntripClientUpdate()
658658
if (connected)
659659
{
660660
// Allocate the ntripClient structure
661+
networkUseDefaultInterface();
661662
ntripClient = new NetworkClient();
662663
if (!ntripClient)
663664
{

Firmware/RTK_Everywhere/TcpClient.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ bool tcpClientStart()
306306
NetworkClient *client;
307307

308308
// Allocate the TCP client
309+
networkUseDefaultInterface();
309310
client = new NetworkClient();
310311
if (client)
311312
{

0 commit comments

Comments
 (0)