summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLou Berger <lberger@labn.net>2017-02-06 21:29:43 -0500
committerLou Berger <lberger@labn.net>2017-02-07 07:42:50 -0500
commitc65742c79174a388f7340b83395fd7b2a19b80a8 (patch)
tree599d28ed079f954b6998398cb31c2147d6313e6c
parent1b4ae82d37fe06a9e6a7cac6a67aa5fb3beb777c (diff)
bgpd rfapi: advertise encap attribute when TT is valid and not MPLS.
Ensure tunnel type set based on rx'ed Ignore bad/mpls encap types. Signed-off-by: Lou Berger <lberger@labn.net>
-rw-r--r--bgpd/bgp_attr.c16
-rw-r--r--bgpd/rfapi/vnc_import_bgp.c3
2 files changed, 10 insertions, 9 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index b1b245d42c..7741f76a75 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -2171,8 +2171,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) {
@@ -2777,7 +2779,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) {
@@ -2808,11 +2813,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);
diff --git a/bgpd/rfapi/vnc_import_bgp.c b/bgpd/rfapi/vnc_import_bgp.c
index 5b76d1870f..d5ca965465 100644
--- a/bgpd/rfapi/vnc_import_bgp.c
+++ b/bgpd/rfapi/vnc_import_bgp.c
@@ -513,7 +513,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];