Raw Ethernet?

Hello,
In Linux you can use the dev_add_pack() function to hook your own user
function in below the TCP stack. This allows you to receive raw ethernet
packets who’s protocol is set to something other than the protocols that the
stack normally handles. This will allow you to write a custom protocol that
goes below IP and is much faster and more efficient. Is there any similar
functionality in QNX?
Thanks!
Chris

bpc2 <bpc2@earthlink.net> wrote:

Hello,
In Linux you can use the dev_add_pack() function to hook your own user
function in below the TCP stack. This allows you to receive raw ethernet
packets who’s protocol is set to something other than the protocols that the
stack normally handles. This will allow you to write a custom protocol that
goes below IP and is much faster and more efficient. Is there any similar
functionality in QNX?

On QNX6 there is actually a document that covers the basics of this in the
Network DDK (which you can install via the pkg-installer). Basically the
answer is that you can pretty much do anything on a packet-by-packet
basis. You can register as an en_en filter and get all the raw ethernet
packets, an ip_ip filter and get all the raw ip packets.

chris


\

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

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

Chris McKillop <cdm@qnx.com> wrote in message
news:9sda1n$dbn$2@nntp.qnx.com

bpc2 <> bpc2@earthlink.net> > wrote:

Hello,
In Linux you can use the dev_add_pack() function to hook your own user
function in below the TCP stack. This allows you to receive raw
ethernet
packets who’s protocol is set to something other than the protocols that
the
stack normally handles. This will allow you to write a custom protocol
that
goes below IP and is much faster and more efficient. Is there any
similar
functionality in QNX?


On QNX6 there is actually a document that covers the basics of this in the
Network DDK (which you can install via the pkg-installer). Basically the
answer is that you can pretty much do anything on a packet-by-packet
basis. You can register as an en_en filter and get all the raw ethernet
packets, an ip_ip filter and get all the raw ip packets.

chris

Are you referring to the “writing your own network driver” document? Or is
there something else I have not found in the help viewer?

If so, this article seems to cover most of what I would need to know, but
there doesn’t seem to be an article specifically on writing filters.

I have two questions then: How do I tell ion that my software is a filter,
and how do I tell it that my software is an en_en filter and that it should
go above the device driver?

I’m working on the “null” driver example in the help viewer pages so
examples relative to that would be appreciated.

TIA
Chris

Chris McKillop <cdm@qnx.com> wrote in message
news:9sda1n$dbn$2@nntp.qnx.com

bpc2 <> bpc2@earthlink.net> > wrote:

Hello,
In Linux you can use the dev_add_pack() function to hook your own user
function in below the TCP stack. This allows you to receive raw
ethernet
packets who’s protocol is set to something other than the protocols that
the
stack normally handles. This will allow you to write a custom protocol
that
goes below IP and is much faster and more efficient. Is there any
similar
functionality in QNX?


On QNX6 there is actually a document that covers the basics of this in the
Network DDK (which you can install via the pkg-installer). Basically the
answer is that you can pretty much do anything on a packet-by-packet
basis. You can register as an en_en filter and get all the raw ethernet
packets, an ip_ip filter and get all the raw ip packets.

chris

Additional question. How would this code be built? What options must be
passed to qcc to tell it that there is no main, that it is building a dll?
Thanks!
chris

Additional question. How would this code be built? What options must be
passed to qcc to tell it that there is no main, that it is building a dll?
Thanks!
chris

You would build it the same way the network driver would be built. Just
using a different output filename (nfm-blah.so instead of devn-blah.so).

chris

\

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

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

Are you referring to the “writing your own network driver” document? Or is
there something else I have not found in the help viewer?

If so, this article seems to cover most of what I would need to know, but
there doesn’t seem to be an article specifically on writing filters.

I have two questions then: How do I tell ion that my software is a filter,
and how do I tell it that my software is an en_en filter and that it should
go above the device driver?

