All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vlad Yasevich <vladislav.yasevich@hp.com>
To: linux-sctp@vger.kernel.org
Subject: Re: Possible problem in sctp_getsockopt_peer_addrs (and similar functions)
Date: Fri, 19 Feb 2010 13:25:38 +0000	[thread overview]
Message-ID: <4B7E9152.6010007@hp.com> (raw)
In-Reply-To: <4B7E5DDF.4070500@nict.go.jp>

Hi Sebastien

Sebastien Decugis wrote:
> Hello list,
> 
> I think there is a problem in sctp_getsockopt_peer_addrs function in
> net/sctp/socket.c.
> 
> I run into the problem when I call sctp_getpaddrs in userland, with a
> buffer containing IPv4 address followed by IPv6. The address buffer I
> receive cannot be parsed. After correctly reading the first address, I
> am not aligned correctly when I move my pointer forward by sizeof(struct
> sockaddr_in), to read the next address. I am not using mapped addresses.
> I believe the source of the problem being the following code:
> 
> list_for_each_entry(from, &asoc->peer.transport_addr_list,
>                               transports) {
>     memcpy(&temp, &from->ipaddr, sizeof(temp));
>     sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp);
>     addrlen = sctp_get_af_specific(sk->sk_family)->sockaddr_len;
> 
> In this last line, shouldn't the address be dependent on the address
> family of &temp, rather than the socket ?
> 
> Sorry if the format of my mail is not good, it is my first post here...
> I am also not subscribed to this list, so please CC me in any answer.
> 
> Best regards,
> Sebastien.
> 

You are correct.  The address length used is totally wrong.  The length
should depend on the family of the address stored in the 'temp' variable
as that is the address that will be copied out to user.

I'll fix it up.

Thanks
-vlad

      reply	other threads:[~2010-02-19 13:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-19  9:46 Possible problem in sctp_getsockopt_peer_addrs (and similar functions) Sebastien Decugis
2010-02-19 13:25 ` Vlad Yasevich [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B7E9152.6010007@hp.com \
    --to=vladislav.yasevich@hp.com \
    --cc=linux-sctp@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.