retriving routing info

Hi,

I’m trying to access the qnx 6.1 routing table trough sockets.
After reading the BSD and QNX route help I’ve wrote the following code:

int main()
{
if_msghdr msgHdr;
ssize i;
int sockfd=0;

sockfd = socket(PF_ROUTE, SOCK_RAW, AF_UNSPEC);
if (sockfd < 0){
retturn -1;
}
memset(&msgHdr, 0, sizeof(msgHdr));
msgHdr.ifm_type = RTM_IFINFO;
msgHdr.ifm_msglen = sizeof(msgHdr);
i = write(sockfd, &msgHdr, sizeof(msgHdr));
printf(“i = %d”, i);
return 0;
}

The result is: i = -1
errno = 243

errno 243 is Protocol not supported.

Whats wrong here?


Benzy Gabay
R&D
Everbee Wireless
mailto:bgabay@everbeewireless.com

Benzy Gabay <bgabay@everbee.com> wrote:
: Hi,

: I’m trying to access the qnx 6.1 routing table trough sockets.
: After reading the BSD and QNX route help I’ve wrote the following code:

: int main()
: {
: if_msghdr msgHdr;

You need to fill in a ‘struct rt_msghdr’.

-seanb

: ssize i;
: int sockfd=0;

: sockfd = socket(PF_ROUTE, SOCK_RAW, AF_UNSPEC);
: if (sockfd < 0){
: retturn -1;
: }
: memset(&msgHdr, 0, sizeof(msgHdr));
: msgHdr.ifm_type = RTM_IFINFO;
: msgHdr.ifm_msglen = sizeof(msgHdr);
: i = write(sockfd, &msgHdr, sizeof(msgHdr));
: printf(“i = %d”, i);
: return 0;
: }

: The result is: i = -1
: errno = 243

: errno 243 is Protocol not supported.

: Whats wrong here?
: –
: ----------------------------------------------
: Benzy Gabay
: R&D
: Everbee Wireless
: mailto:bgabay@everbeewireless.com