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) {
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) {
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);
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];