From owner-freebsd-current@freebsd.org Wed Nov 25 11:12:45 2020 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3188047DE7D for ; Wed, 25 Nov 2020 11:12:45 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from forward501j.mail.yandex.net (forward501j.mail.yandex.net [IPv6:2a02:6b8:0:801:2::111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cgysl6lPPz4tJW for ; Wed, 25 Nov 2020 11:12:43 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from mxback18j.mail.yandex.net (mxback18j.mail.yandex.net [IPv6:2a02:6b8:c04:106:0:640:832a:56af]) by forward501j.mail.yandex.net (Yandex) with ESMTP id AAE1133800BF; Wed, 25 Nov 2020 14:12:38 +0300 (MSK) Received: from localhost (localhost [::1]) by mxback18j.mail.yandex.net (mxback/Yandex) with ESMTP id 5XOtOb0qYj-CcpuuuwF; Wed, 25 Nov 2020 14:12:38 +0300 Received: by myt6-7b46a58f2373.qloud-c.yandex.net with HTTP; Wed, 25 Nov 2020 14:12:37 +0300 From: Alexander V. Chernikov Envelope-From: melifaro@ipfw.ru To: Guy Yur , "freebsd-current@freebsd.org" In-Reply-To: <9b1bb259-1307-7776-cc0b-e7a8eced6ac3@gmail.com> References: <9b1bb259-1307-7776-cc0b-e7a8eced6ac3@gmail.com> Subject: Re: adding existing ipv6 network route returns ENOMEM instead of EEXIST if loopback route also exists MIME-Version: 1.0 X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Wed, 25 Nov 2020 11:12:37 +0000 Message-Id: <4229351606302594@mail.yandex.ru> Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Rspamd-Queue-Id: 4Cgysl6lPPz4tJW X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.30 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a02:6b8:0::/52]; RCVD_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[ipfw.ru:+]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FREEMAIL_TO(0.00)[gmail.com,freebsd.org]; FORGED_SENDER(0.30)[melifaro@freebsd.org,melifaro@ipfw.ru]; RCVD_IN_DNSWL_LOW(-0.10)[2a02:6b8:0:801:2::111:from]; RCVD_TLS_LAST(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a02:6b8:0:801:2::111:from]; ASN(0.00)[asn:13238, ipnet:2a02:6b8::/32, country:RU]; MIME_TRACE(0.00)[0:+]; FROM_NEQ_ENVFROM(0.00)[melifaro@freebsd.org,melifaro@ipfw.ru]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[ipfw.ru:s=mail]; FREEFALL_USER(0.00)[melifaro]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; SPAMHAUS_ZRD(0.00)[2a02:6b8:0:801:2::111:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MAILMAN_DEST(0.00)[freebsd-current] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Nov 2020 11:12:45 -0000 21.11.2020, 22:48, "Guy Yur" : > Hi, > > When adding a route with a netmask, add_route() in route_ctl.c > adds the route with destination address masked. > If the add failed (for example, the route exists) it calls > lookup_prefix() with the original unmasked destination. Thank you for the report! Indeed, there is a problem w.r.t non-masked dst handling. I'll look into that in the end of this week. > > In a scenario where a loopback route was added followed > by the network route being added, if the network route > is added again and the network route destination is the > same as the loopback route, lookup_prefix() will match on > the loopback route, not finding the network route and > add_route() will return ENOMEM instead of EEXIST. > Adding the route with just the network part returns EEXIST as expected. > > Example: > # route -6 add -host fd53::1111 -prefixlen 128 ::1 > # route -6 add -net fd53::1111 -prefixlen 64 ::1 > # route -6 add -net fd53::1111 -prefixlen 64 ::1 > route: writing to routing socket: Cannot allocate memory > add net fd53::1111: gateway ::1 fib 0: Cannot allocate memory > # route -6 add -net fd53:: -prefixlen 64 ::1 > add net fd53::: gateway ::1 fib 0: route already in table > > I was testing https://reviews.freebsd.org/D15406 > changes applied to r367863. > The changes call rtinit to add prefix route when > interface address is added/updated and uses the > interface address as the destination. > rtinit returned ENOMEM instead of EEXIST > causing dhcpcd to printCannot allocate memory. > > route commands above showing the problem were run > in r367863 without D15406 changesas well. > > Thanks, > Guy Yur > > _______________________________________________ > freebsd-current@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"