How to send a packet to specified interface

Hello,

I would like to ask following question:
how to send 1 packet (e.g. ARP packet) to specified interface (e.g. “eth0”)
programatically using QNX 4/TCPIP 4.25 ?

In Linux, one can use SOCK_PACKET socket, however TCPIP toolkit 4.25
does not support this type of sockets:


#include <netdb.h>
#include <sys/socket.h>
#include <linux/in.h>
#include <arpa/inet.h>
#include <linux/if_ether.h>

// open SOCK_PACKET socket
sock=socket(AF_INET,SOCK_PACKET,htons(ETH_P_RARP));
if(sock<0){
exit(1);
}

strcpy(sa.sa_data,DEFAULT_DEVICE); // e.g. “eth0”
// send packet pkt to specified interface
if(sendto(sock,&pkt,sizeof(pkt),0,&sa,sizeof(sa)) < 0){
perror(“sendto”);
exit(1);
}

Is it possible to do it using other (supported) type of socket (SOCK_RAW) ?
If yes, is there any documentation ?

Thanks,

Martin


Mgr. Martin Gazak, MicroStep-MIS
Ilkovicova 3, 841 04 Bratislava, Slovakia
Tel: +421 2 60291 816
e-mail:matog@microstep-mis.sk

Goto qdn.qnx.com and click on contributed software. Do a search for netraw
and you’ll see links to download some development headers and information to
do raw packets.


Cheers,
Adam

QNX Software Systems Ltd.
[ amallory@qnx.com ]

With a PC, I always felt limited by the software available.
On Unix, I am limited only by my knowledge.
–Peter J. Schoenster <pschon@baste.magibox.net>
“Juraj Macica” <jurom@microstep-mis.com> wrote in message
news:a28p51$22e$1@inn.qnx.com

Hello,

I would like to ask following question:
how to send 1 packet (e.g. ARP packet) to specified interface (e.g.
“eth0”)
programatically using QNX 4/TCPIP 4.25 ?

In Linux, one can use SOCK_PACKET socket, however TCPIP toolkit 4.25
does not support this type of sockets:


#include <netdb.h
#include <sys/socket.h
#include <linux/in.h
#include <arpa/inet.h
#include <linux/if_ether.h

// open SOCK_PACKET socket
sock=socket(AF_INET,SOCK_PACKET,htons(ETH_P_RARP));
if(sock<0){
exit(1);
}

strcpy(sa.sa_data,DEFAULT_DEVICE); // e.g. “eth0”
// send packet pkt to specified interface
if(sendto(sock,&pkt,sizeof(pkt),0,&sa,sizeof(sa)) < 0){
perror(“sendto”);
exit(1);
}

Is it possible to do it using other (supported) type of socket (SOCK_RAW)
?
If yes, is there any documentation ?

Thanks,

Martin


Mgr. Martin Gazak, MicroStep-MIS
Ilkovicova 3, 841 04 Bratislava, Slovakia
Tel: +421 2 60291 816
e-mail:> matog@microstep-mis.sk


\