Jiang zhou
2003-11-24 07:32:33 UTC
Hi,all
I want to get a IP address from DHCP server when the vxworks startup. The
vxworks is saved in flash.
In usrAppInit function, I start the net driver, get the IP address from DHCP
server and config this IP address to the net interface. The get IP address
code come from the docs.
pIf = ifunit ("secEnd0"); /* Access network device. */
/* Initialize lease variables for automatic configuration. */
pLeaseCookie = dhcpcInit (pIf, TRUE); /*or FALSE when I config a another ip
address for debug this DHCP function*/
if (pLeaseCookie == NULL)
return (ERROR);
/* Set any lease options here. */
dhcpcOptionAdd (pLeaseCookie, _DHCP_LEASE_TIME_TAG, 4, 1800);
result = dhcpcBind (pLeaseCookie, TURE);
if (result != OK)
return (ERROR); /*Here I get error result and return*/
But I find the DHCP has release the ip address for this request.
I have used dhcpcEventHookAdd to add a hook and use Asynchronous stlye by
set FALSE in bind call. In the hook function, I get a error message when
I get information from this cookie. The error message is no_bind.
Can someone tell me why? I have read a post in this newsgroup, but there is
no help on this.
More when I build the vxworks image, it ocurs conflict when I add DHCPV4
runtime client component. the conflict componets are BOOTP client, DHCP
client timestamp setup and removal. I have remove all of them when I build
the this test vxworks image.
Thank you
I want to get a IP address from DHCP server when the vxworks startup. The
vxworks is saved in flash.
In usrAppInit function, I start the net driver, get the IP address from DHCP
server and config this IP address to the net interface. The get IP address
code come from the docs.
pIf = ifunit ("secEnd0"); /* Access network device. */
/* Initialize lease variables for automatic configuration. */
pLeaseCookie = dhcpcInit (pIf, TRUE); /*or FALSE when I config a another ip
address for debug this DHCP function*/
if (pLeaseCookie == NULL)
return (ERROR);
/* Set any lease options here. */
dhcpcOptionAdd (pLeaseCookie, _DHCP_LEASE_TIME_TAG, 4, 1800);
result = dhcpcBind (pLeaseCookie, TURE);
if (result != OK)
return (ERROR); /*Here I get error result and return*/
But I find the DHCP has release the ip address for this request.
I have used dhcpcEventHookAdd to add a hook and use Asynchronous stlye by
set FALSE in bind call. In the hook function, I get a error message when
I get information from this cookie. The error message is no_bind.
Can someone tell me why? I have read a post in this newsgroup, but there is
no help on this.
More when I build the vxworks image, it ocurs conflict when I add DHCPV4
runtime client component. the conflict componets are BOOTP client, DHCP
client timestamp setup and removal. I have remove all of them when I build
the this test vxworks image.
Thank you