Hello,
I download lwip 2.1.2 (last version) in here. Replace with my lwip files.
And I added my lwipopt.h, and user_config.h file.


Duygu D. <duygudemirpe...@gmail.com>, 1 Eki 2021 Cum, 16:36 tarihinde şunu
yazdı:

> Hello,
> Thank you for your reply.
> I couldnt find anywhere p->len is 576, I checked mbedtls's bio_send
> function I see 136 bytes. I dont know 576 where come from.
> I am a new developper so how can I analyse this "Or your driver might be
> sending zero-copy but the packets get changed
> between being enqueued and actually sending them" sorry for my ignorance
> Best Regards.
>
> goldsi...@gmx.de <goldsi...@gmx.de>, 1 Eki 2021 Cum, 15:42 tarihinde şunu
> yazdı:
>
>> Am 01.10.2021 um 13:40 schrieb Duygu D.:
>> > [..]
>> > When I checked the low_level_output functions I get sending data bytes
>> > 150 byte but Ipv4 length shows us 576 byte, opt.h file set as default
>> > but if I changed TCP_MSS as a 250 byte so I can send 136 byte and Ipv4
>> > packet lenght shows me 136. But does not make sense.  I couldnt do
>> > successful handshaking. Lwip takes care of the IP part if I send the
>> > another IP based packet (like icmp) packet with different sizes. I didnt
>> > get IPv4 packet length error.
>> > I only have this error when I used mbedtls. How can I find the problem?
>>
>> One error I can think of here is that your driver might send packets
>> using 'p->len' instead of iterating over all pbufs ('p->tot_len',
>> iterate over all 'p->next').
>>
>> Or your driver might be sending zero-copy but the packets get changed
>> between being enqueued and actually sending them?
>>
>> Regards,
>> Simon
>>
>> _______________________________________________
>> lwip-users mailing list
>> lwip-users@nongnu.org
>> https://lists.nongnu.org/mailman/listinfo/lwip-users
>
>
>
> --
> Embeded System Engineer
>
>

-- 
Embeded System Engineer
/**
  ******************************************************************************
  * File Name          : lwipopts.h
  * Description        : This file overrides LwIP stack default configuration
  *                      done in opt.h file.
  ******************************************************************************
  * This notice applies to any and all portions of this file
  * that are not between comment pairs USER CODE BEGIN and
  * USER CODE END. Other portions of this file, whether
  * inserted by the user or by software development tools
  * are owned by their respective copyright owners.
  *
  * Copyright (c) 2019 STMicroelectronics International N.V.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted, provided that the following conditions are met:
  *
  * 1. Redistribution of source code must retain the above copyright notice,
  *    this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright notice,
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
  * 3. Neither the name of STMicroelectronics nor the names of other
  *    contributors to this software may be used to endorse or promote products
  *    derived from this software without specific written permission.
  * 4. This software, including modifications and/or derivative works of this
  *    software, must execute solely and exclusively on microcontroller or
  *    microprocessor devices manufactured by or for STMicroelectronics.
  * 5. Redistribution and use of this software other than as permitted under
  *    this license is void and will automatically terminate your rights under
  *    this license.
  *
  * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
  * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
  * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  ******************************************************************************
  */

/* Define to prevent recursive inclusion --------------------------------------*/
#ifndef __LWIPOPTS__H__
#define __LWIPOPTS__H__

#include "stm32f4xx_hal.h"

/*-----------------------------------------------------------------------------*/
/* Current version of LwIP supported by CubeMx: 2.0.3 -*/
/*-----------------------------------------------------------------------------*/

/* Within 'USER CODE' section, code will be kept by default at each generation */
/* USER CODE BEGIN 0 */

/* USER CODE END 0 */

