Mailing List Archive

[PATCH 24/57] bgpd: str2prefix_rd support for AS4 format
This commit enhances the string to prefix route distinguisher function,
since it detects whether administrator number is a 4 byte AS or a 2 byte
AS.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
---
bgpd/bgp_mplsvpn.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c
index 1ee45bf38dfe..8f7b8921283b 100644
--- a/bgpd/bgp_mplsvpn.c
+++ b/bgpd/bgp_mplsvpn.c
@@ -290,12 +290,24 @@ str2prefix_rd (const char *str, struct prefix_rd *prd)

if (! p2)
{
+ unsigned long as_val;
+
if (! all_digit (half))
goto out;
-
- stream_putw (s, RD_TYPE_AS);
- stream_putw (s, atoi (half));
- stream_putl (s, atol (p + 1));
+
+ as_val = atol(half);
+ if (as_val > 0xffff)
+ {
+ stream_putw (s, RD_TYPE_AS4);
+ stream_putl (s, atol (half));
+ stream_putw (s, atol (p + 1));
+ }
+ else
+ {
+ stream_putw (s, RD_TYPE_AS);
+ stream_putw (s, atol (half));
+ stream_putl (s, atol (p + 1));
+ }
}
else
{
--
2.1.4


_______________________________________________
Quagga-dev mailing list
Quagga-dev@lists.quagga.net
https://lists.quagga.net/mailman/listinfo/quagga-dev