Skip to contentSkip to conversation

why is sk->skb->sk_socket->file NULL on incoming packets?

DISCUSSION Luke Kenneth Casson Leighton 2 participants 3 messages Sep 10, 2004

lore
Share & tools
lore
#0 lore raw

hi, simple question - if a userspace ip_queue program (fireflier) can determine the pid of an incoming packet, why can't ipt_owner.c do the same?

how do i force, even by using a userspace thing which asks the packet to be "re-examined", the skb->sk->sk_socket->file to be set?

i _need_ this to work!

_yes_ i have a modified version of ipt_owner.c which can track down the full path name of the program.

_yes_ i'm happy with creating more than one per-executable-program-name rule for instances where sockets are shared between executables (e.g. they're passed over unix-domain-sockets).

help, help!

l.

Signature · 7 lines
--
Truth, honesty and respect are rare commodities that all spring from
the same well: Love.  If you love yourself and everyone and everything
around you, funnily and coincidentally enough, life gets a lot better.
--
<a href="http://lkcl.net">      lkcl.net      </a> <br />
<a href="mailto:[email protected]"> [email protected] </a> <br />
#1 lore raw
Quoted 7 lines · * Luke Kenneth Casson Leighton ([email protected]) wrote:

hi, simple question - if a userspace ip_queue program (fireflier) can determine the pid of an incoming packet, why can't ipt_owner.c do the same?

how do i force, even by using a userspace thing which asks the packet to be "re-examined", the skb->sk->sk_socket->file to be set?

I assume the netfilter hook you come in on is NF_IP_LOCAL_IN? This is at ip level. The sock (sk) is protocol specific, and hasn't been looked up yet. Look at the protocols' input handlers (i.e. udp_rcv or tcp_v4_rcv), they do this lookup (i.e. udp_v4_lookup or __tcp_v4_lookup). The sk_filter() point is probably the first time you have an association between the skb (inbound) and the sock it's going to be queued to. LSM modules use security_sock_rcv_skb at this point.

thanks,
-chris

Signature · 1 line
Linux Security Modules     http://lsm.immunix.org     http://lsm.bkbits.net
#2 lore raw
Quoted 9 lines · Chris Wright
Quoted 7 lines · * Luke Kenneth Casson Leighton ([email protected]) wrote:

hi, simple question - if a userspace ip_queue program (fireflier) can determine the pid of an incoming packet, why can't ipt_owner.c do the same?

how do i force, even by using a userspace thing which asks the packet to be "re-examined", the skb->sk->sk_socket->file to be set?

Quoted 7 lines

I assume the netfilter hook you come in on is NF_IP_LOCAL_IN? This is at ip level. The sock (sk) is protocol specific, and hasn't been looked up yet. Look at the protocols' input handlers (i.e. udp_rcv or tcp_v4_rcv), they do this lookup (i.e. udp_v4_lookup or __tcp_v4_lookup). The sk_filter() point is probably the first time you have an association between the skb (inbound) and the sock it's going to be queued to. LSM modules use security_sock_rcv_skb at this point.

oooo *wide-eyed*. thanks