Looking for RAW Packet Socket functionality

Hi.
I’m trying to port a Linux application to QNX and everything seems
to be compiling fine, except for our socket access. We have been using
the PF_PACKET domain in Linux with a SOCK_RAW type; however, QNX only
seems to support the PF_INET domain. I was wondering how I would send
raw packet data to a standard ethernet driver in QNX (preferably using
sockets).

Thanks for the assistance,
Adam.
adamt@tri-linktech.com
Tel: (604)451-9113 Ext. 208
Fax: (604)451-9118
http://www.tri-linktech.com

Adam Talbot <AdamT@tri-linktech.com> wrote:

Hi.
I’m trying to port a Linux application to QNX and everything seems
to be compiling fine, except for our socket access. We have been using
the PF_PACKET domain in Linux with a SOCK_RAW type; however, QNX only
seems to support the PF_INET domain. I was wondering how I would send
raw packet data to a standard ethernet driver in QNX (preferably using
sockets).

Go over to www.qnxstart.com and do a search for tcpdump. It comes with
the BSD bpf plugin for io-net under QNX. This will allow you to get
raw packet data (and insert raw data) into the stack.

chris

\

cdm@qnx.com > “The faster I go, the behinder I get.”

Chris McKillop – Lewis Carroll –
Software Engineer, QSSL
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

There is no “tcpdump” located on www.qnxstart.com. I found it on
http://staff.qnx.com/~cdm/repository
Package consists of “tcpdump” and “nfm-bpf.so” library but with no interface
description.
Can we have “nfm-bpf.so” library interface description?

Jiri Kristek



Chris McKillop <cdm@qnx.com> pí¹e v diskusním
pøíspìvku:9diukf$4ar$1@nntp.qnx.com

Adam Talbot <> AdamT@tri-linktech.com> > wrote:

Hi.
I’m trying to port a Linux application to QNX and everything seems
to be compiling fine, except for our socket access. We have been using
the PF_PACKET domain in Linux with a SOCK_RAW type; however, QNX only
seems to support the PF_INET domain. I was wondering how I would send
raw packet data to a standard ethernet driver in QNX (preferably using
sockets).


Go over to > www.qnxstart.com > and do a search for tcpdump. It comes with
the BSD bpf plugin for io-net under QNX. This will allow you to get
raw packet data (and insert raw data) into the stack.

chris

\

cdm@qnx.com > “The faster I go, the behinder I get.”
Chris McKillop – Lewis Carroll –
Software Engineer, QSSL

begin 666 Re Looking for RAW Packet Socket functionality.txt
M#0I#:’)I<R!-8TMI;&QO<" \8V1M0’%N>“YC;VT^(’#MFF4@=B!D:7-K=7-N
M[6T-“G#X[7-P['9K=3HY9&EU:V8D-&%R)#% ;FYT<“YQ;G@N8V]M+BXN#0H^
M($%D86T@5&%L8F]T(#Q!9&%M5$!T<FDM;&EN:W1E8V@N8V]M/B!W<F]T93H-
M"CX@/@T*/B ^(” @(”!(:2X-“CX@/B @(” @22=M('1R>6EN9R!T;R!P;W)T
M(&$@3&EN=7@@87!P;&EC871I;VX@=&@44Y8(&%N9”!E=F5R>71H:6YG(’-E
M96US#0H^(#X@=&@8F4@8V]M<&EL:6YG(&9I;F4L(&5X8V5P="!F;W(@;W5R
M(’-O8VME="!A8V-E<W,N("!792!H879E(&)E96X@=7-I;F<-“CX@/B!T:&4@
M4$9?4$%#2T54(&1O;6%I;B!I;B!,:6YU>”!W:71H(&$@4T]#2U]205<@=‘EP
M93L@:&]W979E<BP@44Y8(&]N;‘D-“CX@/B!S965M<R!T;R!S=7!P;W)T(‘1H
M92!01E])3D54(&1O;6%I;BX@($D@=V%S(’=O;F1E<FEN9R!H;W<@22!W;W5L
M9”!S96YD#0H^(#X@<F%W(’!A8VME="!D871A(‘1O(&$@<W1A;F1A<F0@971H
M97)N970@9’)I=F5R(&EN(%%.6" H<’)E9F5R86)L>2!U<VEN9PT*/B ^(’-O
M8VME=’,I+@T*/B ^#0H^#0H^($=O(&]V97(@=&@=W=W+G%N>’-T87)T+F-O
M;2!A;F0@9&@82!S96%R8V@@9F]R(‘1C<&1U;7 N("!)="!C;VUE<R!W:71H
M#0H^(‘1H92!"4T0@8G!F(’!L=6=I;B!F;W(@:6\M;F5T(‘5N9&5R(%%.6"X@
M(%1H:7,@=VEL;"!A;&QO=R!Y;W4@=&@9V5T#0H^(’)A=R!P86-K970@9&%T
M82 H86YD(&EN<V5R="!R87<@9&%T82D@:6YT;R!T:&4@<W1A8VLN#0H^#0H^
M(" @("!C:’)I<PT*/@T*/@T*/B M+0T*/B ^/CX^/CX^/CX^/CX^/CX^/CX^
M/CX^/CX^/CX^/CX^/CX^/CX^/CX^/CX^/CX^/CX^/CX^/CX^/CX^/CX^/CX^
M/CX^/CX^/CX^/@T*/B @(&-D;4!Q;G@N8V]M(" @(" @(" @(" @(" @(" @
M(E1H92!F87-T97(@22!G;RP@=&AE(&)E:&EN9&5R($D@9V5T+B(-“CX@(”!#
M:’)I<R!-8TMI;&QO<" @(" @(" @(" @(" @(" @(" @(" @(" @(" @+2T@
M3&5W:7,@0V%R<F]L;" M+0T*/B @(%-O9G1W87)E($5N9VEN965R+"!14U-,
M#0H^(#P/#P/#P/#P/#P/#P/#P/#P/#P/#P/#P/#P/#P/#P
E/#P/#P/#P/#P/#P/#P/#P/#P/#P/#P/#P#0H-"@``
`
end

Jiri Kristek <jkristek@retia.cz> wrote:

There is no “tcpdump” located on > www.qnxstart.com> . I found it on
http://staff.qnx.com/~cdm/repository
Package consists of “tcpdump” and “nfm-bpf.so” library but with no interface
description.
Can we have “nfm-bpf.so” library interface description?

Yeah, sorry about that. I thought for sure it was on qnxstart. :slight_smile:

If you look online you should be able to find a lot of references.
Also take a look at the sources to tcpdump (found online). A quick
search on google.com got me this hit…

http://www.gsp.com/cgi-bin/man.cgi?section=4&topic=bpf


chris

\

cdm@qnx.com > “The faster I go, the behinder I get.”

Chris McKillop – Lewis Carroll –
Software Engineer, QSSL
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

I think ‘bpf’ in the name stands for ‘berkeley packet filter’.

Jiri Kristek wrote:

Chris McKillop <> cdm@qnx.com> > pí¹e v diskusním
pøíspìvku:9dp08c$4ld$> 1@nntp.qnx.com> …
Jiri Kristek <> jkristek@retia.cz> > wrote:

There is no “tcpdump” located on > www.qnxstart.com> . I found it on
http://staff.qnx.com/~cdm/repository
Package consists of “tcpdump” and “nfm-bpf.so” library but with no
interface
description.
Can we have “nfm-bpf.so” library interface description?


Yeah, sorry about that. I thought for sure it was on qnxstart. > :slight_smile:

If you look online you should be able to find a lot of references.
Also take a look at the sources to tcpdump (found online). A quick
search on google.com got me this hit…

http://www.gsp.com/cgi-bin/man.cgi?section=4&topic=bpf


chris


What type of interface “nfm-bpf.so” provides. Is it raw packet access or is
it BSD Packet Filter Support? Allong to the name of the device nfm-bpf.so
creates ("/dev/io-net/en_en0") I would guest it is raw packet interface.
I tested ioctl commands ( BIOCGDLT, BIOCVERSION, …) from bpf description,
but they are unsupported. So were can we find “nfm-bpf.so” library interface
description?

Jiri

cdm@qnx.com > “The faster I go, the behinder I get.”
Chris McKillop – Lewis Carroll –
Software Engineer, QSSL

Guess I have to jump in here :slight_smile:

Yes, Igor is right, BPF stands for berkeley packet filter.
nfm-bpf.so is intended to support tcpdump, so not ALL bpf
ioctls are implemented. This is the list of “not supported”
BPF cmds.

BIOCSRTIMEOUT:
BIOCGRTIMEOUT:
BIOCIMMEDIATE:
BIOCGHDRCMPLT:
BIOCSHDRCMPLT:
FIOASYNC:
TIOCSPGRP:
TIOCGPGRP:

BIOCGDLT, BIOCVERSION is supported, the device you want to
“devctl()” is “/dev/socket/bpf”.

Now back to your orignal problem, to send raw ethernet packet,
bpf is not the way to go.

Your best bet is get the DDK and learn to write you own filter
module to load into io-net. You can also download the ipfilter-src
package, and check out the ipf_npi.[ch] as an reference.

What exactly is the application you trying to port use?
To send/receive a ethernet packet is easy, to make that
fit into “socket like API” might be harder.

-xtang


Igor Kovalenko <Igor.Kovalenko@motorola.com> wrote:

I think ‘bpf’ in the name stands for ‘berkeley packet filter’.

Jiri Kristek wrote:

Chris McKillop <> cdm@qnx.com> > pí¹e v diskusním
pøíspìvku:9dp08c$4ld$> 1@nntp.qnx.com> …
Jiri Kristek <> jkristek@retia.cz> > wrote:

There is no “tcpdump” located on > www.qnxstart.com> . I found it on
http://staff.qnx.com/~cdm/repository
Package consists of “tcpdump” and “nfm-bpf.so” library but with no
interface
description.
Can we have “nfm-bpf.so” library interface description?


Yeah, sorry about that. I thought for sure it was on qnxstart. > :slight_smile:

If you look online you should be able to find a lot of references.
Also take a look at the sources to tcpdump (found online). A quick
search on google.com got me this hit…

http://www.gsp.com/cgi-bin/man.cgi?section=4&topic=bpf


chris


What type of interface “nfm-bpf.so” provides. Is it raw packet access or is
it BSD Packet Filter Support? Allong to the name of the device nfm-bpf.so
creates ("/dev/io-net/en_en0") I would guest it is raw packet interface.
I tested ioctl commands ( BIOCGDLT, BIOCVERSION, …) from bpf description,
but they are unsupported. So were can we find “nfm-bpf.so” library interface
description?

Jiri

cdm@qnx.com > “The faster I go, the behinder I get.”
Chris McKillop – Lewis Carroll –
Software Engineer, QSSL

Chris McKillop <cdm@qnx.com> pí¹e v diskusním
pøíspìvku:9dp08c$4ld$1@nntp.qnx.com

Jiri Kristek <> jkristek@retia.cz> > wrote:

There is no “tcpdump” located on > www.qnxstart.com> . I found it on
http://staff.qnx.com/~cdm/repository
Package consists of “tcpdump” and “nfm-bpf.so” library but with no
interface
description.
Can we have “nfm-bpf.so” library interface description?


Yeah, sorry about that. I thought for sure it was on qnxstart. > :slight_smile:

If you look online you should be able to find a lot of references.
Also take a look at the sources to tcpdump (found online). A quick
search on google.com got me this hit…

http://www.gsp.com/cgi-bin/man.cgi?section=4&topic=bpf


chris


What type of interface “nfm-bpf.so” provides. Is it raw packet access or is

it BSD Packet Filter Support? Allong to the name of the device nfm-bpf.so
creates ("/dev/io-net/en_en0") I would guest it is raw packet interface.
I tested ioctl commands ( BIOCGDLT, BIOCVERSION, …) from bpf description,
but they are unsupported. So were can we find “nfm-bpf.so” library interface
description?

Jiri


cdm@qnx.com > “The faster I go, the behinder I get.”
Chris McKillop – Lewis Carroll –
Software Engineer, QSSL

Many thanks for all responses to my question. I still don’t particularly know
what I need to do with thish, though.

Xiaodan Tang wrote:

What exactly is the application you trying to port use?
To send/receive a ethernet packet is easy, to make that
fit into “socket like API” might be harder.

Well, I need to use a standard ethernet card to get data onto the network in the
format:
U8 destAddr[6];
U8 destAddr[6];
U16 ether_type;
U8 userData[X];
U8 userDataByte;
U8 CPI;
U16 length;
U32 CRC;
If there is an easy way to do this without using sockets, I would be happy to do it
that way. I suspect this requires writing an io-net conversion module. I have the
DDK for this, but I have no idea how easy/difficult it would be.

We wrote a Linux driver for our network card and we used sockets send raw ethernet
data to our network card. We cannot use TCP/IP or any other protocol, as the other
devices on the network are our own devices that do not support these protocols.
Now, we are trying to port our application to a POSIX compatible OS and QNX seems
to be our best bet, so we writing lots of little programs to make sure it will
work. Some of the sockets packet functionality that we have been using does not
seem to be supported in QNX, though. Here are the calls we use to send data to the
network card:
/* First we opened the socket. */
soc = socket (PF_PACKET, SOCK_RAW, htons (ETH_P_TELAN));

/* Then we used ioctl to find our network card */
strcpy (ifInfo.ifr_name, “eth0”);
ioctl (soc, SIOCGIFINDEX, &ifInfo);
ioctl (soc, SIOCGIFHWADDR, &ifInfo);

/* Then we the data through the socket using a destination in the format of
sockaddr_ll */
struct sockaddr_ll destAddr;

/* Create a destination structure for sending through the socket. */
destAddr.sll_family = AF_PACKET;
destAddr.sll_protocol = htons(ETH_P_TELAN);
destAddr.sll_ifindex = ifInfo.ifr_ifindex;
destAddr.sll_hatype = ARPHRD_ETHER;
destAddr.sll_pkttype = PACKET_OUTGOING;
destAddr.sll_halen = 6;
memcpy (destAddr.sll_addr, &ethHeader.h_dest[0], 6);

sendto (soc, cell, cellSize, 0, (sockaddr*)&destAddr, sizeof (destAddr);

It seems to me that PF_PACKET is a newer protocol family, or domain which QNX
doesn’t support. I believe it is a replacement for the older PF_INET/SOCK_RAW
combination, but I’m not sure.
I’m also not sure if using PF_INET/SOCK_RAW will add any TCP/IP header
information to the packet before it gets sent over the network.
I’m also not sure what the difference between SOCK_RAW and SOCK_SEQPACKET is
and if we should be using SOCK_SEQPACKET.
Also, the PF_PACKET uses a sockaddr_ll structure to locate the NIC in the
sendto function; however, I don’t know which structure I should be using now that
sockaddr_ll is no longer available.
I’m pretty sure that some of the ioctl functions seem to be significantly
different as well, but there seems to be sufficient documentation on that, so I may
be able to figure that part out myself. All the QNX documentation for sockets
seems to deal with strictly TCP/IP and nothing more.

Now back to your orignal problem, to send raw ethernet packet,
bpf is not the way to go.

Thanks, I didn’t think it was quite what I was looking for, but it did give me
a better understanding of the PF_INET/SOCK_RAW to PF_PACKET conversion, as the
libpcap source code supports both.

Your best bet is get the DDK and learn to write you own filter
module to load into io-net. You can also download the ipfilter-src
package, and check out the ipf_npi.[ch] as an reference.

Yeah, I was afraid I might have to do that, but I thought I’d investigate the
PF_INET/SOCK_RAW capabilites before I investigated that too much.

Again, thanks for the replies,
Adam.
adamt@tri-linktech.com
Tel: (604)451-9113 Ext. 208
Fax: (604)451-9118
http://www.tri-linktech.com

Xiaodan Tang wrote:

Guess I have to jump in here > :slight_smile:

Yes, Igor is right, BPF stands for berkeley packet filter.
nfm-bpf.so is intended to support tcpdump, so not ALL bpf
ioctls are implemented. This is the list of “not supported”
BPF cmds.

BIOCSRTIMEOUT:
BIOCGRTIMEOUT:
BIOCIMMEDIATE:
BIOCGHDRCMPLT:
BIOCSHDRCMPLT:
FIOASYNC:
TIOCSPGRP:
TIOCGPGRP:

BIOCGDLT, BIOCVERSION is supported, the device you want to
“devctl()” is “/dev/socket/bpf”.

Now back to your orignal problem, to send raw ethernet packet,
bpf is not the way to go.

Your best bet is get the DDK and learn to write you own filter
module to load into io-net. You can also download the ipfilter-src
package, and check out the ipf_npi.[ch] as an reference.

What exactly is the application you trying to port use?
To send/receive a ethernet packet is easy, to make that
fit into “socket like API” might be harder.

-xtang

Igor Kovalenko <> Igor.Kovalenko@motorola.com> > wrote:
I think ‘bpf’ in the name stands for ‘berkeley packet filter’.

Jiri Kristek wrote:

Chris McKillop <> cdm@qnx.com> > pí¹e v diskusním
pøíspìvku:9dp08c$4ld$> 1@nntp.qnx.com> …
Jiri Kristek <> jkristek@retia.cz> > wrote:

There is no “tcpdump” located on > www.qnxstart.com> . I found it on
http://staff.qnx.com/~cdm/repository
Package consists of “tcpdump” and “nfm-bpf.so” library but with no
interface
description.
Can we have “nfm-bpf.so” library interface description?


Yeah, sorry about that. I thought for sure it was on qnxstart. > :slight_smile:

If you look online you should be able to find a lot of references.
Also take a look at the sources to tcpdump (found online). A quick
search on google.com got me this hit…

http://www.gsp.com/cgi-bin/man.cgi?section=4&topic=bpf


chris


What type of interface “nfm-bpf.so” provides. Is it raw packet access or is
it BSD Packet Filter Support? Allong to the name of the device nfm-bpf.so
creates ("/dev/io-net/en_en0") I would guest it is raw packet interface.
I tested ioctl commands ( BIOCGDLT, BIOCVERSION, …) from bpf description,
but they are unsupported. So were can we find “nfm-bpf.so” library interface
description?

Jiri

cdm@qnx.com > “The faster I go, the behinder I get.”
Chris McKillop – Lewis Carroll –
Software Engineer, QSSL

Xiaodan Tang <xtang@qnx.com> píse v diskusním
pøíspìvku:9drj7k$mm2$1@nntp.qnx.com

Guess I have to jump in here > :slight_smile:

Yes, Igor is right, BPF stands for berkeley packet filter.
nfm-bpf.so is intended to support tcpdump, so not ALL bpf
ioctls are implemented. This is the list of “not supported”
BPF cmds.

BIOCSRTIMEOUT:
BIOCGRTIMEOUT:
BIOCIMMEDIATE:
BIOCGHDRCMPLT:
BIOCSHDRCMPLT:
FIOASYNC:
TIOCSPGRP:
TIOCGPGRP:

BIOCGDLT, BIOCVERSION is supported, the device you want to
“devctl()” is “/dev/socket/bpf”.

Thanks, now it seems my test port of tcpdump which uses your nfm-bpf.so
starts working. But BIOCPROMISC command returns: “No such file or
directory”.
I use experimental version of ethernet driver from Chris, which supports
promiscous mode and with your original tcpdump it works. Can you help?



Now back to your orignal problem, to send raw ethernet packet,
bpf is not the way to go.

Your best bet is get the DDK and learn to write you own filter
module to load into io-net. You can also download the ipfilter-src
package, and check out the ipf_npi.[ch] as an reference.

What exactly is the application you trying to port use?
To send/receive a ethernet packet is easy, to make that
fit into “socket like API” might be harder.

-xtang


Igor Kovalenko <> Igor.Kovalenko@motorola.com> > wrote:
I think ‘bpf’ in the name stands for ‘berkeley packet filter’.

Jiri Kristek wrote:

Chris McKillop <> cdm@qnx.com> > pí¹e v diskusním
pøíspìvku:9dp08c$4ld$> 1@nntp.qnx.com> …
Jiri Kristek <> jkristek@retia.cz> > wrote:

There is no “tcpdump” located on > www.qnxstart.com> . I found it on
http://staff.qnx.com/~cdm/repository
Package consists of “tcpdump” and “nfm-bpf.so” library but with no
interface
description.
Can we have “nfm-bpf.so” library interface description?


Yeah, sorry about that. I thought for sure it was on qnxstart. > :slight_smile:

If you look online you should be able to find a lot of references.
Also take a look at the sources to tcpdump (found online). A quick
search on google.com got me this hit…

http://www.gsp.com/cgi-bin/man.cgi?section=4&topic=bpf


chris


What type of interface “nfm-bpf.so” provides. Is it raw packet access
or is
it BSD Packet Filter Support? Allong to the name of the device
nfm-bpf.so
creates ("/dev/io-net/en_en0") I would guest it is raw packet
interface.
I tested ioctl commands ( BIOCGDLT, BIOCVERSION, …) from bpf
description,
but they are unsupported. So were can we find “nfm-bpf.so” library
interface
description?

Jiri




cdm@qnx.com > “The faster I go, the behinder I get.”
Chris McKillop – Lewis Carroll –
Software Engineer, QSSL

Jiri Kristek <jkristek@retia.cz> wrote:

Xiaodan Tang <> xtang@qnx.com> > píse v diskusním
pøíspìvku:9drj7k$mm2$> 1@nntp.qnx.com> …
Guess I have to jump in here > :slight_smile:

Yes, Igor is right, BPF stands for berkeley packet filter.
nfm-bpf.so is intended to support tcpdump, so not ALL bpf
ioctls are implemented. This is the list of “not supported”
BPF cmds.

BIOCSRTIMEOUT:
BIOCGRTIMEOUT:
BIOCIMMEDIATE:
BIOCGHDRCMPLT:
BIOCSHDRCMPLT:
FIOASYNC:
TIOCSPGRP:
TIOCGPGRP:

BIOCGDLT, BIOCVERSION is supported, the device you want to
“devctl()” is “/dev/socket/bpf”.



Thanks, now it seems my test port of tcpdump which uses your nfm-bpf.so
starts working. But BIOCPROMISC command returns: “No such file or
directory”.
I use experimental version of ethernet driver from Chris, which supports
promiscous mode and with your original tcpdump it works. Can you help?

I really should find some time to pack up the libpcap/tcpdump source
I’ve changed :slight_smile:

Your problem is because there is a bug in io-net that prevent a module
inside io-net (the nfm-bpf.so) to open a file created by io-net (/dev/io-net/en0)
The work around is in libpcap, instead of send BIOCPROMISC to bpf,
you open it yourself, like:

/* instead of sending a BIOCPROMISC to bpf (which will ALWAYS

  • enable the promiscuous mode, we send a devctl the /dev/io-net/enX,
  • in this case, if the passed in “promisc” is 0, we acutally
  • Turn Off the promiscuous mode.
  • This method (target to enX directly) is safer cause older
  • io-net will not allow nfm-bpf.so open /dev/io-net/enX
  • (the _RESMGR_FLAG_SELF is not set when the driver being attached.
    */
    {
    char ifname[30];
    int efd, eret;

sprintf(ifname, “/dev/io-net/%s”, device);
if ((efd = open(ifname, O_WRONLY)) != -1) {
devctl(efd, DCMD_IO_NET_PROMISCUOUS, &promisc, sizeof(promisc), NULL);
close(efd);
}
}

Good luck.

-xtang

Xiaodan Tang <xtang@qnx.com> píse v diskusním
pøíspìvku:9du03q$7t0$1@nntp.qnx.com

Jiri Kristek <> jkristek@retia.cz> > wrote:

Xiaodan Tang <> xtang@qnx.com> > píse v diskusním
pøíspìvku:9drj7k$mm2$> 1@nntp.qnx.com> …
Guess I have to jump in here > :slight_smile:

Yes, Igor is right, BPF stands for berkeley packet filter.
nfm-bpf.so is intended to support tcpdump, so not ALL bpf
ioctls are implemented. This is the list of “not supported”
BPF cmds.

BIOCSRTIMEOUT:
BIOCGRTIMEOUT:
BIOCIMMEDIATE:
BIOCGHDRCMPLT:
BIOCSHDRCMPLT:
FIOASYNC:
TIOCSPGRP:
TIOCGPGRP:

BIOCGDLT, BIOCVERSION is supported, the device you want to
“devctl()” is “/dev/socket/bpf”.


Thanks, now it seems my test port of tcpdump which uses your nfm-bpf.so
starts working. But BIOCPROMISC command returns: “No such file or
directory”.
I use experimental version of ethernet driver from Chris, which supports
promiscous mode and with your original tcpdump it works. Can you help?

I really should find some time to pack up the libpcap/tcpdump source
I’ve changed > :slight_smile:

Your problem is because there is a bug in io-net that prevent a module
inside io-net (the nfm-bpf.so) to open a file created by io-net
(/dev/io-net/en0)
The work around is in libpcap, instead of send BIOCPROMISC to bpf,
you open it yourself, like:

/* instead of sending a BIOCPROMISC to bpf (which will ALWAYS

  • enable the promiscuous mode, we send a devctl the
    /dev/io-net/enX,
  • in this case, if the passed in “promisc” is 0, we acutally
  • Turn Off the promiscuous mode.
  • This method (target to enX directly) is safer cause older
  • io-net will not allow nfm-bpf.so open /dev/io-net/enX
  • (the _RESMGR_FLAG_SELF is not set when the driver being
    attached.
    */
    {
    char ifname[30];
    int efd, eret;

sprintf(ifname, “/dev/io-net/%s”, device);
if ((efd = open(ifname, O_WRONLY)) != -1) {
devctl(efd, DCMD_IO_NET_PROMISCUOUS, &promisc,
sizeof(promisc), NULL);
close(efd);
}
}

Good luck.

-xtang

Yes, we did it that way. Giving your source code port to public would sure
be helpfull.
Can we expect ethernet drivers with promiscous mode support in a near
future?

Jiri

Jiri Kristek <jkristek@retia.cz> wrote:

Yes, we did it that way. Giving your source code port to public would sure
be helpfull.
Can we expect ethernet drivers with promiscous mode support in a near
future?

The 6.1 release is the target.

chris

cdm@qnx.com > “The faster I go, the behinder I get.”

Chris McKillop – Lewis Carroll –
Software Engineer, QSSL
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<