How to get reference to "sock" structure related to particular socket descriptor
Hi,
I am developing an application which requires me to add some more variable in struct sock inside linux kernel. (like adding a new int auth_level, int key etc.)
Now to set these fields, I am writing a system call which the applications need to invoke whenever they want to set values of these newly added varialbe. My system call is like
modifySocket(int sockfd, value1, value2 ...)
So, now to set values newly added variables in sock structure, i need have referece to that sock structure. As input I can not ask anything more than sockfd (socket descriptor).
Can anybody help by suggesting a way to accomplish this?
By following kernel codes of sys_send and sys_sendto functions I came to know about sockfd_lookup() function. But this is of no use to me as it returns reference to socket structure and not to sock structure.
Is there any way to get reference to sock structure from socket structure?
Sorry if questions are silly, but I am very new to kernel programming and dont know about structures and functionalities available.
Thank You.
|