From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B5A9C282C4 for ; Tue, 12 Feb 2019 04:38:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0032C21773 for ; Tue, 12 Feb 2019 04:38:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727197AbfBLEiG (ORCPT ); Mon, 11 Feb 2019 23:38:06 -0500 Received: from shards.monkeyblade.net ([23.128.96.9]:47936 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726864AbfBLEiG (ORCPT ); Mon, 11 Feb 2019 23:38:06 -0500 Received: from localhost (unknown [IPv6:2601:601:9f80:35cd::bf5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id A548514C16EF9; Mon, 11 Feb 2019 20:38:05 -0800 (PST) Date: Mon, 11 Feb 2019 20:38:01 -0800 (PST) Message-Id: <20190211.203801.1570457113402893162.davem@davemloft.net> To: liuzhiqiang26@huawei.com Cc: kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org, 0xeffeff@gmail.com, edumazet@google.com, netdev@vger.kernel.org, mingfangsen@huawei.com, zhangwenhao8@huawei.com, wangxiaogang3@huawei.com, zhoukang7@huawei.com, dsahern@gmail.com, thaller@redhat.com, maowenan@huawei.com Subject: Re: [PATCH v2] net: fix IPv6 prefix route residue From: David Miller In-Reply-To: <131bd64c-1484-39c3-d813-dde47ff4198c@huawei.com> References: <98d563a5-34f0-a504-d62f-d20ed7c770da@huawei.com> <131bd64c-1484-39c3-d813-dde47ff4198c@huawei.com> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Mon, 11 Feb 2019 20:38:06 -0800 (PST) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Zhiqiang Liu Date: Mon, 11 Feb 2019 10:57:46 +0800 > From: Zhiqiang Liu > > Follow those steps: > # ip addr add 2001:123::1/32 dev eth0 > # ip addr add 2001:123:456::2/64 dev eth0 > # ip addr del 2001:123::1/32 dev eth0 > # ip addr del 2001:123:456::2/64 dev eth0 > and then prefix route of 2001:123::1/32 will still exist. > > This is because ipv6_prefix_equal in check_cleanup_prefix_route > func does not check whether two IPv6 addresses have the same > prefix length. If the prefix of one address starts with another > shorter address prefix, even though their prefix lengths are > different, the return value of ipv6_prefix_equal is true. > > Here I add a check of whether two addresses have the same prefix > to decide whether their prefixes are equal. > > Fixes: 5b84efecb7d9 ("ipv6 addrconf: don't cleanup prefix route > for IFA_F_NOPREFIXROUTE") > Signed-off-by: Zhiqiang Liu > Reported-by: Wenhao Zhang Applied and queued up for -stable. Please do not split up long Fixes: tag lines, keep the entire tag on one line only. I fixed it up for you this time. Thanks.