Skip to content

Commit c33ff6a

Browse files
authored
Merge pull request #18358 from pguibert6WIND/bgp_evpn_source_vrf
BGP evpn testing and bug fixes related to non default EVPN backbone
2 parents 6c4847a + f58a727 commit c33ff6a

11 files changed

+697
-40
lines changed

bgpd/bgp_evpn.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,8 @@ static struct vrf_irt_node *vrf_import_rt_new(struct ecommunity_val *rt)
144144
struct vrf_irt_node *irt;
145145

146146
bgp_evpn = bgp_get_evpn();
147-
if (!bgp_evpn) {
148-
flog_err(EC_BGP_NO_DFLT,
149-
"vrf import rt new - evpn instance not created yet");
147+
if (!bgp_evpn)
150148
return NULL;
151-
}
152149

153150
irt = XCALLOC(MTYPE_BGP_EVPN_VRF_IMPORT_RT,
154151
sizeof(struct vrf_irt_node));
@@ -170,11 +167,8 @@ static void vrf_import_rt_free(struct vrf_irt_node *irt)
170167
struct bgp *bgp_evpn = NULL;
171168

172169
bgp_evpn = bgp_get_evpn();
173-
if (!bgp_evpn) {
174-
flog_err(EC_BGP_NO_DFLT,
175-
"vrf import rt free - evpn instance not created yet");
170+
if (!bgp_evpn)
176171
return;
177-
}
178172

179173
hash_release(bgp_evpn->vrf_import_rt_hash, irt);
180174
list_delete(&irt->vrfs);
@@ -197,12 +191,8 @@ static struct vrf_irt_node *lookup_vrf_import_rt(struct ecommunity_val *rt)
197191
struct vrf_irt_node tmp;
198192

199193
bgp_evpn = bgp_get_evpn();
200-
if (!bgp_evpn) {
201-
flog_err(
202-
EC_BGP_NO_DFLT,
203-
"vrf import rt lookup - evpn instance not created yet");
194+
if (!bgp_evpn)
204195
return NULL;
205-
}
206196

207197
memset(&tmp, 0, sizeof(tmp));
208198
memcpy(&tmp.rt, rt, ECOMMUNITY_SIZE);

bgpd/bgp_evpn_vty.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3516,7 +3516,7 @@ static void evpn_set_advertise_all_vni(struct bgp *bgp)
35163516
static void evpn_unset_advertise_all_vni(struct bgp *bgp)
35173517
{
35183518
bgp->advertise_all_vni = 0;
3519-
bgp_set_evpn(bgp_get_default());
3519+
bgp_set_evpn(NULL);
35203520
bgp_zebra_advertise_all_vni(bgp, bgp->advertise_all_vni);
35213521
bgp_evpn_cleanup_on_disable(bgp);
35223522
}
@@ -3739,9 +3739,14 @@ DEFUN (no_bgp_evpn_advertise_all_vni,
37393739
"Advertise All local VNIs\n")
37403740
{
37413741
struct bgp *bgp = VTY_GET_CONTEXT(bgp);
3742+
struct bgp *bgp_evpn = NULL;
37423743

37433744
if (!bgp)
37443745
return CMD_WARNING;
3746+
bgp_evpn = bgp_get_evpn();
3747+
if (!bgp_evpn || bgp_evpn != bgp)
3748+
return CMD_SUCCESS;
3749+
37453750
evpn_unset_advertise_all_vni(bgp);
37463751
return CMD_SUCCESS;
37473752
}

bgpd/bgpd.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3515,12 +3515,6 @@ static struct bgp *bgp_create(as_t *as, const char *name,
35153515
name, bgp->as_pretty);
35163516
}
35173517

3518-
/* Default the EVPN VRF to the default one */
3519-
if (inst_type == BGP_INSTANCE_TYPE_DEFAULT && !bgp_master.bgp_evpn) {
3520-
bgp_lock(bgp);
3521-
bm->bgp_evpn = bgp;
3522-
}
3523-
35243518
bgp_lock(bgp);
35253519

