|
From: | address@hidden |
Subject: | Re: [lwip-devel] Receive a UDP packet on multiple PCBs ? (same port) |
Date: | Tue, 11 May 2010 21:07:23 +0200 |
User-agent: | Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; de; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 |
Stéphane Lesage wrote:
That udp_bind() in this case is a bug. It should only succeed if SO_REUSEADDR is set for all pcbs, but this is not implemented yet and someone decided to allow multiple-bind as long as that's not implemented. However, that wasn't as wise as we can now bind multiple pcbs, but not receive data on all of them.Currently, only the last PCB (socket) receives the packets. (there's no bind() problem)
Once SO_REUSEADDR (or whatever we call it) is implemented for UDP, I would think that there's no problem in adding extra code that searches for all matches and duplicates the received data if more than one match is found (and if the first match has REUSEADDR set).
However, that would have to be implemented (and properly integrated into the higher level APIs). This is a task targeted at 1.4.0: https://savannah.nongnu.org/task/?6995
The proper way is to only allow a second bind if all previous pcbs/sockets have REUSEADDR set.I don't know how an IP stack is supposed to behave in this case...
Simon
[Prev in Thread] | Current Thread | [Next in Thread] |