From cf710a3cb131b00bf8682b541d945b7fc7d93d14 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Fri, 13 Sep 2019 15:44:23 +0200 Subject: [PATCH] esp_netif: include tcpip_adapter legacy header by default to provide *implicit* compatiblity --- components/esp_netif/component.mk | 2 +- components/esp_netif/esp_netif_defaults.c | 6 ++--- components/esp_netif/esp_netif_handlers.c | 26 +------------------ components/esp_netif/include/esp_netif.h | 12 ++++++++- .../esp_netif/include/esp_netif_types.h | 20 +------------- .../esp_netif/loopback/esp_netif_loopback.c | 21 +++++++-------- components/esp_netif/lwip/esp_netif_lwip.c | 15 +++++------ .../esp_netif/lwip/esp_netif_lwip_defaults.c | 3 --- .../esp_netif/lwip/esp_netif_lwip_internal.h | 1 - components/esp_netif/test/test_esp_netif.c | 4 +-- components/lwip/port/esp32/netif/wlanif.c | 4 --- .../tcpip_adapter/include/tcpip_adapter.h | 9 ++++--- .../protocols/https_server/sdkconfig.defaults | 1 + .../protocols/mqtt/publish_test/sdkconfig.ci | 3 ++- examples/protocols/mqtt/ssl/sdkconfig.ci | 1 + examples/protocols/mqtt/tcp/sdkconfig.ci | 1 + examples/protocols/mqtt/ws/sdkconfig.ci | 1 + examples/protocols/mqtt/wss/sdkconfig.ci | 2 +- .../network_tests/main/lwip_test_netif.c | 4 +-- 19 files changed, 47 insertions(+), 89 deletions(-) diff --git a/components/esp_netif/component.mk b/components/esp_netif/component.mk index c45836abad..8402e569d2 100644 --- a/components/esp_netif/component.mk +++ b/components/esp_netif/component.mk @@ -3,4 +3,4 @@ # COMPONENT_ADD_INCLUDEDIRS := include COMPONENT_PRIV_INCLUDEDIRS := private_include lwip -COMPONENT_SRCDIRS := . lwip \ No newline at end of file +COMPONENT_SRCDIRS := . lwip loopback \ No newline at end of file diff --git a/components/esp_netif/esp_netif_defaults.c b/components/esp_netif/esp_netif_defaults.c index c1e20e2017..9bd38bb9d3 100644 --- a/components/esp_netif/esp_netif_defaults.c +++ b/components/esp_netif/esp_netif_defaults.c @@ -38,7 +38,7 @@ const esp_netif_inherent_config_t _g_esp_netif_inherent_sta_config = { .lost_ip_event = IP_EVENT_STA_LOST_IP, .get_ip_event = IP_EVENT_STA_GOT_IP, .if_key = "WIFI_STA_DEF", - .if_type = ESP_NETIF_TYPE_STA, + .if_desc = "sta", .route_prio = 100 }; @@ -53,7 +53,7 @@ const esp_netif_inherent_config_t _g_esp_netif_inherent_ap_config = { .flags = ESP_NETIF_DHCPS | ESP_NETIF_FLAG_AUTOUP, .ip_info = (esp_netif_ip_info_t*)&soft_ap_ip, .if_key = "WIFI_AP_DEF", - .if_type = ESP_NETIF_TYPE_AP, + .if_desc = "ap", .route_prio = 10 }; @@ -62,6 +62,6 @@ const esp_netif_inherent_config_t _g_esp_netif_inherent_eth_config = { .lost_ip_event = 0, .flags = ESP_NETIF_DHCPC | ESP_NETIF_FLAG_GARP | ESP_NETIF_FLAG_EVENT_IP_MODIFIED, .if_key = "ETH_DEF", - .if_type = ESP_NETIF_TYPE_ETH, + .if_desc = "eth", .route_prio = 50 }; diff --git a/components/esp_netif/esp_netif_handlers.c b/components/esp_netif/esp_netif_handlers.c index 8bad5f9117..04d3c5f7bf 100644 --- a/components/esp_netif/esp_netif_handlers.c +++ b/components/esp_netif/esp_netif_handlers.c @@ -28,30 +28,6 @@ static const char *TAG = "esp_netif_handlers"; -#define _STR(x) #x - -/** - * @brief This function converts interface type to string, which - * helps with backward compatibility of test infrastructure - * to check for standard message that specific interface (sta, ap, eth) - * obtained IP address - */ -static const char* get_netif_type(esp_netif_t* netif) { - const char* s_esp_netif_type_desc[] = { - _STR(ESP_NETIF_TYPE_UNKNOWN), - "sta", - "ap", - "eth", - _STR(ESP_NETIF_TYPE_OTHER) - }; - size_t type_nr = esp_netif_get_type(netif); - if (type_nr > sizeof(s_esp_netif_type_desc)/sizeof(s_esp_netif_type_desc[0])) { - type_nr = 0; - } - return s_esp_netif_type_desc[type_nr]; -} - - void esp_netif_action_start(void *esp_netif, esp_event_base_t base, int32_t event_id, void *data) { ESP_LOGD(TAG, "esp_netif action has started with netif%p from event_id=%d", esp_netif, event_id); @@ -117,7 +93,7 @@ void esp_netif_action_got_ip(void *esp_netif, esp_event_base_t base, int32_t eve { ESP_LOGD(TAG, "esp_netif action got_ip with netif%p from event_id=%d", esp_netif, event_id); const ip_event_got_ip_t *event = (const ip_event_got_ip_t *) data; - ESP_LOGI(TAG, "%s ip: " IPSTR ", mask: " IPSTR ", gw: " IPSTR, get_netif_type(esp_netif), + ESP_LOGI(TAG, "%s ip: " IPSTR ", mask: " IPSTR ", gw: " IPSTR, esp_netif_get_desc(esp_netif), IP2STR(&event->ip_info.ip), IP2STR(&event->ip_info.netmask), IP2STR(&event->ip_info.gw)); diff --git a/components/esp_netif/include/esp_netif.h b/components/esp_netif/include/esp_netif.h index d2ec9dd509..65623a716d 100644 --- a/components/esp_netif/include/esp_netif.h +++ b/components/esp_netif/include/esp_netif.h @@ -22,6 +22,16 @@ #include "esp_netif_types.h" #include "esp_netif_defaults.h" +// +// Note: tcpip_adapter legacy API has to be included by default to provide full compatibility +// for applications that used tcpip_adapter API without explicit inclusion of tcpip_adapter.h +// +#if CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER +#define _ESP_NETIF_SUPPRESS_LEGACY_WARNING_ +#include "tcpip_adapter.h" +#undef _ESP_NETIF_SUPPRESS_LEGACY_WARNING_ +#endif // CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER + /** * @defgroup ESP_NETIF_INIT_API ESP-NETIF Initialization API * @brief Initialization and deinitialization of underlying TCP/IP stack and esp-netif instances @@ -679,7 +689,7 @@ const char *esp_netif_get_ifkey(esp_netif_t *esp_netif); * * @return Enumerated type of this interface, such as station, AP, ethernet */ -esp_netif_type_t esp_netif_get_type(esp_netif_t *esp_netif); +const char *esp_netif_get_desc(esp_netif_t *esp_netif); /** * @brief Returns configured event for this esp-netif instance and supplied event type diff --git a/components/esp_netif/include/esp_netif_types.h b/components/esp_netif/include/esp_netif_types.h index 364b498c59..908f151334 100644 --- a/components/esp_netif/include/esp_netif_types.h +++ b/components/esp_netif/include/esp_netif_types.h @@ -130,15 +130,6 @@ typedef enum esp_netif_flags { ESP_NETIF_FLAG_EVENT_IP_MODIFIED = 1 << 4 } esp_netif_flags_t; -typedef enum esp_netif_type { - ESP_NETIF_TYPE_UNKNOWN, - ESP_NETIF_TYPE_STA, - ESP_NETIF_TYPE_AP, - ESP_NETIF_TYPE_ETH, - ESP_NETIF_TYPE_OTHER, - ESP_NETIF_TYPE_MAX -} esp_netif_type_t; - typedef enum esp_netif_ip_event_type { ESP_NETIF_IP_EVENT_GOT_IP = 1, ESP_NETIF_IP_EVENT_LOST_IP = 2, @@ -158,8 +149,8 @@ typedef struct esp_netif_inherent_config { esp_netif_ip_info_t* ip_info; /*!< initial ip address for this interface */ uint32_t get_ip_event; /*!< event id to be raised when interface gets an IP */ uint32_t lost_ip_event; /*!< event id to be raised when interface losts its IP */ - esp_netif_type_t if_type; /*!< enum type of the interface */ const char * if_key; /*!< string identifier of the interface */ + const char * if_desc; /*!< textual description of the interface */ int route_prio; /*!< numeric priority of this interface to become a default routing if (if other netifs are up) */ } esp_netif_inherent_config_t; @@ -191,15 +182,6 @@ typedef struct esp_netif_driver_ifconfig esp_netif_driver_ifconfig_t; /** * @brief Specific L3 network stack configuration */ -typedef enum esp_netif_netstack_type { - ESP_NETIF_NETWORK_STACK_IS_LWIP = 0, - ESP_NETIF_NETWORK_STACK_IS_LOOPBACK = 1, - ESP_NETIF_NETWORK_STACK_MAX, -} esp_netif_netstack_type_t; - -typedef struct esp_netif_netstack_base_config { - esp_netif_netstack_type_t type; -} esp_netif_netstack_base_config_t; typedef struct esp_netif_netstack_config esp_netif_netstack_config_t; diff --git a/components/esp_netif/loopback/esp_netif_loopback.c b/components/esp_netif/loopback/esp_netif_loopback.c index 0052a686cb..5f481052c0 100644 --- a/components/esp_netif/loopback/esp_netif_loopback.c +++ b/components/esp_netif/loopback/esp_netif_loopback.c @@ -56,7 +56,7 @@ struct esp_netif_obj { esp_netif_flags_t flags; char * hostname; char * if_key; - esp_netif_type_t if_type; + char * if_desc; int route_prio; }; @@ -135,18 +135,14 @@ static esp_err_t esp_netif_init_configuration(esp_netif_t *esp_netif, const esp_ if (cfg->base->if_key) { esp_netif->if_key = strdup(cfg->base->if_key); } - if (cfg->base->if_type) { - esp_netif->if_type = cfg->base->if_type; + if (cfg->base->if_desc) { + esp_netif->if_desc = strdup(cfg->base->if_desc); } if (cfg->base->route_prio) { esp_netif->route_prio = cfg->base->route_prio; } - // Install network stack functions -- connects netif and L3 stack - if (cfg->stack->base.type != ESP_NETIF_NETWORK_STACK_IS_LOOPBACK) { - ESP_LOGE(TAG, "Failed to configure uknown network stack %d", cfg->stack->base.type); - return ESP_ERR_NOT_SUPPORTED; - } + // Network stack is bypassed in loopback interface // Install IO functions only if provided -- connects driver and netif // this configuration could be updated after esp_netif_new(), typically in post_attach callback @@ -215,6 +211,7 @@ void esp_netif_destroy(esp_netif_t *esp_netif) free(esp_netif->ip_info); free(esp_netif->ip_info_old); free(esp_netif->if_key); + free(esp_netif->if_desc); free(esp_netif); } } @@ -228,7 +225,7 @@ esp_err_t esp_netif_attach(esp_netif_t *esp_netif, esp_netif_iodriver_handle dri esp_err_t ret = base_driver->post_attach(esp_netif, driver_handle); if (ret != ESP_OK) { ESP_LOGE(TAG, "Post-attach callback of driver(%p) failed with %d", driver_handle, ret); - return ESP_ERR_ESP_NETIF_DRIVER_ATACH_FAILED; + return ESP_ERR_ESP_NETIF_DRIVER_ATTACH_FAILED; } } return ESP_OK; @@ -420,14 +417,14 @@ esp_netif_flags_t esp_netif_get_flags(esp_netif_t *esp_netif) return esp_netif->flags; } -char *esp_netif_get_ifkey(esp_netif_t *esp_netif) +const char *esp_netif_get_ifkey(esp_netif_t *esp_netif) { return esp_netif->if_key; } -esp_netif_type_t esp_netif_get_type(esp_netif_t *esp_netif) +const char *esp_netif_get_desc(esp_netif_t *esp_netif) { - return esp_netif->if_type; + return esp_netif->if_desc; } esp_netif_t *esp_netif_get_handle_from_ifkey(const char *if_key) diff --git a/components/esp_netif/lwip/esp_netif_lwip.c b/components/esp_netif/lwip/esp_netif_lwip.c index ef22c888b9..41080148a7 100644 --- a/components/esp_netif/lwip/esp_netif_lwip.c +++ b/components/esp_netif/lwip/esp_netif_lwip.c @@ -93,7 +93,7 @@ struct esp_netif_obj { esp_netif_flags_t flags; char * hostname; char * if_key; - esp_netif_type_t if_type; + char * if_desc; int route_prio; }; @@ -322,8 +322,8 @@ static esp_err_t esp_netif_init_configuration(esp_netif_t *esp_netif, const esp_ if (cfg->base->if_key) { esp_netif->if_key = strdup(cfg->base->if_key); } - if (cfg->base->if_type) { - esp_netif->if_type = cfg->base->if_type; + if (cfg->base->if_desc) { + esp_netif->if_desc = strdup(cfg->base->if_desc); } if (cfg->base->route_prio) { esp_netif->route_prio = cfg->base->route_prio; @@ -331,10 +331,6 @@ static esp_err_t esp_netif_init_configuration(esp_netif_t *esp_netif, const esp_ // Install network stack functions -- connects netif and L3 stack const esp_netif_netstack_config_t *esp_netif_stack_config = cfg->stack; - if (cfg->stack->base.type != ESP_NETIF_NETWORK_STACK_IS_LWIP) { - ESP_LOGE(TAG, "Failed to configure uknown network stack %d", cfg->stack->base.type); - return ESP_ERR_NOT_SUPPORTED; - } if (esp_netif_stack_config->init_fn) { esp_netif->lwip_init_fn = esp_netif_stack_config->init_fn; } @@ -448,6 +444,7 @@ void esp_netif_destroy(esp_netif_t *esp_netif) free(esp_netif->ip_info); free(esp_netif->ip_info_old); free(esp_netif->if_key); + free(esp_netif->if_desc); esp_netif_lwip_remove(esp_netif); free(esp_netif->lwip_netif); free(esp_netif->hostname); @@ -1348,9 +1345,9 @@ const char *esp_netif_get_ifkey(esp_netif_t *esp_netif) return esp_netif->if_key; } -esp_netif_type_t esp_netif_get_type(esp_netif_t *esp_netif) +const char *esp_netif_get_desc(esp_netif_t *esp_netif) { - return esp_netif->if_type; + return esp_netif->if_desc; } esp_netif_t *esp_netif_get_handle_from_ifkey(const char *if_key) diff --git a/components/esp_netif/lwip/esp_netif_lwip_defaults.c b/components/esp_netif/lwip/esp_netif_lwip_defaults.c index 6fce8067ac..6fc61088ac 100644 --- a/components/esp_netif/lwip/esp_netif_lwip_defaults.c +++ b/components/esp_netif/lwip/esp_netif_lwip_defaults.c @@ -24,17 +24,14 @@ // static const struct esp_netif_netstack_config s_eth_netif_config = { - .base = { .type = ESP_NETIF_NETWORK_STACK_IS_LWIP }, .init_fn = ethernetif_init, .input_fn = ethernetif_input }; static const struct esp_netif_netstack_config s_wifi_netif_config_ap = { - .base = { .type = ESP_NETIF_NETWORK_STACK_IS_LWIP }, .init_fn = wlanif_init_ap, .input_fn = wlanif_input }; static const struct esp_netif_netstack_config s_wifi_netif_config_sta = { - .base = { .type = ESP_NETIF_NETWORK_STACK_IS_LWIP }, .init_fn = wlanif_init_sta, .input_fn = wlanif_input }; diff --git a/components/esp_netif/lwip/esp_netif_lwip_internal.h b/components/esp_netif/lwip/esp_netif_lwip_internal.h index 46f2f123f7..56ac90d68b 100644 --- a/components/esp_netif/lwip/esp_netif_lwip_internal.h +++ b/components/esp_netif/lwip/esp_netif_lwip_internal.h @@ -19,7 +19,6 @@ // LWIP netif specific network stack configuration struct esp_netif_netstack_config { - esp_netif_netstack_base_config_t base; err_t (*init_fn)(struct netif*); void (*input_fn)(struct netif *netif, void *buffer, size_t len, void *eb); }; diff --git a/components/esp_netif/test/test_esp_netif.c b/components/esp_netif/test/test_esp_netif.c index b2b4ddbcda..329259c0b1 100644 --- a/components/esp_netif/test/test_esp_netif.c +++ b/components/esp_netif/test/test_esp_netif.c @@ -4,9 +4,7 @@ TEST_CASE("esp_netif: init and destroy", "[esp_netif][leaks=0]") { - esp_netif_inherent_config_t base = {}; - const esp_netif_netstack_base_config_t stack = { .type = ESP_NETIF_NETWORK_STACK_IS_LWIP }; - esp_netif_config_t cfg = { .base = &base, .stack = (const esp_netif_netstack_config_t*)&stack }; + esp_netif_config_t cfg = ESP_NETIF_DEFAULT_WIFI_STA(); esp_netif_t *esp_netif = esp_netif_new(NULL); TEST_ASSERT_EQUAL(NULL, esp_netif); diff --git a/components/lwip/port/esp32/netif/wlanif.c b/components/lwip/port/esp32/netif/wlanif.c index e4df53a0a1..4b5c839d1c 100644 --- a/components/lwip/port/esp32/netif/wlanif.c +++ b/components/lwip/port/esp32/netif/wlanif.c @@ -120,10 +120,6 @@ low_level_output(struct netif *netif, struct pbuf *p) if (esp_netif == NULL) { return ERR_IF; } - esp_netif_type_t type = esp_netif_get_type(esp_netif); - if (type != ESP_NETIF_TYPE_STA && type != ESP_NETIF_TYPE_AP) { - return ERR_IF; - } struct pbuf *q = p; err_t ret; diff --git a/components/tcpip_adapter/include/tcpip_adapter.h b/components/tcpip_adapter/include/tcpip_adapter.h index 90d0d6ae0f..c50493abe4 100644 --- a/components/tcpip_adapter/include/tcpip_adapter.h +++ b/components/tcpip_adapter/include/tcpip_adapter.h @@ -11,20 +11,23 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +#ifndef _ESP_NETIF_SUPPRESS_LEGACY_WARNING_ +#warning "This header is deprecated, please use new network related API in esp_netif.h" +#include "esp_netif.h" +#endif #ifndef _TCPIP_ADAPTER_H_ #define _TCPIP_ADAPTER_H_ -#warning "This header is deprecated, please use new network related API in esp_netif.h" - #include "esp_netif.h" + #include "tcpip_adapter_types.h" /** * @brief tcpip adapter legacy init. It is used only to set the compatibility mode of esp-netif, which * will enable backward compatibility of esp-netif. */ -void tcpip_adapter_init(void); +void tcpip_adapter_init(void) __attribute__ ((deprecated)); /** * @brief Compatiblity mode: convert the esp-netif handle to tcpip_adapter legacy interface enum diff --git a/examples/protocols/https_server/sdkconfig.defaults b/examples/protocols/https_server/sdkconfig.defaults index a9595bf0c1..abb6640942 100644 --- a/examples/protocols/https_server/sdkconfig.defaults +++ b/examples/protocols/https_server/sdkconfig.defaults @@ -1 +1,2 @@ CONFIG_ESP_HTTPS_SERVER_ENABLE=y +CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n diff --git a/examples/protocols/mqtt/publish_test/sdkconfig.ci b/examples/protocols/mqtt/publish_test/sdkconfig.ci index 34319fcf33..3ae004960c 100644 --- a/examples/protocols/mqtt/publish_test/sdkconfig.ci +++ b/examples/protocols/mqtt/publish_test/sdkconfig.ci @@ -5,4 +5,5 @@ CONFIG_EXAMPLE_BROKER_WSS_URI="wss://${EXAMPLE_MQTT_BROKER_WSS}/ws" CONFIG_EXAMPLE_BROKER_CERTIFICATE_OVERRIDE="${EXAMPLE_MQTT_BROKER_CERTIFICATE}" CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=16384 -CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=16384 \ No newline at end of file +CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=16384 +CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n diff --git a/examples/protocols/mqtt/ssl/sdkconfig.ci b/examples/protocols/mqtt/ssl/sdkconfig.ci index b3557c28d7..716fb5bb08 100644 --- a/examples/protocols/mqtt/ssl/sdkconfig.ci +++ b/examples/protocols/mqtt/ssl/sdkconfig.ci @@ -10,3 +10,4 @@ CONFIG_MQTT_TASK_STACK_SIZE=6144 CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=16384 CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096 +CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n diff --git a/examples/protocols/mqtt/tcp/sdkconfig.ci b/examples/protocols/mqtt/tcp/sdkconfig.ci index 09ca8f37cc..43a5f637ec 100644 --- a/examples/protocols/mqtt/tcp/sdkconfig.ci +++ b/examples/protocols/mqtt/tcp/sdkconfig.ci @@ -1,2 +1,3 @@ CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y CONFIG_BROKER_URL="FROM_STDIN" +CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n diff --git a/examples/protocols/mqtt/ws/sdkconfig.ci b/examples/protocols/mqtt/ws/sdkconfig.ci index 4f14eef990..caa4f0ca3c 100644 --- a/examples/protocols/mqtt/ws/sdkconfig.ci +++ b/examples/protocols/mqtt/ws/sdkconfig.ci @@ -1 +1,2 @@ CONFIG_BROKER_URI="ws://${EXAMPLE_MQTT_BROKER_WS}/ws" +CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n diff --git a/examples/protocols/mqtt/wss/sdkconfig.ci b/examples/protocols/mqtt/wss/sdkconfig.ci index d0dd4929e9..d088025f6a 100644 --- a/examples/protocols/mqtt/wss/sdkconfig.ci +++ b/examples/protocols/mqtt/wss/sdkconfig.ci @@ -1,3 +1,3 @@ CONFIG_BROKER_URI="wss://${EXAMPLE_MQTT_BROKER_WSS}/ws" CONFIG_BROKER_CERTIFICATE_OVERRIDE="${EXAMPLE_MQTT_BROKER_CERTIFICATE}" - +CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=n diff --git a/examples/system/network_tests/main/lwip_test_netif.c b/examples/system/network_tests/main/lwip_test_netif.c index 0efbbbf2e0..859e518bb6 100644 --- a/examples/system/network_tests/main/lwip_test_netif.c +++ b/examples/system/network_tests/main/lwip_test_netif.c @@ -26,7 +26,6 @@ static struct netif *g_last_netif = NULL; // LWIP netif specific defines struct esp_netif_netstack_config { - esp_netif_netstack_base_config_t base; err_t (*init_fn)(struct netif*); void (*input_fn)(struct netif *netif, void *buffer, size_t len, void *eb); }; @@ -35,8 +34,7 @@ err_t testnetif_init(struct netif *netif); void testnetif_input(struct netif *netif, void *buffer, size_t len, void *eb); -const struct esp_netif_netstack_config _g_test_netif_stack_config = { { ESP_NETIF_NETWORK_STACK_IS_LWIP }, testnetif_init, testnetif_input}; - +const struct esp_netif_netstack_config _g_test_netif_stack_config = { testnetif_init, testnetif_input}; err_t testnetif_output(struct netif *netif, struct pbuf *p) {