SIOCADDRT failed on QNX 6.2

bridged with qdn.public.ddk.network
Post Reply
Beth

SIOCADDRT failed on QNX 6.2

Post by Beth » Wed Jun 25, 2003 6:35 pm

I use the following code to add host route to the routing table, it works on
QNX 6.1a, but failed on QNX 6.2 with error message "error is: 103, Operation
not supported". Any idea why?

#include <net/route.h>
#include <sys/sockio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <string.h>
#include <netinet/in.h>
#include <arpa/inet.h>


int main(int argc, char * argv[])
{
int sock;
int rc = 0;
struct ortentry rt;
struct sockaddr_in *rt_gateway;
struct sockaddr_in *rt_dst;
struct sockaddr_in *rt_netmask;

/* add host to gw */

char ipbuf[30]="10.3.247.19";
char gwbuf[30]="10.3.38.1";
char mskbuf[30]="255.255.255.255";
int cmd = SIOCADDRT;

/* delete host to gw */
/*
char ipbuf[30]="10.3.247.19";
char gwbuf[30]="";
char mskbuf[30]="";
int cmd = SIOCDELRT;
*/

sock = socket( AF_INET, SOCK_DGRAM, 0 );
if ( sock < 0 )
return sock;

memset( &rt, 0, sizeof(rt) );

rt.rt_flags = RTF_HOST | RTF_UP;

rt_gateway = (struct sockaddr_in *)&rt.rt_gateway;
rt_dst = (struct sockaddr_in *)&rt.rt_dst;
rt_netmask = (struct sockaddr_in *)&rt.rt_netmask;

rt_gateway->sin_family = AF_INET;
rt_dst->sin_family = AF_INET;
rt_netmask->sin_family = AF_INET;

rt_gateway->sin_len = sizeof(rt.rt_gateway);
rt_dst->sin_len = sizeof(rt.rt_dst);
rt_netmask->sin_len = sizeof(rt.rt_netmask);

rt_gateway->sin_addr.s_addr = ntohl(inet_network(gwbuf));
rt_dst->sin_addr.s_addr = ntohl(inet_network(ipbuf));
rt_netmask->sin_addr.s_addr = ntohl(inet_network(mskbuf));

if ( (rc = ioctl( sock, cmd, &rt )) == -1 ) {
printf ( "error is: %d, %s \n", errno, strerror(errno) );
}
close( sock );

return rc;
}

Sean Boudreau

Re: SIOCADDRT failed on QNX 6.2

Post by Sean Boudreau » Wed Jun 25, 2003 7:10 pm

Beth <id@net.com> wrote:
I use the following code to add host route to the routing table, it works on
QNX 6.1a, but failed on QNX 6.2 with error message "error is: 103, Operation
not supported". Any idea why?
SIOCADDRT isn't supported by the full stack.

-seanb

Beth

Re: SIOCADDRT failed on QNX 6.2

Post by Beth » Wed Jun 25, 2003 9:18 pm

It was supported on QNX 6.1 full stack and not on QNX6.2?
What is the alternative for SIOCADDRT and SIOCDELRT on QNX 6.2 full stack?
What I need is to add/del route to host programmatically.

Thanks,
-Beth

"Sean Boudreau" <seanb@node25.ott.qnx.com> wrote in message
news:bdcs3q$31r$1@nntp.qnx.com...
Beth <id@net.com> wrote:
I use the following code to add host route to the routing table, it
works on
QNX 6.1a, but failed on QNX 6.2 with error message "error is: 103,
Operation
not supported". Any idea why?

SIOCADDRT isn't supported by the full stack.

-seanb

OS Support

Re: SIOCADDRT failed on QNX 6.2

Post by OS Support » Thu Jun 26, 2003 12:55 pm

See the following link for a description of packet routing and
example source code that shows how to set the default route.

http://www.qnx.com/developer/docs/momen ... ef/r/route
_proto.html

Regards,
Barry F.

Beth <id@net.com> wrote in message news:bdd26t$fai$1@inn.qnx.com...
It was supported on QNX 6.1 full stack and not on QNX6.2?
What is the alternative for SIOCADDRT and SIOCDELRT on QNX 6.2 full stack?
What I need is to add/del route to host programmatically.

