]> git.proxmox.com Git - mirror_frr.git/blob - bgpd/bgp_mplsvpn.h
Merge pull request #101 from LabNConsulting/working/master/patch-set/3-vrf
[mirror_frr.git] / bgpd / bgp_mplsvpn.h
1 /* MPLS-VPN
2 Copyright (C) 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
3
4 This file is part of GNU Zebra.
5
6 GNU Zebra is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
9 later version.
10
11 GNU Zebra is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU Zebra; see the file COPYING. If not, write to the Free
18 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 02111-1307, USA. */
20
21 #ifndef _QUAGGA_BGP_MPLSVPN_H
22 #define _QUAGGA_BGP_MPLSVPN_H
23
24 #define RD_TYPE_AS 0
25 #define RD_TYPE_IP 1
26 #define RD_TYPE_AS4 2
27 #if ENABLE_BGP_VNC
28 #define RD_TYPE_VNC_ETH 0xff00 /* VNC L2VPN */
29 #endif
30
31 #define RD_ADDRSTRLEN 28
32
33 #ifdef MPLS_LABEL_MAX
34 # undef MPLS_LABEL_MAX
35 #endif
36
37 typedef enum {
38 MPLS_LABEL_IPV4_EXPLICIT_NULL = 0, /* [RFC3032] */
39 MPLS_LABEL_ROUTER_ALERT = 1, /* [RFC3032] */
40 MPLS_LABEL_IPV6_EXPLICIT_NULL = 2, /* [RFC3032] */
41 MPLS_LABEL_IMPLICIT_NULL = 3, /* [RFC3032] */
42 MPLS_LABEL_UNASSIGNED4 = 4,
43 MPLS_LABEL_UNASSIGNED5 = 5,
44 MPLS_LABEL_UNASSIGNED6 = 6,
45 MPLS_LABEL_ELI = 7, /* Entropy Indicator [RFC6790] */
46 MPLS_LABEL_UNASSIGNED8 = 8,
47 MPLS_LABEL_UNASSIGNED9 = 9,
48 MPLS_LABEL_UNASSIGNED10 = 10,
49 MPLS_LABEL_UNASSIGNED11 = 11,
50 MPLS_LABEL_GAL = 13, /* [RFC5586] */
51 MPLS_LABEL_OAM_ALERT = 14, /* [RFC3429] */
52 MPLS_LABEL_EXTENSION = 15, /* [RFC7274] */
53 MPLS_LABEL_MAX = 1048575,
54 MPLS_LABEL_ILLEGAL = 0xFFFFFFFF /* for internal use only */
55 } mpls_special_label_t;
56
57 #define MPLS_LABEL_IS_SPECIAL(label) \
58 ((label) <= MPLS_LABEL_EXTENSION)
59 #define MPLS_LABEL_IS_NULL(label) \
60 ((label) == MPLS_LABEL_IPV4_EXPLICIT_NULL || \
61 (label) == MPLS_LABEL_IPV6_EXPLICIT_NULL || \
62 (label) == MPLS_LABEL_IMPLICIT_NULL)
63
64 #define BGP_VPNVX_HELP_STR \
65 "Address Family \n" \
66 "Address Family \n"
67
68 struct rd_as
69 {
70 u_int16_t type;
71 as_t as;
72 u_int32_t val;
73 };
74
75 struct rd_ip
76 {
77 u_int16_t type;
78 struct in_addr ip;
79 u_int16_t val;
80 };
81
82 #if ENABLE_BGP_VNC
83 struct rd_vnc_eth
84 {
85 u_int16_t type;
86 uint8_t local_nve_id;
87 struct ethaddr macaddr;
88 };
89 #endif
90
91 extern u_int16_t decode_rd_type (u_char *);
92 extern void encode_rd_type (u_int16_t, u_char *);
93 extern void bgp_mplsvpn_init (void);
94 extern int bgp_nlri_parse_vpn (struct peer *, struct attr *, struct bgp_nlri *);
95 extern u_int32_t decode_label (u_char *);
96 extern void encode_label(u_int32_t, u_char *);
97 extern void decode_rd_as (u_char *, struct rd_as *);
98 extern void decode_rd_as4 (u_char *, struct rd_as *);
99 extern void decode_rd_ip (u_char *, struct rd_ip *);
100 #if ENABLE_BGP_VNC
101 extern void decode_vnc_eth (u_char *, struct rd_vnc_eth *);
102 #endif
103 extern int str2prefix_rd (const char *, struct prefix_rd *);
104 extern int str2tag (const char *, u_char *);
105 extern char *prefix_rd2str (struct prefix_rd *, char *, size_t);
106
107 extern int
108 argv_find_and_parse_vpnvx(struct cmd_token **argv, int argc, int *index, afi_t *afi);
109
110 #endif /* _QUAGGA_BGP_MPLSVPN_H */