Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frrcfgd: fix incorrect rendering of route-map references #14183

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

toreanderson
Copy link

Why I did it

frrcfgd generated incorrect configuration that referred to route-maps under BGP address families, e.g.:

  neighbor peergroup route-map R in
  neighbor peergroup route-map M in
  neighbor peergroup route-map A in
  neighbor peergroup route-map P in

This happens because the Jinja2 templates looped over the string, leading to a new line for each individual character in the route-map name.

How I did it

Removed the for loops so that only a single line is being rendered.

How to verify it

sonic-db-cli CONFIG_DB HSET 'ROUTE_REDISTRIBUTE|default|connected|bgp|ipv4' route_map RMAP
docker restart bgp
sudo grep redistribute /etc/sonic/frr/bgpd.conf
vtysh -c 'sh run' | grep redistribute

Expected output from the last two commands:

  redistribute connected route-map RMAP

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211

Reason: current templates will load incorrect and quite possibly harmful configuration after the BGP container restarts.

Description for the changelog

frrcfgd: fix incorrect rendering of route-map references

Ensure to add label/tag for the feature raised. example - PR#2174 under sonic-utilities repo. where, Generic Config and Update feature has been labelled as GCU.

Link to config_db schema for YANG module changes

N/A

A picture of a cute animal (not mandatory but encouraged)

bilde

A reference to a route-maps under a BGP address family is a single-value
string, not a multi-value list. Looping over it yields incorrect
configuration being rendered, for example:

```
  neighbor peergroup route-map R in
  neighbor peergroup route-map M in
  neighbor peergroup route-map A in
  neighbor peergroup route-map P in
```

These overwrite each other as the configuration is loaded, making the
effective FRR contain only the last one listed. This route-map (in this
case called `P`) does most likely not exist, leading to an effective
configuration which rejects all routes.

The correct and expected rendered configuration would be:

```
  neighbor peergroup route-map RMAP in
```

Signed-off-by: Tore Anderson <tore@redpill-linpro.com>
@toreanderson toreanderson requested a review from lguohan as a code owner March 9, 2023 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant