mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-02 20:24:32 +02:00
Merge branch 'bugfix/slip_ipv6_fix' into 'master'
esp-netif: Fix SLIP interface to start with correct IPv6 addr Closes IDFGH-2952 See merge request espressif/esp-idf!10116
This commit is contained in:
@@ -649,6 +649,9 @@ static esp_err_t esp_netif_start_api(esp_netif_api_msg_t *msg)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
struct netif *p_netif = esp_netif->lwip_netif;
|
struct netif *p_netif = esp_netif->lwip_netif;
|
||||||
|
if (_IS_NETIF_POINT2POINT_TYPE(esp_netif, SLIP_LWIP_NETIF)) {
|
||||||
|
esp_netif_start_slip(esp_netif);
|
||||||
|
}
|
||||||
if (esp_netif->flags&ESP_NETIF_FLAG_AUTOUP) {
|
if (esp_netif->flags&ESP_NETIF_FLAG_AUTOUP) {
|
||||||
ESP_LOGD(TAG, "%s Setting the lwip netif%p UP", __func__, p_netif);
|
ESP_LOGD(TAG, "%s Setting the lwip netif%p UP", __func__, p_netif);
|
||||||
netif_set_up(p_netif);
|
netif_set_up(p_netif);
|
||||||
|
@@ -73,7 +73,7 @@ netif_related_data_t * esp_netif_new_slip(esp_netif_t *esp_netif, const esp_neti
|
|||||||
*/
|
*/
|
||||||
esp_err_t esp_netif_stop_slip(esp_netif_t *esp_netif)
|
esp_err_t esp_netif_stop_slip(esp_netif_t *esp_netif)
|
||||||
{
|
{
|
||||||
lwip_slip_ctx_t *slip_ctx = (lwip_slip_ctx_t *)esp_netif;
|
lwip_slip_ctx_t *slip_ctx = (lwip_slip_ctx_t *)esp_netif->related_data;
|
||||||
assert(slip_ctx->base.netif_type == SLIP_LWIP_NETIF);
|
assert(slip_ctx->base.netif_type == SLIP_LWIP_NETIF);
|
||||||
|
|
||||||
ESP_LOGI(TAG, "%s: Stopped SLIP connection: %p", __func__, slip_ctx);
|
ESP_LOGI(TAG, "%s: Stopped SLIP connection: %p", __func__, slip_ctx);
|
||||||
@@ -84,6 +84,26 @@ esp_err_t esp_netif_stop_slip(esp_netif_t *esp_netif)
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Starts the SLIP interface
|
||||||
|
*/
|
||||||
|
esp_err_t esp_netif_start_slip(esp_netif_t *esp_netif)
|
||||||
|
{
|
||||||
|
lwip_slip_ctx_t *slip_ctx = (lwip_slip_ctx_t *)esp_netif->related_data;
|
||||||
|
assert(slip_ctx->base.netif_type == SLIP_LWIP_NETIF);
|
||||||
|
|
||||||
|
ESP_LOGI(TAG, "%s: Starting SLIP interface: %p", __func__, slip_ctx);
|
||||||
|
|
||||||
|
// Set the netif up
|
||||||
|
netif_set_up(esp_netif->lwip_netif);
|
||||||
|
netif_set_link_up(esp_netif->lwip_netif);
|
||||||
|
int8_t addr_index = 0;
|
||||||
|
|
||||||
|
netif_ip6_addr_set(esp_netif->lwip_netif, addr_index, (ip6_addr_t *)&slip_ctx->addr);
|
||||||
|
netif_ip6_addr_set_state(esp_netif->lwip_netif, addr_index, IP6_ADDR_VALID);
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets paramaters for the supplied netif
|
* @brief Sets paramaters for the supplied netif
|
||||||
@@ -230,10 +250,7 @@ err_t esp_slipif_init(struct netif *netif)
|
|||||||
// Store netif index in net interface for SIO open command to abstract the dev
|
// Store netif index in net interface for SIO open command to abstract the dev
|
||||||
netif->state = (void *)esp_index;
|
netif->state = (void *)esp_index;
|
||||||
|
|
||||||
err_t err = slipif_init(netif);
|
return slipif_init(netif);
|
||||||
netif_set_up(netif);
|
|
||||||
netif_set_link_up(netif);
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct esp_netif_netstack_config s_netif_config_slip = {
|
static const struct esp_netif_netstack_config s_netif_config_slip = {
|
||||||
|
@@ -44,5 +44,15 @@ void esp_netif_destroy_slip(netif_related_data_t *slip);
|
|||||||
*/
|
*/
|
||||||
esp_err_t esp_netif_stop_slip(esp_netif_t *esp_netif);
|
esp_err_t esp_netif_stop_slip(esp_netif_t *esp_netif);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Start the esp slip netif
|
||||||
|
*
|
||||||
|
* @param[in] esp_netif handle to slip esp-netif instance
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - ESP_OK on success
|
||||||
|
*/
|
||||||
|
esp_err_t esp_netif_start_slip(esp_netif_t *esp_netif);
|
||||||
|
|
||||||
|
|
||||||
#endif // _ESP_NETIF_LWIP_SLIP_H_
|
#endif // _ESP_NETIF_LWIP_SLIP_H_
|
||||||
|
@@ -198,7 +198,7 @@ esp_netif_t *slip_if_init(void)
|
|||||||
esp_netif_slip_config_t slip_config;
|
esp_netif_slip_config_t slip_config;
|
||||||
|
|
||||||
IP6_ADDR(&slip_config.ip6_addr,
|
IP6_ADDR(&slip_config.ip6_addr,
|
||||||
lwip_htonl(0xfd000000),
|
lwip_htonl(0xfd0000),
|
||||||
lwip_htonl(0x00000000),
|
lwip_htonl(0x00000000),
|
||||||
lwip_htonl(0x00000000),
|
lwip_htonl(0x00000000),
|
||||||
lwip_htonl(0x00000001)
|
lwip_htonl(0x00000001)
|
||||||
|
Reference in New Issue
Block a user