Skip navigation.
Home
The QNX Community Portal

View topic - Raw sockets QNX 6.4.1

Raw sockets QNX 6.4.1

For discussion of realtime and/or embedded programming.

Raw sockets QNX 6.4.1

Postby psns » Mon May 10, 2010 10:25 am

Hi for all!
I'm making an assessment about the temporal behavior of the standard Protocol Stacks of different operating systems and I'm trying to send Ethernet Raw packets in the QNX Netrino OS. I want send only the most basic packet:
destination MAC (6 bytes) + source MAC (6 bytes) + Ethernet Type (2 bytes) + Payload (46 to 1500 bytes).

In other versions of Linux (eg Ubuntu) I use:

Code: Select all
SocketFD = socket(AF_PACKET,SOCK_RAW,htons(ETH_P_ALL));


and I pass the sockaddr_ll struct to the sendto syscall. But on QNX I don't know what domain and protocol I have to use on socket syscall neither what is the struct that I have to pass to the sendto syscall.

Can you help me with this please?
Thanks in advance!
Pedro Silva
psns
New Member
 
Posts: 4
Joined: Mon May 10, 2010 10:22 am

Postby seanb » Mon May 10, 2010 12:32 pm

Check out BPF / libpcap. They're the 'BSD' way to
implement AF_PACKET.

-seanb
seanb
QNX Master
 
Posts: 133
Joined: Fri Jul 28, 2006 5:36 pm

Postby psns » Tue May 11, 2010 4:31 pm

Where I can find this information?
I checked the http://canmore.annwfn.net/howtos/bpf/ webpage, which is very good, but I still had very problems because I'm not comfortable with the BPF interface.

When I try to change the length of the buffer to where the read call will store my packet (e.g. 1500 bytes), with the

if ( ioctl(buf, BIOCSBLEN, 1500) == -1) {
perror("BIOCSBLEN");
}


I get a error "BIOCSBLEN: Bad Address".

I really need help to handle with this...
Thanks in advance for all!
psns
New Member
 
Posts: 4
Joined: Mon May 10, 2010 10:22 am

Postby psns » Wed May 19, 2010 10:20 am

Any help?
psns
New Member
 
Posts: 4
Joined: Mon May 10, 2010 10:22 am

Postby psns » Wed May 19, 2010 10:31 am

I solved the BIOCSBLEN question...

int bufsize = PACKET_SIZE;
if ( ioctl(buf, BIOCSBLEN, &bufsize ) == -1) {
perror("BIOCSBLEN");
}
psns
New Member
 
Posts: 4
Joined: Mon May 10, 2010 10:22 am


Return to Realtime and Embedded

Who is online

Users browsing this forum: No registered users and 4 guests