I'm writing a network protocol module, and having trouble getting the information from a connected peer socket. I don't know where to pull this info from and don't understand the kernel examples.
Here is my 'struct proto_ops' callback of .getname.
Code:
static int my_getname(struct socket *sock, struct sockaddr *uaddr,
int *uaddr_len, int peer)
{
struct sock *sk = sock->sk;
struct sockaddr_in *sin = (struct sockaddr_in *)uaddr;
sin->sin_family = AF_INET;
*uaddr_len = sizeof(struct sockaddr);
return 0;
}
I'm just not sure how to populate the 'struct sockaddr' w/ the protocol address.
update ... It comes from the accept().