This PR is to fix the issues in LwIP for AutoIP which is required for passing Bonjour Conformance Test for mDNS. Following gives the summary of the changes/fixes added.
Changes:
1. Following issues are fixed in LwIP for AutoIP.
- Fixed bug in max conflict rate limiting: According to RFC section RFC 3927 Section 2.2.1 conflict probe interval should be increased to 60 seconds, once conflict count reaches after MAX_CONFLICTS (i.e., 10) counts. The initial value of 'autoip->tried_llipaddr' is 0. Hence the probe interval (i.e., autoip->ttw) should be increased to 60 secs when 'autoip->tried_llipaddr >= MAX_CONFLICTS'
- Added code to free 'autoip' client in autoip_stop() API: New 'autoip' client is allocated in autoip_start() API, and the client is not freed during autoip_stop(). This would result in memory leak, if not freed. Updated autoip_stop() API to take care of releasing the memory allocated for 'autoip' client.
2. Introduced a configurable macro "MBED_CONF_LWIP_DHCP_TIMEOUT" in "lwipopts.h" to configure DHCP timeout based on the usecase requirement. For example: bonjour conformance test would need a DHCP timeout value which is grater than 320 secs to run mDNS probing test to verify protocol compilance of the implementation.
Tested the fixes using Bonjour Conformance Test tool Version 1.5.0 for IPv4. It has successfully passed Bonjour Conformance Test.
When flashing a binary STLink won't skip writing padding which happens
to be the same value as flash's erase value. STM32L4 based targets
have an additional 8-bit of embedded ECC for each 64-bit word of data.
The initial value, when a sector is erased, for the ECC bits is 0xFF.
When you write the erase value to a given address these bits gets
modified to something different due to the ECC algoritm in use. The
visible bits are intact but difference in ECC value prevents flipping
any 1's to 0's. Only way to proceed is to erase the whole sector.
Changes:
1. Following issues are fixed in LwIP for AutoIP.
a) Fixed bug in max conflict rate limitting.
- According to RFC section RFC 3927 Section 2.2.1 conflict probe interval
should be increased to 60 seconds, once conflict count reaches after
MAX_CONFLICTS (i.e., 10) counts.
- The initial value of 'autoip->tried_llipaddr' is 0. Hence the probe
interval (i.e., autoip->ttw) should be increased to 60 secs
when 'autoip->tried_llipaddr >= MAX_CONFLICTS'
b) Added code to free 'autoip' client in autoip_stop() API.
- New 'autoip' client is allocated in autoip_start() API, and the client
is not freed during autoip_stop(). This would result in memory leak
if not freed.
- Updated autoip_stop() API to take care of releasing the memory allocated
for 'autoip' client.
2. Introduced a configurable macro "MBED_CONF_LWIP_DHCP_TIMEOUT" in "lwipopts.h"
to configure DHCP timeout based on the usecase requirement. For example:
bonjour conformance test would need a DHCP timeout value which is grater than
320 secs to run mDNS probing test to verify protocol compilance of the implementation.
The default computation assumes that a flash sector is several times
larger than a flash page. On PSoC 6 targets this is not the case
(the two values are the same) so the computed size is too small.
This could cause incomplete data retrieval and mismatch when reading
data in more than one chunk, because every chunk would be read to the
same location at the beginning of the output buffer.
IAR compilation fails at `_fs = { 0 };` due to
```
[Error] FATFileSystem.cpp@285,0: [Pe029]: expected an expression
```
Changing that object initializer list instead, as that seems
to pass IAR compilation, too.
Changed original memset to object initialiser list based on review
feedback from Kevin Bracey.