Skip to content

Commit 44781b7

Browse files
committed
fix(aft_netif): Minor compat fix for v6.0+
1 parent 4f92fbf commit 44781b7

File tree

1 file changed

+24
-23
lines changed

1 file changed

+24
-23
lines changed

components/freertos_tcp/esp_netif/esp_netif_impl.c

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -71,7 +71,7 @@ struct esp_netif_stack *esp_netif_new_netstack_if(esp_netif_t *esp_netif, const
7171
ip4_to_afpt_ip(&base_cfg->ip_info->netmask, mask);
7272
ip4_to_afpt_ip(&base_cfg->ip_info->gw, gw);
7373
}
74-
FreeRTOS_FillEndPoint( &( netif->aft_netif ), &( netif->endpoints[0]), ip, mask, gw, dns, base_cfg->mac );
74+
FreeRTOS_FillEndPoint(&(netif->aft_netif), &(netif->endpoints[0]), ip, mask, gw, dns, base_cfg->mac);
7575
if (base_cfg->flags & ESP_NETIF_DHCP_CLIENT) {
7676
netif->endpoints[0].bits.bWantDHCP = pdTRUE;
7777
}
@@ -367,7 +367,7 @@ esp_err_t esp_netif_get_ip_info(esp_netif_t *esp_netif, esp_netif_ip_info_t *ip_
367367
ESP_LOGD(TAG, "%s esp_netif:%p", __func__, esp_netif);
368368
uint32_t ulIPAddress = 0, ulNetMask, ulGatewayAddress, ulDNSServerAddress;
369369
struct esp_netif_stack *netif = esp_netif->net_stack;
370-
FreeRTOS_GetEndPointConfiguration( &ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress, netif->aft_netif.pxEndPoint );
370+
FreeRTOS_GetEndPointConfiguration(&ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress, netif->aft_netif.pxEndPoint);
371371
ip_info->ip.addr = ulIPAddress;
372372
ip_info->netmask.addr = ulNetMask;
373373
ip_info->gw.addr = ulGatewayAddress;
@@ -472,7 +472,8 @@ int esp_netif_get_all_ip6(esp_netif_t *esp_netif, esp_ip6_addr_t if_ip6[])
472472
return 0;
473473
}
474474

475-
esp_ip6_addr_type_t esp_netif_ip6_get_addr_type(esp_ip6_addr_t *ip6_addr)
475+
// esp_ip6_addr_type_t esp_netif_ip6_get_addr_type(esp_ip6_addr_t *ip6_addr)
476+
esp_ip6_addr_type_t esp_netif_ip6_get_addr_type(const esp_ip6_addr_t* ip6_addr)
476477
{
477478
return ESP_IP6_ADDR_IS_UNKNOWN;
478479
}
@@ -484,7 +485,7 @@ esp_err_t esp_netif_tcpip_exec(esp_netif_callback_fn fn, void *ctx)
484485

