]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: Function to encode Encapsulation type extended community
authorvivek <vivek@cumulusnetworks.com>
Mon, 15 May 2017 20:47:36 +0000 (13:47 -0700)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 12 Jul 2017 16:34:33 +0000 (12:34 -0400)
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
bgpd/bgp_encap_types.h

index ffeb2f61eaf869842177a7a5fc2754716f2355c6..03664fe7a09f708c7a5b86d2432e01532bc4f710 100644 (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 */