I am trying to verify the Ethernet devices on a device are working correctly. I’m running the command:
ifconfig("interfaceName dhcp")
for each ethernet interface.
What I would also like to do is verify that each device got an ip address as well. I know I can just run ‘ifconfig’ by itself and look at the output, but I’m writing automated test code. So is there a function that can return the ip address of a specific interface in VxWorks?
I believe ifAddrGet() in ifLib.h may be what you’re looking for. The first argument takes an interface name and the second argument takes a buffer, into which the address will be returned.
I haven’t tested the following on an actual target, but it should be a start toward what you need: