Ben Whitten | 23 May 2013 10:22
Picon

SMTP base64 patch, HTTPD question.

Hey,

This generates working userpass auth strings. Tested with GMX, Lavabit, Aol, Plusnet, and Yahoo. With various username/password sizes.

I am also hunting a bug in the httpserver_raw, when including SSI tags; it finds the tag, sends the preceding data, then the tag. But then the sending length is never reset so it sends the remaining page at the tag length.
As a result serving a webpage takes 2-3 seconds if its a 4K file with an SSI tag in the <title>.
The problem seems to be around :1351 where I think len is being mistaken for something else, where its actually the length of the previously sent section (last tag length). Could someone more familiar with the code take a look too?

Thanks,
Ben Whitten

--- C:/Users/bwhitten/Desktop/contrib-1.4.1/apps/smtp/smtp.c    Mon Dec 17 19:03:22 2012
+++ C:/Users/bwhitten/Desktop/contrib-1.4.1/apps/smtp/smtp - Copy.c    Thu May 23 08:51:16 2013
<at> <at> -804,8 +804,8 <at> <at>
   s8_t j;
   size_t target_idx = 0;
   size_t longer = 3 - (source_len % 3);
-  size_t source_len_b64 = source_len + longer;
-  size_t len = (((source_len_b64) * 4) / 3);
+  size_t source_len_b64 = source_len + ((longer != 3) ? longer : 0);
+  size_t len = (((source_len_b64 / 3) * 4));
   u8_t x = 5;
   u8_t current = 0;
   LWIP_UNUSED_ARG(target_len);
<at> <at> -824,7 +824,7 <at> <at>
       }
     }
   }
