Open eroom1966 opened 3 weeks ago
Hmm, I think I see my problem. When I see that the remote end has gone away, I call esp_wireguard_disconnect(), this results in setting ctx->netif to NULL a subsequent call to esp_wireguardif_peer_is_up, then causes the crash.
Ultimately what I want to do is install a new certificate when it is no longer valid, I cannot figure out the sequence of calls. Effectively I have this
setup wg_config call esp_wireguard_init() call esp_wireguard_connect(&ctx); check esp_wireguardif_peer_is_up(&ctx)
// all is now running as expected
at some point later, the certificate becomes invalid, and I need to install a new certificate and force a re-connect.
What calls should I make ?
I have a strange scenario. I am connected to a server/endpoint and all is working as expected. The server/endpoint then goes down, and I stop receiving traffic.
I then call esp_wireguardif_peer_is_up() to see if it is still available, but this causes a crash The crash is due to the following assert failing
esp_wireguardif_peer_is_up() -> wireguardif_peer_is_up() wireguardif_peer_is_up() -> wireguardif_lookup_peer()
This assert fails due to netif being NULL
I put a simple fix into this function, to check that ctx->netif is non NULL
I don't understand enough about this code, but this solves my problem, what I do not understand is why is ctx->netif==NULL ? All I do to get to this state, is to take down the remote wireguard after connection has been established
Thx Lee