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 @@ -884,6 +884,7 @@ void mqttClientUpdate()
884
884
// Connect to the MQTT broker
885
885
case MQTT_CLIENT_CONNECTING_2_BROKER: {
886
886
// Allocate the mqttSecureClient structure
887
+ networkUseDefaultInterface ();
887
888
mqttSecureClient = new NetworkClientSecure ();
888
889
if (!mqttSecureClient)
889
890
{
Original file line number Diff line number Diff line change @@ -2451,6 +2451,25 @@ void networkUpdate()
2451
2451
}
2452
2452
}
2453
2453
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
+
2454
2473
// ----------------------------------------
2455
2474
// Add a network user
2456
2475
// ----------------------------------------
Original file line number Diff line number Diff line change @@ -658,6 +658,7 @@ void ntripClientUpdate()
658
658
if (connected)
659
659
{
660
660
// Allocate the ntripClient structure
661
+ networkUseDefaultInterface ();
661
662
ntripClient = new NetworkClient ();
662
663
if (!ntripClient)
663
664
{
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