lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] dhcp bug fix


From: Paul C
Subject: Re: [lwip-users] dhcp bug fix
Date: Thu, 25 Nov 2004 21:49:34 +1030

Hi Leon

On Thu, 25 Nov 2004 12:06:14 +0100, "Leon Woestenberg"
<address@hidden> said:
> Hello Paul,
> 
> please make sure you are sending plain text to the mailing list and use
> unified
> diff patches (diff -Nur will do this).
> 

Sorry about that.

> > In dhcp_decline the netif is not configured so udp_send fails with ERR_RTE.
> >
> Could you deduce where this ERR_RTE was created?
> 
> udp_send() calls upon ip_route() which should return the default
> interface
> where the default gateway is on.
> 

When the netif is not configured when it comes to find the netif to use
for 
output the test for local network fails so it tries to use the gateway
(which
is not configured) so it gives up ERR_RTE.  I'm not quite sure why the
sendto avoids
this trap.



> > This patch a copy of how the dhcp request is sent worked for me.
> > 
> > 682,683c682,683
> > <     udp_connect(dhcp->pcb, &dhcp->server_ip_addr, DHCP_SERVER_PORT);
> > <     udp_send(dhcp->pcb, dhcp->p_out);
> > ---
> > >     udp_connect(dhcp->pcb, IP_ADDR_ANY, DHCP_SERVER_PORT);
> > >     udp_sendto(dhcp->pcb, dhcp->p_out, IP_ADDR_BROADCAST, 
> > > DHCP_SERVER_PORT);
> 
> The last line is indeed a good fix, as per RFC 2131 (DHCP) section
> 4.4.4, we
> should broadcast DECLINE messages.
> 
> The first line connecting to the ANY address (0.0.0.0) seems strange,
> but it
> might be a legal or illegal workaround to the fact that udp_send()
> returns
> ERR_RTE as you say. 
> 
> I do not see the need for the connect now that we use sendto(). If you
> remove
> it completely, does it still work?
> 

I'll try that tomorrow.

Paul




reply via email to

[Prev in Thread] Current Thread [Next in Thread]