Date: Sun, 24 Jan 2021 13:01:23 +0200 From: Guy Yur <guyyur@gmail.com> To: "Alexander V. Chernikov" <melifaro@freebsd.org>, "freebsd-current@freebsd.org" <freebsd-current@freebsd.org> Subject: Re: adding existing ipv6 network route returns ENOMEM instead of EEXIST if loopback route also exists Message-ID: <1fc009db-196f-f196-c115-c4a85f81f209@gmail.com> In-Reply-To: <4229351606302594@mail.yandex.ru> References: <9b1bb259-1307-7776-cc0b-e7a8eced6ac3@gmail.com> <4229351606302594@mail.yandex.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi, On 25/11/20 1:12 pm, Alexander V. Chernikov wrote: > 21.11.2020, 22:48, "Guy Yur" <guyyur@gmail.com>: >> 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. Did you get a chance to look at it? I am currently using a workaround of setting RTAX_DST to the masked address before the call to lookup_prefix in add_route(): info->rti_info[RTAX_DST] = rt_key(rt); /* addition failed. Lookup prefix in the rib to determine the cause */ rt_orig = lookup_prefix(rnh, info, &rnd_orig); >> 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" Thanks, Guy Yur
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1fc009db-196f-f196-c115-c4a85f81f209>