Skip to content

ospfd: fix forwarding-address-self for existing external LSAs - #22864

Open
enkechen-panw wants to merge 2 commits into
FRRouting:masterfrom
enkechen-panw:ospf-forwarding-address-self-fix
Open

ospfd: fix forwarding-address-self for existing external LSAs#22864
enkechen-panw wants to merge 2 commits into
FRRouting:masterfrom
enkechen-panw:ospf-forwarding-address-self-fix

Conversation

@enkechen-panw

@enkechen-panw enkechen-panw commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Refresh external LSAs when forwarding-address-self config changes
  • Fix NSSA Type-7 LSA refresh to use the newly computed forwarding
    address instead of preserving the stale value

Problem

When forwarding-address-self is configured after redistribute, existing
external LSAs retain their original forwarding address.

Additionally, for NSSA areas, ospf_nssa_lsa_refresh() was explicitly
preserving the old forwarding address from the existing LSA,
preventing the config change from taking effect on Type-7 LSAs.

Solution

  1. Schedule an ASBR redistribution update when forwarding-address-self
    changes to refresh all external LSAs
  2. Fix ospf_nssa_lsa_refresh() to use the newly computed forwarding
    address, applying the same NSSA logic as origination (per RFC 3101)

@mwinter-osr

Copy link
Copy Markdown
Member

@greptileai review

Comment thread ospfd/ospf_vty.c
@greptile-apps

greptile-apps Bot commented Jul 29, 2026

Copy link
Copy Markdown

Greptile Summary

This PR corrects forwarding-address refresh behavior for existing external LSAs.

  • Schedules an ASBR redistribution update when forwarding-address-self changes.
  • Recomputes Type-7 forwarding addresses while preserving the existing P-bit state.
  • Withdraws the old Type-7 LSA when a valid replacement cannot be generated.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
ospfd/ospf_lsa.c Recomputes Type-7 forwarding addresses during refresh and safely withdraws the old LSA when no valid P-bit address exists.
ospfd/ospf_vty.c Schedules external-LSA refreshes only when the forwarding-address-self setting actually changes.

Sequence Diagram

sequenceDiagram
    participant CLI as forwarding-address-self CLI
    participant ASBR as ASBR update scheduler
    participant LSA as External LSA refresh
    participant LSDB as OSPF LSDB
    CLI->>ASBR: Schedule update when value changes
    ASBR->>LSA: Refresh Type-5 and Type-7 LSAs
    LSA->>LSA: Recompute forwarding address
    alt Valid replacement
        LSA->>LSDB: Install and flood refreshed LSA
    else P-bit set without eligible address
        LSA->>LSDB: Flush old Type-7 LSA
    end
Loading

Reviews (5): Last reviewed commit: "ospfd: fix NSSA LSA refresh to use curre..." | Re-trigger Greptile

When `forwarding-address-self` is configured after `redistribute`, the
external LSAs that were already originated do not reflect the new
forwarding address setting. This causes the LSAs to have the actual
nexthop as the forwarding address instead of 0.0.0.0.

Fix this by scheduling an ASBR redistribution update to refresh all
external LSAs whenever the `forwarding-address-self` setting is changed.

Fixes: ospf_forwarding_address_self topotest failure

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
@enkechen-panw
enkechen-panw force-pushed the ospf-forwarding-address-self-fix branch from 8d2a3f4 to 63913e5 Compare July 30, 2026 07:09
@enkechen-panw enkechen-panw changed the title ospfd: refresh external LSAs when forwarding-address-self changes ospfd: fix forwarding-address-self for existing external LSAs Jul 30, 2026
@enkechen-panw

Copy link
Copy Markdown
Contributor Author

@greptileai review

Comment thread ospfd/ospf_lsa.c Outdated
Comment thread ospfd/ospf_lsa.c Outdated
@enkechen-panw
enkechen-panw force-pushed the ospf-forwarding-address-self-fix branch from 63913e5 to 98fdb2d Compare July 30, 2026 07:27
@enkechen-panw

Copy link
Copy Markdown
Contributor Author

@greptileai review

@enkechen-panw
enkechen-panw force-pushed the ospf-forwarding-address-self-fix branch from 98fdb2d to 15eb3ab Compare July 30, 2026 07:33
@github-actions github-actions Bot added size/M and removed size/S labels Jul 30, 2026
@enkechen-panw

Copy link
Copy Markdown
Contributor Author

@greptileai review

Comment thread ospfd/ospf_lsa.c
When `forwarding-address-self` changes, the scheduled ASBR redistribution
update triggers ospf_nssa_lsa_refresh() for existing Type-7 LSAs. However,
ospf_nssa_lsa_refresh() was preserving the forwarding address from the
old LSA, overriding the newly computed value that respects the current
`forwarding-address-self` setting.

Fix this by applying the same NSSA forwarding address logic used during
origination (ospf_nssa_lsa_originate):

- Use the newly computed forwarding address from ospf_external_lsa_new()
- Only apply the NSSA interface address fallback when the P-bit is set
  (per RFC 3101, Type-7 LSAs without P-bit may have zero forwarding address)
- Discard the LSA if P-bit is set but no NSSA interface address is available

Also fix a pre-existing issue where failed refresh would leave the old LSA
orphaned in the LSDB (unregistered from refresh but still advertised with
stale data). Now flush the old LSA on any refresh failure.

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
@enkechen-panw
enkechen-panw force-pushed the ospf-forwarding-address-self-fix branch from 15eb3ab to dbb4db2 Compare July 30, 2026 07:42
@enkechen-panw

Copy link
Copy Markdown
Contributor Author

@greptileai review

@enkechen-panw

Copy link
Copy Markdown
Contributor Author

ci:rerun

1 similar comment
@enkechen-panw

Copy link
Copy Markdown
Contributor Author

ci:rerun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants