Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - How to send ethernet raw packets in qnx 6.4 using libpcap?: (9 Items)
   
How to send ethernet raw packets in qnx 6.4 using libpcap?  
Hi,

I want to send ethernet raw packets in QNX.

in linux we can use,
s = socket(AF_PACKET,SOCK_RAW,htons(ETH_P_ALL)); 

Since QNX doesn't support AF_PACKET. I cannot use this socket API in QNX.

In QNX forum I read that,  In io-pkt there is BPF / libpcap which should provide the same functionality.

Pls tell me how to send ethernet raw packets using BPF/libpcap in qnx 6.4?


Thanks...
RE: How to send ethernet raw packets in qnx 6.4 using libpcap?  
> how to send ethernet raw packets using BPF

The wiki is a good place to start reading about
io-pkt (6.4) and BPF:

http://community.qnx.com/sf/wiki/do/viewPage/projects.networking/wiki/Fi
ltering_wiki_page

It mentions that the tcpdump utility uses BPF. 
In the io-pkt source tree, it is located in:

utils/t/tcpdump

I wish we had svn (and the indexer!) available
externally, so we could just give direct links.

Here is a bit more background on BPF:

http://www.rawether.net/support/bpf-usenix9.pdf

Hope this helps a bit,

--
aboyd
Re: RE: How to send ethernet raw packets in qnx 6.4 using libpcap?  
Hi Andrew Boyd,

Thanks for ur reply.

I couldn't open 
http://community.qnx.com/sf/wiki/do/viewPage/projects.networking/wiki/Fi

Its says "The page you requested cannot be found".

Thanks,
BVB
Re: RE: How to send ethernet raw packets in qnx 6.4 using libpcap?  
On Mon, Jan 05, 2009 at 04:06:51AM -0500, Beniz VB wrote:
> Hi Andrew Boyd,
> 
> Thanks for ur reply.
> 
> I couldn't open 
> http://community.qnx.com/sf/wiki/do/viewPage/projects.networking/wiki/Fi
> 
> Its says "The page you requested cannot be found".

http://community.qnx.com/sf/wiki/do/viewPage/projects.networking/wiki/Filtering_wiki_page

http://www.rawether.net/support/bpfhelp.htm

-seanb
RE: RE: How to send ethernet raw packets in qnx 6.4 using libpcap?  
> Its says "The page you requested cannot be found".

For some reason unknown to me, you cannot view the
networking wiki pages unless you create a (free) user 
account and log in (twice) - sorry about that  :-(

Here are some more links:

http://www.qnx.com/developers/docs/6.4.0/io-pkt_en/user_guide/filtering.
html#BPF


http://en.wikipedia.org/wiki/Berkeley_Packet_Filter


--
aboyd
Re: RE: RE: How to send ethernet raw packets in qnx 6.4 using libpcap?  
Hi Andrew Boyd,

            I tried to send ethernet raw packets through BPF filter. I can able to send & receive ethernet packets. But 
I couldn't implement the 
filter in my program.  I have a doubt whether I should set the BPF filter in assembly level. Can you please send me one 

example C code which can filter raw ethernet messages from the network (in QNX 6.4).

           In my sender program I'll send an ethernet frame (destination hardware (MAC) address [6bytes] + source 
hardware (MAC) address [6 bytes]  + etherl type [2 bytes]  + payload [46 - 1500 bytes] +FCS [4 bytes].)

          In my ethernet frame, I'll put ethertype as 0x9999, inorder to identify it as my frame while receiving. So in 

BPF receiver, I should capture frames which contain ethertype = 0x9999 only. Can u please tell me how to write a bpf 
filter program in C for capturing my frame (QNX 6.4).


Thanks & Regards,
Beniz V B
RE: RE: RE: How to send ethernet raw packets in qnx 6.4 using libpcap?  
> But I couldn't implement the filter in my program

Have you looked at the source in trunk/sys/utils/t/tcpdump ?

--
aboyd
Re: RE: RE: RE: How to send ethernet raw packets in qnx 6.4 using libpcap?  
Hi Boyd,

      Thanks for your reply. I tried to implement the filter in my program. Now I have problem in ioctl(iHdl, BIOCSETF, 
&my_bpf_program). It says invalid argument to ioctl.

        I'm attaching my code. Pls have a look at it and tell me what went wrong in my code. 

        Is there any alternate solution to filter the ethernet raw packets based on ether type?

Thanks,
Beniz V B
Attachment: Text bpfreceiver.txt 2.79 KB
Re: RE: How to send ethernet raw packets in qnx 6.4 using libpcap?  
You'll notice that the e-mail interface to Foundry often breaks up long URLs, so you have to cut and paste the full text
 instead of only clicking on the link.