Re: inode to destination address

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

struct sock *sk = skptr->sk;
and then

((struct tcp_sock*)sk->inet).saddr;   //This gives the source address

Try going through the inet_opt structure in the include/linux/ip.h.

Correct me if I am wrong

Regards
Suthambhara


On Thu, 28 Oct 2004 02:11:35 +0200, Thorsten Holz
<thorsten.holz@xxxxxxxxxxxxxxxxxxxx> wrote:
> Hello all,
> 
> I have a question regarding kernel 2.6:
> 
> I want to get the source & destination address corresponding to
> a given inode. With kernel 2.4 I use
> 
> struct inode * inode_ptr;
> inode_ptr->u.socket_i
> 
> to get the socket associated with the inode and then
> 
> struct socket * sock_ptr;
> sock_ptr->sk->sport / sock_ptr->sk->dport
> 
> to get the values. With linux 2.6 this is not possible because
> kernel 2.6 doesn't associate a socket_i to an inode:
> From fs.h:
>   struct inode {
>     [...]
>        union {
>            void        *generic_ip;
>        } u;
>     [...]
> 
> I use SOCKET_I(inode_ptr) to get the socket, but how do I get
> the destination address now?
> 
> Cheers,
>   Thorsten
> 
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 
>

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux