]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: avoid recalculating as_val value in str2prefix_rd
authorPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 17 Jan 2017 16:51:40 +0000 (17:51 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 17 Jan 2017 16:51:40 +0000 (17:51 +0100)
This is an optimisation that consists in avoiding calling twice atol()
function when converting an ext. community to an AS4 byte or a standard AS byte value.

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

index 6c96dc2907ca2d7ecaaa058a33100eb80e402269..e494f8cbb78a1a2ea3a26e838b29605d968068f7 100644 (file)
@@ -346,13 +346,13 @@ str2prefix_rd (const char *str, struct prefix_rd *prd)
       if (as_val > 0xffff)
         {
           stream_putw (s, RD_TYPE_AS4);
-          stream_putl (s, atol (half));
+          stream_putl (s, as_val);
           stream_putw (s, atol (p + 1));
         }
       else
         {
           stream_putw (s, RD_TYPE_AS);
-          stream_putw (s, atol (half));
+          stream_putw (s, as_val);
           stream_putl (s, atol (p + 1));
         }
     }