485486
esp_netif_t *esp_netif_find_if(esp_netif_find_predicate_t fn, void *ctx)
486487
{
487-
for (NetworkInterface_t *netif = FreeRTOS_FirstNetworkInterface(); netif != NULL; netif = FreeRTOS_NextNetworkInterface(netif) ) {
488+
for (NetworkInterface_t *netif = FreeRTOS_FirstNetworkInterface(); netif != NULL; netif = FreeRTOS_NextNetworkInterface(netif)) {
488489
esp_netif_t *esp_netif = netif->pvArgument;
489490
if (fn(esp_netif, ctx)) {
490491
return esp_netif;
@@ -500,25 +501,25 @@ esp_err_t esp_netif_set_link_speed(esp_netif_t *esp_netif, uint32_t speed)
500501

501502
/* Called by FreeRTOS+TCP when the network connects or disconnects. Disconnect
502503
* events are only received if implemented in the MAC driver. */
503-
void vApplicationIPNetworkEventHook_Multi( eIPCallbackEvent_t eNetworkEvent,
504-
struct xNetworkEndPoint *pxEndPoint )
504+
void vApplicationIPNetworkEventHook_Multi(eIPCallbackEvent_t eNetworkEvent,
505+
struct xNetworkEndPoint *pxEndPoint)
505506
{
506507
uint32_t ulIPAddress = 0, ulNetMask, ulGatewayAddress, ulDNSServerAddress;
507508
char cBuffer[ 16 ];
508509
static BaseType_t xTasksAlreadyCreated = pdFALSE;
509510

510511
/* If the network has just come up...*/
511-
if ( eNetworkEvent == eNetworkUp ) {
512+
if (eNetworkEvent == eNetworkUp) {
512513
/* Create the tasks that use the IP stack if they have not already been
513514
* created. */
514-
if ( xTasksAlreadyCreated == pdFALSE ) {
515+
if (xTasksAlreadyCreated == pdFALSE) {
515516
/* See the comments above the definitions of these pre-processor
516517
* macros at the top of this file for a description of the individual
517518
* demo tasks. */
518519

519520
#if ( mainCREATE_TCP_ECHO_TASKS_SINGLE == 1 )
520521
{
521-
vStartTCPEchoClientTasks_SingleTasks( mainECHO_CLIENT_TASK_STACK_SIZE, mainECHO_CLIENT_TASK_PRIORITY );
522+
vStartTCPEchoClientTasks_SingleTasks(mainECHO_CLIENT_TASK_STACK_SIZE, mainECHO_CLIENT_TASK_PRIORITY);
522523
}
523524
#endif /* mainCREATE_TCP_ECHO_TASKS_SINGLE */
524525

@@ -527,18 +528,18 @@ void vApplicationIPNetworkEventHook_Multi( eIPCallbackEvent_t eNetworkEvent,
527528

528529
/* Print out the network configuration, which may have come from a DHCP
529530
* server. */
530-
FreeRTOS_GetEndPointConfiguration( &ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress, pxEndPoint );
531-
FreeRTOS_inet_ntoa( ulIPAddress, cBuffer );
532-
printf( "\r\n\r\nIP Address: %s\r\n", cBuffer );
531+
FreeRTOS_GetEndPointConfiguration(&ulIPAddress, &ulNetMask, &ulGatewayAddress, &ulDNSServerAddress, pxEndPoint);
532+
FreeRTOS_inet_ntoa(ulIPAddress, cBuffer);
533+
printf("\r\n\r\nIP Address: %s\r\n", cBuffer);
533534

534-
FreeRTOS_inet_ntoa( ulNetMask, cBuffer );
535-
printf( "Subnet Mask: %s\r\n", cBuffer );
535+
FreeRTOS_inet_ntoa(ulNetMask, cBuffer);
536+
printf("Subnet Mask: %s\r\n", cBuffer);
536537

537-
FreeRTOS_inet_ntoa( ulGatewayAddress, cBuffer );
538-
printf( "Gateway Address: %s\r\n", cBuffer );
538+
FreeRTOS_inet_ntoa(ulGatewayAddress, cBuffer);
539+
printf("Gateway Address: %s\r\n", cBuffer);
539540

540-
FreeRTOS_inet_ntoa( ulDNSServerAddress, cBuffer );
541-
printf( "DNS Server Address: %s\r\n\r\n\r\n", cBuffer );
541+
FreeRTOS_inet_ntoa(ulDNSServerAddress, cBuffer);
542+
printf("DNS Server Address: %s\r\n\r\n\r\n", cBuffer);
542543
esp_netif_t *esp_netif = pxEndPoint->pxNetworkInterface->pvArgument;
543544
ip_event_got_ip_t evt = {
544545
.esp_netif = esp_netif,
@@ -553,21 +554,21 @@ void vApplicationIPNetworkEventHook_Multi( eIPCallbackEvent_t eNetworkEvent,
553554
ESP_LOGE(TAG, "dhcpc cb: failed to post got ip event (%x)", ret);
554555
}
555556
} else {
556-
printf( "Application idle hook network down\n" );
557+
printf("Application idle hook network down\n");
557558
}
558559
}
559560

560-
BaseType_t xApplicationDNSQueryHook_Multi( struct xNetworkEndPoint *pxEndPoint, const char *pcName )
561+
BaseType_t xApplicationDNSQueryHook_Multi(struct xNetworkEndPoint *pxEndPoint, const char *pcName)
561562
{
562563
BaseType_t xReturn;
563564

564565
esp_netif_t *esp_netif = pxEndPoint->pxNetworkInterface->pvArgument;
565566
/* Determine if a name lookup is for this node. Two names are given
566567
* to this node: that returned by pcApplicationHostnameHook() and that set
567568
* by mainDEVICE_NICK_NAME. */
568-
if ( strcasecmp( pcName, pcApplicationHostnameHook() ) == 0 ) {
569+
if (strcasecmp(pcName, pcApplicationHostnameHook()) == 0) {
569570
xReturn = pdPASS;
570-
} else if ( strcasecmp( pcName, esp_netif->hostname ) == 0 ) {
571+
} else if (strcasecmp(pcName, esp_netif->hostname) == 0) {
571572
xReturn = pdPASS;
572573
} else {
573574
xReturn = pdFAIL;

0 commit comments

Comments
 (0)