I’m working on the “null” driver example in the help viewer pages so
examples relative to that would be appreciated.

If you nab the source to nfm-ipfilter from http://members.home.com/xtang/
you can see what values you need to pass into io-net and have in the
structures.

chris


\

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

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

BPC Software Group <bpc_sw@hotmail.com> wrote:

Chris McKillop <> cdm@qnx.com> > wrote in message
news:9sda1n$dbn$> 2@nntp.qnx.com> …
bpc2 <> bpc2@earthlink.net> > wrote:

Hello,
In Linux you can use the dev_add_pack() function to hook your own user
function in below the TCP stack. This allows you to receive raw
ethernet
packets who’s protocol is set to something other than the protocols that
the
stack normally handles. This will allow you to write a custom protocol
that
goes below IP and is much faster and more efficient. Is there any
similar
functionality in QNX?


On QNX6 there is actually a document that covers the basics of this in the
Network DDK (which you can install via the pkg-installer). Basically the
answer is that you can pretty much do anything on a packet-by-packet
basis. You can register as an en_en filter and get all the raw ethernet
packets, an ip_ip filter and get all the raw ip packets.

chris


Additional question. How would this code be built? What options must be
passed to qcc to tell it that there is no main, that it is building a dll?

All the QSSL source code are formed in a structure so that you
can easily build some source base under different platform. And
in the mean time, give you the flexibility for “difference between
platform”.

The magical makefiles are under /usr/include/mk/, which you will get
if you install development packages.

To answer your question directly, you usually go into $(CPU)/so/,
type make, to create a *.so. The magic common.mk and Makefile in
project directory taking care of everything else.

-xtang

Chris McKillop <cdm@qnx.com> wrote in message
news:9ssfln$107$1@nntp.qnx.com

Additional question. How would this code be built? What options must
be
passed to qcc to tell it that there is no main, that it is building a
dll?
Thanks!
chris


You would build it the same way the network driver would be built. Just
using a different output filename (nfm-blah.so instead of devn-blah.so).

chris

I guess the magic switch I was looking for is qcc -shared…

Chris

Chris McKillop <cdm@qnx.com> wrote in message
news:9ssfpd$107$2@nntp.qnx.com

Are you referring to the “writing your own network driver” document? Or
is
there something else I have not found in the help viewer?

If so, this article seems to cover most of what I would need to know,
but
there doesn’t seem to be an article specifically on writing filters.

I have two questions then: How do I tell ion that my software is a
filter,
and how do I tell it that my software is an en_en filter and that it
should
go above the device driver?

I’m working on the “null” driver example in the help viewer pages so
examples relative to that would be appreciated.


If you nab the source to nfm-ipfilter from > http://members.home.com/xtang/
you can see what values you need to pass into io-net and have in the
structures.

chris

Ok, I got the file, but it’s a .qpr file. Does that mean I can only install
it with the package manager, I.E. it’s a “repository”? I can’t seem to
inflate or gunzip or untar it. And the package manager doesn’t seem to
recognize it?
Help?
Chris

Ok, I got the file, but it’s a .qpr file. Does that mean I can only install
it with the package manager, I.E. it’s a “repository”? I can’t seem to
inflate or gunzip or untar it. And the package manager doesn’t seem to
recognize it?

pkg-installer -u filename.qpr

chris

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

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

Chris McKillop <cdm@qnx.com> wrote in message
news:9sumeq$df1$1@nntp.qnx.com

Ok, I got the file, but it’s a .qpr file. Does that mean I can only
install
it with the package manager, I.E. it’s a “repository”? I can’t seem to
inflate or gunzip or untar it. And the package manager doesn’t seem to
recognize it?


pkg-installer -u filename.qpr

chris

Ok, I would have gotten that a few years ago when I was more of a
command-line guy.
Now I’m more of a gui guy and couldn’t figure out how to get the gui package
installer to
grok that file. Thanks!