-  for (i = len - longer; i < len; i++) {
+  for (i = len - ((longer != 3) ? longer : 0); i < len; i++) {
     target[i] = '=';
   }
   return len;

_______________________________________________
lwip-devel mailing list
lwip-devel <at> nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-devel
rh_maillist | 10 May 2013 11:21
Picon

pbuf_header for PBUF_REF/ROM in lwip-1.3.1

We' just moving our comms protocol to run over UDP from RS232 using STM32F1 and F2 chips.  The current ST
ethernetif_input port allocates a PBUF_POOL and memcpy's the data from the DMA buffer in to it before
passing it on to netif->input to process.

We've got quite a bit of RAM and not much traffic and are looking to get away from the memcpy.  I've changed this
to allocate a PBUF_REF and then set the payload to point to the DMA buffer directly to save copying as the
processing of these packets is very quick.

This works for UDP traffic but fails for ICMP (echo requests).  The reason is that LWIP does a couple of
pbuf_header calls with -ve values while processing the header but when ICMP wants to send the reply (in
icml.c line 143), it readjusts the header backwards using pbuf_header with a positive value.

This doesn't work for PBUF_REF/ROM types as it can't safely check for underflow.  The underflow for
PBUF_RAM/POOL is checked for by comparing the new payload pointer to the pbuf pointer + sizeof(pbuf)
which can't be done as they aren't allocated in a single block.

One solution is to LWIP_ICMP_ECHO_CHECK_INPUT_PBUF_LEN but this looks like it has a bug in it in
lwip-1.3.1 as it doesn't adjust the payload pointer if it's not defined and it needs adjusting.  Do I
understand this correctly and if so, has it been fixed in a later version?

A solution we've implemented here to add an extra member to pbuf which is original_payload.  When pbufs are
allocated from POOL/RAM then this is set to payload - offset in pbuf_alloc.  For code using REF/ROM pbufs,
they set the original_payload to payload when setting up the pbuf.  Then in pbuf_header, we just check
payload >= original_payload when adjusting backwards to check for underflow.

I'm new to LWIP so just wondered what people thought of this as a solution.  I've attached the new pbuf.c and .h
for reference.  #define PBUF_HEADER_ADJUST_ALL for the new behaviour.

Cheers

Russell
Attachment (pbuf.h): application/octet-stream, 4266 bytes
Attachment (pbuf.c): application/octet-stream, 31 KiB

_______________________________________________
lwip-devel mailing list
lwip-devel <at> nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Ivan Delamer | 10 Apr 2013 18:34
Favicon

FW:

http://grandkobayashi.sakura.ne.jp/5bxcuo.php
hanhui | 4 May 2013 15:27
Picon

[bug #38886] in6_addr error

URL:
  <http://savannah.nongnu.org/bugs/?38886>

                 Summary: in6_addr error
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: hanhui03
            Submitted on: Sat May  4 13:27:55 2013
                Category: IPv6
                Severity: 3 - Normal
              Item Group: Change Request
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 
            lwIP version: CVS Head

    _______________________________________________________

Details:

struct in6_addr { 
union { 
u8_t u8_addr[16]; 
u32_t u32_addr[4]; 
} un; 
#define s6_addr un.u32_addr 
}; 
should be: 
#define s6_addr un.u8_addr 

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?38886>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/
hanhui | 4 May 2013 15:27
Picon

[task #12600] struct in6_addr error

URL:
  <http://savannah.nongnu.org/task/?12600>

                 Summary: struct in6_addr error
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: hanhui03
            Submitted on: Sat May  4 13:27:05 2013
                Category: IPv6
         Should Start On: Sat May  4 00:00:00 2013
   Should be Finished on: Sat May  4 00:00:00 2013
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
        Percent Complete: 0%
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
                  Effort: 0.00

    _______________________________________________________

Details:

struct in6_addr {
  union {
    u8_t  u8_addr[16];
    u32_t u32_addr[4];
  } un;
#define s6_addr  un.u32_addr
};

should be:

#define s6_addr  un.u8_addr

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/task/?12600>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/
hanhui | 29 Apr 2013 17:51
Picon

[bug #38853] connect() use a wrong errno

URL:
  <http://savannah.nongnu.org/bugs/?38853>

                 Summary: connect() use a wrong errno
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: hanhui03
            Submitted on: Mon Apr 29 15:51:35 2013
                Category: sockets/netconn
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 
            lwIP version: git head

    _______________________________________________________

Details:

EALREADY : A connection request is already in progress for the specified
socket.

EISCONN: The specified socket is connection-mode and is already connected.

EALREADY is NOT same as EISCONN, but lwip is only use "ERR_ISCONN" as
EALREADY.

Some software(for example Qt/Embedded) whill check EISCONN to determine
whether the connection is successful!

I suggest that add a netconn error code : ERR_ALREADY used to distinguish
these two cases.

err_t
tcp_connect(struct tcp_pcb *pcb, ip_addr_t *ipaddr, u16_t port,
tcp_connected_fn connected)
{
  if (pcb->state == ESTABLISHED) {
    return ERR_ISCONN;
  } else if (pcb->state != CLOSED) {
    return ERR_ALREADY;
  }

  ...
}

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?38853>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/
Krantip | 29 Apr 2013 07:04
Picon

[patch #8037] LWIP server fails if we connect multiple clients

URL:
  <http://savannah.nongnu.org/patch/?8037>

                 Summary: LWIP server fails if we connect multiple clients
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: krantip
            Submitted on: Mon 29 Apr 2013 05:04:17 AM GMT
                Category: None
                Priority: 7 - High
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None

    _______________________________________________________

Details:

I am using LWIP stack version 4.0.My requirement is,connect minimim 50 clients
to lwip server using single thread.
Single client server is working fine,but if i connect 2-3 clients,then after
some time,I found , tcp_write out of memory error,because of TCP_SND_QUEUELEN
gets over.
I get below error,when it shows tcp-write error.
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 3, ("tcp_write: too long queue %"U16_F" (max
%"U16_F")\n",
*************************************************************
MY opt.h settigs as below,
#define TCP_TMR_INTERVAL                250
#define TCP_SND_BUF                     5840
#TCP_MSS                                1460
#define MEM_SIZE                        64000
#define MEMP_NUM_TCP_PCB                16
#define MEMP_NUM_TCP_PCB_LISTEN         50
#define MEMP_NUM_TCP_SEG                50
#define TCP_WND                         (4 * TCP_MSS)
#define TCP_SND_QUEUELEN                ((4 * (TCP_SND_BUF) + (TCP_MSS -
1))/(TCP_MSS))
***************************************************************
My server code is as folllows,

signed int prvxMBTCPPortReceive(void *arg, struct tcp_pcb *pxPCB, struct pbuf
*p, signed int Err)
{

	unsigned char *pModbusHeader;
	u16_t len;
	signed int Error;
	tcp_nagle_disable(pxPCB);
	if( Err != ERR_OK )
	{
		return Err;
    }
    if( p == NULL )														 // If pbuf is NULL then remote end has
closed connection.
	{
		prvvMBPortReleaseClient( pxPCB );
		return ERR_OK;
    }

	len = p->tot_len;
	pModbusHeader = p->payload;

	MODTCP1 = ((struct mod_tcp_hdr1 *)pModbusHeader);
	Trans_id = MODTCP1->trans_id;
	Proto_ID = MODTCP1->proto_id;
	Len = MODTCP1->len;
	tcp_recved(pxPCB, p->len);
	tcp_tmr();

	memcpy( Comm3Buff, pModbusHeader + 6, (unsigned short) *(pModbusHeader + 5)
);
	ReceiveBuffLength3 = len - 6;
	ProcessSerialIntr3();

	MODTCP1 = ((struct mod_tcp_hdr1 *)&RxBuff[usTCPBufPos]);
	MODTCP1->trans_id = Trans_id;
	MODTCP1->proto_id = 0;
	MODTCP1->len =  htons((unsigned short)(FrameLength3-1));

	memcpy( &RxBuff[usTCPBufPos + 6], Comm3Buff, (unsigned short) (FrameLength3 -
1) );

	if( (Error = tcp_write( pxPCB, RxBuff, (unsigned short) (6+FrameLength3-1),
01 )) == ERR_OK )
	{
		( void )tcp_output( pxPCB );								//Make sure data gets sent immediately
	}
	else
	{
		prvvMBPortReleaseClient( pxPCB );							// Drop the connection in case of an
write error.
	}
	usTCPBufPos = 0;										// Reset the buffer
	pbuf_free( p );
	return ERR_OK;
}

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?8037>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/
Grant Erickson | 27 Apr 2013 21:23
Picon

[patch #8034] autoip: added autoip_remove_struct

URL:
  <http://savannah.nongnu.org/patch/?8034>

                 Summary: autoip: added autoip_remove_struct
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: marathon96
            Submitted on: Sat 27 Apr 2013 07:23:52 PM GMT
                Category: IPv4
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None

    _______________________________________________________

Details:

From: Grant Erickson <marathon96 <at> gmail.com>
Date: Sat, 27 Apr 2013 12:20:29 -0700
Subject: [PATCH] autoip: add autoip_remove_struct

Added previously-missing autoip_remove_struct as a companion to
autoip_set_struct and to parallel dhcp_{set,remove}_struct.

---
 src/include/ipv4/lwip/autoip.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/include/ipv4/lwip/autoip.h b/src/include/ipv4/lwip/autoip.h
index e62b72e..b9f1873 100644
--- a/src/include/ipv4/lwip/autoip.h
+++ b/src/include/ipv4/lwip/autoip.h
 <at>  <at>  -94,6 +94,9  <at>  <at>  struct autoip
 /** Set a struct autoip allocated by the application to work with */
 void autoip_set_struct(struct netif *netif, struct autoip *autoip);

+/** Remove a struct autoip previously set to the netif using
autoip_set_struct() */
+#define autoip_remove_struct(netif) do { (netif)->autoip = NULL; } while (0)
+
 /** Start AutoIP client */
 err_t autoip_start(struct netif *netif);

    _______________________________________________________

File Attachments:

-------------------------------------------------------
Date: Sat 27 Apr 2013 07:23:52 PM GMT  Name: autoip_remove_struct.patch  Size:
927B   By: marathon96

<http://savannah.nongnu.org/patch/download.php?file_id=27963>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?8034>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/
Liam | 25 Apr 2013 23:48
Picon

[patch #8030] Correct spelling of received

URL:
  <http://savannah.nongnu.org/patch/?8030>

                 Summary: Correct spelling of received
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: morepork
            Submitted on: Thu 25 Apr 2013 09:48:14 PM GMT
                Category: None
                Priority: 3 - Low
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None

    _______________________________________________________

Details:

diff --git a/src/core/tcp.c b/src/core/tcp.c
index a0cbb15..8690cd2 100644
--- a/src/core/tcp.c
+++ b/src/core/tcp.c
 <at>  <at>  -667,7 +667,7  <at>  <at>  tcp_recved(struct tcp_pcb *pcb, u16_t len)
     tcp_output(pcb);
   }

-  LWIP_DEBUGF(TCP_DEBUG, ("tcp_recved: recveived %"U16_F" bytes, wnd %"U16_F"
(%"U16_F").\n",
+  LWIP_DEBUGF(TCP_DEBUG, ("tcp_recved: received %"U16_F" bytes, wnd %"U16_F"
(%"U16_F").\n",
          len, pcb->rcv_wnd, TCP_WND - pcb->rcv_wnd));
 }

    _______________________________________________________

File Attachments:

-------------------------------------------------------
Date: Thu 25 Apr 2013 09:48:14 PM GMT  Name:
0001-Corrected-spelling-of-received.patch  Size: 739B   By: morepork

<http://savannah.nongnu.org/patch/download.php?file_id=27941>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?8030>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/
Simon Goldschmidt | 24 Apr 2013 22:34
Picon

[task #12586] Release 1.5.0 beta1

URL:
  <http://savannah.nongnu.org/task/?12586>

                 Summary: Release 1.5.0 beta1
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: goldsimon
            Submitted on: Mi 24 Apr 2013 20:34:47 GMT
                Category: Documentation
         Should Start On: Mi 24 Apr 2013 00:00:00 GMT
   Should be Finished on: Mi 24 Apr 2013 00:00:00 GMT
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
        Percent Complete: 0%
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
                  Effort: 0.00

    _______________________________________________________

Details:

This should be a place to summarize what should be done for a first 1.5.0 beta
(1st "official" release including IPv6 support).

Here's what I have on my list:
- add a "planned release" for 1.5.0 beta1 check all IPv6-related bug
reports/patches (these should only include fixes, not addons, which can be
done in a later beta or release)
- make the example ports (linux + win32) work correctly with IPv6 (if it
doesn't already work)
- make the contrib apps work with IPv6, so people can see how IPv6 is used

Please feel free to add your comments on what should go in.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/task/?12586>

_______________________________________________
  Nachricht gesendet von/durch Savannah
  http://savannah.nongnu.org/
Jiri Engelthaler | 22 Apr 2013 22:54
Picon

[patch #8027] Completed HW checksuming for IPv4 and IPv6 ICMP's

URL:
  <http://savannah.nongnu.org/patch/?8027>

                 Summary: Completed HW checksuming for IPv4 and IPv6 ICMP's
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: engy
            Submitted on: Mon 22 Apr 2013 08:54:13 PM GMT
                Category: IPv4
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None

    _______________________________________________________

Details:

Hello. I have completed generating and checking of checksum in HW by disabling
options CHECKSUM_CHECK_ICMP, CHECKSUM_CHECK_ICMP6 and CHECKSUM_GEN_ICMP6. 
Tested on ARM ST32F407 on both IPv4 and IPv6.

Regards
  Jiri Engelthaler

    _______________________________________________________

File Attachments:

-------------------------------------------------------
Date: Mon 22 Apr 2013 08:54:13 PM GMT  Name: hw_checksum.patch  Size: 7kB  
By: engy

<http://savannah.nongnu.org/patch/download.php?file_id=27929>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?8027>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/

Gmane