File tree Expand file tree Collapse file tree 5 files changed +23
-0
lines changed Expand file tree Collapse file tree 5 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -356,6 +356,7 @@ void httpClientUpdate()
356
356
// Connect to the HTTP server
357
357
case HTTP_CLIENT_CONNECTING_2_SERVER: {
358
358
// Allocate the httpSecureClient structure
359
+ networkUseDefaultInterface ();
359
360
httpSecureClient = new NetworkClientSecure ();
360
361
if (!httpSecureClient)
361
362
{
Original file line number Diff line number Diff line change @@ -876,6 +876,7 @@ void mqttClientUpdate()
876
876
// Connect to the MQTT broker
877
877
case MQTT_CLIENT_CONNECTING_2_BROKER: {
878
878
// Allocate the mqttSecureClient structure
879
+ networkUseDefaultInterface ();
879
880
mqttSecureClient = new NetworkClientSecure ();
880
881
if (!mqttSecureClient)
881
882
{
Original file line number Diff line number Diff line change @@ -2434,6 +2434,25 @@ void networkUpdate()
2434
2434
}
2435
2435
}
2436
2436
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
+
2437
2456
// ----------------------------------------
2438
2457
// Add a network user
2439
2458
// ----------------------------------------
Original file line number Diff line number Diff line change @@ -656,6 +656,7 @@ void ntripClientUpdate()
656
656
if (connected)
657
657
{
658
658
// Allocate the ntripClient structure
659
+ networkUseDefaultInterface ();
659
660
ntripClient = new NetworkClient ();
660
661
if (!ntripClient)
661
662
{
Original file line number Diff line number Diff line change @@ -306,6 +306,7 @@ bool tcpClientStart()
306
306
NetworkClient *client;
307
307
308
308
// Allocate the TCP client
309
+ networkUseDefaultInterface ();
309
310
client = new NetworkClient ();
310
311
if (client)
311
312
{
You can’t perform that action at this time.
0 commit comments