[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] Re: [lwip] changes in IP/UDP for DHCP
From: |
leon . woestenberg |
Subject: |
[lwip-users] Re: [lwip] changes in IP/UDP for DHCP |
Date: |
Wed, 08 Jan 2003 22:05:33 -0000 |
Hello Adam,
> > 1.2) Changes to udp.c for DHCP
> >
> > --begin--
> >
> > for(pcb = udp_pcbs; pcb != NULL; pcb = pcb->next) {
> > ...
> > }
> > #if (LWIP_DHCP > 0)
> > // pcb that accepts DHCP msg from DHCP server port?
> > if((pcb->local_port == udphdr->dest) && (udphdr->src ==
> > DHCP_SERVER_PORT))
> > {
> > return;
> > }
> > #endif
> > }
> >
> > --end--
> Is this really necessary? The DHCP client should have a UDP PCB in the
list
> anyway (with the IP addresses left unspecified, i.e.,
ip_addr_isany(pcb->ips)
> == 1).
>
You are right. The above code, is not needed.
I used:
udp_bind(state->pcb, IP_ADDR_ANY, DHCP_CLIENT_PORT);
udp_connect(state->pcb, IP_ADDR_ANY, DHCP_SERVER_PORT);
the problem is, IP_ADDR_ANY is defined 0, interpreted NULL by
udp_connect, and so, not set. It remains the old value.
#define IP_ADDR_ANY 0
#define IP_ADDR_BROADCAST (&ip_addr_broadcast)
So, what is a neat way of connecting an udp_pcb to IP_ADDR_ANY,
Would #define IP_ADDR_BROADCAST (&ip_addr_any) do the
trick nicely, or should I do a ip_set_addr on the
destination address of the udp?
Also, as a small sidenote, I found it confusing having
pcb->local_* and pcb->dest_*.
More appropriate are pcb->local_* and pcb->remote_* which
are location based identifiers. dest and src are always
respective to a communication direction.
Regards, Leon.
[This message was sent through the lwip discussion list.]
- [lwip-users] Re: [lwip] changes in IP/UDP for DHCP,
leon . woestenberg <=
- [lwip-users] Re: [lwip] changes in IP/UDP for DHCP, Leon Woestenberg, 2003/01/08
- [lwip-users] Re: [lwip] changes in IP/UDP for DHCP, Adam Dunkels, 2003/01/08
- [lwip-users] Re: [lwip] changes in IP/UDP for DHCP, Adam Dunkels, 2003/01/08
- [lwip-users] Re: [lwip] changes in IP/UDP for DHCP, Horst Garnetzke, 2003/01/09
- [lwip-users] Re: [lwip] changes in IP/UDP for DHCP, Adam Dunkels, 2003/01/09