In a related question, I now have a program that I think is an en-en filter,
it’s toptype and
bottom type are both “en”, and it just passes packets through and counts
them for now.
But I can’t seem to mount it. I’m root, RTP 6.1, and the .so file is in my
current directory.
mount -vvv -T io-net etherFilter.so fails:


Failed with external mounts, trying internal mount
Type [io-net] Flags 0x80000000
Device [etherFilter.so] Directory [/]
Options []
mount: Can’t mount / (type io-net)
mount: Possible reason: permission denied

Chris

But I can’t seem to mount it. I’m root, RTP 6.1, and the .so file is in my
current directory.
mount -vvv -T io-net etherFilter.so fails:

try this…

mount -Tio-net $PWD/etherFilter.so

chris

\

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

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

Chris McKillop <cdm@qnx.com> wrote in message
news:9svo89$29i$2@nntp.qnx.com

But I can’t seem to mount it. I’m root, RTP 6.1, and the .so file is in
my
current directory.
mount -vvv -T io-net etherFilter.so fails:

try this…

mount -Tio-net $PWD/etherFilter.so

chris

Ok, so I can mount and unmount my filter, but things just don’t work for
very long, if at all. What I want to do is to have an en_en or ip_ip
filter, that mounts right above the en0 driver. I have an example that I
have cobbled up based on the example code in the help viewer, and the xtang
ipfilter code. By “instrumenting” my code with the led() function which
allows setting a digit on a hex led display ( embedded MIPS board ), I can
see that it initializes OK, and that dependig on the combinations of _ABOVE,
or _BELOW, with en_en and ip_ip, I can see that it sometimes calls
my_rx_down() and my_rx_up fucntions. But after a few times it usually locks
up the whole stack until i umount it from a serial console. I’m not sure
what I’m doing wrong! Anybody got a clue for me?
Thanks!
Chris




