mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-31 19:24:43 +02:00
Merge pull request #578 from david-cermak/fix/eppp_netif_config
[eppp]: Make some common esp_netif options configurable
This commit is contained in:
4
.github/workflows/eppp__build.yml
vendored
4
.github/workflows/eppp__build.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
|||||||
name: Build
|
name: Build
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
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" }]
|
test: [ { app: host, path: "examples/host" }, { app: slave, path: "examples/slave" }, { app: test_app, path: "test/test_app" }]
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
container: espressif/idf:${{ matrix.idf_ver }}
|
container: espressif/idf:${{ matrix.idf_ver }}
|
||||||
@@ -23,6 +23,6 @@ jobs:
|
|||||||
- name: Build ${{ matrix.test.app }} with IDF-${{ matrix.idf_ver }}
|
- name: Build ${{ matrix.test.app }} with IDF-${{ matrix.idf_ver }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
${IDF_PATH}/install.sh --enable-pytest
|
|
||||||
. ${IDF_PATH}/export.sh
|
. ${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
|
python ./ci/build_apps.py ./components/eppp_link/${{matrix.test.path}} -vv --preserve-all
|
||||||
|
@@ -3,6 +3,6 @@ commitizen:
|
|||||||
bump_message: 'bump(eppp): $current_version -> $new_version'
|
bump_message: 'bump(eppp): $current_version -> $new_version'
|
||||||
pre_bump_hooks: python ../../ci/changelog.py eppp_link
|
pre_bump_hooks: python ../../ci/changelog.py eppp_link
|
||||||
tag_format: eppp-v$version
|
tag_format: eppp-v$version
|
||||||
version: 0.1.0
|
version: 0.1.1
|
||||||
version_files:
|
version_files:
|
||||||
- idf_component.yml
|
- idf_component.yml
|
||||||
|
@@ -1,5 +1,11 @@
|
|||||||
# Changelog
|
# 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)
|
## [0.1.0](https://github.com/espressif/esp-protocols/commits/eppp-v0.1.0)
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
@@ -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)
|
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");
|
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
|
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++;
|
if_key[sizeof(if_key) - 2 /* 2 = two chars before the terminator */ ] += s_eppp_netif_count++;
|
||||||
base_netif_cfg.if_key = if_key;
|
base_netif_cfg.if_key = if_key;
|
||||||
if (role == EPPP_CLIENT) {
|
if (eppp_config->ppp.netif_description) {
|
||||||
base_netif_cfg.if_desc = "pppos_client";
|
base_netif_cfg.if_desc = eppp_config->ppp.netif_description;
|
||||||
} else {
|
} 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,
|
esp_netif_config_t netif_ppp_config = { .base = &base_netif_cfg,
|
||||||
.driver = ppp_driver_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 *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) {
|
if (!netif) {
|
||||||
ESP_LOGE(TAG, "Failed to initialize PPP netif");
|
ESP_LOGE(TAG, "Failed to initialize PPP netif");
|
||||||
remove_handlers();
|
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)
|
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_EPPP_LINK_DEVICE_UART
|
||||||
if (config->transport != EPPP_TRANSPORT_UART) {
|
if (config->transport != EPPP_TRANSPORT_UART) {
|
||||||
ESP_LOGE(TAG, "Invalid transport: UART device must be enabled in Kconfig");
|
ESP_LOGE(TAG, "Invalid transport: UART device must be enabled in Kconfig");
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
version: 0.1.0
|
version: 0.1.1
|
||||||
url: https://github.com/espressif/esp-protocols/tree/master/components/eppp_link
|
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
|
description: The component provides a general purpose PPP connectivity, typically used as WiFi-PPP router
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@@ -37,6 +37,8 @@
|
|||||||
. ppp = { \
|
. ppp = { \
|
||||||
.our_ip4_addr = { .addr = our_ip }, \
|
.our_ip4_addr = { .addr = our_ip }, \
|
||||||
.their_ip4_addr = { .addr = their_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 {
|
struct eppp_config_pppos_s {
|
||||||
esp_ip4_addr_t our_ip4_addr;
|
esp_ip4_addr_t our_ip4_addr;
|
||||||
esp_ip4_addr_t their_ip4_addr;
|
esp_ip4_addr_t their_ip4_addr;
|
||||||
|
int netif_prio;
|
||||||
|
const char *netif_description;
|
||||||
} ppp;
|
} ppp;
|
||||||
|
|
||||||
} eppp_config_t;
|
} eppp_config_t;
|
||||||
|
Reference in New Issue
Block a user