-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Issue 1968 defaultvrfonly #2042
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ struct zebra_ns_table { | |
|
||
uint32_t tableid; | ||
afi_t afi; | ||
ns_id_t ns_id; | ||
|
||
struct route_table *table; | ||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,9 @@ void static_install_route(afi_t afi, safi_t safi, struct prefix *p, | |
struct vrf *nh_vrf; | ||
|
||
/* Lookup table. */ | ||
table = zebra_vrf_table(afi, safi, si->vrf_id); | ||
table = zebra_vrf_table_with_table_id(afi, safi, | ||
si->vrf_id, | ||
si->table_id); | ||
if (!table) | ||
return; | ||
|
||
|
@@ -170,10 +172,15 @@ void static_install_route(afi_t afi, safi_t safi, struct prefix *p, | |
re->metric = 0; | ||
re->mtu = 0; | ||
re->vrf_id = si->vrf_id; | ||
re->table = | ||
(si->vrf_id != VRF_DEFAULT) | ||
? (zebra_vrf_lookup_by_id(si->vrf_id))->table_id | ||
: zebrad.rtm_table_default; | ||
if (si->vrf_id != VRF_DEFAULT) | ||
re->table = zebra_vrf_lookup_by_id(si->vrf_id) | ||
->table_id; | ||
else if (si->table_id) /* case default VRF, table used | ||
*/ | ||
re->table = si->table_id; | ||
else /* case default VRF, default table | ||
*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
re->table = zebrad.rtm_table_default; | ||
re->nexthop_num = 0; | ||
re->tag = si->tag; | ||
|
||
|
@@ -290,7 +297,9 @@ void static_uninstall_route(afi_t afi, safi_t safi, struct prefix *p, | |
struct prefix nh_p; | ||
|
||
/* Lookup table. */ | ||
table = zebra_vrf_table(afi, safi, si->vrf_id); | ||
table = zebra_vrf_table_with_table_id(afi, safi, | ||
si->vrf_id, | ||
si->table_id); | ||
if (!table) | ||
return; | ||
|
||
|
@@ -395,7 +404,8 @@ int static_add_route(afi_t afi, safi_t safi, uint8_t type, struct prefix *p, | |
const char *ifname, enum static_blackhole_type bh_type, | ||
route_tag_t tag, uint8_t distance, struct zebra_vrf *zvrf, | ||
struct zebra_vrf *nh_zvrf, | ||
struct static_nh_label *snh_label) | ||
struct static_nh_label *snh_label, | ||
uint32_t table_id) | ||
{ | ||
struct route_node *rn; | ||
struct static_route *si; | ||
|
@@ -445,7 +455,7 @@ int static_add_route(afi_t afi, safi_t safi, uint8_t type, struct prefix *p, | |
if (update) | ||
static_delete_route(afi, safi, type, p, src_p, gate, ifname, | ||
update->tag, update->distance, zvrf, | ||
&update->snh_label); | ||
&update->snh_label, table_id); | ||
|
||
/* Make new static route structure. */ | ||
si = XCALLOC(MTYPE_STATIC_ROUTE, sizeof(struct static_route)); | ||
|
@@ -457,6 +467,7 @@ int static_add_route(afi_t afi, safi_t safi, uint8_t type, struct prefix *p, | |
si->vrf_id = zvrf_id(zvrf); | ||
si->nh_vrf_id = zvrf_id(nh_zvrf); | ||
strcpy(si->nh_vrfname, nh_zvrf->vrf->name); | ||
si->table_id = table_id; | ||
|
||
if (ifname) | ||
strlcpy(si->ifname, ifname, sizeof(si->ifname)); | ||
|
@@ -526,7 +537,8 @@ int static_delete_route(afi_t afi, safi_t safi, uint8_t type, struct prefix *p, | |
struct prefix_ipv6 *src_p, union g_addr *gate, | ||
const char *ifname, route_tag_t tag, uint8_t distance, | ||
struct zebra_vrf *zvrf, | ||
struct static_nh_label *snh_label) | ||
struct static_nh_label *snh_label, | ||
uint32_t table_id) | ||
{ | ||
struct route_node *rn; | ||
struct static_route *si; | ||
|
@@ -552,6 +564,8 @@ int static_delete_route(afi_t afi, safi_t safi, uint8_t type, struct prefix *p, | |
&& IPV6_ADDR_SAME(gate, &si->addr.ipv6)))) | ||
&& (!strcmp(ifname ? ifname : "", si->ifname)) | ||
&& (!tag || (tag == si->tag)) | ||
&& ((table_id && table_id == si->table_id) || | ||
(table_id == 0)) | ||
&& (!snh_label->num_labels | ||
|| !memcmp(&si->snh_label, snh_label, | ||
sizeof(struct static_nh_label)))) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -434,7 +434,8 @@ struct zebra_vrf *zebra_vrf_alloc(void) | |
zebra_vxlan_init_tables(zvrf); | ||
zebra_mpls_init_tables(zvrf); | ||
zebra_pw_init(zvrf); | ||
|
||
zvrf->table_id = RT_TABLE_MAIN; | ||
/* by default table ID is default one */ | ||
return zvrf; | ||
} | ||
|
||
|
@@ -524,9 +525,7 @@ static int vrf_config_write(struct vty *vty) | |
if (zvrf->l3vni) | ||
vty_out(vty, "vni %u\n", zvrf->l3vni); | ||
vty_out(vty, "!\n"); | ||
} | ||
|
||
if (vrf_is_user_cfged(vrf)) { | ||
} else if (vrf_is_user_cfged(vrf)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the wrong fix. We should use the vty_frame() code to display vrf config information. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi Donald, the issue is related to default routing table.
I don't see the point here with vty_frame(). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pguibert6WIND, Donald (and I) agree with you that it should not show the default VRF. If I understand Donald correctly, he is saying that your approach to fixing this is not ideal (again I agree). We have facilities in Incidentally, I have touched this code to use Ergo you can just revert this part of the patch. |
||
vty_out(vty, "vrf %s\n", zvrf_name(zvrf)); | ||
if (zvrf->l3vni) | ||
vty_out(vty, " vni %u%s\n", zvrf->l3vni, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put this comment on its own line above the else, or move the terminating
*/
onto the same line as/*
.