bgpd: Function to encode Encapsulation type extended community

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
This commit is contained in:
vivek 2017-05-15 13:47:36 -07:00 committed by Donald Sharp
parent a463860968
commit 86f6f09e2e

View File

@ -19,6 +19,8 @@
#ifndef _QUAGGA_BGP_ENCAP_TYPES_H
#define _QUAGGA_BGP_ENCAP_TYPES_H
#include "bgpd/bgp_ecommunity.h"
/* from http://www.iana.org/assignments/bgp-parameters/bgp-parameters.xhtml#tunnel-types */
typedef enum {
BGP_ENCAP_TYPE_RESERVED=0,
@ -213,4 +215,15 @@ struct bgp_encap_type_pbb {
struct bgp_tea_subtlv_encap_pbb st_encap;
};
static inline void
encode_encap_extcomm (bgp_encap_types tnl_type,
struct ecommunity_val *eval)
{
memset (eval, 0, sizeof (*eval));
eval->val[0] = ECOMMUNITY_ENCODE_OPAQUE;
eval->val[1] = ECOMMUNITY_OPAQUE_SUBTYPE_ENCAP;
eval->val[6] = ((tnl_type) >> 8) & 0xff;
eval->val[7] = (tnl_type) & 0xff;
}
#endif /* _QUAGGA_BGP_ENCAP_TYPES_H */