Source Device

I’m writing an IP-Filter module below the IP layer. It’s running on QNX RTOS 6.1a (x86 machine).

I was wondering if there was anyway to tell which device the packet received at the IP Filter level came from. This would be in the up direction. The uint16_t iface, value i’m getting is 0 right now.
What if it was a serial device connected? Is there a numeric value for each specific device? Does iface=0 always mean ethernet0, and iface=1 ethernet1?

I just basically want to know how to tell what device the packet i’m receiving originated from.

Help would be appreciated. Thanks.

QNX SLC Project Group

QNX SLC Project Group <qnx_slcproject@canda.com> wrote:

I’m writing an IP-Filter module below the IP layer. It’s running on QNX RTOS 6.1a (x86 machine).

I was wondering if there was anyway to tell which device the packet received at the IP Filter level came from. This would be in the up direction. The uint16_t iface, value i’m getting is 0 right now.
What if it was a serial device connected? Is there a numeric value for each specific device? Does iface=0 always mean ethernet0, and iface=1 ethernet1?

I just basically want to know how to tell what device the packet i’m receiving originated from.

When you loaded, drivers (up producers) under you will asked to
send a “advertise” packet to you. It’s an npkt with _NPKT_MSG
flag in it.

In side the advertise information, each producer told you their
“cell/endpoint/iface”, along with their name (like en0, or en1,
or ppp0), you are suppose to remember that information.

When ever a packet comming in, you have to compare the
cell/endpoint/iface from the “rx_up()” PARAMATER list (yes,
not the one in npkt, they are useless when a packet going up),
and figure out with interface it is comming from.

-xtang

Does that mean that I can only get the device type if the ip filter is
loaded before the devices? The advertise message is only sent when a device
connects to io-net does it not? Or is there an advertise messages when the
ip filter is loaded?


“Xiaodan Tang” <xtang@qnx.com> wrote in message
news:a4c6mp$nvq$2@nntp.qnx.com

QNX SLC Project Group <> qnx_slcproject@canda.com> > wrote:
I’m writing an IP-Filter module below the IP layer. It’s running on QNX
RTOS 6.1a (x86 machine).

I was wondering if there was anyway to tell which device the packet
received at the IP Filter level came from. This would be in the up

direction. The uint16_t iface, value i’m getting is 0 right now.

What if it was a serial device connected? Is there a numeric value for
each specific device? Does iface=0 always mean ethernet0, and iface=1

ethernet1?

I just basically want to know how to tell what device the packet i’m
receiving originated from.

When you loaded, drivers (up producers) under you will asked to
send a “advertise” packet to you. It’s an npkt with _NPKT_MSG
flag in it.

In side the advertise information, each producer told you their
“cell/endpoint/iface”, along with their name (like en0, or en1,
or ppp0), you are suppose to remember that information.

When ever a packet comming in, you have to compare the
cell/endpoint/iface from the “rx_up()” PARAMATER list (yes,
not the one in npkt, they are useless when a packet going up),
and figure out with interface it is comming from.

-xtang

QNX SLC Project Group <qnx_slcproject@canada.com> wrote:

Does that mean that I can only get the device type if the ip filter is
loaded before the devices? The advertise message is only sent when a device
connects to io-net does it not? Or is there an advertise messages when the
ip filter is loaded?

The advertise message was sent when:

the driver is loaded.
anything above driver changed (like filter is loaded, tcpip loaded…)

So your filter ALWAYS get at least one message per device. (Note
you could get 2 messages from one device, if you load driver first,
then filter (first message), then tcpip (second message)).

You should also make sure that you always pass up the message
aftery you’ve done with it.

-xtang

“Xiaodan Tang” <> xtang@qnx.com> > wrote in message
news:a4c6mp$nvq$> 2@nntp.qnx.com> …
QNX SLC Project Group <> qnx_slcproject@canda.com> > wrote:
I’m writing an IP-Filter module below the IP layer. It’s running on QNX
RTOS 6.1a (x86 machine).

I was wondering if there was anyway to tell which device the packet
received at the IP Filter level came from. This would be in the up
direction. The uint16_t iface, value i’m getting is 0 right now.
What if it was a serial device connected? Is there a numeric value for
each specific device? Does iface=0 always mean ethernet0, and iface=1
ethernet1?

I just basically want to know how to tell what device the packet i’m
receiving originated from.

When you loaded, drivers (up producers) under you will asked to
send a “advertise” packet to you. It’s an npkt with _NPKT_MSG
flag in it.

In side the advertise information, each producer told you their
“cell/endpoint/iface”, along with their name (like en0, or en1,
or ppp0), you are suppose to remember that information.

When ever a packet comming in, you have to compare the
cell/endpoint/iface from the “rx_up()” PARAMATER list (yes,
not the one in npkt, they are useless when a packet going up),
and figure out with interface it is comming from.

-xtang