network interface ioctl()s problem

bridged with qdn.public.qnxrtp.porting
Post Reply
Guest

network interface ioctl()s problem

Post by Guest » Sun Sep 09, 2001 10:16 pm

Hello all,

developing under QNX RTP 6.1.0, my application gathers the IP broadcast
addresses of all interfaces.

I'm traversing through the interface list as in the 4.4BSD way explained
in section 5.9 of An Advanced 4.4 BSD IPC Tutorial at:

http://www-users.cs.umn.edu/~bentlema/u ... c/ipc.html

However, proceeding through the ifconf structure's buffer, containing an ifreq
structure for each interface, I fail to traverse through the buffer ifreq
structure's properly (wrong offsets...)

for (n; --n >= 0; ifr+=sizeof(struct ifreq))

A snippet of source code in the QNX Knowledge database issue 10246 does a
similar thing, but uses a different way of traversing through the buffer,
which seems to work ok.

for (n; --n >= 0; ifr= (struct ifreq*)((char *)ifr + ifr->ifr_addr.sa_len + IFNAMSIZ))

I have no clue as why this other method is the better way.

My source code is small and online, at:

http://www.esrac.ele.tue.nl/~leon/qnx/interfaces/

The second problem I'm encountering, is that once a get the ifflags using ioctl(), the
ifreq's seem to become corrupted.

I hope someone can enlighten me,

Leon Woestenberg.
#/** PhEDIT attribute block
#-11:16777215
#0:649:monospace10:-3:-3:0
#649:694:monospace10:0:-1:0
#694:868:monospace10:-3:-3:0
#868:957:monospace10:0:-1:0
#957:1285:monospace10:-3:-3:0
#** PhEDIT attribute block ends (-0000231)**/

Post Reply

Return to “qdn.public.qnxrtp.porting”