diff options
| author | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2021-07-08 14:09:20 -0300 |
|---|---|---|
| committer | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2021-07-09 07:55:25 -0300 |
| commit | 1fe59b44fc94337f0b508bc762a401a9dbe9c1a3 (patch) | |
| tree | 8a525db11e5c2b61c3b8cb29b9eb55c4ed9bd6f5 /ospfd/ospf_flood.c | |
| parent | f45f6a22b052988a6ca3399fde66249e8b6e00cc (diff) | |
lib,ospfd,ospf6d: remove duplicated function
Move `is_default_prefix` variations to `lib/prefix.h` and make the code
use the library version instead of implementing it again.
NOTE
----
The function was split into per family versions to cover all types.
Using `union prefixconstptr` is not possible due to static analyzer
warnings which cause CI to fail.
The specific cases that would cause this failure were:
- Caller used `struct prefix_ipv4` and called the generic function.
- `is_default_prefix` with signature using `const struct prefix *` or
`union prefixconstptr`.
The compiler would complain about reading bytes outside of the memory
bounds even though it did not take into account the `prefix->family`
part.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'ospfd/ospf_flood.c')
| -rw-r--r-- | ospfd/ospf_flood.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ospfd/ospf_flood.c b/ospfd/ospf_flood.c index 6c1ac6761a..55bcaebd6e 100644 --- a/ospfd/ospf_flood.c +++ b/ospfd/ospf_flood.c @@ -98,14 +98,14 @@ struct external_info *ospf_external_info_check(struct ospf *ospf, int redist_on = 0; redist_on = - is_prefix_default(&p) + is_default_prefix4(&p) ? vrf_bitmap_check( - zclient->default_information[AFI_IP], - ospf->vrf_id) + zclient->default_information[AFI_IP], + ospf->vrf_id) : (zclient->mi_redist[AFI_IP][type].enabled || vrf_bitmap_check( - zclient->redist[AFI_IP][type], - ospf->vrf_id)); + zclient->redist[AFI_IP][type], + ospf->vrf_id)); // Pending: check for MI above. if (redist_on) { ext_list = ospf->external[type]; @@ -128,7 +128,7 @@ struct external_info *ospf_external_info_check(struct ospf *ospf, } } - if (is_prefix_default(&p) && ospf->external[DEFAULT_ROUTE]) { + if (is_default_prefix4(&p) && ospf->external[DEFAULT_ROUTE]) { ext_list = ospf->external[DEFAULT_ROUTE]; for (ALL_LIST_ELEMENTS_RO(ext_list, node, ext)) { |
