Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Jan Engelhardt <jengelh@medozas.de>
Cc: "Netfilter Developer Mailing List"
	<netfilter-devel@vger.kernel.org>,
	netdev@vger.kernel.org, "Rafał Maj" <rafal.maj.it@gmail.com>
Subject: Re: sk->sk_socket seems to disappear before connection termination
Date: Wed, 10 Nov 2010 06:47:17 +0100	[thread overview]
Message-ID: <1289368037.2700.14.camel@edumazet-laptop> (raw)
In-Reply-To: <alpine.LNX.2.01.1011100205220.17978@obet.zrqbmnf.qr>

Le mercredi 10 novembre 2010 à 02:09 +0100, Jan Engelhardt a écrit :
> Hi,
> 
> 
> Rafał reported this to us on IRC, paraphrasing what has been observed:
> 
> Using a simple rule like `iptables -A OUTPUT -p tcp --dport 80 -j LOG 
> --log-uid`, one can observe on creating a connection and terminating
> it that the trailing packets have skb->sk->sk_socket == NULL.
> Is this intended? Is the socket not retained until after TCP has
> sent out the closing exchange?
> 
> As I can reproduce:
> 
> $ telnet 134.76.13.21 80
> Trying 134.76.13.21...
> Connected to 134.76.13.21.
> Escape character is '^]'.
> ^]
> telnet> ^D
> Connection closed.
> 
> [491419.500978] IN= OUT=tun0 SRC=134.76.2.163 DST=134.76.13.21 LEN=60 TOS=0x10 PREC=0x00 TTL=64 ID=35420 DF PROTO=TCP SPT=58613 DPT=80 WINDOW=5488 RES=0x00 SYN URGP=0 UID=25121 GID=100 
> [491419.511533] IN= OUT=tun0 SRC=134.76.2.163 DST=134.76.13.21 LEN=52 TOS=0x10 PREC=0x00 TTL=64 ID=35421 DF PROTO=TCP SPT=58613 DPT=80 WINDOW=86 RES=0x00 ACK URGP=0 UID=25121 GID=100 
> [491420.052182] IN= OUT=tun0 SRC=134.76.2.163 DST=134.76.13.21 LEN=52 TOS=0x10 PREC=0x00 TTL=64 ID=35422 DF PROTO=TCP SPT=58613 DPT=80 WINDOW=86 RES=0x00 ACK FIN URGP=0 UID=25121 GID=100 
> [491420.063619] IN= OUT=tun0 SRC=134.76.2.163 DST=134.76.13.21 LEN=52 TOS=0x10 PREC=0x00 TTL=64 ID=35423 DF PROTO=TCP SPT=58613 DPT=80 WINDOW=86 RES=0x00 ACK URGP=0 

Hmmm... skb->sk->sk_socket is really NULL ?

Are you sure its not skb->sk->sk_socket->file which is NULL ?

In this case, you might need to use sock_i_uid() / sock_i_ino() as a
fallback ? (expensive because they take a rwlock)




--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-11-10  5:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-10  1:09 sk->sk_socket seems to disappear before connection termination Jan Engelhardt
2010-11-10  5:47 ` Eric Dumazet [this message]
2010-11-10 10:53   ` Jan Engelhardt
2010-11-10 16:44     ` Eric Dumazet
2010-11-10 17:17       ` Jan Engelhardt
2010-11-10 17:37         ` Eric Dumazet
2010-11-11 11:00           ` Patrick McHardy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1289368037.2700.14.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=jengelh@medozas.de \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=rafal.maj.it@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox