The latest ESP-IDF versions have added really good support for NAT and PPPoS modem interface. However, the ESP32 seems to crash when trying to run NAT code in some cases – especially in calls to esp_netif_internal_dhcpc_cb().
I encountered this error when trying to set up an ESP32 4G hotspot.
Why ESP32 crashes on esp_netif_internal_dhcpc_cb()
I tried to get an idea but was unable to pin down the exact cause. The only consistency was that the function always caused a crash and the error was consistently a LoadProhibited error. Experimenting with all the likely menuconfig settings did not solve the problem.
As is usual with LoadProhibited errors, it seems like the function esp_netif_internal_dhcpc_cb() was trying to write to a NULL or unallocated pointer. It is more likely that an incorrect pointer or address is being passed to it.
Either way, I gave up trying to fix it after noticing that the error was only occuring when the application used IDF 5.0.0 and not with IDF 4.3.
I found a blog post related to ESP32 NAT router that mentions a fix and says that the callback code has a bug in it. You might want to give that a read before you go on to modify the IDF code.
ESP-IDF version 5.0.1 seems to have solved this issue and I have not seen this crash occur again after upgrading. IDF 5.0.1 bug fix list does not explicitly mention this issue as resolved.
Because many experimental features in IDF 5.0.0 release have had bug fixes, it is possible that this error was a consequence of something else being broken and was fixed.