diff options
author | vivek <vivek@cumulusnetworks.com> | 2018-03-27 02:11:39 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-04-25 18:39:16 +0200 |
commit | 92708db6c3b8ff9dfa81a8bbb99a472f05d76f35 (patch) | |
tree | ef9595c1c81148365e41ef311e17e2deb701709b /bgpd/bgp_rd.c | |
parent | bgpd: Fix params/checks for route leaking and L3VPN (diff) | |
download | frr-92708db6c3b8ff9dfa81a8bbb99a472f05d76f35.tar.xz frr-92708db6c3b8ff9dfa81a8bbb99a472f05d76f35.zip |
bgpd: Auto RD definitions and encoding
Setup a per-VRF identifier to use along with the Router Id to build the
RD. Define a function to encode the RD. Code is brought over from EVPN
and EVPN code has been modified to use the generic function.
Ticket: CM-20256
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Diffstat (limited to 'bgpd/bgp_rd.c')
-rw-r--r-- | bgpd/bgp_rd.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/bgpd/bgp_rd.c b/bgpd/bgp_rd.c index 64e083d1e..3f7ea1604 100644 --- a/bgpd/bgp_rd.c +++ b/bgpd/bgp_rd.c @@ -200,3 +200,15 @@ char *prefix_rd2str(struct prefix_rd *prd, char *buf, size_t size) snprintf(buf, size, "Unknown Type: %d", type); return buf; } + +void form_auto_rd(struct in_addr router_id, + uint16_t rd_id, + struct prefix_rd *prd) +{ + char buf[100]; + + prd->family = AF_UNSPEC; + prd->prefixlen = 64; + sprintf(buf, "%s:%hu", inet_ntoa(router_id), rd_id); + str2prefix_rd(buf, prd); +} |