2 * Copyright 2015-2016, LabN Consulting, L.L.C.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; see the file COPYING; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #include "lib/zebra.h"
21 #include "lib/memory.h"
22 #include "lib/prefix.h"
23 #include "lib/table.h"
26 #include "bgpd/bgpd.h"
27 #include "bgpd/bgp_attr.h"
29 #include "bgpd/bgp_encap_types.h"
30 #include "bgpd/bgp_encap_tlv.h"
32 #include "bgpd/rfapi/rfapi.h"
33 #include "bgpd/rfapi/rfapi_encap_tlv.h"
34 #include "bgpd/rfapi/rfapi_private.h"
35 #include "bgpd/rfapi/rfapi_monitor.h"
36 #include "bgpd/rfapi/rfapi_vty.h"
37 #include "bgpd/rfapi/bgp_rfapi_cfg.h"
38 #include "bgpd/rfapi/vnc_debug.h"
40 static void rfapi_add_endpoint_address_to_subtlv(
41 struct bgp
*bgp
, struct rfapi_ip_addr
*ea
,
42 struct bgp_tea_subtlv_remote_endpoint
*subtlv
)
44 subtlv
->family
= ea
->addr_family
;
45 if (subtlv
->family
== AF_INET
)
46 subtlv
->ip_address
.v4
= ea
->addr
.v4
;
48 subtlv
->ip_address
.v6
= ea
->addr
.v6
;
49 subtlv
->as4
= htonl(bgp
->as
);
53 rfapi_tunneltype_option_to_tlv(struct bgp
*bgp
, struct rfapi_ip_addr
*ea
,
54 struct rfapi_tunneltype_option
*tto
,
55 struct attr
*attr
, int always_add
)
58 #define _RTTO_MAYBE_ADD_ENDPOINT_ADDRESS(ttype) \
61 && !CHECK_FLAG(bgp->rfapi_cfg->flags, \
62 BGP_VNC_CONFIG_ADV_UN_METHOD_ENCAP))) \
64 && !CHECK_SUBTLV_FLAG(&tto->bgpinfo.ttype, \
65 BGP_TEA_SUBTLV_REMOTE_ENDPOINT)) { \
66 rfapi_add_endpoint_address_to_subtlv( \
67 bgp, ea, &tto->bgpinfo.ttype.st_endpoint); \
68 SET_SUBTLV_FLAG(&tto->bgpinfo.ttype, \
69 BGP_TEA_SUBTLV_REMOTE_ENDPOINT); \
72 struct rfapi_tunneltype_option dto
;
73 if (tto
== NULL
) { /* create default type */
75 memset(tto
, 0, sizeof(dto
));
76 tto
->type
= RFAPI_BGP_ENCAP_TYPE_DEFAULT
;
79 case BGP_ENCAP_TYPE_L2TPV3_OVER_IP
:
80 _RTTO_MAYBE_ADD_ENDPOINT_ADDRESS(l2tpv3_ip
);
81 bgp_encap_type_l2tpv3overip_to_tlv(&tto
->bgpinfo
.l2tpv3_ip
,
85 case BGP_ENCAP_TYPE_GRE
:
86 _RTTO_MAYBE_ADD_ENDPOINT_ADDRESS(gre
);
87 bgp_encap_type_gre_to_tlv(&tto
->bgpinfo
.gre
, attr
);
90 case BGP_ENCAP_TYPE_TRANSMIT_TUNNEL_ENDPOINT
:
91 _RTTO_MAYBE_ADD_ENDPOINT_ADDRESS(transmit_tunnel_endpoint
);
92 bgp_encap_type_transmit_tunnel_endpoint(
93 &tto
->bgpinfo
.transmit_tunnel_endpoint
, attr
);
96 case BGP_ENCAP_TYPE_IPSEC_IN_TUNNEL_MODE
:
97 _RTTO_MAYBE_ADD_ENDPOINT_ADDRESS(ipsec_tunnel
);
98 bgp_encap_type_ipsec_in_tunnel_mode_to_tlv(
99 &tto
->bgpinfo
.ipsec_tunnel
, attr
);
102 case BGP_ENCAP_TYPE_IP_IN_IP_TUNNEL_WITH_IPSEC_TRANSPORT_MODE
:
103 _RTTO_MAYBE_ADD_ENDPOINT_ADDRESS(ip_ipsec
);
104 bgp_encap_type_ip_in_ip_tunnel_with_ipsec_transport_mode_to_tlv(
105 &tto
->bgpinfo
.ip_ipsec
, attr
);
108 case BGP_ENCAP_TYPE_MPLS_IN_IP_TUNNEL_WITH_IPSEC_TRANSPORT_MODE
:
109 _RTTO_MAYBE_ADD_ENDPOINT_ADDRESS(mpls_ipsec
);
110 bgp_encap_type_mpls_in_ip_tunnel_with_ipsec_transport_mode_to_tlv(
111 &tto
->bgpinfo
.mpls_ipsec
, attr
);
114 case BGP_ENCAP_TYPE_IP_IN_IP
:
115 _RTTO_MAYBE_ADD_ENDPOINT_ADDRESS(ip_ip
);
116 bgp_encap_type_ip_in_ip_to_tlv(&tto
->bgpinfo
.ip_ip
, attr
);
119 case BGP_ENCAP_TYPE_VXLAN
:
120 _RTTO_MAYBE_ADD_ENDPOINT_ADDRESS(vxlan
);
121 bgp_encap_type_vxlan_to_tlv(&tto
->bgpinfo
.vxlan
, attr
);
124 case BGP_ENCAP_TYPE_NVGRE
:
125 _RTTO_MAYBE_ADD_ENDPOINT_ADDRESS(nvgre
);
126 bgp_encap_type_nvgre_to_tlv(&tto
->bgpinfo
.nvgre
, attr
);
129 case BGP_ENCAP_TYPE_MPLS
:
130 /* nothing to do for MPLS */
133 case BGP_ENCAP_TYPE_MPLS_IN_GRE
:
134 _RTTO_MAYBE_ADD_ENDPOINT_ADDRESS(mpls_gre
);
135 bgp_encap_type_mpls_in_gre_to_tlv(&tto
->bgpinfo
.mpls_gre
, attr
);
138 case BGP_ENCAP_TYPE_VXLAN_GPE
:
139 _RTTO_MAYBE_ADD_ENDPOINT_ADDRESS(vxlan_gpe
);
140 bgp_encap_type_vxlan_gpe_to_tlv(&tto
->bgpinfo
.vxlan_gpe
, attr
);
143 case BGP_ENCAP_TYPE_MPLS_IN_UDP
:
144 _RTTO_MAYBE_ADD_ENDPOINT_ADDRESS(mpls_udp
);
145 bgp_encap_type_mpls_in_udp_to_tlv(&tto
->bgpinfo
.mpls_udp
, attr
);
148 case BGP_ENCAP_TYPE_PBB
:
149 _RTTO_MAYBE_ADD_ENDPOINT_ADDRESS(pbb
);
150 bgp_encap_type_pbb_to_tlv(&tto
->bgpinfo
.pbb
, attr
);
153 case BGP_ENCAP_TYPE_RESERVED
:
154 assert(!"Cannot process BGP_ENCAP_TYPE_RESERVED");
159 struct rfapi_un_option
*rfapi_encap_tlv_to_un_option(struct attr
*attr
)
161 struct rfapi_un_option
*uo
= NULL
;
162 struct rfapi_tunneltype_option
*tto
;
164 struct bgp_attr_encap_subtlv
*stlv
;
166 /* no tunnel encap attr stored */
167 if (!attr
->encap_tunneltype
)
170 stlv
= attr
->encap_subtlvs
;
172 uo
= XCALLOC(MTYPE_RFAPI_UN_OPTION
, sizeof(struct rfapi_un_option
));
173 uo
->type
= RFAPI_UN_OPTION_TYPE_TUNNELTYPE
;
174 uo
->v
.tunnel
.type
= attr
->encap_tunneltype
;
177 switch (attr
->encap_tunneltype
) {
178 case BGP_ENCAP_TYPE_L2TPV3_OVER_IP
:
179 rc
= tlv_to_bgp_encap_type_l2tpv3overip(
180 stlv
, &tto
->bgpinfo
.l2tpv3_ip
);
183 case BGP_ENCAP_TYPE_GRE
:
184 rc
= tlv_to_bgp_encap_type_gre(stlv
, &tto
->bgpinfo
.gre
);
187 case BGP_ENCAP_TYPE_TRANSMIT_TUNNEL_ENDPOINT
:
188 rc
= tlv_to_bgp_encap_type_transmit_tunnel_endpoint(
189 stlv
, &tto
->bgpinfo
.transmit_tunnel_endpoint
);
192 case BGP_ENCAP_TYPE_IPSEC_IN_TUNNEL_MODE
:
193 rc
= tlv_to_bgp_encap_type_ipsec_in_tunnel_mode(
194 stlv
, &tto
->bgpinfo
.ipsec_tunnel
);
197 case BGP_ENCAP_TYPE_IP_IN_IP_TUNNEL_WITH_IPSEC_TRANSPORT_MODE
:
198 rc
= tlv_to_bgp_encap_type_ip_in_ip_tunnel_with_ipsec_transport_mode(
199 stlv
, &tto
->bgpinfo
.ip_ipsec
);
202 case BGP_ENCAP_TYPE_MPLS_IN_IP_TUNNEL_WITH_IPSEC_TRANSPORT_MODE
:
203 rc
= tlv_to_bgp_encap_type_mpls_in_ip_tunnel_with_ipsec_transport_mode(
204 stlv
, &tto
->bgpinfo
.mpls_ipsec
);
207 case BGP_ENCAP_TYPE_IP_IN_IP
:
208 rc
= tlv_to_bgp_encap_type_ip_in_ip(stlv
, &tto
->bgpinfo
.ip_ip
);
211 case BGP_ENCAP_TYPE_VXLAN
:
212 rc
= tlv_to_bgp_encap_type_vxlan(stlv
, &tto
->bgpinfo
.vxlan
);
215 case BGP_ENCAP_TYPE_NVGRE
:
216 rc
= tlv_to_bgp_encap_type_nvgre(stlv
, &tto
->bgpinfo
.nvgre
);
219 case BGP_ENCAP_TYPE_MPLS
:
220 rc
= tlv_to_bgp_encap_type_mpls(stlv
, &tto
->bgpinfo
.mpls
);
223 case BGP_ENCAP_TYPE_MPLS_IN_GRE
:
224 rc
= tlv_to_bgp_encap_type_mpls_in_gre(stlv
,
225 &tto
->bgpinfo
.mpls_gre
);
228 case BGP_ENCAP_TYPE_VXLAN_GPE
:
229 rc
= tlv_to_bgp_encap_type_vxlan_gpe(stlv
,
230 &tto
->bgpinfo
.vxlan_gpe
);
233 case BGP_ENCAP_TYPE_MPLS_IN_UDP
:
234 rc
= tlv_to_bgp_encap_type_mpls_in_udp(stlv
,
235 &tto
->bgpinfo
.mpls_udp
);
238 case BGP_ENCAP_TYPE_PBB
:
239 rc
= tlv_to_bgp_encap_type_pbb(stlv
, &tto
->bgpinfo
.pbb
);
243 vnc_zlog_debug_verbose("%s: unknown tunnel type %d", __func__
,
244 attr
->encap_tunneltype
);
249 XFREE(MTYPE_RFAPI_UN_OPTION
, uo
);
254 /***********************************************************************
256 ***********************************************************************/
258 static void subtlv_print_encap_l2tpv3_over_ip(
259 void *stream
, int column_offset
,
260 struct bgp_tea_subtlv_encap_l2tpv3_over_ip
*st
)
262 int (*fp
)(void *, const char *, ...);
265 const char *vty_newline
;
267 if (rfapiStream2Vty(stream
, &fp
, &vty
, &out
, &vty_newline
) == 0)
272 fp(out
, "%*s%s%s", column_offset
, "", "SubTLV: Encap(L2TPv3 over IP)",
274 fp(out
, "%*s SessionID: %d%s", column_offset
, "", st
->sessionid
,
276 fp(out
, "%*s Cookie: (length %d)%s", column_offset
, "",
277 st
->cookie_length
, vty_newline
);
280 static void subtlv_print_encap_gre(void *stream
, int column_offset
,
281 struct bgp_tea_subtlv_encap_gre_key
*st
)
283 int (*fp
)(void *, const char *, ...);
286 const char *vty_newline
;
288 if (rfapiStream2Vty(stream
, &fp
, &vty
, &out
, &vty_newline
) == 0)
293 fp(out
, "%*s%s%s", column_offset
, "", "SubTLV: Encap(GRE)",
295 fp(out
, "%*s GRE key: %d (0x%x)%s", column_offset
, "", st
->gre_key
,
296 st
->gre_key
, vty_newline
);
299 static void subtlv_print_encap_pbb(void *stream
, int column_offset
,
300 struct bgp_tea_subtlv_encap_pbb
*st
)
302 int (*fp
)(void *, const char *, ...);
305 const char *vty_newline
;
307 if (rfapiStream2Vty(stream
, &fp
, &vty
, &out
, &vty_newline
) == 0)
312 fp(out
, "%*s%s%s", column_offset
, "", "SubTLV: Encap(PBB)",
315 fp(out
, "%*s ISID: %d (0x%x)%s", column_offset
, "", st
->isid
,
316 st
->isid
, vty_newline
);
319 fp(out
, "%*s VID: %d (0x%x)%s", column_offset
, "", st
->vid
,
320 st
->vid
, vty_newline
);
322 fp(out
, "%*s MACADDR %02x:%02x:%02x:%02x:%02x:%02x%s", column_offset
,
323 "", st
->macaddr
[0], st
->macaddr
[1], st
->macaddr
[2], st
->macaddr
[3],
324 st
->macaddr
[4], st
->macaddr
[5], vty_newline
);
327 static void subtlv_print_proto_type(void *stream
, int column_offset
,
328 struct bgp_tea_subtlv_proto_type
*st
)
330 int (*fp
)(void *, const char *, ...);
333 const char *vty_newline
;
335 if (rfapiStream2Vty(stream
, &fp
, &vty
, &out
, &vty_newline
) == 0)
340 fp(out
, "%*s%s%s", column_offset
, "", "SubTLV: Encap(Proto Type)",
342 fp(out
, "%*s Proto %d (0x%x)%s", column_offset
, "", st
->proto
,
343 st
->proto
, vty_newline
);
346 static void subtlv_print_color(void *stream
, int column_offset
,
347 struct bgp_tea_subtlv_color
*st
)
349 int (*fp
)(void *, const char *, ...);
352 const char *vty_newline
;
354 if (rfapiStream2Vty(stream
, &fp
, &vty
, &out
, &vty_newline
) == 0)
359 fp(out
, "%*s%s%s", column_offset
, "", "SubTLV: Color", vty_newline
);
360 fp(out
, "%*s Color: %d (0x%x)", column_offset
, "", st
->color
,
361 st
->color
, vty_newline
);
364 static void subtlv_print_ipsec_ta(void *stream
, int column_offset
,
365 struct bgp_tea_subtlv_ipsec_ta
*st
)
367 int (*fp
)(void *, const char *, ...);
370 const char *vty_newline
;
372 if (rfapiStream2Vty(stream
, &fp
, &vty
, &out
, &vty_newline
) == 0)
377 fp(out
, "%*s%s%s", column_offset
, "", "SubTLV: IPSEC TA", vty_newline
);
378 fp(out
, "%*s Authenticator Type: %d (0x%x)", column_offset
, "",
379 st
->authenticator_type
, st
->authenticator_type
, vty_newline
);
380 fp(out
, "%*s Authenticator: (length %d)", column_offset
, "",
381 st
->authenticator_length
, vty_newline
);
384 /***********************************************************************
386 ***********************************************************************/
389 print_encap_type_l2tpv3overip(void *stream
, int column_offset
,
390 struct bgp_encap_type_l2tpv3_over_ip
*bet
)
392 const char *type
= "L2TPv3 over IP";
393 int (*fp
)(void *, const char *, ...);
396 const char *vty_newline
;
398 if (rfapiStream2Vty(stream
, &fp
, &vty
, &out
, &vty_newline
) == 0)
403 fp(out
, "%*sTEA type %s%s", column_offset
, "", type
, vty_newline
);
405 subtlv_print_encap_l2tpv3_over_ip(stream
, column_offset
+ 2,
407 subtlv_print_proto_type(stream
, column_offset
+ 2, &bet
->st_proto
);
408 subtlv_print_color(stream
, column_offset
+ 2, &bet
->st_color
);
411 static void print_encap_type_gre(void *stream
, int column_offset
,
412 struct bgp_encap_type_gre
*bet
)
414 const char *type
= "GRE";
415 int (*fp
)(void *, const char *, ...);
418 const char *vty_newline
;
420 if (rfapiStream2Vty(stream
, &fp
, &vty
, &out
, &vty_newline
) == 0)
425 fp(out
, "%*sTEA type %s%s", column_offset
, "", type
, vty_newline
);
427 subtlv_print_encap_gre(stream
, column_offset
+ 2, &bet
->st_encap
);
428 subtlv_print_proto_type(stream
, column_offset
+ 2, &bet
->st_proto
);
429 subtlv_print_color(stream
, column_offset
+ 2, &bet
->st_color
);
432 static void print_encap_type_ip_in_ip(void *stream
, int column_offset
,
433 struct bgp_encap_type_ip_in_ip
*bet
)
435 const char *type
= "IP in IP";
436 int (*fp
)(void *, const char *, ...);
439 const char *vty_newline
;
441 if (rfapiStream2Vty(stream
, &fp
, &vty
, &out
, &vty_newline
) == 0)
446 fp(out
, "%*sTEA type %s%s", column_offset
, "", type
, vty_newline
);
448 subtlv_print_proto_type(stream
, column_offset
+ 2, &bet
->st_proto
);
449 subtlv_print_color(stream
, column_offset
+ 2, &bet
->st_color
);
452 static void print_encap_type_transmit_tunnel_endpoint(
453 void *stream
, int column_offset
,
454 struct bgp_encap_type_transmit_tunnel_endpoint
*bet
)
456 const char *type
= "Transmit Tunnel Endpoint";
457 int (*fp
)(void *, const char *, ...);
460 const char *vty_newline
;
462 if (rfapiStream2Vty(stream
, &fp
, &vty
, &out
, &vty_newline
) == 0)
467 fp(out
, "%*sTEA type %s%s", column_offset
, "", type
, vty_newline
);
469 /* no subtlvs for this type */
472 static void print_encap_type_ipsec_in_tunnel_mode(
473 void *stream
, int column_offset
,
474 struct bgp_encap_type_ipsec_in_tunnel_mode
*bet
)
476 const char *type
= "IPSEC in Tunnel mode";
477 int (*fp
)(void *, const char *, ...);
480 const char *vty_newline
;
482 if (rfapiStream2Vty(stream
, &fp
, &vty
, &out
, &vty_newline
) == 0)
487 fp(out
, "%*sTEA type %s%s", column_offset
, "", type
, vty_newline
);
488 subtlv_print_ipsec_ta(stream
, column_offset
+ 2, &bet
->st_ipsec_ta
);
491 static void print_encap_type_ip_in_ip_tunnel_with_ipsec_transport_mode(
492 void *stream
, int column_offset
,
493 struct bgp_encap_type_ip_in_ip_tunnel_with_ipsec_transport_mode
*bet
)
495 const char *type
= "IP in IP Tunnel with IPSEC transport mode";
496 int (*fp
)(void *, const char *, ...);
499 const char *vty_newline
;
501 if (rfapiStream2Vty(stream
, &fp
, &vty
, &out
, &vty_newline
) == 0)
506 fp(out
, "%*sTEA type %s%s", column_offset
, "", type
, vty_newline
);
508 subtlv_print_ipsec_ta(stream
, column_offset
+ 2, &bet
->st_ipsec_ta
);
511 static void print_encap_type_mpls_in_ip_tunnel_with_ipsec_transport_mode(
512 void *stream
, int column_offset
,
513 struct bgp_encap_type_mpls_in_ip_tunnel_with_ipsec_transport_mode
*bet
)
515 const char *type
= "MPLS in IP Tunnel with IPSEC transport mode";
516 int (*fp
)(void *, const char *, ...);
519 const char *vty_newline
;
521 if (rfapiStream2Vty(stream
, &fp
, &vty
, &out
, &vty_newline
) == 0)
526 fp(out
, "%*sTEA type %s%s", column_offset
, "", type
, vty_newline
);
528 subtlv_print_ipsec_ta(stream
, column_offset
+ 2, &bet
->st_ipsec_ta
);
532 static void print_encap_type_pbb(void *stream
, int column_offset
,
533 struct bgp_encap_type_pbb
*bet
)
535 const char *type
= "PBB";
536 int (*fp
)(void *, const char *, ...);
539 const char *vty_newline
;
541 if (rfapiStream2Vty(stream
, &fp
, &vty
, &out
, &vty_newline
) == 0)
546 fp(out
, "%*sTEA type %s%s", column_offset
, "", type
, vty_newline
);
548 subtlv_print_encap_pbb(stream
, column_offset
+ 2, &bet
->st_encap
);
552 static void print_encap_type_vxlan(void *stream
, int column_offset
,
553 struct bgp_encap_type_vxlan
*bet
)
555 const char *type
= "VXLAN";
556 int (*fp
)(void *, const char *, ...);
559 const char *vty_newline
;
561 if (rfapiStream2Vty(stream
, &fp
, &vty
, &out
, &vty_newline
) == 0)
566 fp(out
, "%*sTEA type %s%s", column_offset
, "", type
, vty_newline
);
568 /* no subtlvs for this type */
572 static void print_encap_type_nvgre(void *stream
, int column_offset
,
573 struct bgp_encap_type_nvgre
*bet
)
575 const char *type
= "NVGRE";
576 int (*fp
)(void *, const char *, ...);
579 const char *vty_newline
;
581 if (rfapiStream2Vty(stream
, &fp
, &vty
, &out
, &vty_newline
) == 0)
586 fp(out
, "%*sTEA type %s%s", column_offset
, "", type
, vty_newline
);
588 /* no subtlvs for this type */
591 static void print_encap_type_mpls(void *stream
, int column_offset
,
592 struct bgp_encap_type_mpls
*bet
)
594 const char *type
= "MPLS";
595 int (*fp
)(void *, const char *, ...);
598 const char *vty_newline
;
600 if (rfapiStream2Vty(stream
, &fp
, &vty
, &out
, &vty_newline
) == 0)
605 fp(out
, "%*sTEA type %s%s", column_offset
, "", type
, vty_newline
);
607 /* no subtlvs for this type */
610 static void print_encap_type_mpls_in_gre(void *stream
, int column_offset
,
611 struct bgp_encap_type_mpls_in_gre
*bet
)
613 const char *type
= "MPLS in GRE";
614 int (*fp
)(void *, const char *, ...);
617 const char *vty_newline
;
619 if (rfapiStream2Vty(stream
, &fp
, &vty
, &out
, &vty_newline
) == 0)
624 fp(out
, "%*sTEA type %s%s", column_offset
, "", type
, vty_newline
);
626 /* no subtlvs for this type */
629 static void print_encap_type_vxlan_gpe(void *stream
, int column_offset
,
630 struct bgp_encap_type_vxlan_gpe
*bet
)
632 const char *type
= "VXLAN GPE";
633 int (*fp
)(void *, const char *, ...);
636 const char *vty_newline
;
638 if (rfapiStream2Vty(stream
, &fp
, &vty
, &out
, &vty_newline
) == 0)
643 fp(out
, "%*sTEA type %s%s", column_offset
, "", type
, vty_newline
);
645 /* no subtlvs for this type */
648 static void print_encap_type_mpls_in_udp(void *stream
, int column_offset
,
649 struct bgp_encap_type_mpls_in_udp
*bet
)
651 const char *type
= "MPLS in UDP";
652 int (*fp
)(void *, const char *, ...);
655 const char *vty_newline
;
657 if (rfapiStream2Vty(stream
, &fp
, &vty
, &out
, &vty_newline
) == 0)
662 fp(out
, "%*sTEA type %s%s", column_offset
, "", type
, vty_newline
);
664 /* no subtlvs for this type */
667 void rfapi_print_tunneltype_option(void *stream
, int column_offset
,
668 struct rfapi_tunneltype_option
*tto
)
671 case BGP_ENCAP_TYPE_L2TPV3_OVER_IP
:
672 print_encap_type_l2tpv3overip(stream
, column_offset
,
673 &tto
->bgpinfo
.l2tpv3_ip
);
676 case BGP_ENCAP_TYPE_GRE
:
677 print_encap_type_gre(stream
, column_offset
, &tto
->bgpinfo
.gre
);
680 case BGP_ENCAP_TYPE_TRANSMIT_TUNNEL_ENDPOINT
:
681 print_encap_type_transmit_tunnel_endpoint(
682 stream
, column_offset
,
683 &tto
->bgpinfo
.transmit_tunnel_endpoint
);
686 case BGP_ENCAP_TYPE_IPSEC_IN_TUNNEL_MODE
:
687 print_encap_type_ipsec_in_tunnel_mode(
688 stream
, column_offset
, &tto
->bgpinfo
.ipsec_tunnel
);
691 case BGP_ENCAP_TYPE_IP_IN_IP_TUNNEL_WITH_IPSEC_TRANSPORT_MODE
:
692 print_encap_type_ip_in_ip_tunnel_with_ipsec_transport_mode(
693 stream
, column_offset
, &tto
->bgpinfo
.ip_ipsec
);
696 case BGP_ENCAP_TYPE_MPLS_IN_IP_TUNNEL_WITH_IPSEC_TRANSPORT_MODE
:
697 print_encap_type_mpls_in_ip_tunnel_with_ipsec_transport_mode(
698 stream
, column_offset
, &tto
->bgpinfo
.mpls_ipsec
);
701 case BGP_ENCAP_TYPE_IP_IN_IP
:
702 print_encap_type_ip_in_ip(stream
, column_offset
,
703 &tto
->bgpinfo
.ip_ip
);
706 case BGP_ENCAP_TYPE_VXLAN
:
707 print_encap_type_vxlan(stream
, column_offset
,
708 &tto
->bgpinfo
.vxlan
);
711 case BGP_ENCAP_TYPE_NVGRE
:
712 print_encap_type_nvgre(stream
, column_offset
,
713 &tto
->bgpinfo
.nvgre
);
716 case BGP_ENCAP_TYPE_MPLS
:
717 print_encap_type_mpls(stream
, column_offset
,
721 case BGP_ENCAP_TYPE_MPLS_IN_GRE
:
722 print_encap_type_mpls_in_gre(stream
, column_offset
,
723 &tto
->bgpinfo
.mpls_gre
);
726 case BGP_ENCAP_TYPE_VXLAN_GPE
:
727 print_encap_type_vxlan_gpe(stream
, column_offset
,
728 &tto
->bgpinfo
.vxlan_gpe
);
731 case BGP_ENCAP_TYPE_MPLS_IN_UDP
:
732 print_encap_type_mpls_in_udp(stream
, column_offset
,
733 &tto
->bgpinfo
.mpls_udp
);
736 case BGP_ENCAP_TYPE_PBB
:
737 print_encap_type_pbb(stream
, column_offset
, &tto
->bgpinfo
.pbb
);
740 case BGP_ENCAP_TYPE_RESERVED
:
741 assert(!"Cannot process BGP_ENCAP_TYPE_RESERVED");