35263520
bgp->allow_martian = false;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
interface loop141 vrf vrf-141
2+
ip address 192.168.116.61/32
3+
ipv6 address fd00::116/128
4+
!
5+
interface loop142 vrf vrf-142
6+
ip address 192.168.126.61/32
7+
ipv6 address fd00::126/128
8+
!
9+
interface eth-r2.141 vrf vrf-141
10+
ip address 192.168.106.61/24
11+
!
12+
interface eth-r2.142 vrf vrf-142
13+
ip address 192.168.105.61/24
14+
!
15+
router bgp 65001 vrf vrf-142
16+
bgp router-id 192.168.105.61
17+
bgp log-neighbor-changes
18+
no bgp ebgp-requires-policy
19+
neighbor 192.168.105.41 remote-as 65000
20+
neighbor 192.168.105.41 capability extended-nexthop
21+
address-family ipv4 unicast
22+
network 192.168.126.61/32
23+
exit-address-family
24+
address-family ipv6 unicast
25+
neighbor 192.168.105.41 activate
26+
network fd00::126/128
27+
exit-address-family
28+
!
29+
router bgp 65001 vrf vrf-141
30+
bgp router-id 192.168.106.61
31+
bgp log-neighbor-changes
32+
no bgp ebgp-requires-policy
33+
neighbor 192.168.106.41 remote-as 65000
34+
neighbor 192.168.106.41 capability extended-nexthop
35+
address-family ipv4 unicast
36+
network 192.168.116.61/32
37+
exit-address-family
38+
address-family ipv6 unicast
39+
neighbor 192.168.106.41 activate
40+
network fd00::116/128
41+
exit-address-family
42+
!
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
{
2+
"65000:2":{
3+
"rd":"65000:2",
4+
"[5]:[0]:[32]:[192.168.116.61]":{
5+
"prefix":"[5]:[0]:[32]:[192.168.116.61]",
6+
"prefixLen":352,
7+
"paths":[
8+
{
9+
"valid":true,
10+
"bestpath":true,
11+
"selectionReason":"First path received",
12+
"pathFrom":"internal",
13+
"routeType":5,
14+
"ethTag":0,
15+
"ipLen":32,
16+
"ip":"192.168.116.61",
17+
"metric":0,
18+
"locPrf":100,
19+
"weight":0,
20+
"peerId":"192.168.1.101",
21+
"path":"65001",
22+
"origin":"IGP",
23+
"nexthops":[
24+
{
25+
"ip":"192.168.2.2",
26+
"hostname":"rr",
27+
"afi":"ipv4",
28+
"used":true
29+
}
30+
]
31+
}
32+
]
33+
},
34+
"[5]:[0]:[32]:[192.168.126.61]":{
35+
"prefix":"[5]:[0]:[32]:[192.168.126.61]",
36+
"prefixLen":352,
37+
"paths":[
38+
{
39+
"valid":true,
40+
"bestpath":true,
41+
"selectionReason":"First path received",
42+
"pathFrom":"internal",
43+
"routeType":5,
44+
"ethTag":0,
45+
"ipLen":32,
46+
"ip":"192.168.126.61",
47+
"metric":0,
48+
"locPrf":100,
49+
"weight":0,
50+
"peerId":"192.168.1.101",
51+
"path":"65001",
52+
"origin":"IGP",
53+
"nexthops":[
54+
{
55+
"ip":"192.168.2.2",
56+
"hostname":"rr",
57+
"afi":"ipv4",
58+
"used":true
59+
}
60+
]
61+
}
62+
]
63+
},
64+
"[5]:[0]:[128]:[fd00::116]":{
65+
"prefix":"[5]:[0]:[128]:[fd00::116]",
66+
"prefixLen":352,
67+
"paths":[
68+
{
69+
"valid":true,
70+
"bestpath":true,
71+
"selectionReason":"First path received",
72+
"pathFrom":"internal",
73+
"routeType":5,
74+
"ethTag":0,
75+
"ipLen":128,
76+
"ip":"fd00::116",
77+
"metric":0,
78+
"locPrf":100,
79+
"weight":0,
80+
"peerId":"192.168.1.101",
81+
"path":"65001",
82+
"origin":"IGP",
83+
"nexthops":[
84+
{
85+
"ip":"192.168.2.2",
86+
"hostname":"rr",
87+
"afi":"ipv4",
88+
"used":true
89+
}
90+
]
91+
}
92+
]
93+
},
94+
"[5]:[0]:[128]:[fd00::126]":{
95+
"prefix":"[5]:[0]:[128]:[fd00::126]",
96+
"prefixLen":352,
97+
"paths":[
98+
{
99+
"valid":true,
100+
"bestpath":true,
101+
"selectionReason":"First path received",
102+
"pathFrom":"internal",
103+
"routeType":5,
104+
"ethTag":0,
105+
"ipLen":128,
106+
"ip":"fd00::126",
107+
"metric":0,
108+
"locPrf":100,
109+
"weight":0,
110+
"peerId":"192.168.1.101",
111+
"path":"65001",
112+
"origin":"IGP",
113+
"nexthops":[
114+
{
115+
"ip":"192.168.2.2",
116+
"hostname":"rr",
117+
"afi":"ipv4",
118+
"used":true
119+
}
120+
]
121+
}
122+
]
123+
}
124+
},
125+
"numPrefix":14,
126+
"totalPrefix":14
127+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"65000:2":{
3+
"rd":"65000:2",
4+
"[5]:[0]:[32]:[192.168.116.61]":{
5+
"prefix":"[5]:[0]:[32]:[192.168.116.61]",
6+
"prefixLen":352,
7+
"paths":[
8+
{
9+
"valid":true,
10+
"bestpath":true,
11+
"selectionReason":"First path received",
12+
"pathFrom":"internal",
13+
"routeType":5,
14+
"ethTag":0,
15+
"ipLen":32,
16+
"ip":"192.168.116.61",
17+
"metric":0,
18+
"locPrf":100,
19+
"weight":0,
20+
"peerId":"192.168.1.101",
21+
"path":"65001",
22+
"origin":"IGP",
23+
"nexthops":[
24+
{
25+
"ip":"192.168.2.2",
26+
"hostname":"rr",
27+
"afi":"ipv4",
28+
"used":true
29+
}
30+
]
31+
}
32+
]
33+
},
34+
"[5]:[0]:[128]:[fd00::126]":{
35+
"prefix":"[5]:[0]:[128]:[fd00::126]",
36+
"prefixLen":352,
37+
"paths":[
38+
{
39+
"valid":true,
40+
"bestpath":true,
41+
"selectionReason":"First path received",
42+
"pathFrom":"internal",
43+
"routeType":5,
44+
"ethTag":0,
45+
"ipLen":128,
46+
"ip":"fd00::126",
47+
"metric":0,
48+
"locPrf":100,
49+
"weight":0,
50+
"peerId":"192.168.1.101",
51+
"path":"65001",
52+
"origin":"IGP",
53+
"nexthops":[
54+
{
55+
"ip":"192.168.2.2",
56+
"hostname":"rr",
57+
"afi":"ipv4",
58+
"used":true
59+
}
60+
]
61+
}
62+
]
63+
}
64+
},
65+
"numPrefix":10,
66+
"totalPrefix":10
67+
}

tests/topotests/bgp_evpn_rt5/r2/frr.conf

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,35 @@ interface eth-rr
2727
!
2828
ip route 0.0.0.0/0 192.168.2.101
2929
!
30+
interface eth-ce1.141 vrf vrf-141
31+
ip address 192.168.106.41/24
32+
!
33+
interface eth-ce1.142 vrf vrf-142
34+
ip address 192.168.105.41/24
35+
!
36+
router bgp 65000 vrf vrf-142
37+
bgp router-id 192.168.105.41
38+
bgp log-neighbor-changes
39+
no bgp ebgp-requires-policy
40+
neighbor 192.168.105.61 remote-as 65001
41+
neighbor 192.168.105.61 shutdown
42+
neighbor 192.168.105.61 capability extended-nexthop
43+
address-family ipv6 unicast
44+
neighbor 192.168.105.61 activate
45+
exit-address-family
46+
!
47+
router bgp 65000 vrf vrf-141
48+
bgp router-id 192.168.106.41
49+
bgp log-neighbor-changes
50+
!
51+
no bgp ebgp-requires-policy
52+
neighbor 192.168.106.61 remote-as 65001
53+
neighbor 192.168.106.61 shutdown
54+
neighbor 192.168.106.61 capability extended-nexthop
55+
address-family ipv6 unicast
56+
neighbor 192.168.106.61 activate
57+
exit-address-family
58+
!
3059
router bgp 65000
3160
bgp router-id 192.168.0.2
3261
bgp log-neighbor-changes
@@ -45,10 +74,14 @@ router bgp 65000 vrf vrf-101
4574
bgp log-neighbor-changes
4675
no bgp network import-check
4776
address-family ipv4 unicast
77+
import vrf vrf-141
78+
import vrf vrf-142
4879
network 10.0.101.2/32
4980
network 10.0.101.12/32
5081
exit-address-family
5182
address-family ipv6 unicast
83+
import vrf vrf-141
84+
import vrf vrf-142
5285
network fd01::2/128
5386
network fd01::12/128
5487
exit-address-family

0 commit comments

Comments
 (0)