buglwIP - A Lightweight TCP/IP stack - Bugs: bug #51149, UDP and DHCP server

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #51149: UDP and DHCP server

Submitted by:  Marco <marcoe>
Submitted on:  Wed 31 May 2017 02:58:40 PM UTC  
 
Category: DHCPSeverity: 3 - Normal
Item Group: Change RequestStatus: Invalid
Privacy: PublicAssigned to: None
Open/Closed: ClosedPlanned Release: None
lwIP version: 2.0.2

Thu 01 Jun 2017 07:42:58 AM UTC, comment #2:

Hello Dirk,
thank you for your answer, solution 1 is OK for us.

Sorry for posting in the wrong section.

Marco <marcoe>
Wed 31 May 2017 04:59:42 PM UTC, comment #1:

Two solutions:

1) Upgrade to git head and use udp_bind_netif()
2) Use SO_REUSE+SO_REUSE_RXTOALL and check for incoming netif for yourself by comparing ip_data.current_input_netif to desired value

Answer is valid for callback API. udp_bind_netif() is not exported via netconn/sockets yet.

I close the bug. Please reopen if you still think there is a bug in lwip. Otherwise, please create a task for a missing feature.

Dirk Ziegelmeier <dziegel>
Project Member
Wed 31 May 2017 02:58:40 PM UTC, original submission:

Hello guys,
we have one device with 3 network cards:1 ethernet, 1 wifi sta and 1 wifi access point. We have developed one dhcp server and configured it over the ethernet and the wifi access point interfaces. The dhcp server creates a new udp pcb and bind the udp to the local ip address of the interface and the port 67 so we have 2 different udp_pcb, one bound to the ethernet and one to the wifi access point interface, but the function udp_input() delivers the received broadcast packet only to one pcb because :

(taken from core/udp.c)
/* Iterate through the UDP pcb list for a matching pcb.
* 'Perfect match' pcbs (connected to the remote port & ip address) are
* preferred. If no perfect match is found, the first unconnected pcb that
* matches the local port and ip address gets the datagram. */

How we can delivery the incoming packet to all or almost the correct pcb?

I see two possible solutions:

1. In udp_input() check the source and destination port and if are 68/67 match the pcb bound to the same address of the incoming network interface.
2. Add a method to retrieve in the udp recv callback the source interface for the last packet.

Some one have a better solutions?

Marco <marcoe>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by dziegel (Posted a comment)
  • -unavailable- added by marcoe (Submitted the item)
  • -unavailable- added by marcoe
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 31 May 2017 04:59:42 PM UTCdziegelStatusNone=>Invalid
      Open/ClosedOpen=>Closed
    Wed 31 May 2017 02:58:40 PM UTCmarcoeCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1