ipNetToMediaTable

Hello Everyone!
I have written a simple C program to retrieve the ipNetToMediaTable on the QNX RTOS.
I’m making use of sysctl( ) for this purpose.
The first sysctl( ) call is being made as follows,
int mib[6];
size_t needed;

mib[0] = CTL_NET;
mib[1] = PF_ROUTE;
mib[2] = 0;
mib[3] = AF_INET;
mib[4] = NET_RT_FLAGS;
mib[5] = RTF_LLINFO;

if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0)
printf(“route-sysctl-estimate”);

Now the problem is that ,When this first call to sysctl gets executed the value of needed comes out to be 0,which actually should be the size of available data.Because of this value of needed ,I’m not able to use these calls further to get the ipNetToMediaTable.
Can anyone help me in sorting out this problem?
Thanking in advance for any kind help.

regards
Nitin

If you are running 6.1, or 6.2 with the ‘external_arp’ option
(io-net -ptcpip external_arp …), then 0 is the real value.
If you are running 6.2 with default args, you should get
a value more in line with what you expect.

-seanb

Nitin <nitinm4u@hotmail.com> wrote:
: Hello Everyone!
: I have written a simple C program to retrieve the ipNetToMediaTable on the QNX RTOS.
: I’m making use of sysctl( ) for this purpose.
: The first sysctl( ) call is being made as follows,
: int mib[6];
: size_t needed;

: mib[0] = CTL_NET;
: mib[1] = PF_ROUTE;
: mib[2] = 0;
: mib[3] = AF_INET;
: mib[4] = NET_RT_FLAGS;
: mib[5] = RTF_LLINFO;

: if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0)
: printf(“route-sysctl-estimate”);

: Now the problem is that ,When this first call to sysctl gets executed the value of needed comes out to be 0,which actually should be the size of available data.Because of this value of needed ,I’m not able to use these calls further to get the ipNetToMediaTable.
: Can anyone help me in sorting out this problem?
: Thanking in advance for any kind help.

: regards
: Nitin