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
This commit is contained in:
parent
8586c17750
commit
efc284cb12
@ -690,7 +690,6 @@ void
|
||||
in6_ifattach(struct ifnet *ifp, struct ifnet *altifp)
|
||||
{
|
||||
struct in6_ifaddr *ia;
|
||||
struct in6_addr in6;
|
||||
|
||||
if (ifp->if_afdata[AF_INET6] == NULL)
|
||||
return;
|
||||
@ -723,18 +722,16 @@ in6_ifattach(struct ifnet *ifp, struct ifnet *altifp)
|
||||
|
||||
/*
|
||||
* assign loopback address for loopback interface.
|
||||
* XXX multiple loopback interface case.
|
||||
*/
|
||||
if ((ifp->if_flags & IFF_LOOPBACK) != 0) {
|
||||
struct ifaddr *ifa;
|
||||
|
||||
in6 = in6addr_loopback;
|
||||
ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, &in6);
|
||||
if (ifa == NULL) {
|
||||
if (in6_ifattach_loopback(ifp) != 0)
|
||||
return;
|
||||
} else
|
||||
ifa_free(ifa);
|
||||
/*
|
||||
* check that loopback address doesn't exist yet.
|
||||
*/
|
||||
ia = in6ifa_ifwithaddr(&in6addr_loopback, 0);
|
||||
if (ia == NULL)
|
||||
in6_ifattach_loopback(ifp);
|
||||
else
|
||||
ifa_free(&ia->ia_ifa);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -742,18 +739,10 @@ in6_ifattach(struct ifnet *ifp, struct ifnet *altifp)
|
||||
*/
|
||||
if (!(ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) &&
|
||||
ND_IFINFO(ifp)->flags & ND6_IFF_AUTO_LINKLOCAL) {
|
||||
int error;
|
||||
|
||||
ia = in6ifa_ifpforlinklocal(ifp, 0);
|
||||
if (ia == NULL) {
|
||||
error = in6_ifattach_linklocal(ifp, altifp);
|
||||
#if 0
|
||||
if (error)
|
||||
log(LOG_NOTICE, "in6_ifattach_linklocal: "
|
||||
"failed to add a link-local addr to %s\n",
|
||||
if_name(ifp));
|
||||
#endif
|
||||
} else
|
||||
if (ia == NULL)
|
||||
in6_ifattach_linklocal(ifp, altifp);
|
||||
else
|
||||
ifa_free(&ia->ia_ifa);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user