* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <zebra.h>
+#include "command.h"
#include "memory.h"
#include "prefix.h"
-#include "vty.h"
#include "filter.h"
#include "bgpd.h"
struct attr *attr)
{
struct attr_extra *extra = bgp_attr_extra_get(attr);
+ struct bgp_attr_encap_subtlv *tlv;
+ uint32_t vnid;
extra->encap_tunneltype = BGP_ENCAP_TYPE_VXLAN;
+
+ if(bet == NULL ||!bet->vnid)
+ return;
+ if(extra->encap_subtlvs)
+ XFREE(MTYPE_ENCAP_TLV, extra->encap_subtlvs);
+ tlv = XCALLOC (MTYPE_ENCAP_TLV, sizeof(struct bgp_attr_encap_subtlv)-1+12);
+ tlv->type = 1; /* encapsulation type */
+ tlv->length = 12;
+ if(bet->vnid)
+ {
+ vnid = htonl(bet->vnid | VXLAN_ENCAP_MASK_VNID_VALID);
+ memcpy(&tlv->value, &vnid, 4);
+ }
+ if(bet->mac_address)
+ {
+ char *ptr = (char *)&tlv->value + 4;
+ memcpy( ptr, bet->mac_address, 6);
+ }
+ extra->encap_subtlvs = tlv;
+ return;
}
void