mirror of
https://github.com/opnsense/src.git
synced 2026-06-14 19:20:18 -04:00
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>
(cherry picked from commit f84c30106e)
This commit is contained in:
parent
4e97cbba1c
commit
0e77fc2a79
1 changed files with 6 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue