Skip to content

Commit a4aeee9

Browse files
author
Sathish Kumar Mani
committed
mbed-os/LwIP changes and fixes in auto-IP for Bonjour Conformance Test
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.
1 parent fe252a7 commit a4aeee9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

features/lwipstack/lwip/src/core/ipv4/lwip_autoip.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static err_t autoip_arp_announce(struct netif *netif);
9595
static void autoip_start_probing(struct netif *netif);
9696

9797
/* static variables */
98-
static u8_t is_autoip_alloced = 0; /* Set when 'struct autoip' is allocated dynamically and assigned to 'netif' */
98+
static u8_t is_autoip_allocated = 0; /* Set when 'struct autoip' is allocated dynamically and assigned to 'netif' */
9999

100100
/**
101101
* @ingroup autoip
@@ -281,7 +281,7 @@ autoip_start(struct netif *netif)
281281
("autoip_start(): could not allocate autoip\n"));
282282
return ERR_MEM;
283283
}
284-
is_autoip_alloced = 1;
284+
is_autoip_allocated = 1;
285285
/* store this AutoIP client in the netif */
286286
netif_set_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_AUTOIP, autoip);
287287
LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE, ("autoip_start(): allocated autoip"));
@@ -358,12 +358,12 @@ autoip_stop(struct netif *netif)
358358
if (autoip != NULL) {
359359
autoip->state = AUTOIP_STATE_OFF;
360360
/* If autoip is dynamically allocated in start, free autoip structure and reset autoip index in netif */
361-
if (is_autoip_alloced) {
361+
if (is_autoip_allocated) {
362362
/* Reset the auto IP index and then free autoip structure */
363363
netif_set_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_AUTOIP, NULL);
364364
mem_free(autoip);
365365
autoip = NULL;
366-
is_autoip_alloced = 0;
366+
is_autoip_allocated = 0;
367367
} else {
368368
autoip->tried_llipaddr = 0;
369369
}

0 commit comments

Comments
 (0)