#ifdef __cplusplus
 extern "C" {
#endif

/* STM32CubeMX Specific Parameters (not defined in opt.h) ---------------------*/
/* Parameters set in STM32CubeMX LwIP Configuration GUI -*/
/*----- WITH_RTOS disabled (Since FREERTOS is not set) -----*/
#define WITH_RTOS 0
/*----- CHECKSUM_BY_HARDWARE disabled -----*/
#define CHECKSUM_BY_HARDWARE 0
/*-----------------------------------------------------------------------------*/

/* LwIP Stack Parameters (modified compared to initialization value in opt.h) -*/
/* Parameters set in STM32CubeMX LwIP Configuration GUI -*/
/*----- Value in opt.h for NO_SYS: 0 -----*/
#define NO_SYS 1
/*----- Value in opt.h for SYS_LIGHTWEIGHT_PROT: 1 -----*/
#define SYS_LIGHTWEIGHT_PROT 0
/*----- Value in opt.h for MEM_ALIGNMENT: 1 -----*/
#define MEM_ALIGNMENT 4
/*----- Value in opt.h for LWIP_ETHERNET: LWIP_ARP || PPPOE_SUPPORT -*/
#define LWIP_ETHERNET 1
/*----- Value in opt.h for LWIP_DNS_SECURE: (LWIP_DNS_SECURE_RAND_XID | LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING | LWIP_DNS_SECURE_RAND_SRC_PORT) -*/
#define LWIP_DNS_SECURE 7
/*----- Value in opt.h for TCP_SND_QUEUELEN: (4*TCP_SND_BUF + (TCP_MSS - 1))/TCP_MSS -----*/
#define TCP_SND_QUEUELEN 9
/*----- Value in opt.h for TCP_SNDLOWAT: LWIP_MIN(LWIP_MAX(((TCP_SND_BUF)/2), (2 * TCP_MSS) + 1), (TCP_SND_BUF) - 1) -*/
#define TCP_SNDLOWAT 1071
/*----- Value in opt.h for TCP_SNDQUEUELOWAT: LWIP_MAX(TCP_SND_QUEUELEN)/2, 5) -*/
#define TCP_SNDQUEUELOWAT 5
/*----- Value in opt.h for TCP_WND_UPDATE_THRESHOLD: LWIP_MIN(TCP_WND/4, TCP_MSS*4) -----*/
#define TCP_WND_UPDATE_THRESHOLD 536
/*----- Value in opt.h for LWIP_NETCONN: 1 -----*/
#define LWIP_NETCONN 0
/*----- Value in opt.h for LWIP_SOCKET: 1 -----*/
#define LWIP_SOCKET 0
/*----- Value in opt.h for RECV_BUFSIZE_DEFAULT: INT_MAX -----*/
#define RECV_BUFSIZE_DEFAULT 2000000000
/*----- Value in opt.h for LWIP_STATS: 1 -----*/
#define LWIP_STATS 0
/*----- Value in opt.h for CHECKSUM_GEN_IP: 1 -----*/
#define CHECKSUM_GEN_IP 0
/*----- Value in opt.h for CHECKSUM_GEN_UDP: 1 -----*/
#define CHECKSUM_GEN_UDP 0
/*----- Value in opt.h for CHECKSUM_GEN_TCP: 1 -----*/
#define CHECKSUM_GEN_TCP 0
/*----- Value in opt.h for CHECKSUM_GEN_ICMP: 1 -----*/
#define CHECKSUM_GEN_ICMP 0
/*----- Value in opt.h for CHECKSUM_GEN_ICMP6: 1 -----*/
#define CHECKSUM_GEN_ICMP6 0
/*----- Value in opt.h for CHECKSUM_CHECK_IP: 1 -----*/
#define CHECKSUM_CHECK_IP 0
/*----- Value in opt.h for CHECKSUM_CHECK_UDP: 1 -----*/
#define CHECKSUM_CHECK_UDP 0
/*----- Value in opt.h for CHECKSUM_CHECK_TCP: 1 -----*/
#define CHECKSUM_CHECK_TCP 0
/*----- Value in opt.h for CHECKSUM_CHECK_ICMP: 1 -----*/
#define CHECKSUM_CHECK_ICMP 0
/*----- Value in opt.h for CHECKSUM_CHECK_ICMP6: 1 -----*/
#define CHECKSUM_CHECK_ICMP6 0
/*-----------------------------------------------------------------------------*/
/* USER CODE BEGIN 1 */
// #define IP_REASSEMBLY 0


#define LWIP_ALTCP                  1
#define LWIP_ALTCP_TLS              1
#define LWIP_ALTCP_TLS_MBEDTLS      1
// #define MEMP_NUM_SYS_TIMEOUT            (LWIP_NUM_SYS_TIMEOUT_INTERNAL + 2)

#define MEM_SIZE                  (100 * 1024)
// #define LWIP_DEBUG
// #define MEMP_NUM_TCP_PCB          20
// #define MEMP_NUM_TCP_PCB_LISTEN   10
// #define MEMP_NUM_TCP_SEG          20
// #define PBUF_POOL_SIZE            32
// for mqtt tls
// #define TCP_WND               (31 * TCP_MSS)
// #define TCP_SND_BUF           (10 * TCP_MSS)
// 
// #define PBUF_POOL_SIZE        32
// #define MEMP_NUM_ALTCP_PCB    (MEMP_NUM_TCP_PCB)

#define LWIP_DEBUG            1
// #define DNS_DEBUG             LWIP_DBG_ON
// #define DHCP_DEBUG            LWIP_DBG_ON
// #define MQTT_DEBUG            LWIP_DBG_ON
// #define ALTCP_MBEDTLS_DEBUG   LWIP_DBG_ON
#define TCP_DEBUG             LWIP_DBG_ON
// #define MEM_DEBUG             LWIP_DBG_ON
#undef TCP_MSS
// #define TCP_MSS           800//(1500 - 40)
// #define TCP_WND          (22 * TCP_MSS) //TCP_WND >= MBEDTLS_SSL_MAX_CONTENT_LEN
// #undef  MEMP_MEM_MALLOC
// #define MEMP_MEM_MALLOC   1 //Only one can be selected with MEM_USE_POOLS

// do not use memory pool
// #undef  MEM_USE_POOLS
// #define MEM_USE_POOLS     0 //Only one can be selected with MEMP_MEM_MALLOC
// #define MBEDTLS_DEBUG_C 

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>



/* USER CODE END 1 */

#ifdef __cplusplus
}
#endif
#endif /*__LWIPOPTS__H_H */

