mirror of https://github.com/ARMmbed/mbed-os.git
lwIP changes for PPP service
Created (a new) PPP interface for PPP service. Removed lwip dependencies to PPP (memory allocations etc.). Moved PPP configuration options away from lwIP mbed_lib.json to new PPP service. For backwards compatibility, using the old options is also currently supported.pull/10974/head
parent
c9cb8f8296
commit
3864e12172
|
@ -36,8 +36,6 @@
|
|||
#include "lwip/dns.h"
|
||||
#include "lwip/udp.h"
|
||||
|
||||
#include "ppp_lwip.h"
|
||||
|
||||
#include "LWIPStack.h"
|
||||
|
||||
LWIP::Interface *LWIP::Interface::list;
|
||||
|
@ -352,7 +350,7 @@ char *LWIP::Interface::get_gateway(char *buf, nsapi_size_t buflen)
|
|||
LWIP::Interface::Interface() :
|
||||
hw(NULL), has_addr_state(0),
|
||||
connected(NSAPI_STATUS_DISCONNECTED),
|
||||
dhcp_started(false), dhcp_has_to_be_set(false), blocking(true), ppp(false)
|
||||
dhcp_started(false), dhcp_has_to_be_set(false), blocking(true), ppp_enabled(false)
|
||||
{
|
||||
memset(&netif, 0, sizeof netif);
|
||||
|
||||
|
@ -395,7 +393,7 @@ nsapi_error_t LWIP::add_ethernet_interface(EMAC &emac, bool default_if, OnboardN
|
|||
}
|
||||
interface->emac = &emac;
|
||||
interface->memory_manager = &memory_manager;
|
||||
interface->ppp = false;
|
||||
interface->ppp_enabled = false;
|
||||
|
||||
#if (MBED_MAC_ADDRESS_SUM != MBED_MAC_ADDR_INTERFACE)
|
||||
netif->interface.hwaddr[0] = MBED_MAC_ADDR_0;
|
||||
|
@ -452,7 +450,7 @@ nsapi_error_t LWIP::add_l3ip_interface(L3IP &l3ip, bool default_if, OnboardNetwo
|
|||
}
|
||||
interface->l3ip = &l3ip;
|
||||
interface->memory_manager = &memory_manager;
|
||||
interface->ppp = false;
|
||||
interface->ppp_enabled = false;
|
||||
|
||||
|
||||
|
||||
|
@ -462,7 +460,7 @@ nsapi_error_t LWIP::add_l3ip_interface(L3IP &l3ip, bool default_if, OnboardNetwo
|
|||
#if LWIP_IPV4
|
||||
0, 0, 0,
|
||||
#endif
|
||||
interface, &LWIP::Interface::l3ip_if_init, tcpip_input)) {
|
||||
interface, &LWIP::Interface::l3ip_if_init, ip_input)) {
|
||||
return NSAPI_ERROR_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
|
@ -521,21 +519,27 @@ nsapi_error_t LWIP::remove_l3ip_interface(OnboardNetworkStack::Interface **inter
|
|||
|
||||
#endif //LWIP_L3IP
|
||||
}
|
||||
/* Internal API to preserve existing PPP functionality - revise to better match mbed_ipstak_add_ethernet_interface later */
|
||||
nsapi_error_t LWIP::_add_ppp_interface(void *hw, bool default_if, nsapi_ip_stack_t stack, LWIP::Interface **interface_out)
|
||||
|
||||
|
||||
nsapi_error_t LWIP::add_ppp_interface(PPP &ppp, bool default_if, OnboardNetworkStack::Interface **interface_out)
|
||||
{
|
||||
#if LWIP_PPP_API
|
||||
#if PPP_SUPPORT
|
||||
Interface *interface = new (std::nothrow) Interface();
|
||||
if (!interface) {
|
||||
return NSAPI_ERROR_NO_MEMORY;
|
||||
}
|
||||
interface->hw = hw;
|
||||
interface->ppp = true;
|
||||
interface->ppp = &ppp;
|
||||
interface->memory_manager = &memory_manager;
|
||||
interface->ppp_enabled = true;
|
||||
|
||||
nsapi_error_t ret = ppp_lwip_if_init(hw, &interface->netif, stack);
|
||||
if (ret != NSAPI_ERROR_OK) {
|
||||
free(interface);
|
||||
return ret;
|
||||
// interface->netif.hwaddr_len = 0; should we set?
|
||||
|
||||
if (!netif_add(&interface->netif,
|
||||
#if LWIP_IPV4
|
||||
0, 0, 0,
|
||||
#endif
|
||||
interface, &LWIP::Interface::ppp_if_init, tcpip_input)) {
|
||||
return NSAPI_ERROR_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
if (default_if) {
|
||||
|
@ -548,11 +552,62 @@ nsapi_error_t LWIP::_add_ppp_interface(void *hw, bool default_if, nsapi_ip_stack
|
|||
|
||||
*interface_out = interface;
|
||||
|
||||
//lwip_add_random_seed(seed); to do?
|
||||
|
||||
return NSAPI_ERROR_OK;
|
||||
|
||||
#else
|
||||
return NSAPI_ERROR_UNSUPPORTED;
|
||||
|
||||
#endif //PPP_SUPPORT
|
||||
}
|
||||
|
||||
nsapi_error_t LWIP::remove_ppp_interface(OnboardNetworkStack::Interface **interface_out)
|
||||
{
|
||||
#if PPP_SUPPORT
|
||||
if ((interface_out != NULL) && (*interface_out != NULL)) {
|
||||
|
||||
Interface *lwip = static_cast<Interface *>(*interface_out);
|
||||
Interface *node = lwip->list;
|
||||
|
||||
if (lwip->list != NULL) {
|
||||
if (lwip->list == lwip) {
|
||||
// Power down PPP service
|
||||
lwip->ppp->power_down();
|
||||
if (netif_is_link_up(&lwip->netif)) {
|
||||
// Wait PPP service to report link down
|
||||
osSemaphoreAcquire(lwip->unlinked, osWaitForever);
|
||||
}
|
||||
netif_remove(&node->netif);
|
||||
lwip->list = lwip->list->next;
|
||||
delete node;
|
||||
} else {
|
||||
while (node->next != NULL && node->next != lwip) {
|
||||
node = node->next;
|
||||
}
|
||||
if (node->next != NULL && node->next == lwip) {
|
||||
Interface *remove = node->next;
|
||||
// Power down PPP service
|
||||
remove->ppp->power_down();
|
||||
if (netif_is_link_up(&lwip->netif)) {
|
||||
// Wait PPP service to report link down
|
||||
osSemaphoreAcquire(lwip->unlinked, osWaitForever);
|
||||
}
|
||||
netif_remove(&remove->netif);
|
||||
node->next = node->next->next;
|
||||
delete remove;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NSAPI_ERROR_OK;
|
||||
#else
|
||||
return NSAPI_ERROR_UNSUPPORTED;
|
||||
#endif //LWIP_PPP_API
|
||||
|
||||
#endif //PPP_SUPPORT
|
||||
}
|
||||
|
||||
void LWIP::set_default_interface(OnboardNetworkStack::Interface *interface)
|
||||
{
|
||||
if (interface) {
|
||||
|
@ -609,7 +664,7 @@ nsapi_error_t LWIP::Interface::bringup(bool dhcp, const char *ip, const char *ne
|
|||
|
||||
#if LWIP_IPV4
|
||||
if (stack != IPV6_STACK) {
|
||||
if (!dhcp && !ppp) {
|
||||
if (!dhcp && !ppp_enabled) {
|
||||
ip4_addr_t ip_addr;
|
||||
ip4_addr_t netmask_addr;
|
||||
ip4_addr_t gw_addr;
|
||||
|
@ -629,23 +684,10 @@ nsapi_error_t LWIP::Interface::bringup(bool dhcp, const char *ip, const char *ne
|
|||
client_callback(NSAPI_EVENT_CONNECTION_STATUS_CHANGE, NSAPI_STATUS_CONNECTING);
|
||||
}
|
||||
|
||||
if (ppp) {
|
||||
err_t err = ppp_lwip_connect(hw);
|
||||
if (err) {
|
||||
connected = NSAPI_STATUS_DISCONNECTED;
|
||||
if (client_callback) {
|
||||
client_callback(NSAPI_EVENT_CONNECTION_STATUS_CHANGE, NSAPI_STATUS_DISCONNECTED);
|
||||
}
|
||||
return err_remap(err);
|
||||
}
|
||||
}
|
||||
|
||||
if (!netif_is_link_up(&netif)) {
|
||||
if (blocking) {
|
||||
if (osSemaphoreAcquire(linked, LINK_TIMEOUT * 1000) != osOK) {
|
||||
if (ppp) {
|
||||
(void) ppp_lwip_disconnect(hw);
|
||||
}
|
||||
return NSAPI_ERROR_NO_CONNECTION;
|
||||
}
|
||||
}
|
||||
|
@ -665,9 +707,6 @@ nsapi_error_t LWIP::Interface::bringup(bool dhcp, const char *ip, const char *ne
|
|||
// If doesn't have address
|
||||
if (!LWIP::get_ip_addr(true, &netif)) {
|
||||
if (osSemaphoreAcquire(has_any_addr, DHCP_TIMEOUT * 1000) != osOK) {
|
||||
if (ppp) {
|
||||
(void) ppp_lwip_disconnect(hw);
|
||||
}
|
||||
return NSAPI_ERROR_DHCP_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -713,21 +752,7 @@ nsapi_error_t LWIP::Interface::bringdown()
|
|||
}
|
||||
#endif
|
||||
|
||||
if (ppp) {
|
||||
/* this is a blocking call, returns when PPP is properly closed */
|
||||
err_t err = ppp_lwip_disconnect(hw);
|
||||
if (err) {
|
||||
return err_remap(err);
|
||||
}
|
||||
MBED_ASSERT(!netif_is_link_up(&netif));
|
||||
/*if (netif_is_link_up(&netif)) {
|
||||
if (sys_arch_sem_wait(&unlinked, 15000) == SYS_ARCH_TIMEOUT) {
|
||||
return NSAPI_ERROR_DEVICE_ERROR;
|
||||
}
|
||||
}*/
|
||||
} else {
|
||||
netif_set_down(&netif);
|
||||
}
|
||||
netif_set_down(&netif);
|
||||
|
||||
#if LWIP_IPV6
|
||||
mbed_lwip_clear_ipv6_addresses(&netif);
|
||||
|
|
|
@ -0,0 +1,162 @@
|
|||
/*
|
||||
* Copyright (c) 2019 ARM Limited
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "lwip/tcpip.h"
|
||||
#include "lwip/tcp.h"
|
||||
#include "lwip/ip.h"
|
||||
#include "lwip/ip_addr.h"
|
||||
#include "lwip/dns.h"
|
||||
#include "netif/etharp.h"
|
||||
#include "lwip/ethip6.h"
|
||||
#include "netsocket/nsapi_types.h"
|
||||
#include "netsocket/PPP.h"
|
||||
#include "LWIPStack.h"
|
||||
#include "lwip_tools.h"
|
||||
|
||||
#if PPP_SUPPORT
|
||||
|
||||
#if PPP_IPV4_SUPPORT && LWIP_IPV4
|
||||
err_t LWIP::Interface::ppp4_output(struct netif *netif, struct pbuf *p, const ip4_addr_t *ipaddr)
|
||||
{
|
||||
/* Increase reference counter since lwip stores handle to pbuf and frees
|
||||
it after output */
|
||||
pbuf_ref(p);
|
||||
|
||||
LWIP::Interface *mbed_if = static_cast<LWIP::Interface *>(netif->state);
|
||||
bool ret = mbed_if->ppp->link_out(p, IPV4_STACK);
|
||||
return ret ? ERR_OK : ERR_IF;
|
||||
}
|
||||
#endif
|
||||
#if PPP_IPV6_SUPPORT && LWIP_IPV6
|
||||
err_t LWIP::Interface::ppp6_output(struct netif *netif, struct pbuf *p, const ip6_addr_t *ipaddr)
|
||||
{
|
||||
/* Increase reference counter since lwip stores handle to pbuf and frees
|
||||
it after output */
|
||||
pbuf_ref(p);
|
||||
|
||||
LWIP::Interface *mbed_if = static_cast<LWIP::Interface *>(netif->state);
|
||||
bool ret = mbed_if->ppp->link_out(p, IPV6_STACK);
|
||||
return ret ? ERR_OK : ERR_IF;
|
||||
}
|
||||
#endif
|
||||
void LWIP::Interface::ppp_input(net_stack_mem_buf_t *buf)
|
||||
{
|
||||
struct pbuf *p = static_cast<struct pbuf *>(buf);
|
||||
|
||||
/* pass all packets to IP stack input */
|
||||
if (netif.input(p, &netif) != ERR_OK) {
|
||||
LWIP_DEBUGF(NETIF_DEBUG, ("Emac LWIP: IP input error\n"));
|
||||
|
||||
pbuf_free(p);
|
||||
}
|
||||
}
|
||||
|
||||
void LWIP::Interface::ppp_state_change(bool up)
|
||||
{
|
||||
if (up) {
|
||||
#if PPP_IPV6_SUPPORT && LWIP_IPV6
|
||||
const nsapi_addr_t *ipv6_addr = LWIP::Interface::ppp->get_ip_address(NSAPI_IPv6);
|
||||
|
||||
ip_addr_t ip_addr;
|
||||
if (ipv6_addr && convert_mbed_addr_to_lwip(&ip_addr, ipv6_addr)) {
|
||||
netif_ip6_addr_set(&netif, 0, ip_2_ip6(&ip_addr));
|
||||
netif_ip6_addr_set_state(&netif, 0, IP6_ADDR_PREFERRED);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if PPP_IPV4_SUPPORT && LWIP_IPV4
|
||||
const nsapi_addr_t *ipv4_addr = LWIP::Interface::ppp->get_ip_address(NSAPI_IPv4);
|
||||
if (ipv4_addr) {
|
||||
ip_addr_t ip_addr;
|
||||
ip_addr_t netmask;
|
||||
ip_addr_t gateway;
|
||||
|
||||
int conv_ip = 0;
|
||||
if (convert_mbed_addr_to_lwip(&ip_addr, ipv4_addr)) {
|
||||
conv_ip++;
|
||||
}
|
||||
|
||||
const nsapi_addr_t *ipv4_netmask = LWIP::Interface::ppp->get_netmask();
|
||||
if (ipv4_netmask && convert_mbed_addr_to_lwip(&netmask, ipv4_netmask)) {
|
||||
conv_ip++;
|
||||
}
|
||||
|
||||
const nsapi_addr_t *ipv4_gateway = LWIP::Interface::ppp->get_gateway();
|
||||
if (ipv4_gateway && convert_mbed_addr_to_lwip(&gateway, ipv4_gateway)) {
|
||||
conv_ip++;
|
||||
}
|
||||
|
||||
if (conv_ip == 3) {
|
||||
netif_set_addr(&netif, ip_2_ip4(&ip_addr), ip_2_ip4(&netmask), ip_2_ip4(&gateway));
|
||||
}
|
||||
|
||||
unsigned char dns_index = 0;
|
||||
|
||||
for (unsigned char index = 0; index < 2; index++) {
|
||||
ip_addr_t dns_server;
|
||||
const nsapi_addr_t *ipv4_dns_server = LWIP::Interface::ppp->get_dns_server(index);
|
||||
if (ipv4_dns_server && convert_mbed_addr_to_lwip(&dns_server, ipv4_dns_server)) {
|
||||
dns_setserver(dns_index++, &dns_server, &netif);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// Read negotiated MTU
|
||||
uint32_t mtu = LWIP::Interface::ppp->get_mtu_size();
|
||||
netif.mtu = mtu;
|
||||
#if PPP_IPV6_SUPPORT && LWIP_IPV6 && LWIP_ND6_ALLOW_RA_UPDATES
|
||||
netif.mtu6 = mtu;
|
||||
#endif
|
||||
tcpip_callback_with_block((tcpip_callback_fn)netif_set_link_up, &netif, 1);
|
||||
} else {
|
||||
tcpip_callback_with_block((tcpip_callback_fn)netif_set_link_down, &netif, 1);
|
||||
}
|
||||
}
|
||||
|
||||
err_t LWIP::Interface::ppp_if_init(struct netif *netif)
|
||||
{
|
||||
int err = ERR_OK;
|
||||
LWIP::Interface *mbed_if = static_cast<LWIP::Interface *>(netif->state);
|
||||
|
||||
mbed_if->ppp->set_memory_manager(*mbed_if->memory_manager);
|
||||
mbed_if->ppp->set_link_input_cb(mbed::callback(mbed_if, &LWIP::Interface::ppp_input));
|
||||
mbed_if->ppp->set_link_state_cb(mbed::callback(mbed_if, &LWIP::Interface::ppp_state_change));
|
||||
|
||||
/* Interface capabilities */
|
||||
netif->flags = NETIF_FLAG_BROADCAST;
|
||||
|
||||
if (!mbed_if->ppp->power_up()) {
|
||||
err = ERR_IF;
|
||||
}
|
||||
|
||||
netif->mtu = mbed_if->ppp->get_mtu_size();
|
||||
mbed_if->ppp->get_ifname(netif->name, NSAPI_INTERFACE_PREFIX_SIZE);
|
||||
|
||||
#if PPP_IPV4_SUPPORT && LWIP_IPV4
|
||||
netif->output = &LWIP::Interface::ppp4_output;
|
||||
#endif /* PPP_IPV4_SUPPORT */
|
||||
#if PPP_IPV6_SUPPORT && LWIP_IPV6
|
||||
netif->output_ip6 = &LWIP::Interface::ppp6_output;
|
||||
#endif
|
||||
netif->linkoutput = NULL;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -39,6 +39,7 @@
|
|||
#include "lwip-sys/arch/sys_arch.h"
|
||||
|
||||
#include "LWIPStack.h"
|
||||
#include "lwip_tools.h"
|
||||
|
||||
#ifndef LWIP_SOCKET_MAX_MEMBERSHIPS
|
||||
#define LWIP_SOCKET_MAX_MEMBERSHIPS 4
|
||||
|
@ -69,89 +70,6 @@ void LWIP::socket_callback(struct netconn *nc, enum netconn_evt eh, u16_t len)
|
|||
lwip.adaptation.unlock();
|
||||
}
|
||||
|
||||
#if !LWIP_IPV4 || !LWIP_IPV6
|
||||
static bool all_zeros(const uint8_t *p, int len)
|
||||
{
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (p[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool convert_lwip_addr_to_mbed(nsapi_addr_t *out, const ip_addr_t *in)
|
||||
{
|
||||
#if LWIP_IPV6
|
||||
if (IP_IS_V6(in)) {
|
||||
out->version = NSAPI_IPv6;
|
||||
SMEMCPY(out->bytes, ip_2_ip6(in), sizeof(ip6_addr_t));
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#if LWIP_IPV4
|
||||
if (IP_IS_V4(in)) {
|
||||
out->version = NSAPI_IPv4;
|
||||
SMEMCPY(out->bytes, ip_2_ip4(in), sizeof(ip4_addr_t));
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#if LWIP_IPV6 && LWIP_IPV4
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool convert_mbed_addr_to_lwip(ip_addr_t *out, const nsapi_addr_t *in)
|
||||
{
|
||||
#if LWIP_IPV6
|
||||
if (in->version == NSAPI_IPv6) {
|
||||
IP_SET_TYPE(out, IPADDR_TYPE_V6);
|
||||
SMEMCPY(ip_2_ip6(out), in->bytes, sizeof(ip6_addr_t));
|
||||
return true;
|
||||
}
|
||||
#if !LWIP_IPV4
|
||||
/* For bind() and other purposes, need to accept "null" of other type */
|
||||
/* (People use IPv4 0.0.0.0 as a general null) */
|
||||
if (in->version == NSAPI_UNSPEC ||
|
||||
(in->version == NSAPI_IPv4 && all_zeros(in->bytes, 4))) {
|
||||
ip_addr_set_zero_ip6(out);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if LWIP_IPV4
|
||||
if (in->version == NSAPI_IPv4) {
|
||||
IP_SET_TYPE(out, IPADDR_TYPE_V4);
|
||||
SMEMCPY(ip_2_ip4(out), in->bytes, sizeof(ip4_addr_t));
|
||||
return true;
|
||||
}
|
||||
#if !LWIP_IPV6
|
||||
/* For symmetry with above, accept IPv6 :: as a general null */
|
||||
if (in->version == NSAPI_UNSPEC ||
|
||||
(in->version == NSAPI_IPv6 && all_zeros(in->bytes, 16))) {
|
||||
ip_addr_set_zero_ip4(out);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if LWIP_IPV4 && LWIP_IPV6
|
||||
if (in->version == NSAPI_UNSPEC) {
|
||||
#if IP_VERSION_PREF == PREF_IPV4
|
||||
ip_addr_set_zero_ip4(out);
|
||||
#else
|
||||
ip_addr_set_zero_ip6(out);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void LWIP::tcpip_init_irq(void *eh)
|
||||
{
|
||||
static_cast<rtos::Semaphore *>(eh)->release();
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "netsocket/nsapi_types.h"
|
||||
#include "netsocket/EMAC.h"
|
||||
#include "netsocket/L3IP.h"
|
||||
#include "netsocket/PPP.h"
|
||||
#include "netsocket/OnboardNetworkStack.h"
|
||||
#include "LWIPMemoryManager.h"
|
||||
|
||||
|
@ -168,6 +169,18 @@ public:
|
|||
static err_t l3ip_if_init(struct netif *netif);
|
||||
#endif
|
||||
|
||||
#if PPP_SUPPORT
|
||||
#if PPP_IPV4_SUPPORT && LWIP_IPV4
|
||||
static err_t ppp4_output(struct netif *netif, struct pbuf *p, const ip4_addr_t *ipaddr);
|
||||
#endif
|
||||
#if PPP_IPV6_SUPPORT && LWIP_IPV6
|
||||
static err_t ppp6_output(struct netif *netif, struct pbuf *p, const ip6_addr_t *ipaddr);
|
||||
#endif
|
||||
void ppp_input(net_stack_mem_buf_t *buf);
|
||||
void ppp_state_change(bool up);
|
||||
static err_t ppp_if_init(struct netif *netif);
|
||||
#endif
|
||||
|
||||
union {
|
||||
#if LWIP_ETHERNET
|
||||
EMAC *emac; /**< HW specific emac implementation */
|
||||
|
@ -175,7 +188,9 @@ public:
|
|||
#if LWIP_L3IP
|
||||
L3IP *l3ip; /**< L3IP implementation */
|
||||
#endif
|
||||
|
||||
#if PPP_SUPPORT
|
||||
PPP *ppp; /**< PPP implementation */
|
||||
#endif
|
||||
void *hw; /**< alternative implementation pointer - used for PPP */
|
||||
};
|
||||
|
||||
|
@ -202,7 +217,7 @@ public:
|
|||
bool dhcp_started;
|
||||
bool dhcp_has_to_be_set;
|
||||
bool blocking;
|
||||
bool ppp;
|
||||
bool ppp_enabled;
|
||||
mbed::Callback<void(nsapi_event_t, intptr_t)> client_callback;
|
||||
struct netif netif;
|
||||
static Interface *list;
|
||||
|
@ -251,7 +266,7 @@ public:
|
|||
* @param[out] interface_out set to interface handle that must be passed to subsequent mbed_stack calls
|
||||
* @return NSAPI_ERROR_OK on success, or error code
|
||||
*/
|
||||
nsapi_error_t _add_ppp_interface(void *pcb, bool default_if, nsapi_ip_stack_t stack, LWIP::Interface **interface_out);
|
||||
virtual nsapi_error_t add_ppp_interface(PPP &ppp, bool default_if, OnboardNetworkStack::Interface **interface_out);
|
||||
|
||||
/** Remove a network interface from IP stack
|
||||
*
|
||||
|
@ -261,6 +276,14 @@ public:
|
|||
*/
|
||||
virtual nsapi_error_t remove_l3ip_interface(OnboardNetworkStack::Interface **interface_out);
|
||||
|
||||
/** Remove a network interface from IP stack
|
||||
*
|
||||
* Removes PPP objects,network interface from stack list, and shutdown device driver.
|
||||
* @param[out] interface_out pointer to stack interface object controlling the PPP
|
||||
* @return NSAPI_ERROR_OK on success, or error code
|
||||
*/
|
||||
virtual nsapi_error_t remove_ppp_interface(OnboardNetworkStack::Interface **interface_out);
|
||||
|
||||
/** Get a domain name server from a list of servers to query
|
||||
*
|
||||
* Returns a DNS server address for a index. If returns error no more
|
||||
|
|
|
@ -36,10 +36,6 @@
|
|||
#include <stddef.h> /* for size_t */
|
||||
#include "mbed_toolchain.h"
|
||||
|
||||
#if LWIP_USE_EXTERNAL_MBEDTLS
|
||||
#include "mbedtls/md5.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -175,9 +171,6 @@ SET_MEMP_SECTION(memp_memory_TCPIP_MSG_INPKT_base);
|
|||
SET_MEMP_SECTION(memp_memory_SYS_TIMEOUT_base);
|
||||
SET_MEMP_SECTION(memp_memory_TCP_SEG_base);
|
||||
SET_MEMP_SECTION(memp_memory_TCPIP_MSG_API_base);
|
||||
SET_MEMP_SECTION(memp_memory_PPP_PCB_base);
|
||||
SET_MEMP_SECTION(memp_memory_PPPOS_PCB_base);
|
||||
SET_MEMP_SECTION(memp_memory_PPP_PCB_base);
|
||||
#if defined (__ICCARM__)
|
||||
#pragma default_variable_attributes =
|
||||
#endif
|
||||
|
|
|
@ -438,16 +438,6 @@ void sys_init(void) {
|
|||
MBED_ERROR(MBED_MAKE_ERROR(MBED_MODULE_NETWORK_STACK, MBED_ERROR_CODE_INITIALIZATION_FAILED), "sys_init error, mutex initialization failed\n");
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* Routine: sys_jiffies
|
||||
*---------------------------------------------------------------------------*
|
||||
* Description:
|
||||
* Used by PPP as a timestamp-ish value
|
||||
*---------------------------------------------------------------------------*/
|
||||
u32_t sys_jiffies(void) {
|
||||
return osKernelGetTickCount();
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* Routine: sys_arch_protect
|
||||
*---------------------------------------------------------------------------*
|
||||
|
|
|
@ -75,22 +75,34 @@
|
|||
#include "lwip/sys.h"
|
||||
#include <string.h>
|
||||
|
||||
/* pull in md5 of ppp? */
|
||||
#if !PPP_SUPPORT
|
||||
#undef PPP_SUPPORT
|
||||
#define PPP_SUPPORT 1
|
||||
#define PPP_FAKED_ON 1
|
||||
#endif
|
||||
#if !LWIP_USE_EXTERNAL_MBEDTLS
|
||||
|
||||
#include "ppp_opts.h"
|
||||
#include "ppp.h"
|
||||
#include "pppcrypt.h"
|
||||
#include "polarssl/md5.h"
|
||||
|
||||
#if PPP_FAKED_ON && !LWIP_USE_EXTERNAL_POLARSSL && !LWIP_USE_EXTERNAL_MBEDTLS
|
||||
#undef LWIP_INCLUDED_POLARSSL_MD5
|
||||
#define LWIP_INCLUDED_POLARSSL_MD5 1
|
||||
#include "polarssl/lwip_md5.c"
|
||||
#endif
|
||||
#define MD5_context md5_context
|
||||
#define MD5_init(context)
|
||||
#define MD5_starts md5_starts
|
||||
#define MD5_update md5_update
|
||||
#define MD5_finish md5_finish
|
||||
#define MD5_free(context)
|
||||
|
||||
#endif /* !LWIP_USE_EXTERNAL_MBEDTLS */
|
||||
|
||||
/*
|
||||
* Map hashes and ciphers functions to mbed TLS
|
||||
*/
|
||||
#if LWIP_USE_EXTERNAL_MBEDTLS
|
||||
|
||||
#include "mbedtls/md5.h"
|
||||
|
||||
#define MD5_context mbedtls_md5_context
|
||||
#define MD5_init mbedtls_md5_init
|
||||
#define MD5_starts mbedtls_md5_starts
|
||||
#define MD5_update mbedtls_md5_update
|
||||
#define MD5_finish mbedtls_md5_finish
|
||||
#define MD5_free mbedtls_md5_free
|
||||
|
||||
#endif /* LWIP_USE_EXTERNAL_MBEDTLS */
|
||||
|
||||
static u8_t input[64];
|
||||
static u32_t base_time;
|
||||
|
@ -127,7 +139,7 @@ u32_t
|
|||
lwip_hook_tcp_isn(const void *local_ip_ptr, u16_t local_port,
|
||||
const void *remote_ip_ptr, u16_t remote_port)
|
||||
{
|
||||
lwip_md5_context ctx;
|
||||
MD5_context ctx;
|
||||
u8_t output[16];
|
||||
u32_t isn;
|
||||
const ip_addr_t *local_ip = local_ip_ptr;
|
||||
|
@ -176,13 +188,12 @@ lwip_hook_tcp_isn(const void *local_ip_ptr, u16_t local_port,
|
|||
input[35] = remote_port & 0xff;
|
||||
|
||||
/* The secret and padding are already filled in. */
|
||||
|
||||
/* Generate the hash, using MD5. */
|
||||
lwip_md5_init(&ctx);
|
||||
lwip_md5_starts(&ctx);
|
||||
lwip_md5_update(&ctx, input, sizeof(input));
|
||||
lwip_md5_finish(&ctx, output);
|
||||
lwip_md5_free(&ctx);
|
||||
MD5_init(&ctx);
|
||||
MD5_starts(&ctx);
|
||||
MD5_update(&ctx, input, sizeof(input));
|
||||
MD5_finish(&ctx, output);
|
||||
MD5_free(&ctx);
|
||||
|
||||
/* Arbitrarily take the first 32 bits from the generated hash. */
|
||||
MEMCPY(&isn, output, sizeof(isn));
|
||||
|
|
|
@ -58,9 +58,6 @@
|
|||
#include "lwip/mld6.h"
|
||||
#include "lwip/api.h"
|
||||
|
||||
#include "ppp_opts.h"
|
||||
#include "ppp_impl.h"
|
||||
|
||||
#ifndef LWIP_SKIP_PACKING_CHECK
|
||||
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
|
@ -175,12 +172,6 @@ PACK_STRUCT_END
|
|||
#if ((LWIP_SOCKET || LWIP_NETCONN) && (NO_SYS==1))
|
||||
#error "If you want to use Sequential API, you have to define NO_SYS=0 in your lwipopts.h"
|
||||
#endif
|
||||
#if (LWIP_PPP_API && (NO_SYS==1))
|
||||
#error "If you want to use PPP API, you have to define NO_SYS=0 in your lwipopts.h"
|
||||
#endif
|
||||
#if (LWIP_PPP_API && (PPP_SUPPORT==0))
|
||||
#error "If you want to use PPP API, you have to enable PPP_SUPPORT in your lwipopts.h"
|
||||
#endif
|
||||
#if (((!LWIP_DHCP) || (!LWIP_AUTOIP)) && LWIP_DHCP_AUTOIP_COOP)
|
||||
#error "If you want to use DHCP/AUTOIP cooperation mode, you have to define LWIP_DHCP=1 and LWIP_AUTOIP=1 in your lwipopts.h"
|
||||
#endif
|
||||
|
@ -208,20 +199,8 @@ PACK_STRUCT_END
|
|||
#if (DNS_LOCAL_HOSTLIST && !DNS_LOCAL_HOSTLIST_IS_DYNAMIC && !(defined(DNS_LOCAL_HOSTLIST_INIT)))
|
||||
#error "you have to define define DNS_LOCAL_HOSTLIST_INIT {{'host1', 0x123}, {'host2', 0x234}} to initialize DNS_LOCAL_HOSTLIST"
|
||||
#endif
|
||||
#if PPP_SUPPORT && !PPPOS_SUPPORT && !PPPOE_SUPPORT && !PPPOL2TP_SUPPORT
|
||||
#error "PPP_SUPPORT needs at least one of PPPOS_SUPPORT, PPPOE_SUPPORT or PPPOL2TP_SUPPORT turned on"
|
||||
#endif
|
||||
#if PPP_SUPPORT && !PPP_IPV4_SUPPORT && !PPP_IPV6_SUPPORT
|
||||
#error "PPP_SUPPORT needs PPP_IPV4_SUPPORT and/or PPP_IPV6_SUPPORT turned on"
|
||||
#endif
|
||||
#if PPP_SUPPORT && PPP_IPV4_SUPPORT && !LWIP_IPV4
|
||||
#error "PPP_IPV4_SUPPORT needs LWIP_IPV4 turned on"
|
||||
#endif
|
||||
#if PPP_SUPPORT && PPP_IPV6_SUPPORT && !LWIP_IPV6
|
||||
#error "PPP_IPV6_SUPPORT needs LWIP_IPV6 turned on"
|
||||
#endif
|
||||
#if !LWIP_ETHERNET && (LWIP_ARP || PPPOE_SUPPORT)
|
||||
#error "LWIP_ETHERNET needs to be turned on for LWIP_ARP or PPPOE_SUPPORT"
|
||||
#if !LWIP_ETHERNET && LWIP_ARP
|
||||
#error "LWIP_ETHERNET needs to be turned on for LWIP_ARP"
|
||||
#endif
|
||||
#if LWIP_TCPIP_CORE_LOCKING_INPUT && !LWIP_TCPIP_CORE_LOCKING
|
||||
#error "When using LWIP_TCPIP_CORE_LOCKING_INPUT, LWIP_TCPIP_CORE_LOCKING must be enabled, too"
|
||||
|
@ -370,9 +349,6 @@ lwip_init(void)
|
|||
#if LWIP_DNS
|
||||
dns_init();
|
||||
#endif /* LWIP_DNS */
|
||||
#if PPP_SUPPORT
|
||||
ppp_init();
|
||||
#endif
|
||||
|
||||
#if LWIP_TIMERS
|
||||
sys_timeouts_init();
|
||||
|
|
|
@ -68,7 +68,6 @@
|
|||
#include "lwip/igmp.h"
|
||||
#include "lwip/timeouts.h"
|
||||
/* needed by default MEMP_NUM_SYS_TIMEOUT */
|
||||
#include "ppp_opts.h"
|
||||
#include "lwip/netdb.h"
|
||||
#include "lwip/dns.h"
|
||||
#include "lwip/priv/nd6_priv.h"
|
||||
|
|
|
@ -83,8 +83,7 @@
|
|||
#if LWIP_CHECKSUM_ON_COPY
|
||||
#include "lwip/inet_chksum.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include "string.h"
|
||||
|
||||
#define SIZEOF_STRUCT_PBUF LWIP_MEM_ALIGN_SIZE(sizeof(struct pbuf))
|
||||
/* Since the pool is created in memp, PBUF_POOL_BUFSIZE will be automatically
|
||||
|
|
|
@ -505,7 +505,7 @@
|
|||
* The number of sys timeouts used by the core stack (not apps)
|
||||
* The default number of timeouts is calculated here for all enabled modules.
|
||||
*/
|
||||
#define LWIP_NUM_SYS_TIMEOUT_INTERNAL (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + PPP_NUM_TIMEOUTS + (LWIP_IPV6 * (1 + LWIP_IPV6_REASS + LWIP_IPV6_MLD)))
|
||||
#define LWIP_NUM_SYS_TIMEOUT_INTERNAL (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + (LWIP_IPV6 * (1 + LWIP_IPV6_REASS + LWIP_IPV6_MLD)))
|
||||
|
||||
/**
|
||||
* MEMP_NUM_SYS_TIMEOUT: the number of simultaneously active timeouts.
|
||||
|
|
|
@ -51,11 +51,6 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#include "netif/ppp/ppp_opts.h"
|
||||
#if PPPOE_SUPPORT
|
||||
#include "netif/ppp/pppoe.h"
|
||||
#endif /* PPPOE_SUPPORT */
|
||||
|
||||
#ifdef LWIP_HOOK_FILENAME
|
||||
#include LWIP_HOOK_FILENAME
|
||||
#endif
|
||||
|
|
|
@ -23,9 +23,14 @@
|
|||
#include "lwip/api.h"
|
||||
|
||||
#include "LWIPStack.h"
|
||||
#include "lwip_tools.h"
|
||||
|
||||
#include "netsocket/nsapi_types.h"
|
||||
|
||||
#if !LWIP_IPV4 || !LWIP_IPV6
|
||||
static bool all_zeros(const uint8_t *p, int len);
|
||||
#endif
|
||||
|
||||
/* LWIP error remapping */
|
||||
nsapi_error_t LWIP::err_remap(err_t err)
|
||||
{
|
||||
|
@ -192,3 +197,86 @@ void LWIP::arena_dealloc(struct mbed_lwip_socket *s)
|
|||
free(s->multicast_memberships);
|
||||
s->multicast_memberships = NULL;
|
||||
}
|
||||
|
||||
bool convert_lwip_addr_to_mbed(nsapi_addr_t *out, const ip_addr_t *in)
|
||||
{
|
||||
#if LWIP_IPV6
|
||||
if (IP_IS_V6(in)) {
|
||||
out->version = NSAPI_IPv6;
|
||||
SMEMCPY(out->bytes, ip_2_ip6(in), sizeof(ip6_addr_t));
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#if LWIP_IPV4
|
||||
if (IP_IS_V4(in)) {
|
||||
out->version = NSAPI_IPv4;
|
||||
SMEMCPY(out->bytes, ip_2_ip4(in), sizeof(ip4_addr_t));
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#if LWIP_IPV6 && LWIP_IPV4
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool convert_mbed_addr_to_lwip(ip_addr_t *out, const nsapi_addr_t *in)
|
||||
{
|
||||
#if LWIP_IPV6
|
||||
if (in->version == NSAPI_IPv6) {
|
||||
IP_SET_TYPE(out, IPADDR_TYPE_V6);
|
||||
SMEMCPY(ip_2_ip6(out), in->bytes, sizeof(ip6_addr_t));
|
||||
return true;
|
||||
}
|
||||
#if !LWIP_IPV4
|
||||
/* For bind() and other purposes, need to accept "null" of other type */
|
||||
/* (People use IPv4 0.0.0.0 as a general null) */
|
||||
if (in->version == NSAPI_UNSPEC ||
|
||||
(in->version == NSAPI_IPv4 && all_zeros(in->bytes, 4))) {
|
||||
ip_addr_set_zero_ip6(out);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if LWIP_IPV4
|
||||
if (in->version == NSAPI_IPv4) {
|
||||
IP_SET_TYPE(out, IPADDR_TYPE_V4);
|
||||
SMEMCPY(ip_2_ip4(out), in->bytes, sizeof(ip4_addr_t));
|
||||
return true;
|
||||
}
|
||||
#if !LWIP_IPV6
|
||||
/* For symmetry with above, accept IPv6 :: as a general null */
|
||||
if (in->version == NSAPI_UNSPEC ||
|
||||
(in->version == NSAPI_IPv6 && all_zeros(in->bytes, 16))) {
|
||||
ip_addr_set_zero_ip4(out);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if LWIP_IPV4 && LWIP_IPV6
|
||||
if (in->version == NSAPI_UNSPEC) {
|
||||
#if IP_VERSION_PREF == PREF_IPV4
|
||||
ip_addr_set_zero_ip4(out);
|
||||
#else
|
||||
ip_addr_set_zero_ip6(out);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#if !LWIP_IPV4 || !LWIP_IPV6
|
||||
static bool all_zeros(const uint8_t *p, int len)
|
||||
{
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (p[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2019 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef LWIPTOOLS_H_
|
||||
#define LWIPTOOLS_H_
|
||||
|
||||
bool convert_lwip_addr_to_mbed(nsapi_addr_t *out, const ip_addr_t *in);
|
||||
bool convert_mbed_addr_to_lwip(ip_addr_t *out, const nsapi_addr_t *in);
|
||||
|
||||
#endif /* LWIPTOOLS_H_ */
|
|
@ -119,17 +119,10 @@
|
|||
#define MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE 512
|
||||
#endif
|
||||
|
||||
// Thread stack size for private PPP thread
|
||||
#ifndef MBED_CONF_LWIP_PPP_THREAD_STACKSIZE
|
||||
#define MBED_CONF_LWIP_PPP_THREAD_STACKSIZE 768
|
||||
#endif
|
||||
|
||||
#ifdef LWIP_DEBUG
|
||||
#define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE*2, 8)
|
||||
#define PPP_THREAD_STACK_SIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_PPP_THREAD_STACKSIZE*2, 8)
|
||||
#else
|
||||
#define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE, 8)
|
||||
#define PPP_THREAD_STACK_SIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_PPP_THREAD_STACKSIZE, 8)
|
||||
#endif
|
||||
|
||||
#define MEMP_NUM_SYS_TIMEOUT 16
|
||||
|
@ -313,11 +306,6 @@
|
|||
#define DNS_DEBUG LWIP_DBG_OFF
|
||||
#define IP6_DEBUG LWIP_DBG_OFF
|
||||
|
||||
#if MBED_CONF_LWIP_ENABLE_PPP_TRACE
|
||||
#define PPP_DEBUG LWIP_DBG_ON
|
||||
#else
|
||||
#define PPP_DEBUG LWIP_DBG_OFF
|
||||
#endif //MBED_CONF_LWIP_ENABLE_PPP_TRACE
|
||||
#define ETHARP_DEBUG LWIP_DBG_OFF
|
||||
#define UDP_LPC_EMAC LWIP_DBG_OFF
|
||||
|
||||
|
@ -358,33 +346,40 @@
|
|||
#define INTERFACE_NAME_MAX_SIZE NSAPI_INTERFACE_NAME_MAX_SIZE
|
||||
// Note generic macro name used rather than MBED_CONF_LWIP_PPP_ENABLED
|
||||
// to allow users like PPPCellularInterface to detect that nsapi_ppp.h is available.
|
||||
#if NSAPI_PPP_AVAILABLE
|
||||
#define PPP_SUPPORT 1
|
||||
#if MBED_CONF_LWIP_IPV6_ENABLED
|
||||
#define PPP_IPV6_SUPPORT 1
|
||||
// Disable DAD for PPP
|
||||
#define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0
|
||||
|
||||
// Enable PPP for now either from lwIP PPP configuration (obsolete) or from PPP service configuration
|
||||
#if MBED_CONF_PPP_ENABLED || MBED_CONF_LWIP_PPP_ENABLED
|
||||
|
||||
#define PPP_SUPPORT 1
|
||||
|
||||
#if MBED_CONF_PPP_IPV4_ENABLED || MBED_CONF_LWIP_IPV4_ENABLED
|
||||
#define LWIP 0x11991199
|
||||
#if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV4_ENABLED
|
||||
#error LWIP: IPv4 PPP enabled but not IPv4
|
||||
#endif
|
||||
#undef LWIP
|
||||
#define PPP_IPV4_SUPPORT 1
|
||||
#endif
|
||||
#define CHAP_SUPPORT 1
|
||||
#define PPP_INPROC_IRQ_SAFE 1
|
||||
// Save RAM
|
||||
#define PAP_SUPPORT 0
|
||||
#define VJ_SUPPORT 0
|
||||
#define PRINTPKT_SUPPORT 0
|
||||
|
||||
// Broadcast
|
||||
#define IP_SOF_BROADCAST 0
|
||||
#define IP_SOF_BROADCAST_RECV 0
|
||||
#if MBED_CONF_PPP_IPV6_ENABLED || MBED_CONF_LWIP_IPV6_ENABLED
|
||||
#define LWIP 0x11991199
|
||||
#if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV6_ENABLED
|
||||
#error LWIP: IPv6 PPP enabled but not IPv6
|
||||
#endif
|
||||
#undef LWIP
|
||||
#define PPP_IPV6_SUPPORT 1
|
||||
// Later to be dynamic for use for multiple interfaces
|
||||
#define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0
|
||||
#endif
|
||||
|
||||
#define MAXNAMELEN 64 /* max length of hostname or name for auth */
|
||||
#define MAXSECRETLEN 64
|
||||
#endif // NSAPI_PPP_AVAILABLE
|
||||
#endif
|
||||
|
||||
// Make sure we default these to off, so
|
||||
// LWIP doesn't default to on
|
||||
#ifndef LWIP_ARP
|
||||
#define LWIP_ARP 0
|
||||
#endif
|
||||
|
||||
// Checksum-on-copy disabled due to https://savannah.nongnu.org/bugs/?50914
|
||||
#define LWIP_CHECKSUM_ON_COPY 0
|
||||
|
||||
|
@ -399,8 +394,9 @@
|
|||
#include "lwip_tcp_isn.h"
|
||||
#define LWIP_HOOK_TCP_ISN lwip_hook_tcp_isn
|
||||
#ifdef MBEDTLS_MD5_C
|
||||
#include "mbedtls/md5.h"
|
||||
#define LWIP_USE_EXTERNAL_MBEDTLS 1
|
||||
#define LWIP_USE_EXTERNAL_MBEDTLS 1
|
||||
#else
|
||||
#define LWIP_USE_EXTERNAL_MBEDTLS 0
|
||||
#endif
|
||||
|
||||
#endif /* LWIPOPTS_H_ */
|
||||
|
|
|
@ -34,26 +34,23 @@
|
|||
"value": false
|
||||
},
|
||||
"ppp-enabled": {
|
||||
"help": "Enable support for PPP interfaces",
|
||||
"value": false,
|
||||
"macro_name": "NSAPI_PPP_AVAILABLE"
|
||||
"help": "Enable support for PPP interfaces (obsolete: use netsocket/ppp configuration instead)",
|
||||
"value": false
|
||||
},
|
||||
"ppp-ipv4-enabled": {
|
||||
"help": "Enable support for ipv4 PPP interface",
|
||||
"value": true,
|
||||
"macro_name": "NSAPI_PPP_IPV4_AVAILABLE"
|
||||
"help": "Enable support for ipv4 PPP interface (obsolete: use netsocket/ppp configuration instead)",
|
||||
"value": false
|
||||
},
|
||||
"ppp-ipv6-enabled": {
|
||||
"help": "Enable support for ipv6 PPP interface",
|
||||
"value": false,
|
||||
"macro_name": "NSAPI_PPP_IPV6_AVAILABLE"
|
||||
"help": "Enable support for ipv6 PPP interface (obsolete: use netsocket/ppp configuration instead)",
|
||||
"value": false
|
||||
},
|
||||
"use-mbed-trace": {
|
||||
"help": "Use mbed trace for debug, rather than printf",
|
||||
"value": false
|
||||
},
|
||||
"enable-ppp-trace": {
|
||||
"help": "Enable trace support for PPP interfaces",
|
||||
"help": "Enable trace support for PPP interfaces (obsolete: use netsocket/ppp configuration instead)",
|
||||
"value": false
|
||||
},
|
||||
"socket-max": {
|
||||
|
@ -129,7 +126,7 @@
|
|||
"value": 512
|
||||
},
|
||||
"ppp-thread-stacksize": {
|
||||
"help": "Thread stack size for PPP",
|
||||
"help": "Thread stack size for PPP (obsolete: use netsocket/ppp configuration instead)",
|
||||
"value": 768
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue