Skip to content

Commit 653328b

Browse files
committed
fix(eppp): Support for IPv4-only mode
Closes #864
1 parent f8748e0 commit 653328b

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

components/eppp_link/eppp_netif_tun.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,13 @@ static err_t tun_output_v4(struct netif *netif, struct pbuf *p, const ip4_addr_t
6565
LWIP_UNUSED_ARG(ipaddr);
6666
return tun_output(netif, p);
6767
}
68+
#if LWIP_IPV6
6869
static err_t tun_output_v6(struct netif *netif, struct pbuf *p, const ip6_addr_t *ipaddr)
6970
{
7071
LWIP_UNUSED_ARG(ipaddr);
7172
return tun_output(netif, p);
7273
}
73-
74+
#endif
7475
static err_t tun_init(struct netif *netif)
7576
{
7677
if (netif == NULL) {
@@ -151,9 +152,12 @@ static void cmd_ping_on_ping_end(esp_ping_handle_t hdl, void *args)
151152
}
152153
if (IP_IS_V4(&target_addr)) {
153154
ESP_LOGD(TAG, "\n--- %s ping statistics ---\n", inet_ntoa(*ip_2_ip4(&target_addr)));
154-
} else {
155+
}
156+
#if LWIP_IPV6
157+
else {
155158
ESP_LOGD(TAG, "\n--- %s ping statistics ---\n", inet6_ntoa(*ip_2_ip6(&target_addr)));
156159
}
160+
#endif
157161
ESP_LOGI(TAG, "%" PRIu32 " packets transmitted, %" PRIu32 " received, %" PRIu32 "%% packet loss, time %" PRIu32 "ms\n",
158162
transmitted, received, loss, total_time_ms);
159163
esp_ping_delete_session(hdl);
@@ -168,7 +172,11 @@ esp_err_t eppp_check_connection(esp_netif_t *netif)
168172
ip_addr_t target_addr = {0};
169173
esp_netif_ip_info_t ip;
170174
esp_netif_get_ip_info(netif, &ip);
175+
#if LWIP_IPV6
171176
target_addr.u_addr.ip4.addr = ip.gw.addr;
177+
#else
178+
target_addr.addr = ip.gw.addr;
179+
#endif
172180
config.target_addr = target_addr;
173181
esp_ping_callbacks_t cbs = {
174182
.cb_args = netif,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_LWIP_IPV6=n

0 commit comments

Comments
 (0)