]> git.puffer.fish Git - mirror/frr.git/commit
bgpd: Initialize attr->local_pref to the configured default value 11402/head
authorDonatas Abraitis <donatas@opensourcerouting.org>
Mon, 6 Jun 2022 06:49:37 +0000 (09:49 +0300)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Tue, 14 Jun 2022 10:54:03 +0000 (10:54 +0000)
commite9bb5340674571ce3e0f49665fa665ebb70e3e0a
tree97cad2545967399db06989f71620343679f32d92
parent23fb6cb98f854175ecc5724e8e2198c952b29d93
bgpd: Initialize attr->local_pref to the configured default value

When we use network/redistribute local_preference is configured inproperly
when using route-maps something like:

```
network 100.100.100.100/32 route-map rm1
network 100.100.100.200/32 route-map rm2

route-map rm1 permit 10
 set local-preference +10
route-map rm2 permit 10
 set local-preference -10
```

Before:
```
root@spine1-debian-11:~# vtysh -c 'show bgp ipv4 unicast 100.100.100.100/32 json' | jq '.paths[].locPrf'
10
root@spine1-debian-11:~# vtysh -c 'show bgp ipv4 unicast 100.100.100.200/32 json' | jq '.paths[].locPrf'
0
```

After:
```
root@spine1-debian-11:~# vtysh -c 'show bgp ipv4 unicast 100.100.100.100/32 json' | jq '.paths[].locPrf'
110
root@spine1-debian-11:~# vtysh -c 'show bgp ipv4 unicast 100.100.100.200/32 json' | jq '.paths[].locPrf'
90
```

Set local-preference as the default value configured per BGP instance, but
do not set LOCAL_PREF flag by default.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 0f05ea43b0c18c890ef0faf81de1d4ad74893d86)
12 files changed:
bgpd/bgp_attr.c
bgpd/bgp_attr.h
bgpd/bgp_evpn.c
bgpd/bgp_evpn_mh.c
bgpd/bgp_route.c
bgpd/bgp_routemap.c
bgpd/bgp_updgrp_adv.c
bgpd/rfapi/rfapi.c
bgpd/rfapi/vnc_export_bgp.c
tests/topotests/bgp_set_local_preference_add_subtract/r2/bgpd.conf
tests/topotests/bgp_set_local_preference_add_subtract/r3/bgpd.conf
tests/topotests/bgp_set_local_preference_add_subtract/test_bgp_set_local-preference_add_subtract.py