From 7829e8f97622455186386ea786a7def196e18af6 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Mon, 27 May 2024 16:43:32 +0200 Subject: [PATCH 1/3] fix(eppp): Make some common netif options configurable --- components/eppp_link/eppp_link.c | 22 +++++++++++++++++----- components/eppp_link/include/eppp_link.h | 4 ++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/components/eppp_link/eppp_link.c b/components/eppp_link/eppp_link.c index a2a8e6a1b3..2a763412e6 100644 --- a/components/eppp_link/eppp_link.c +++ b/components/eppp_link/eppp_link.c @@ -157,7 +157,7 @@ static void netif_deinit(esp_netif_t *netif) } } -static esp_netif_t *netif_init(eppp_type_t role) +static esp_netif_t *netif_init(eppp_type_t role, eppp_config_t *eppp_config) { if (s_eppp_netif_count > 9) { // Limit to max 10 netifs, since we use "EPPPx" as the unique key (where x is 0-9) ESP_LOGE(TAG, "Cannot create more than 10 instances"); @@ -217,10 +217,13 @@ static esp_netif_t *netif_init(eppp_type_t role) char if_key[] = "EPPP0"; // netif key needs to be unique if_key[sizeof(if_key) - 2 /* 2 = two chars before the terminator */ ] += s_eppp_netif_count++; base_netif_cfg.if_key = if_key; - if (role == EPPP_CLIENT) { - base_netif_cfg.if_desc = "pppos_client"; + if (eppp_config->ppp.netif_description) { + base_netif_cfg.if_desc = eppp_config->ppp.netif_description; } else { - base_netif_cfg.if_desc = "pppos_server"; + base_netif_cfg.if_desc = role == EPPP_CLIENT ? "pppos_client" : "pppos_server"; + } + if (eppp_config->ppp.netif_prio) { + base_netif_cfg.route_prio = eppp_config->ppp.netif_prio; } esp_netif_config_t netif_ppp_config = { .base = &base_netif_cfg, .driver = ppp_driver_cfg, @@ -703,7 +706,12 @@ void eppp_deinit(esp_netif_t *netif) esp_netif_t *eppp_init(eppp_type_t role, eppp_config_t *config) { - esp_netif_t *netif = netif_init(role); + if (config == NULL || (role != EPPP_SERVER && role != EPPP_CLIENT)) { + ESP_LOGE(TAG, "Invalid configuration or role"); + return NULL; + } + + esp_netif_t *netif = netif_init(role, config); if (!netif) { ESP_LOGE(TAG, "Failed to initialize PPP netif"); remove_handlers(); @@ -730,6 +738,10 @@ esp_netif_t *eppp_init(eppp_type_t role, eppp_config_t *config) esp_netif_t *eppp_open(eppp_type_t role, eppp_config_t *config, int connect_timeout_ms) { + if (config == NULL || (role != EPPP_SERVER && role != EPPP_CLIENT)) { + ESP_LOGE(TAG, "Invalid configuration or role"); + return NULL; + } #if CONFIG_EPPP_LINK_DEVICE_UART if (config->transport != EPPP_TRANSPORT_UART) { ESP_LOGE(TAG, "Invalid transport: UART device must be enabled in Kconfig"); diff --git a/components/eppp_link/include/eppp_link.h b/components/eppp_link/include/eppp_link.h index e97051312d..289585270a 100644 --- a/components/eppp_link/include/eppp_link.h +++ b/components/eppp_link/include/eppp_link.h @@ -37,6 +37,8 @@ . ppp = { \ .our_ip4_addr = { .addr = our_ip }, \ .their_ip4_addr = { .addr = their_ip }, \ + .netif_prio = 0, \ + .netif_description = NULL, \ } \ } @@ -88,6 +90,8 @@ typedef struct eppp_config_t { struct eppp_config_pppos_s { esp_ip4_addr_t our_ip4_addr; esp_ip4_addr_t their_ip4_addr; + int netif_prio; + const char *netif_description; } ppp; } eppp_config_t; From 90fdcfc340536bcba06aab407f893933c38ce786 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Mon, 27 May 2024 17:04:05 +0200 Subject: [PATCH 2/3] fix(eppp): Add build test for IDF v5.3, fix idf-build-apps deps --- .github/workflows/eppp__build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/eppp__build.yml b/.github/workflows/eppp__build.yml index eb10692346..2e863d00fd 100644 --- a/.github/workflows/eppp__build.yml +++ b/.github/workflows/eppp__build.yml @@ -13,7 +13,7 @@ jobs: name: Build strategy: matrix: - idf_ver: ["latest"] + idf_ver: ["latest", "release-v5.3"] test: [ { app: host, path: "examples/host" }, { app: slave, path: "examples/slave" }, { app: test_app, path: "test/test_app" }] runs-on: ubuntu-20.04 container: espressif/idf:${{ matrix.idf_ver }} @@ -23,6 +23,6 @@ jobs: - name: Build ${{ matrix.test.app }} with IDF-${{ matrix.idf_ver }} shell: bash run: | - ${IDF_PATH}/install.sh --enable-pytest . ${IDF_PATH}/export.sh + pip install idf-component-manager idf-build-apps --upgrade python ./ci/build_apps.py ./components/eppp_link/${{matrix.test.path}} -vv --preserve-all From d96f45a1f9c0af787d33bfc6742f09b136c00d6b Mon Sep 17 00:00:00 2001 From: David Cermak Date: Tue, 28 May 2024 16:11:19 +0200 Subject: [PATCH 3/3] bump(eppp): 0.1.0 -> 0.1.1 0.1.1 Bug Fixes - Make some common netif options configurable (7829e8f) --- components/eppp_link/.cz.yaml | 2 +- components/eppp_link/CHANGELOG.md | 6 ++++++ components/eppp_link/idf_component.yml | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/components/eppp_link/.cz.yaml b/components/eppp_link/.cz.yaml index d0cc2ecd80..7414302c3c 100644 --- a/components/eppp_link/.cz.yaml +++ b/components/eppp_link/.cz.yaml @@ -3,6 +3,6 @@ commitizen: bump_message: 'bump(eppp): $current_version -> $new_version' pre_bump_hooks: python ../../ci/changelog.py eppp_link tag_format: eppp-v$version - version: 0.1.0 + version: 0.1.1 version_files: - idf_component.yml diff --git a/components/eppp_link/CHANGELOG.md b/components/eppp_link/CHANGELOG.md index 204228dd54..64220cb093 100644 --- a/components/eppp_link/CHANGELOG.md +++ b/components/eppp_link/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [0.1.1](https://github.com/espressif/esp-protocols/commits/eppp-v0.1.1) + +### Bug Fixes + +- Make some common netif options configurable ([7829e8f](https://github.com/espressif/esp-protocols/commit/7829e8f)) + ## [0.1.0](https://github.com/espressif/esp-protocols/commits/eppp-v0.1.0) ### Features diff --git a/components/eppp_link/idf_component.yml b/components/eppp_link/idf_component.yml index fea8307a23..d6ac84bf2c 100644 --- a/components/eppp_link/idf_component.yml +++ b/components/eppp_link/idf_component.yml @@ -1,4 +1,4 @@ -version: 0.1.0 +version: 0.1.1 url: https://github.com/espressif/esp-protocols/tree/master/components/eppp_link description: The component provides a general purpose PPP connectivity, typically used as WiFi-PPP router dependencies: