- /* go back and insert MP unf_len */
- unf_len += sizeof(struct bgp_attr_mp_unreach_nlri_partial);
- unf_len = htons(unf_len);
- memcpy(&unreach_len, &unf_len, sizeof(unf_len));
+ if (unf_len)
+ {
+ /* go back and insert MP unf_len */
+ unf_len += sizeof(struct bgp_attr_mp_unreach_nlri_partial);
+ unf_len = htons(unf_len);
+ memcpy(unreach_len, &unf_len, sizeof(unf_len));
+ }
+ else
+ {
+ /* we can remove this attribute, then */
+ data -= BGP_PATH_ATTR_MP_UNREACH_NLRI_PARTIAL_SIZE;
+ len -= BGP_PATH_ATTR_MP_UNREACH_NLRI_PARTIAL_SIZE;
+ }