]> git.proxmox.com Git - mirror_frr.git/blame - bgpd/bgp_rd.h
Merge pull request #12780 from opensourcerouting/spdx-license-id
[mirror_frr.git] / bgpd / bgp_rd.h
CommitLineData
acddc0ed 1// SPDX-License-Identifier: GPL-2.0-or-later
8557760c 2/* BGP RD definitions for BGP-based VPNs (IP/EVPN)
3 * -- brought over from bgpd/bgp_mplsvpn.h
4 * Copyright (C) 2000 Kunihiro Ishiguro <kunihiro@zebra.org>
8557760c 5 */
6
7#ifndef _QUAGGA_BGP_RD_H
8#define _QUAGGA_BGP_RD_H
9
10/* RD types */
11#define RD_TYPE_AS 0
12#define RD_TYPE_IP 1
13#define RD_TYPE_AS4 2
14
49e5a4a0 15#ifdef ENABLE_BGP_VNC
8557760c 16#define RD_TYPE_VNC_ETH 0xff00 /* VNC L2VPN */
17#endif
18
19#define RD_ADDRSTRLEN 28
c44ab6f1 20#define RD_BYTES 8
8557760c 21
d62a17ae 22struct rd_as {
d7c0a89a 23 uint16_t type;
d62a17ae 24 as_t as;
d7c0a89a 25 uint32_t val;
8557760c 26};
27
d62a17ae 28struct rd_ip {
d7c0a89a 29 uint16_t type;
d62a17ae 30 struct in_addr ip;
d7c0a89a 31 uint16_t val;
8557760c 32};
33
49e5a4a0 34#ifdef ENABLE_BGP_VNC
d62a17ae 35struct rd_vnc_eth {
d7c0a89a 36 uint16_t type;
d62a17ae 37 uint8_t local_nve_id;
38 struct ethaddr macaddr;
8557760c 39};
40#endif
41
1be1693e 42extern uint16_t decode_rd_type(const uint8_t *pnt);
d7c0a89a 43extern void encode_rd_type(uint16_t, uint8_t *);
8557760c 44
1be1693e
DS
45extern void decode_rd_as(const uint8_t *pnt, struct rd_as *rd_as);
46extern void decode_rd_as4(const uint8_t *pnt, struct rd_as *rd_as);
5a1ae2c2 47extern void decode_rd_ip(const uint8_t *pnt, struct rd_ip *rd_ip);
49e5a4a0 48#ifdef ENABLE_BGP_VNC
5f040085
DS
49extern void decode_rd_vnc_eth(const uint8_t *pnt,
50 struct rd_vnc_eth *rd_vnc_eth);
8557760c 51#endif
52
d62a17ae 53extern int str2prefix_rd(const char *, struct prefix_rd *);
5f040085 54extern char *prefix_rd2str(const struct prefix_rd *, char *, size_t);
92708db6 55extern void form_auto_rd(struct in_addr router_id, uint16_t rd_id,
56 struct prefix_rd *prd);
8557760c 57
58#endif /* _QUAGGA_BGP_RD_H */