Thanks,
-Beth

"Sean Boudreau" <seanb@node25.ott.qnx.com> wrote in message
news:bdcs3q$31r$1@nntp.qnx.com...
Beth <id@net.com> wrote:
I use the following code to add host route to the routing table, it
works on
QNX 6.1a, but failed on QNX 6.2 with error message "error is: 103,
Operation
not supported". Any idea why?

SIOCADDRT isn't supported by the full stack.

-seanb

Beth

Re: SIOCADDRT failed on QNX 6.2

Post by Beth » Thu Jun 26, 2003 3:05 pm

Thanks for your help. Does the document you referred to also applies to the
QNX 6.1a?
To be clear, can I use SIOCADDRT/SIOCDELRT for tiny stack on both QNX 6.1
and QNX 6.2,
and use the socket(PF_ROUTE.... ) call for full tcp stack on both QNX 6.1
and QNX 6.2?

Thanks,
-Beth

"OS Support" <os@qnx.com> wrote in message news:bdeq2s$99h$1@nntp.qnx.com...
See the following link for a description of packet routing and
example source code that shows how to set the default route.


http://www.qnx.com/developer/docs/momen ... ef/r/route
_proto.html

Regards,
Barry F.

Beth <id@net.com> wrote in message news:bdd26t$fai$1@inn.qnx.com...
It was supported on QNX 6.1 full stack and not on QNX6.2?
What is the alternative for SIOCADDRT and SIOCDELRT on QNX 6.2 full
stack?
What I need is to add/del route to host programmatically.

Thanks,
-Beth

"Sean Boudreau" <seanb@node25.ott.qnx.com> wrote in message
news:bdcs3q$31r$1@nntp.qnx.com...
Beth <id@net.com> wrote:
I use the following code to add host route to the routing table, it
works on
QNX 6.1a, but failed on QNX 6.2 with error message "error is: 103,
Operation
not supported". Any idea why?

SIOCADDRT isn't supported by the full stack.

-seanb



Beth

Re: SIOCADDRT failed on QNX 6.2

Post by Beth » Thu Jun 26, 2003 8:02 pm

I have tried the example provided in the QNX 6.2 document on setting the
host route, it worked both on QNX 6.2 and 6.1. My question is whether the
ioctl() call of SIOCSIFADDR, SIOCSIFFLAGS... are supported in QNX 6.2 tiny
and full stack?

Thanks for any information.

-Beth

"Beth" <id@net.com> wrote in message news:bdf0nk$mbr$1@inn.qnx.com...
Thanks for your help. Does the document you referred to also applies to
the
QNX 6.1a?
To be clear, can I use SIOCADDRT/SIOCDELRT for tiny stack on both QNX 6.1
and QNX 6.2,
and use the socket(PF_ROUTE.... ) call for full tcp stack on both QNX 6.1
and QNX 6.2?

Thanks,
-Beth

"OS Support" <os@qnx.com> wrote in message
news:bdeq2s$99h$1@nntp.qnx.com...
See the following link for a description of packet routing and
example source code that shows how to set the default route.



http://www.qnx.com/developer/docs/momen ... ef/r/route
_proto.html

Regards,
Barry F.

Beth <id@net.com> wrote in message news:bdd26t$fai$1@inn.qnx.com...
It was supported on QNX 6.1 full stack and not on QNX6.2?
What is the alternative for SIOCADDRT and SIOCDELRT on QNX 6.2 full
stack?
What I need is to add/del route to host programmatically.

Thanks,
-Beth

"Sean Boudreau" <seanb@node25.ott.qnx.com> wrote in message
news:bdcs3q$31r$1@nntp.qnx.com...
Beth <id@net.com> wrote:
I use the following code to add host route to the routing table,
it
works on
QNX 6.1a, but failed on QNX 6.2 with error message "error is: 103,
Operation
not supported". Any idea why?

SIOCADDRT isn't supported by the full stack.

-seanb





Post Reply

Return to “qdn.public.ddk.network”