/************************* (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
///////////////////////////////////////////////////////////////////////////////////////
// in order to overwrite definitions, include this file at the end of config.h

///////////////////////////////////////////////////////////////////////////////////////
// disable MICRO
///////////////////////////////////////////////////////////////////////////////////////

#undef  MBEDTLS_HAVE_TIME
#undef  MBEDTLS_HAVE_TIME_DATE

#undef  MBEDTLS_SSL_PROTO_DTLS
#undef  MBEDTLS_SSL_DTLS_ANTI_REPLAY
#undef  MBEDTLS_SSL_DTLS_HELLO_VERIFY
#undef  MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE
#undef  MBEDTLS_SSL_DTLS_BADMAC_LIMIT

#undef  MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH

///////////////////////////////////////////////////////////////////////////////////////
// enable MICRO
///////////////////////////////////////////////////////////////////////////////////////

#define MBEDTLS_SSL_PROTO_TLS1
#define MBEDTLS_SSL_PROTO_TLS1_1
#define MBEDTLS_SSL_PROTO_TLS1_2

// #define MBEDTLS_NO_PLATFORM_ENTROPY
// #define MBEDTLS_ENTROPY_NV_SEED
// #define MBEDTLS_ENTROPY_C
// #define ALTCP_MBEDTLS_RNG_FN					mbedtls_entropy_func 
// #define MBEDTLS_PLATFORM_NV_SEED_READ_MACRO		mbedtls_platform_std_nv_seed_read
// #define MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO	mbedtls_platform_std_nv_seed_write

#define MBEDTLS_HAVE_ASM

#define MBEDTLS_NO_64BIT_MULTIPLICATION

#define MBEDTLS_PLATFORM_MEMORY
#define MBEDTLS_PLATFORM_C

#define MBEDTLS_SSL_MAX_CONTENT_LEN             16384
#define MBEDTLS_SSL_IN_CONTENT_LEN              16384

#ifdef _WIN32
#define MBEDTLS_SSL_OUT_CONTENT_LEN             16384
#undef  MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
#else
#define MBEDTLS_SSL_OUT_CONTENT_LEN             1024    //16384
#define MBEDTLS_PLATFORM_NO_STD_FUNCTIONS

#define MBEDTLS_PLATFORM_SNPRINTF_MACRO			snprintf
#define MBEDTLS_PLATFORM_VSNPRINTF_MACRO		vsnprintf
#endif

//0 No debug,1 Error,2 State change,3 Informational,4 Verbose
#define MBEDTLS_DEBUG_LEVEL 					1

extern int mbedtls_platform_std_nv_seed_read(unsigned char *buf, unsigned int buf_len);
extern int mbedtls_platform_std_nv_seed_write(unsigned char *buf, unsigned int buf_len);
_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to