Skip to content

Commit

Permalink
Merge pull request #12282 from FRRouting/mergify/bp/stable/8.4/pr-12115
Browse files Browse the repository at this point in the history
ospfd: Allow unnumbered and numbered addresses to co-exist better (backport #12115)
  • Loading branch information
Jafaral committed Nov 8, 2022
2 parents 9d2a8d5 + fe5434e commit dd63a54
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ospfd/ospf_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,13 +461,13 @@ struct ospf_interface *ospf_if_lookup_recv_if(struct ospf *ospf,
{
struct route_node *rn;
struct prefix_ipv4 addr;
struct ospf_interface *oi, *match;
struct ospf_interface *oi, *match, *unnumbered_match;

addr.family = AF_INET;
addr.prefix = src;
addr.prefixlen = IPV4_MAX_BITLEN;

match = NULL;
match = unnumbered_match = NULL;

for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) {
oi = rn->info;
Expand All @@ -482,7 +482,7 @@ struct ospf_interface *ospf_if_lookup_recv_if(struct ospf *ospf,
continue;

if (CHECK_FLAG(oi->connected->flags, ZEBRA_IFA_UNNUMBERED))
match = oi;
unnumbered_match = oi;
else if (prefix_match(CONNECTED_PREFIX(oi->connected),
(struct prefix *)&addr)) {
if ((match == NULL) || (match->address->prefixlen
Expand All @@ -491,7 +491,10 @@ struct ospf_interface *ospf_if_lookup_recv_if(struct ospf *ospf,
}
}

return match;
if (match)
return match;

return unnumbered_match;
}

void ospf_interface_fifo_flush(struct ospf_interface *oi)
Expand Down

0 comments on commit dd63a54

Please sign in to comment.