Skip to content

Commit 0f169d1

Browse files
committed
Network: Add networkUseDefaultInterface routine
1 parent c66a4f9 commit 0f169d1

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
@@ -876,6 +876,7 @@ void mqttClientUpdate()
876876
// Connect to the MQTT broker
877877
case MQTT_CLIENT_CONNECTING_2_BROKER: {
878878
// Allocate the mqttSecureClient structure
879+
networkUseDefaultInterface();
879880
mqttSecureClient = new NetworkClientSecure();
880881
if (!mqttSecureClient)
881882
{

Firmware/RTK_Everywhere/Network.ino

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2434,6 +2434,25 @@ void networkUpdate()
24342434
}
24352435
}
24362436

2437+
//----------------------------------------
2438+
// Set the default network interface
2439+
//----------------------------------------
2440+
void networkUseDefaultInterface()
2441+
{
2442+
NetIndex_t index;
2443+
bool isDefault;
2444+
2445+
// Get the network index
2446+
index = networkGetCurrentInterfaceIndex();
2447+
if (index < NETWORK_OFFLINE)
2448+
{
2449+
// Get the default network interface
2450+
isDefault = networkInterfaceTable[index].netif->isDefault();
2451+
if (!isDefault)
2452+
networkInterfaceTable[index].netif->setDefault();
2453+
}
2454+
}
2455+
24372456
//----------------------------------------
24382457
// Add a network user
24392458
//----------------------------------------

Firmware/RTK_Everywhere/NtripClient.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,7 @@ void ntripClientUpdate()
656656
if (connected)
657657
{
658658
// Allocate the ntripClient structure
659+
networkUseDefaultInterface();
659660
ntripClient = new NetworkClient();
660661
if (!ntripClient)
661662
{

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)