On Tue, 7 Sep 1999, Cathryn Mataga http://junglevision.com wrote:
> Yeah, I've been looking at the kernel source, and I'm trying to figure
> out how on earth getpeername can return 0 for the len. I copied this out
> of net/socket.c. Shouldn't len=*usockaddr_len; be in there somewhere?
> Or, how does Linux manage to work at all...
>
> asmlinkage int sys_getpeername(int fd, struct sockaddr *usockaddr, int
>*usockaddr_len)
> {
> struct socket *sock;
> char address[MAX_SOCK_ADDR];
> int len, err;
>
> lock_kernel();
> if ((sock = sockfd_lookup(fd, &err))!=NULL)
> {
> err = sock->ops->getname(sock, (struct sockaddr *)address, &len, 1);
> if (!err)
> err=move_addr_to_user(address,len, usockaddr, usockaddr_len);
> sockfd_put(sock);
> }
> unlock_kernel();
> return err;
> }
Ha! Thanks Cathryn, I think you found it!
It seems the interface to getname has changed a bit. From that code I
deduce that &len is now supposed be _filled_in_ by sock->ops->getname().
At least inet_getname() does that. And it's now move_addr_to_user() that
handles truncating the address struct if needed.
Now it should only be a matter of a small adjustment to ax25_getname(),
nr_getname() and rose_getname() and we are back to business...
--
--... Tomi Manninen / [EMAIL PROTECTED] / OH2BNS @ OH2RBI.FIN.EU ...--