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

Submitter:  Marco <marcoe>
Submitted:  Wed 31 May 2017 02:58:40 PM UTC
   
 
Category:  DHCP Severity:  3 - Normal
Item Group:  Change Request Status:  Invalid
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Planned 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>
Group administrator
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>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-05-31 dziegel StatusNone Invalid
        Open/ClosedOpen Closed
    2017-05-31 marcoe Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code