[quagga-dev,15553,02/16] bgpd: setting nexthop doesn't need inet_pton

Message ID 1465927630-27768-2-git-send-email-chris@opensourcerouting.org
State Under Review
Headers show
Series
  • [quagga-dev,15552,01/16] zebra: fix null pointer dereference in zsend_ipv4_nexthop_lookup_mrib
Related show

Commit Message

Christian Franke June 14, 2016, 6:06 p.m.
From: Christian Franke <nobody@nowhere.ws>

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
---
 bgpd/bgp_routemap.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

Comments

Donald Sharp June 15, 2016, 12:26 p.m. | #1
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>

On Tue, Jun 14, 2016 at 2:06 PM, Christian Franke <
chris@opensourcerouting.org> wrote:

> From: Christian Franke <nobody@nowhere.ws>
>
> Signed-off-by: Christian Franke <chris@opensourcerouting.org>
> ---
>  bgpd/bgp_routemap.c | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
> index 39fa08c..c781ff1 100644
> --- a/bgpd/bgp_routemap.c
> +++ b/bgpd/bgp_routemap.c
> @@ -1990,7 +1990,6 @@ route_set_ipv6_nexthop_peer (void *rule, struct
> prefix *prefix,
>    struct in6_addr peer_address;
>    struct bgp_info *bgp_info;
>    struct peer *peer;
> -  char peer_addr_buf[INET6_ADDRSTRLEN];
>
>    if (type == RMAP_BGP)
>      {
> @@ -2003,19 +2002,13 @@ route_set_ipv6_nexthop_peer (void *rule, struct
> prefix *prefix,
>           && peer->su_remote
>           && sockunion_family (peer->su_remote) == AF_INET6)
>         {
> -         inet_pton (AF_INET6, sockunion2str (peer->su_remote,
> -                                             peer_addr_buf,
> -                                             INET6_ADDRSTRLEN),
> -                    &peer_address);
> +         peer_address = peer->su_remote->sin6.sin6_addr;
>         }
>        else if (CHECK_FLAG (peer->rmap_type, PEER_RMAP_TYPE_OUT)
>                && peer->su_local
>                && sockunion_family (peer->su_local) == AF_INET6)
>         {
> -         inet_pton (AF_INET, sockunion2str (peer->su_local,
> -                                            peer_addr_buf,
> -                                            INET6_ADDRSTRLEN),
> -                    &peer_address);
> +         peer_address = peer->su_local->sin6.sin6_addr;
>         }
>
>        if (IN6_IS_ADDR_LINKLOCAL(&peer_address))
> --
> 2.8.0
>
>
> _______________________________________________
> Quagga-dev mailing list
> Quagga-dev@lists.quagga.net
> https://lists.quagga.net/mailman/listinfo/quagga-dev
>

Patch hide | download patch | download mbox

diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index 39fa08c..c781ff1 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -1990,7 +1990,6 @@  route_set_ipv6_nexthop_peer (void *rule, struct prefix *prefix,
   struct in6_addr peer_address;
   struct bgp_info *bgp_info;
   struct peer *peer;
-  char peer_addr_buf[INET6_ADDRSTRLEN];
 
   if (type == RMAP_BGP)
     {
@@ -2003,19 +2002,13 @@  route_set_ipv6_nexthop_peer (void *rule, struct prefix *prefix,
 	  && peer->su_remote
 	  && sockunion_family (peer->su_remote) == AF_INET6)
 	{
-	  inet_pton (AF_INET6, sockunion2str (peer->su_remote,
-					      peer_addr_buf,
-					      INET6_ADDRSTRLEN),
-		     &peer_address);
+	  peer_address = peer->su_remote->sin6.sin6_addr;
 	}
       else if (CHECK_FLAG (peer->rmap_type, PEER_RMAP_TYPE_OUT)
 	       && peer->su_local
 	       && sockunion_family (peer->su_local) == AF_INET6)
 	{
-	  inet_pton (AF_INET, sockunion2str (peer->su_local,
-					     peer_addr_buf,
-					     INET6_ADDRSTRLEN),
-		     &peer_address);
+	  peer_address = peer->su_local->sin6.sin6_addr;
 	}
 
       if (IN6_IS_ADDR_LINKLOCAL(&peer_address))