io-net filter

Hello,

I am interested creating filter that will match packets based on
protocol id of the IP header and determine which interface it came in on
(i.e. en0 ) and convey this info to the application somehow. Application
would abviosly be reading a socket. First is it possible to do this any
other way - I looked into SO_BINDTODEVICE already, it is only supported with
UDP on QNX and need to work over raw sockets? Second, if io-net filter is
the only way go, am I stuck with inserting interface info (i.e en0) in the
IP packet itself? If so, at the filter level, do I need to recalc the CRC
so that stack doesn’t drop it?

-Vinay

Vinay Ravuri <vinay_usenet@yahoo.com> wrote:

Hello,

I am interested creating filter that will match packets based on
protocol id of the IP header and determine which interface it came in on
(i.e. en0 ) and convey this info to the application somehow. Application
would abviosly be reading a socket. First is it possible to do this any
other way - I looked into SO_BINDTODEVICE already, it is only supported with
UDP on QNX and need to work over raw sockets? Second, if io-net filter is
the only way go, am I stuck with inserting interface info (i.e en0) in the
IP packet itself? If so, at the filter level, do I need to recalc the CRC
so that stack doesn’t drop it?

SO_BINDTODEVICE is currently only supported for udp sockets. If you’re
using ip and you add to the payload you’ll probably have to modify
(struct ip)->ip_len so therefor yes, (struct ip)->ip_sum will have to
change as well.

-seanb