Obtaining a MAC address on VxWorks 6.8
I'm trying to solve another problem , but I'm stuck with getting MAC addresses on VxWorks 6.8 .
With muxIoctl()
I am not getting the correct result:
/* Binding the cookie */
PROTO_COOKIE muxCookie = muxBind( ... ); /* Binding network service <-> end */
/*
* Error handling etc.
* [...]
*/
/* Getting the the address */
char result[6];
STATUS status = muxIoctl(muxCookie, EIOCGADDR, result); /* ioctl the device address */
if( status != OK )
{
/* Error handling */
}
else
{
/* ioctl() was Ok, print 'result' */
}
What looks good to me is not in reality. As a result, the muxIoctl()
buffer does not contain the corresponding MAC addres, instead it looks something like this (tested on two devices):
Device #1: 00 00 00 00 0A 00
Device #2: 00 00 00 00 0B 00
^
|
Every byte is 0, with the exception of these
Both devices have a valid MAC address, this can be seen either with ifconfig
or with the transmitted packets. The interfaces (as mentioned above) work and work fine.
Receiving a cookie through muxDevAcquire()
(or dropped out endFindByName()
) instead of using one of them muxBind()
has the same result.
Also: muxDevExists()
returns TRUE
, and other "hacky" code doesn't work either (however it returns values as above):
const char* devName = ...
int unit = ...
char result[6];
END_OBJ* end = endFindByName(devName, unit);
STATUS status = end->pFuncTable->ioctl(end, EIOCGADDR, result);
Btw. other controls over muxIoctl()
in the same location work very well.
The devices mentioned above use dtsec, which also work fine, with one exception: the corresponding case dtsecEndIoctl()
- base ioctl()
for delegates muxIoctl()
- doesn't set the address! It only executes once on system boot (otherwise it copies the bytes above)!
Since EIOCGADDR
of is dtsecEndIoctl()
not much larger than the a bcopy()
of pDrvCtrl->dtsecAddr
( pDrvCtrl
= muxCookie
, cast to DTSEC_DRV_CTRL*
!?), It looks like a problem to muxCookie
me. However, the cookie works fine every time and everywhere - expected here (side note: not tested for etsec yet).
Long explanation, short question: How to fix this, respectively, how to get the MAC address?
Other discussions related to this issue:
- http://compgroups.net/comp.os.vxworks/read-mac-address-on-vxworks-6.8/1115852
- https://groups.google.com/forum/?_escaped_fragment_=topic/comp.os.vxworks/djh_jH1I0Uk#!topic/comp.os.vxworks/djh_jH1I0Uk
(Everyone doesn't work)
[Update]: Etsec muxIoctl()
uses correct MAC, dtsec wit does not work as above.
source to share
No one has answered this question yet
Check out similar questions: