Skip to content

Commit

Permalink
bgpd rfapi: advertise encap attribute when TT is valid and not MPLS.
Browse files Browse the repository at this point in the history
     Ensure tunnel type set based on rx'ed
     Ignore bad/mpls encap types.

Signed-off-by: Lou Berger <lberger@labn.net>
  • Loading branch information
louberger committed Feb 7, 2017
1 parent 22e9f17 commit ac73d8f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
16 changes: 8 additions & 8 deletions bgpd/bgp_attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -2241,8 +2241,10 @@ bgp_attr_encap(
stlv_last = tlv;
}

if (attre && (BGP_ATTR_ENCAP == type)) {
attre->encap_tunneltype = tunneltype;
if (BGP_ATTR_ENCAP == type) {
if (!attre)
attre = bgp_attr_extra_get(attr);
attre->encap_tunneltype = tunneltype;
}

if (length) {
Expand Down Expand Up @@ -2854,7 +2856,10 @@ bgp_packet_mpattr_tea(
struct bgp_attr_encap_subtlv *st;
const char *attrname;

if (!attr || !attr->extra)
if (!attr || !attr->extra ||
(attrtype == BGP_ATTR_ENCAP &&
(!attr->extra->encap_tunneltype ||
attr->extra->encap_tunneltype == BGP_ENCAP_TYPE_MPLS)))
return;

switch (attrtype) {
Expand Down Expand Up @@ -2885,11 +2890,6 @@ bgp_packet_mpattr_tea(
assert(0);
}


/* if no tlvs, don't make attr */
if (subtlvs == NULL)
return;

/* compute attr length */
for (st = subtlvs; st; st = st->next) {
attrlenfield += (attrhdrlen + st->length);
Expand Down
3 changes: 2 additions & 1 deletion bgpd/rfapi/vnc_import_bgp.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,8 @@ vnc_import_bgp_add_route_mode_resolve_nve_one_bi (
if (bi->attr && bi->attr->extra)
{
encaptlvs = bi->attr->extra->vnc_subtlvs;
if (bi->attr->extra->encap_tunneltype != BGP_ENCAP_TYPE_MPLS)
if (bi->attr->extra->encap_tunneltype != BGP_ENCAP_TYPE_RESERVED &&
bi->attr->extra->encap_tunneltype != BGP_ENCAP_TYPE_MPLS)
{
if (opt != NULL)
opt->next = &optary[cur_opt];
Expand Down

0 comments on commit ac73d8f

Please sign in to comment.