begin 666 etherDrvr.c
M+R@(&5T:&5R1’)V<BYC"B\O("!A(‘1E<W0@=&@<V5E(&EF($D@8V%N(&=E
M;F5R871E(&%N($5T:&5R;F5T(&9I;‘1E<B!T:&%T(&AO;VMS(&EN=&@:6\M
M;F5T"B\O("!A;F0@<V5E<R!A;&P@=&AE(’!A8VME=’,@9FQO=VEN9R!B>2!I
M;B!B;W1H(&1I<F5C=&EO;G,N"B\O(" +R@(%1H92!G96YE<F%L(&ED96$@
M:7,@=&@:&]O:R!I;B!A<R!A(&9I;'1E<B!J=7-T(&%B;W9E(‘1H90HO+R @
M=‘5L:7 @9’)I=F5R+@HO+R @“B\O(”!#:’)I<R!“96%S;&5Y+”!“97)K96QE
M>2!0<F]C97-S($-O;G1R;VPL($EN8RX@,C P,0HO+R @”@HC:6YC;'5D92 B
M;&5D+F@B"B-I;F-L=61E(#QH=R]I;F]U="YH/@HC:6YC;'5D92 <WES+VUM
M86XN:#X
"B-I;F-L=61E(#QS>7,O:6\M;F5T+F@^“B-I;F-L=61E(#QI;G1T
M>7!E<RYH/@HC:6YC;‘5D92 \871O;6EC+F@^"B-I;F-L=61E(#QU;FES=&0N
M:#X*(VEN8VQU9&4@/’-T9&EO+F@^“B-I;F-L=61E(#QS=’)I;F=S+F@^“B-I
M;F-L=61E(#QE<G)N;RYH/@HC:6YC;'5D92 ;F5T+VEF+F@^“B-I;F-L=61E
M(#QN970O:69?='EP97,N:#X*“B-U;F1E9B @4TA/4E1?3$5$7T1%3$%9"B-D
M969I;F4@4TA/4E1?3$5$7T1%3$%9(#!X9F9F9F8*(V1E9FEN92!-5%5325I%
M(#$U,30*(V1E9FEN92!004-+151?4TE:12 U, HC9&5F:6YE(%!!0TM%5%])
M3E]54T4@#!X,2 /" S,2D@H*+R@1F]R=V%R9”!D96-L87)A=&EO;B!O
M9B!O=7(@9G5N8W1I;VYS"FEN=”!M>5]I;FET*”!V;VED(“ID;&Q?:&1L+”!D
M:7-P871C:%]T(“ID<’ L(&EO7VYE=%]S96QF7W0@FEO;BP@8VAA<B J;W!T
M:6]N<R I.PIS=&%T:6,@:6YT(&UY7W)E9VES=&5R7V1E=FEC92@@=F]I9" I
M.PIV;VED(“IM>5]R>%]T:’)E860H('9O:60@F%R9R I.PII;G0@;7E?='A?
M9&]N92@@;G!K=%]T(“IN<&MT+”!V;VED("ID;VYE7VAD;“P@=F]I9” J9G5N
M8U]H9&P@3L:6YT(&UY7W)X7W5P
”!N<&MT7W0@FYP:W0L('9O:60@F9U
M;F-?:&1L+"!I;G0@;V9F+"!I;G0@9G)A;6QE;E]S=6(L('5I;G0Q-E]T(&-E
M;&PL(‘5I;G0Q-E]T(&5N9’!O:6YT+"!U:6YT,39?="!I9F%C92 I.PII;G0@
M;7E?<GA?9&]W;B@@;G!K=%]T(“IN<&MT+”!V;VED(“IF=6YC7VAD;” I.PII
M;G0@;7E?<VAU=&1O=VXQ
"!I;G0@<F5G:7-T<F%N=%]H9&PL(‘9O:60@F9U
M;F-?:&1L(“D[“FEN=”!M>5]S:'5T9&]W;C(H(&EN=”!R96=I<W1R86YT7VAD
M;“P@=F]I9” J9G5N8U]H9&P@3L"@HO+R!’;&]B86P@<WEM8F]L<PIV;VED
M(“IM>5]D;&Q?:&1L.PII;U]N971?<V5L9E]T(“IM>5]I;VX[“FEN=”!M>5]R
M96=?:&1L.PIU:6YT,39?=”!M>5]C96QL.PIU:6YT,39?=”!M>5]E;F1P;VEN
M=#L
"FEO7VYE=%]D;&Q?96YT<GE?="!I;U]N971?9&QL7V5N=’)Y(#T
>PH@
M(" R+" @(" @(" O+R!.=6UB97(@;V8@9G5N8W1I;VYS"B @(&UY7VEN:70L
M("\O(&EN:70H
0H@(”!.54Q,(” @(" O+R B;6%S=&5R(B!S:‘5T9&]W;B@I
M"GT["@H*+R@9G5N8W1I;VYS(‘1H870@=V4@<W5P<&QY"FEO7VYE=%]R96=I
M<W1R86YT7V9U;F-S7W0@;7E?9G5N8W,@/0I[“B @(” @7TE/7TY%5%]214=?
M3D953D-3+" @(" O+R!N9G5N8W,(" @("!M>5]R>%]U<“P@(” @(" @(" @
M(" @("\O(’)E8V5I=F4@82!P86-K970@;VX@:70G<R!W87D@=7 (" @("!M
M>5]R>%]D;W=N+" @(" @(" @(" @("\O(’)E8V5I=F4@82!P86-K970@;VX@
M:70G<R!W87D@9&]W;@H@(" @(&UY7W1X7V1O;F4L(" @(" @(" @(" @+R@
M<F5L96%S92!O=7(@:&]L9"!A(’!A8VME= H@(" @(&UY7W-H=71D;W=N,2P@
M(" @(" @(" @+R@<VAU=&1O=VXQ
"D
(" @("!M>5]S:‘5T9&]W;C(L(" @
M(" @(" @("\O(’-H=71D;W=N,B@I"B @(" @3E5,3"P@(" @(" @(" @(" @
M(" @(" O+R!D;%]A9’9E<G0H0H@(" @($Y53$PL(" @(" @(" @(" @(" @
M(" @+R@9&5V8W1L
"D*(" @("!.54Q,+" @(" @(" @(" @(" @(" @("\O
M(&9L=7-H*“D*(” @("!.54Q,+" @(" @(" @(" @(" @(" @("\O(’)A=U]O
M<&5N*“D*(” @("!.54Q,“GT[“B @(” @(” @(" @(" @(" @(" @(" @(" @
M(" @(" @(" @(" @(" @“B\O(&$@9&5S8W)I<‘1I;VX@;V8@;W5R(&1R:79E
M<@II;U]N971?<F5G:7-T<F%N=%]T(&UY7V5N=’)Y(#T*>PH@(” @(%]214=?
M1DE,5$527T)%3$]7+" O+R!(%]214=?24Y)5%]/3D-%+" @=VAE<F4@=&AE
M(&8C*“4@:7,@7VEN:71?;VYC92!D969I;F5D(3*(” @(" B8G!C+6EP+69I
M;‘1E<BYS;R(L+R@;W5R(&YA;64*(" @(" B:7 B+" @(" @(" @(" @(" @
M+R@;W5R(‘1O<"!T>7!E"B @(" @(FEP(BP@(" @(" @(" @(" @("\O(&]U
M<B!B;W1T;VT@=‘EP90H@(" @($Y53$PL(" @(" @(" @(" @(" O+R!G;&]B
M86P@8V]N=’)O;"!H86YD;&4*(" @(" F;7E?9G5N8W,L(" @(" @(" @+R@
M<&]I;G1E<B!T;R!O=7(@9G5N8W1I;VYS"B @(" @," @(" @(" @(" @(" @
M(" @("\O("-D97!E;F1E;F-I97,?3L"@HO+V1E8G5G(&9U;F-T:6]N<PIU
M:6YT<‘1R7W0@;&5D7VAA;F1L.PH*=F]I9"!L961?:6YI="@@=F]I9" I"GL*
M(" @<VEZ95]T(&QE;B ](#@["@H@("!L961?:&%N9&P@/2!M;6%P7V1E=FEC
M95]I;R H(&QE;BP@3$5$7T%$1%)%4U,@3L)"@H@("!4:’)E861#=&PH(%].
M5$]?5$-43%])3RP@3E5,3" I.PI]"@IV;VED(&QE9"@@:6YT(’=H:6-H+"!I
M;G0@9’5R871I;VX@0I["B @(&]U=#@@"!L961?:&%N9&PL(’=H:6-H(“D[
M"B @(’=H:6QE(”@@9’5R871I;VXM+2 I.PH
(" @<F5T=7)N.PI]"@H*+R@
M(%1H92!D;&P@9G5N8W1I;VYS+@II;G0@;7E?:6YI=" H=F]I9" J9&QL7VAD
M;“P@9&ES<&%T8VA?=” J9’!P+"!I;U]N971?<V5L9E]T(“II;VXL(&-H87(@
MF]P=&EO;G,I"GL(” @;7E?9&QL7VAD;" ](&1L;%]H9&P["B @(&UY7VEO
M;B ](&EO;CL*"B @(&QE9%]I;FET*"D[“B @(&QE9”@@,’@P+"!32$]25%],
M141?1$5,05D@3L(" @“B @(”\O(%)E9VES=&5R(’=I=&@@:6\M;F5T"B @
M(&EF("@@(6UY7W)E9VES=&5R7V1E=FEC92@I(“D@>PH@(” @("!R971U<FXH
M(“TQ(“D[“B @('T*(” @;&5D*” P>#,L(%-(3U)47TQ%1%]$14Q!62 I.PH*
M(” @<F5T=7)N("@P3L@(" @(" @(" O+R!S=6-C97-S"GT"G-T871I8R!I
M;G0@;7E?<F5G:7-T97)?9&5V:6-E(“AV;VED0I[“B @(&QE9”@@,’@Q+"!3
M2$]25%],141?1$5,05D@3L(" @“B @(&EF(”@H
FUY7VEO;B M/B!R96<I
M"B @(” @(" H;7E?9&QL7VAD;“P*“29M>5]E;G1R>2P*“29M>5]R96=?:&1L
M+ H))FUY7V-E;&PL”@DF;7E?96YD<&]I;G0I(#P@,“D*(” @(”![”@ER971U
M<FX@# I.R @(" @+R@9F%I;&5D"B @(" @?0H@("!L960H(#!X,BP@4TA/
M4E1?3$5$7T1%3$%9(“D[“B @(’)E='5R;B H,2D[(” @(” @(" @+R@<W5C
M8V5S<PI]"@H
"FEN="!M>5]T>%]D;VYE*"!N<&MT7W0@FYP:W0L('9O:60@
M
F1O;F5?:&1L+"!V;VED(“IF=6YC7VAD;” I"GL*(" @;&5D*" P>#8L(%-(
M3U)47TQ%1%]$14Q!62 I.PH@(" (" @<F5T=7)N(# ["GT"2 @(" @(" @
M"FEN="!M>5]R>%]U<"@@;G!K=%]T(“IN<&MT+ H)(”!V;VED(“IF=6YC7VAD
M;“P*“2 @:6YT(&]F9BP*“2 @:6YT(&9R86UL96Y?<W5B+ H)(”!U:6YT,39?
M=”!C96QL+ H)(”!U:6YT,39?=”!E;F1P;VEN=“P*“2 @=6EN=#$V7W0@:69A
M8V4@0I[“B @(&QE9”@@,’@T+"!32$]25%],141?1$5,05D@3L(" @“B @
M(”@J;7E?:6]N+3YT>%]U<“DH(&UY7W)E9U]H9&PL(&YP:W0L(&]F9BP@9G)A
M;6QE;E]S=6(L(&-E;&PL(&5N9’!O:6YT+”!I9F%C92 I.PH
(” @;&5D*” P
M>$$L(%-(3U)47TQ%1%]$14Q!62 I.PH@("!R971U<FX@14]+.PI]"@H*:6YT
M(&UY7W)X7V1O=VXH(&YP:W1?=" J;G!K=“P@=F]I9” J9G5N8U]H9&P@0I[
M"B @(&QE9"@@,’@U+"!32$]25%],141?1$5,05D@3L"B @(’)E='5R;B H
M
FUY7VEO;BT^=‘A?9&]W;BDH(&UY7W)E9U]H9&PL(&YP:W0@3L?0H*:6YT
M(&UY7W-H=71D;W=N,2@@:6YT(’)E9VES=’)A;G1?:&1L+"!V;VED(“IF=6YC
M7VAD;” I"GL*(" @;&5D*" P>$4L(%-(3U)47TQ%1%]$14Q!62 I.PH@("!R
M971U<FX@14]+.R @+R@(’)E='5R;B!%0E5362!I9B!W92!D;VXG="!W86YT
M('1H96T@=&@<VAU="!U<R!D;W=N('EE= I]"@II;G0@;7E?<VAU=&1O=VXR
M*"!I;G0@<F5G:7-T<F%N=%]H9&PL(‘9O:60@F9U;F-?:&1L("D>PH@("!L
M960H(#!X1BP@4TA/4E1?3$5$7T1%3$%9("D["B @(’)E=‘5R;B P.R @+R@
M(&%T(‘1H:7,@<&]I;G0L(’=E(&AA=F4@;F@8VAO:6-E(&%N9"!M=7-T(’-H
)=71D;W=N"GT*
`
end