Bug 138678 - [lo] FreeBSD does not assign linklocal address to loopbacks >0
Summary: [lo] FreeBSD does not assign linklocal address to loopbacks >0
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-net (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-09 21:00 UTC by cwf-ml
Modified: 2018-02-19 10:35 UTC (History)
2 users (show)

See Also:


Attachments
Proposed patch (1.54 KB, patch)
2018-01-03 14:38 UTC, Andrey V. Elsukov
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description cwf-ml 2009-09-09 21:00:06 UTC
we create another loopback interface (lo1) via a cloned_interfaces list
and add it to the ipv6_interfaces list. Then we assign it an address.

After reboot the system comes up and lo1 does not have a loopback address:

bbres1# (~) ifconfig -a
[...]
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x4
        inet 127.0.0.1 netmask 0xff000000
lo1: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        inet6 2a00:ff:cfff:530::1:1 prefixlen 128

This is a problem because route6d refuses to run when it finds a v6
interface without linklocal address.

Fix: 

Workaround: explicitly configure the linklocal address via rc.conf:

ipv6_ifconfig_lo1_alias0="fe80::1/64"
How-To-Repeat: see above
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2009-09-09 21:05:49 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-net

Over to maintainer(s).
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:01:02 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 3 Andrey V. Elsukov freebsd_committer freebsd_triage 2018-01-03 14:38:13 UTC
Created attachment 189363 [details]
Proposed patch

in6_ifattach fails to add IPv6 loopback address to loopback interface due to it already exists on lo0 and then just exits before LLA should be assigned.
This patch changes the behavior, it checks for IPv6 loopback address existence in the whole system, not only on given interface. And if loopback address is already configured, it doesn't try assign it again.
Comment 4 commit-hook freebsd_committer freebsd_triage 2018-01-29 10:34:05 UTC
A commit references this bug:

Author: ae
Date: Mon Jan 29 10:33:56 UTC 2018
New revision: 328540
URL: https://svnweb.freebsd.org/changeset/base/328540

Log:
  Assign IPv6 link-local address to loopback interfaces whith unit > 0.

  When an interface has IFF_LOOPBACK flag in6_ifattach() tries to assing
  IPv6 loopback address to this interface. It uses in6ifa_ifpwithaddr()
  to check, that interface doesn't already have given address and then
  uses in6_ifattach_loopback(). If in6_ifattach_loopback() fails, it just
  exits and thus skips assignment of IPv6 LLA.
  Fix this using in6ifa_ifwithaddr() function. If IPv6 loopback address is
  already assigned in the system, do not call in6_ifattach_loopback().

  PR:		138678
  MFC after:	3 weeks

Changes:
  head/sys/netinet6/in6_ifattach.c
Comment 5 commit-hook freebsd_committer freebsd_triage 2018-02-19 10:31:09 UTC
A commit references this bug:

Author: ae
Date: Mon Feb 19 10:30:34 UTC 2018
New revision: 329558
URL: https://svnweb.freebsd.org/changeset/base/329558

Log:
  MFC r328540:
    Assign IPv6 link-local address to loopback interfaces whith unit > 0.

    When an interface has IFF_LOOPBACK flag in6_ifattach() tries to assing
    IPv6 loopback address to this interface. It uses in6ifa_ifpwithaddr()
    to check, that interface doesn't already have given address and then
    uses in6_ifattach_loopback(). If in6_ifattach_loopback() fails, it just
    exits and thus skips assignment of IPv6 LLA.
    Fix this using in6ifa_ifwithaddr() function. If IPv6 loopback address is
    already assigned in the system, do not call in6_ifattach_loopback().

    PR:		138678

Changes:
_U  stable/11/
  stable/11/sys/netinet6/in6_ifattach.c
Comment 6 Andrey V. Elsukov freebsd_committer freebsd_triage 2018-02-19 10:35:58 UTC
Fixed in head/ and stable/11. Thanks!