[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20090316135822.GF6891@traven>
Date: Mon, 16 Mar 2009 14:58:22 +0100
From: Matthias Kaehlcke <matthias@...hlcke.net>
To: Cliffe <cliffe@...net>
Cc: linux-kernel@...r.kernel.org
Subject: Re: Getting the port numbers and IP address from struct socket
El Mon, Mar 16, 2009 at 10:03:31PM +0800 Cliffe ha dit:
> This may be a simple question, but how do I determine the port numbers,
> and IP addresses from a (struct socket)socket?
i'm far from being a networking expert, so i might be plain
wrong. after having a look at the kernel sources i think it works in
the following way:
struct inet_sock *inet = inet_sk(socket->sk);
the data you are looking for are:
inet->saddr
inet->sport
inet->daddr
inet->dport
btw: for these kind of questions it is better to write to the
kernelnewbies list (kernelnewbies@...linux.org)
best regards
--
Matthias Kaehlcke
Embedded Linux Engineer
Barcelona
Anyone who has never made a mistake has never tried anything new
(Albert Einstein)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists