Skip to content

Commit 39dfe26

Browse files
authored
Merge pull request #578 from david-cermak/fix/eppp_netif_config
[eppp]: Make some common esp_netif options configurable
2 parents fcb6080 + d96f45a commit 39dfe26

File tree

6 files changed

+31
-9
lines changed

6 files changed

+31
-9
lines changed

.github/workflows/eppp__build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
name: Build
1414
strategy:
1515
matrix:
16-
idf_ver: ["latest"]
16+
idf_ver: ["latest", "release-v5.3"]
1717
test: [ { app: host, path: "examples/host" }, { app: slave, path: "examples/slave" }, { app: test_app, path: "test/test_app" }]
1818
runs-on: ubuntu-20.04
1919
container: espressif/idf:${{ matrix.idf_ver }}
@@ -23,6 +23,6 @@ jobs:
2323
- name: Build ${{ matrix.test.app }} with IDF-${{ matrix.idf_ver }}
2424
shell: bash
2525
run: |
26-
${IDF_PATH}/install.sh --enable-pytest
2726
. ${IDF_PATH}/export.sh
27+
pip install idf-component-manager idf-build-apps --upgrade
2828
python ./ci/build_apps.py ./components/eppp_link/${{matrix.test.path}} -vv --preserve-all

components/eppp_link/.cz.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ commitizen:
33
bump_message: 'bump(eppp): $current_version -> $new_version'
44
pre_bump_hooks: python ../../ci/changelog.py eppp_link
55
tag_format: eppp-v$version
6-
version: 0.1.0
6+
version: 0.1.1
77
version_files:
88
- idf_component.yml

components/eppp_link/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [0.1.1](https://github.com/espressif/esp-protocols/commits/eppp-v0.1.1)
4+
5+
### Bug Fixes
6+
7+
- Make some common netif options configurable ([7829e8f](https://github.com/espressif/esp-protocols/commit/7829e8f))
8+
39
## [0.1.0](https://github.com/espressif/esp-protocols/commits/eppp-v0.1.0)
410

511
### Features

components/eppp_link/eppp_link.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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

704707
esp_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

731739
esp_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");

components/eppp_link/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 0.1.0
1+
version: 0.1.1
22
url: https://github.com/espressif/esp-protocols/tree/master/components/eppp_link
33
description: The component provides a general purpose PPP connectivity, typically used as WiFi-PPP router
44
dependencies:

components/eppp_link/include/eppp_link.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
. ppp = { \
3838
.our_ip4_addr = { .addr = our_ip }, \
3939
.their_ip4_addr = { .addr = their_ip }, \
40+
.netif_prio = 0, \
41+
.netif_description = NULL, \
4042
} \
4143
}
4244

@@ -88,6 +90,8 @@ typedef struct eppp_config_t {
8890
struct eppp_config_pppos_s {
8991
esp_ip4_addr_t our_ip4_addr;
9092
esp_ip4_addr_t their_ip4_addr;
93+
int netif_prio;
94+
const char *netif_description;
9195
} ppp;
9296

9397
} eppp_config_t;

0 commit comments

Comments
 (0)