Hi,
Please forgive me if this is a stupid question.
I am writing a DHCP server and using udp_recv functionality to handle
incoming broadcast messages on a udp pcb.
I have enabled the BROADCAST flag on the PCB and I can receive the
incoming packets just fine. The udp pcb is bound to ip_addr_any.
When it comes time to respond to the DHCP discover message, I must use
udp_sendto_if function. Without specifying the interface, any send fails
with a routing error because all addresses associated with this first
message are either 0.0.0.0 or 255.255.255.255 (the only genuine address
available is the source hardware address, which is useless for
determining the associated netif).
Here is where I am confused. In order to call udp_sendto_if, I need to
know the netif. If I look at the udp_input function, the netif is
available there and could easily be passed as a simple parameter to the
recv callback function.
Any time I get the urge to modify lwip itself my first thought is, I
must be missing something simple, or doing something wrong. I assume
there is some foundational piece of information I am missing?