From bac21a7c4ba2dd131e8e82a13ab57a1a295a52ef Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Tue, 17 Jan 2017 17:51:40 +0100 Subject: [PATCH] bgpd: avoid recalculating as_val value in str2prefix_rd 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 --- bgpd/bgp_mplsvpn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 6c96dc2907..e494f8cbb7 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -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)); } } -- 2.39.5