netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: Casey Schaufler <casey@schaufler-ca.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: commit b9ef5513c99b breaks ping to ipv6 linklocal addresses on debian buster
Date: Mon, 6 Jan 2020 09:41:04 -0700	[thread overview]
Message-ID: <d8bc9dce-fba2-685b-c26a-89ef05aa004a@gmail.com> (raw)
In-Reply-To: <a2612f24-00b7-7e9e-5a9e-d0d82b22ea8e@i-love.sakura.ne.jp>

On 1/6/20 4:04 AM, Tetsuo Handa wrote:
>>
>> This change seems more appropriate to me (and fixes the failure):
>>
>> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
>> index ecea41ce919b..ce5e3be7c111 100644
>> --- a/security/smack/smack_lsm.c
>> +++ b/security/smack/smack_lsm.c
>> @@ -2854,7 +2854,7 @@ static int smack_socket_connect(struct socket
>> *sock, struct sockaddr *sap,
>>                 rc = smack_netlabel_send(sock->sk, (struct sockaddr_in
>> *)sap);
>>                 break;
>>         case PF_INET6:
>> -               if (addrlen < SIN6_LEN_RFC2133 || sap->sa_family !=
>> AF_INET6)
>> +               if (addrlen < SIN6_LEN_RFC2133)
>>                         return -EINVAL;
> 
> This is called upon connect(), isn't it? Then, it is possible that a socket's
> protocol family is PF_INET6 but address given is AF_INET, isn't it? For example,
> __ip6_datagram_connect() checks for AF_INET before checking addrlen is at least
> SIN6_LEN_RFC2133 bytes. Thus, I think that we need to return 0 if address given
> is AF_INET even if socket is PF_INET6.

In this case, the sockaddr is AF_UNSPEC. From the first message:

$ strace -e connect ping6 -c1 -w1 ff02::1%eth1
connect(4, {sa_family=AF_UNSPEC,
sa_data="\4\1\0\0\0\0\377\2\0\0\0\0\0\0\0\0\0\0\0\0\0\1\3\0\0\0"}, 28) = 0

That's why I was suggesting if the socket is PF_INET6 and the address
length is at least SIN6_LEN_RFC2133, then don't worry about the sa_family.


> 
>>  #ifdef SMACK_IPV6_SECMARK_LABELING
>>                 rsp = smack_ipv6host_label(sip);
>>
>>
>> ie., if the socket family is AF_INET6 the address length should be an
>> IPv6 address. The family in the sockaddr is not as important.
>>
> 
> Commit b9ef5513c99b was wrong, but we need to also fix commit c673944347ed ?
> 

not sure. I have not seen a problem related to it yet.

  reply	other threads:[~2020-01-06 16:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-06  1:26 commit b9ef5513c99b breaks ping to ipv6 linklocal addresses on debian buster David Ahern
2020-01-06  3:51 ` Tetsuo Handa
2020-01-06  4:20   ` David Ahern
2020-01-06 11:04     ` Tetsuo Handa
2020-01-06 16:41       ` David Ahern [this message]
2020-01-06 21:03         ` Tetsuo Handa
2020-01-06 21:33           ` Casey Schaufler
2020-01-07 18:05           ` Casey Schaufler
2020-01-07 18:40           ` Casey Schaufler
2020-01-07 18:44             ` David Ahern
2020-01-08  2:41               ` David Ahern
2020-01-08 23:06                 ` Casey Schaufler
     [not found]                   ` <CAPA1RqAqBZNeN=T_FpApLo_-oZXeFctgGHcggY6xAXV+qHYcKg@mail.gmail.com>
2020-01-09  3:39                     ` David Ahern
2020-01-09  4:06                   ` David Ahern
2020-01-09  9:50                     ` Tetsuo Handa

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=d8bc9dce-fba2-685b-c26a-89ef05aa004a@gmail.com \
    --to=dsahern@gmail.com \
    --cc=casey@schaufler-ca.com \
    --cc=netdev@vger.kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).