summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_mplsvpn.h
blob: 3b37aadbf8c14f836e32a5f5c8a68e97f9c90396 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* MPLS-VPN
 * Copyright (C) 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
 *
 * This file is part of GxNU Zebra.
 *
 * GNU Zebra is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2, or (at your option) any
 * later version.
 *
 * GNU Zebra is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * 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; see the file COPYING; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 */

#ifndef _QUAGGA_BGP_MPLSVPN_H
#define _QUAGGA_BGP_MPLSVPN_H

#include "bgpd/bgp_route.h"
#include "bgpd/bgp_rd.h"

#ifdef MPLS_LABEL_MAX
#undef MPLS_LABEL_MAX
#endif

typedef enum {
	MPLS_LABEL_IPV4_EXPLICIT_NULL = 0, /* [RFC3032] */
	MPLS_LABEL_ROUTER_ALERT = 1,       /* [RFC3032] */
	MPLS_LABEL_IPV6_EXPLICIT_NULL = 2, /* [RFC3032] */
	MPLS_LABEL_IMPLICIT_NULL = 3,      /* [RFC3032] */
	MPLS_LABEL_UNASSIGNED4 = 4,
	MPLS_LABEL_UNASSIGNED5 = 5,
	MPLS_LABEL_UNASSIGNED6 = 6,
	MPLS_LABEL_ELI = 7, /* Entropy Indicator [RFC6790] */
	MPLS_LABEL_UNASSIGNED8 = 8,
	MPLS_LABEL_UNASSIGNED9 = 9,
	MPLS_LABEL_UNASSIGNED10 = 10,
	MPLS_LABEL_UNASSIGNED11 = 11,
	MPLS_LABEL_GAL = 13,       /* [RFC5586] */
	MPLS_LABEL_OAM_ALERT = 14, /* [RFC3429] */
	MPLS_LABEL_EXTENSION = 15, /* [RFC7274] */
	MPLS_LABEL_MAX = 1048575,
	MPLS_LABEL_ILLEGAL = 0xFFFFFFFF /* for internal use only */
} mpls_special_label_t;

#define MPLS_LABEL_IS_SPECIAL(label) ((label) <= MPLS_LABEL_EXTENSION)
#define MPLS_LABEL_IS_NULL(label)                                              \
	((label) == MPLS_LABEL_IPV4_EXPLICIT_NULL                              \
	 || (label) == MPLS_LABEL_IPV6_EXPLICIT_NULL                           \
	 || (label) == MPLS_LABEL_IMPLICIT_NULL)

#define BGP_VPNVX_HELP_STR                                                     \
	"Address Family\n"                                                     \
	"Address Family\n"

#define V4_HEADER                                                              \
	"   Network          Next Hop            Metric LocPrf Weight Path\n"
#define V4_HEADER_TAG "   Network          Next Hop      In tag/Out tag\n"
#define V4_HEADER_OVERLAY                                                      \
	"   Network          Next Hop      EthTag    Overlay Index   RouterMac\n"

extern void bgp_mplsvpn_init(void);
extern int bgp_nlri_parse_vpn(struct peer *, struct attr *, struct bgp_nlri *);
extern u_int32_t decode_label(mpls_label_t *);
extern void encode_label(mpls_label_t, mpls_label_t *);

extern int argv_find_and_parse_vpnvx(struct cmd_token **argv, int argc,
				     int *index, afi_t *afi);
extern int bgp_show_mpls_vpn(struct vty *vty, afi_t afi, struct prefix_rd *prd,
			     enum bgp_show_type type, void *output_arg,
			     int tags, u_char use_json);

#endif /* _QUAGGA_BGP_MPLSVPN_H */