]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: str2prefix_rd support for AS4 format
authorPhilippe Guibert <philippe.guibert@6wind.com>
Mon, 24 Oct 2016 13:16:36 +0000 (15:16 +0200)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 17 Jan 2017 11:01:57 +0000 (12:01 +0100)
This commit improves the ability for str2prefix_rd command to support
AS4 format. Until now, only AS2 format and IP format was supported.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
bgpd/bgp_mplsvpn.c

index b710e0b03bcd92235d6aeca6a3954face1e84642..6c96dc2907ca2d7ecaaa058a33100eb80e402269 100644 (file)
@@ -337,12 +337,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
     {