git: f84c30106e8b - main - routing: Fix newly-added rt_get_inet[6]_parent() api.
Alexander V. Chernikov
melifaro at FreeBSD.org
Mon Aug 30 21:13:59 UTC 2021
The branch main has been updated by melifaro:
URL: https://cgit.FreeBSD.org/src/commit/?id=f84c30106e8b725774b4e9a32c8dd11c90da8c25
commit f84c30106e8b725774b4e9a32c8dd11c90da8c25
Author: Alexander V. Chernikov <melifaro at FreeBSD.org>
AuthorDate: 2021-08-30 21:10:37 +0000
Commit: Alexander V. Chernikov <melifaro at FreeBSD.org>
CommitDate: 2021-08-30 21:10:37 +0000
routing: Fix newly-added rt_get_inet[6]_parent() api.
Correctly handle the case when no default route is present.
Reported by: Konrad <konrad.kreciwilk at korbank.pl>
---
sys/net/route/route_helpers.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sys/net/route/route_helpers.c b/sys/net/route/route_helpers.c
index 569e13a308eb..0696eec416b1 100644
--- a/sys/net/route/route_helpers.c
+++ b/sys/net/route/route_helpers.c
@@ -434,6 +434,9 @@ get_inet_parent_prefix(uint32_t fibnum, struct in_addr addr, int plen)
struct radix_node *rn;
rt = fib4_lookup_rt(fibnum, addr, 0, NHR_UNLOCKED, &rnd);
+ if (rt == NULL)
+ return (NULL);
+
rt_get_inet_prefix_plen(rt, &addr4, &parent_plen, &scopeid);
if (parent_plen <= plen)
return (rt);
@@ -503,6 +506,9 @@ get_inet6_parent_prefix(uint32_t fibnum, const struct in6_addr *paddr, int plen)
struct radix_node *rn;
rt = fib6_lookup_rt(fibnum, paddr, 0, NHR_UNLOCKED, &rnd);
+ if (rt == NULL)
+ return (NULL);
+
rt_get_inet6_prefix_plen(rt, &addr6, &parent_plen, &scopeid);
if (parent_plen <= plen)
return (rt);
More information about the dev-commits-src-all
mailing list