On 7/29/19 8:35 PM, Su Yanjun wrote:
> diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
> index 083cc1c..156c027 100644
> --- a/net/ipv6/ndisc.c
> +++ b/net/ipv6/ndisc.c
> @@ -603,11 +603,14 @@ void ndisc_send_ns(struct net_device *dev, const struct
> in6_addr *solicit,
> int inc_opt = dev->addr_len;
> int optlen = 0;
> struct nd_msg *msg;
> + u32 banned_flags = IFA_F_TENTATIVE | IFA_F_OPTIMISTIC;
>
> if (!saddr) {
banned_flags should be declared here, under !saddr since that is the
scope of its use.
> - if (ipv6_get_lladdr(dev, &addr_buf,
> - (IFA_F_TENTATIVE|IFA_F_OPTIMISTIC)))
> - return;
> + if (ipv6_get_lladdr(dev, &addr_buf, banned_flags)) {
> + /* try global address */
> + if (ipv6_get_addr(dev, &addr_buf, banned_flags))
> + return;
> + }
> saddr = &addr_buf;
> }
>
>