Sorry, I was an idiot.

On Wed, Nov 29, 2017 at 4:16 PM, Ajay Garg <ajaygargn...@gmail.com> wrote:

> Hi All.
>
> We are using WolfSSL at Layer-6, and things work fine in Ubuntu-14.04 with
> our server.
> Most importantly, the transfer of RSA-certificate from server to ubuntu
> works fine.
>
> Now, when we use LWIP on an embedded-SOC, we are not able to receive the
> certificate.
> I am going to give the details of two scenarios, but first the things that
> remain constant ::
>
>
> a)
> We are using NETCONN api for send/recv of bytes..
>
> b)
> We are using Ethernet interface,
>
> c)
> Irrespective of value of TCP_MSS, one call of recv() gives a maximum of
> 1460 bytes (even though the certifcate is >4000 bytes length).
> Not sure if the TCP-fragmentation is happening from the server-side
> itself, or it's the LWIP that is "breaking" the packet.
>
> d)
> Following configurations are constant during the two scenarios
>
>
> ############################################################
> ########################################
>
> /**
>  * NO_SYS==1: Provides VERY minimal functionality. Otherwise,
>  * use lwIP facilities.
>  */
> #define NO_SYS                        0
> #define LWIP_RAW                      0
> #define LWIP_NETIF_STATUS_CALLBACK    1
>
> /**
>  * SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain
>  * critical regions during buffer allocation, deallocation and memory
>  * allocation and deallocation.
>  */
> #define SYS_LIGHTWEIGHT_PROT        1
>
> /* These are not available when using "NO_SYS" */
> #define LWIP_NETCONN                1
> #define LWIP_SOCKET                 0
>
> /* Enable DHCP support */
> #define DHCP_USED
>
> /*
>    ------------------------------------
>    ---------- Memory options ----------
>    ------------------------------------
> */
>
> /**
>  * MEM_ALIGNMENT: should be set to the alignment of the CPU
>  *    4 byte alignment -> #define MEM_ALIGNMENT 4
>  *    2 byte alignment -> #define MEM_ALIGNMENT 2
>  */
> #define MEM_ALIGNMENT                   4
>
>
> /**
>  * MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections.
>  * (requires the LWIP_TCP option)
>  */
> #define MEMP_NUM_TCP_PCB                16
>
> /**
>  * MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections.
>  * (requires the LWIP_TCP option)
>  */
> #define MEMP_NUM_TCP_PCB_LISTEN         1
>
> /**
>  * MEMP_NUM_PBUF: the number of memp struct pbufs (used for PBUF_ROM and
> PBUF_REF).
>  * If the application sends a lot of data out of ROM (or other static
> memory),
>  * this should be set high.
>  */
> #define MEMP_NUM_PBUF                   10
>
> /**
>  * MEMP_NUM_NETBUF: the number of struct netbufs.
>  * (only needed if you use the sequential API, like api_lib.c)
>  */
> #define MEMP_NUM_NETBUF                 8
>
> /**
>  * MEMP_NUM_NETCONN: the number of struct netconns.
>  * (only needed if you use the sequential API, like api_lib.c)
>  */
> #define MEMP_NUM_NETCONN                16
>
> /**
>  * PBUF_POOL_SIZE: the number of buffers in the pbuf pool.
>  */
> #define PBUF_POOL_SIZE                  10
>
> /**
>  * PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool.
>  */
> #define PBUF_POOL_BUFSIZE               GMAC_FRAME_LENTGH_MAX
>
> /*
>    ----------------------------------
>    ---------- DHCP options ----------
>    ----------------------------------
> */
>
> #if defined(DHCP_USED)
> /**
>  * LWIP_DHCP==1: Enable DHCP module.
>  */
> #define LWIP_DHCP               1
> #endif
>
> /*
>    ---------------------------------
>    ---------- UDP options ----------
>    ---------------------------------
> */
>
> /**
>  * LWIP_UDP==1: Turn on UDP.
>  */
> #define LWIP_UDP                1
>
> /*
>    ---------------------------------
>    ---------- TCP options ----------
>    ---------------------------------
> */
>
> /**
>  * LWIP_TCP==1: Turn on TCP.
>  */
> #define LWIP_TCP                1
>
> /**
>  * TCP_WND: The size of a TCP window.  This must be at least
>  * (2 * TCP_MSS) for things to work well
>  */
> #define TCP_WND                 (2 * TCP_MSS)
>
> /**
>  * TCP_SND_BUF: TCP sender buffer space (bytes).
>  * To achieve good performance, this should be at least 2 * TCP_MSS.
>  */
> #define TCP_SND_BUF             (2 * TCP_MSS)
>
> /*
>    ------------------------------------
>    ---------- Thread options ----------
>    ------------------------------------
> */
>
>
> #define netifINTERFACE_TASK_STACK_SIZE    256
> #define netifINTERFACE_TASK_PRIORITY      (tskIDLE_PRIORITY + 4)
> #define TCPIP_THREAD_STACKSIZE            256
> #define TCPIP_THREAD_PRIO                 (tskIDLE_PRIORITY + 5)
>
>
> #define TCPIP_MBOX_SIZE                   16
> #define DEFAULT_ACCEPTMBOX_SIZE           16
> #define DEFAULT_RAW_RECVMBOX_SIZE         16
> #define DEFAULT_TCP_RECVMBOX_SIZE         16
> #define DEFAULT_UDP_RECVMBOX_SIZE          16
>
> /*
>    ----------------------------------------
>    ---------- Statistics options ----------
>    ----------------------------------------
> */
>
> #define LWIP_STATS 0
> #define LWIP_STATS_DISPLAY 0
> #define LWIP_STATS_LARGE 0
>
> #if LWIP_STATS
> #define LINK_STATS 1
> #define IP_STATS   1
> #define IPFRAG_STATS 0
> #define ICMP_STATS 0
> #define IGMP_STATS 0
> #define UDP_STATS  0
> #define TCP_STATS  1
> #define MEM_STATS  1
> #define MEMP_STATS 1
> #define SYS_STATS  1
> #endif
>
> /*
>    ---------------------------------------
>    ---------- Debugging options ----------
>    ---------------------------------------
> */
>
> #define LWIP_NOASSERT
>
> //#define LWIP_DEBUG
> #define LWIP_DBG_MIN_LEVEL              LWIP_DBG_LEVEL_ALL
> #define LWIP_DBG_TYPES_ON               LWIP_DBG_ON
>
> #define ETHARP_DEBUG                    LWIP_DBG_OFF
> #define NETIF_DEBUG                     LWIP_DBG_OFF
> #define PBUF_DEBUG                      LWIP_DBG_OFF
> #define API_LIB_DEBUG                   LWIP_DBG_OFF
> #define API_MSG_DEBUG                   LWIP_DBG_OFF
> #define SOCKETS_DEBUG                   LWIP_DBG_OFF
> #define ICMP_DEBUG                      LWIP_DBG_OFF
> #define IGMP_DEBUG                      LWIP_DBG_OFF
> #define INET_DEBUG                      LWIP_DBG_OFF
> #define IP_DEBUG                        LWIP_DBG_OFF
> #define IP_REASS_DEBUG                  LWIP_DBG_OFF
> #define RAW_DEBUG                       LWIP_DBG_OFF
> #define MEM_DEBUG                       LWIP_DBG_OFF
> #define MEMP_DEBUG                      LWIP_DBG_OFF
> #define SYS_DEBUG                       LWIP_DBG_OFF
> #define TIMERS_DEBUG                    LWIP_DBG_OFF
> #define TCP_DEBUG                       LWIP_DBG_OFF
> #define TCP_INPUT_DEBUG                 LWIP_DBG_OFF
> #define TCP_FR_DEBUG                    LWIP_DBG_OFF
> #define TCP_RTO_DEBUG                   LWIP_DBG_OFF
> #define TCP_CWND_DEBUG                  LWIP_DBG_OFF
> #define TCP_WND_DEBUG                   LWIP_DBG_OFF
> #define TCP_OUTPUT_DEBUG                LWIP_DBG_OFF
> #define TCP_RST_DEBUG                   LWIP_DBG_OFF
> #define TCP_QLEN_DEBUG                  LWIP_DBG_OFF
> #define UDP_DEBUG                       LWIP_DBG_OFF
> #define TCPIP_DEBUG                     LWIP_DBG_OFF
> #define PPP_DEBUG                       LWIP_DBG_OFF
> #define SLIP_DEBUG                      LWIP_DBG_OFF
> #define DHCP_DEBUG                      LWIP_DBG_OFF
> #define AUTOIP_DEBUG                    LWIP_DBG_OFF
> #define SNMP_MSG_DEBUG                  LWIP_DBG_OFF
> #define SNMP_MIB_DEBUG                  LWIP_DBG_OFF
> #define DNS_DEBUG                       LWIP_DBG_OFF
>
> ############################################################
> ########################################
>
>
>
>
> Now, during scenario-1, we use ::
>
> #define TCP_MSS                 5000
> #define MEM_SIZE                4 * 1024
>
> and we receive the bytes as per the attached picture putty-cert-1.png.
>
>
> In scenario-2, we use
>
> #define TCP_MSS                 1460
> #define MEM_SIZE                14 * 1024
>
> and we receive the bytes as per the attached picture putty-cert-2.png.
>
>
>
> Note that in case of Ubuntu, there is no continuous series of 0s, so I
> suspect something is wrong in my lwiopts.h configuration in our
> embedded-SOC case.
> So, will be grateful if some light could be thrown on what parameters we
> need to tweak.
>
>
> Thanks and Regards,
> Ajay
>



-- 
Regards,
Ajay
_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to