netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tj <linux@iam.tj>
To: netdev@vger.kernel.org
Subject: IPv6 address scope not set to operator-configured value
Date: Fri, 8 Sep 2023 18:02:00 +0100	[thread overview]
Message-ID: <f878ef3c-d11b-b1de-fa02-d9617308d460@iam.tj> (raw)

Using iproute2 and kernel v6.5.0 with Debian 12 Bookworm amd64 (tested also with v6.136 nixos) setting scope on an IPv6 fails silently with no indications as to why and the address is configured with what appears to be a scope based on the prefix (usually 0 but for fe80::/16 addresses scope is set to 253). Doesn't matter whether using scope names (from /etc/iproute2/rt_scopes) or numbers. Similar command for IPv4 succeeds.

ip address add fddc::2/64 scope 200 dev PUBLIC
ip -N -6 address show dev PUBLIC
...
inet6 fddc::2/64 scope 0

I used `gdb` to trace this expecting somehow the scope was not being read correctly but it is:

2577            if (!scoped && cmd != RTM_DELADDR)
(gdb) p scoped
$22 = <optimized out>
(gdb) p cmd
$23 = <optimized out>
(gdb) n
2580            req.ifa.ifa_index = ll_name_to_index(d);
(gdb) p req.ifa.ifa_scope
$24 = 200 '\310'
...
2607            if (echo_request)
(gdb) n
2610                    ret = rtnl_talk(&rth, &req.n, NULL);
(gdb) p req.n
$25 = {nlmsg_len = 64, nlmsg_type = 20, nlmsg_flags = 1537, nlmsg_seq = 0, nlmsg_pid = 0}
(gdb) p rth
$26 = {fd = 3, local = {nl_family = 16, nl_pad = 0, nl_pid = 2381950, nl_groups = 0}, peer = {nl_family = 0, nl_pad = 0, nl_pid = 0, nl_groups = 0}, seq = 1694191286,
   dump = 0, proto = 0, dump_fp = 0x0, flags = 4}
(gdb) s
rtnl_talk (rtnl=0x5555555f7020 <rth>, n=n@entry=0x7fffffffe140, answer=answer@entry=0x0) at ./lib/libnetlink.c:1170
1170    {
...
ipaddr_modify (cmd=<optimized out>, flags=<optimized out>, argc=<optimized out>, argv=0x7fffffffe478) at ./ip/ipaddress.c:2612
2612            if (ret)
(gdb) p ret
$27 = 0






             reply	other threads:[~2023-09-08 17:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-08 17:02 Tj [this message]
2023-09-12  9:50 ` IPv6 address scope not set to operator-configured value Guillaume Nault
2023-09-14 13:51   ` Tj
2023-09-14 14:43     ` David Ahern

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=f878ef3c-d11b-b1de-fa02-d9617308d460@iam.tj \
    --to=linux@iam.tj \
    --cc=netdev@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 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).