that code looks like my old lwIP 1.4.0 which did work with DHCP, but if you want to move to lwIP 2.0, I would recommend starting with stepl's lwIP 2.0.2 zip file in the first post of this thread.
I modified my code to match stepl's example. The DHCP went one step further but is not completing. DHCP discover is detected by router. It did send back an OFFER to client (my Teensy). The client is NOT making a DHCP Request to the router. Not sure what is wrong here. Below is my debug log. Can any of the lwip experts help me? Perhaps some setting in lwipopts.h file?
I am using lwip 2.0.3 stable version.
udp_bind(ipaddr = 0.29404.51629.35565, port = 0)
udp_bind: bound to 0.29404.51797.35565, port 0)
netif: IP address of interface netif: netmask of interface netif: GW address of interface netif: added interface addr 0.23140.35341.35565 netmask 0.23140.35375.35565 gw 0.23140.35409.35565
netif: setting default interface netif status changed: ip 0dhcp_start(netif=0) dg44541
dhcp_start(): mallocing new DHCP client
dhcp_start(): allocated dhcp
dhcp_start(): starting DHCP configuration
udp_bind(ipaddr = 0.29320.51629.35565, port = 0)
udp_bind: bound to 0.29320.51797.35565, port 0)
udp_connect: connected to 0.29320.52493.35565, port 0)
MPU_RGDAAC0 0x337DF7DF
SIM_SCGC2 0x201
SIM_SOPT2 0x23F10C2
ENET_PALR 0x4E9E504
ENET_PAUR 0x68EB8808
ENET_EIR 0x0
ENET_EIMR 0x2000000
ENET_ECR 0xF0000112
ENET_MSCR 0x1E
ENET_MRBR 0x640
ENET_RCR 0x45F2D124
ENET_TCR 0x104
ENET_TACC 0x19
ENET_RACC 0x81
ENET_MMFR 0x0
udp_bind(ipaddr = 0.29236.51629.35565, port = 0)
udp_bind: bound to 0.29236.51797.35565, port 0)
ethernet_input: dest:0hx:0hx:0hx:0hx:0hx:0hx, src:0hx:0hx:0hx:0hx:0hx:0hx, type:0
etharp_update_arp_entry: 0.65296.60151.46412 - c0:a8:00:6f:a4:02
etharp_find_entry: found empty entry 0
etharp_find_entry: no empty entry found and not allowed to recycle
etharp_input: incoming ARP request
etharp_input: we are unconfigured, ARP request ignored.
dhcp_discover()
transaction id xid(0)
dhcp_discover: making request
dhcp_discover: realloc()ing
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, DHCP_SERVER_PORT)
udp_send: added header in given pbuf 0
udp_send: sending datagram of length 0
udp_send: UDP packet length 0
udp_send: UDP checksum 0x0000
udp_send: ip_output_if (,,,,0x00,)
ethernet_output: sending packet 0
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 0 msecs
enet link status: 0etharp_timer
etharp_timer
etharp_timer
etharp_timer
etharp_timer
etharp_timer
etharp_timer
dhcp_fine_tmr(): request timeout
dhcp_timeout()
dhcp_timeout(): restarting discovery
dhcp_discover()
transaction id xid(0)
dhcp_discover: making request
dhcp_discover: realloc()ing
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, DHCP_SERVER_PORT)
udp_send: added header in given pbuf 0
udp_send: sending datagram of length 0
udp_send: UDP packet length 0
udp_send: UDP checksum 0x0000
udp_send: ip_output_if (,,,,0x00,)
ethernet_output: sending packet 0
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 0 msecs
etharp_timer
etharp_timer