@@ -157,7 +157,7 @@ static void netif_deinit(esp_netif_t *netif)
157157 }
158158}
159159
160- static esp_netif_t * netif_init (eppp_type_t role )
160+ static esp_netif_t * netif_init (eppp_type_t role , eppp_config_t * eppp_config )
161161{
162162 if (s_eppp_netif_count > 9 ) { // Limit to max 10 netifs, since we use "EPPPx" as the unique key (where x is 0-9)
163163 ESP_LOGE (TAG , "Cannot create more than 10 instances" );
@@ -217,10 +217,13 @@ static esp_netif_t *netif_init(eppp_type_t role)
217217 char if_key [] = "EPPP0" ; // netif key needs to be unique
218218 if_key [sizeof (if_key ) - 2 /* 2 = two chars before the terminator */ ] += s_eppp_netif_count ++ ;
219219 base_netif_cfg .if_key = if_key ;
220- if (role == EPPP_CLIENT ) {
221- base_netif_cfg .if_desc = "pppos_client" ;
220+ if (eppp_config -> ppp . netif_description ) {
221+ base_netif_cfg .if_desc = eppp_config -> ppp . netif_description ;
222222 } else {
223- base_netif_cfg .if_desc = "pppos_server" ;
223+ base_netif_cfg .if_desc = role == EPPP_CLIENT ? "pppos_client" : "pppos_server" ;
224+ }
225+ if (eppp_config -> ppp .netif_prio ) {
226+ base_netif_cfg .route_prio = eppp_config -> ppp .netif_prio ;
224227 }
225228 esp_netif_config_t netif_ppp_config = { .base = & base_netif_cfg ,
226229 .driver = ppp_driver_cfg ,
@@ -703,7 +706,12 @@ void eppp_deinit(esp_netif_t *netif)
703706
704707esp_netif_t * eppp_init (eppp_type_t role , eppp_config_t * config )
705708{
706- esp_netif_t * netif = netif_init (role );
709+ if (config == NULL || (role != EPPP_SERVER && role != EPPP_CLIENT )) {
710+ ESP_LOGE (TAG , "Invalid configuration or role" );
711+ return NULL ;
712+ }
713+
714+ esp_netif_t * netif = netif_init (role , config );
707715 if (!netif ) {
708716 ESP_LOGE (TAG , "Failed to initialize PPP netif" );
709717 remove_handlers ();
@@ -730,6 +738,10 @@ esp_netif_t *eppp_init(eppp_type_t role, eppp_config_t *config)
730738
731739esp_netif_t * eppp_open (eppp_type_t role , eppp_config_t * config , int connect_timeout_ms )
732740{
741+ if (config == NULL || (role != EPPP_SERVER && role != EPPP_CLIENT )) {
742+ ESP_LOGE (TAG , "Invalid configuration or role" );
743+ return NULL ;
744+ }
733745#if CONFIG_EPPP_LINK_DEVICE_UART
734746 if (config -> transport != EPPP_TRANSPORT_UART ) {
735747 ESP_LOGE (TAG , "Invalid transport: UART device must be enabled in Kconfig" );
0 commit comments