]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: fix handling of nhp_ary when exporting vrf routes to zebra 1638/head
authorLou Berger <lberger@labn.net>
Sun, 14 Jan 2018 20:42:06 +0000 (15:42 -0500)
committerLou Berger <lberger@labn.net>
Sun, 14 Jan 2018 20:42:06 +0000 (15:42 -0500)
Signed-off-by: Lou Berger <lberger@labn.net>
bgpd/rfapi/vnc_zebra.c

index f8b38468f5e441f851afec15417864e054c1f68d..e0e58e9559ba0847916e9752208a17d1d0800e02 100644 (file)
@@ -385,6 +385,8 @@ static void vnc_zebra_route_msg(struct prefix *p, unsigned int nhp_count,
        struct zapi_route api;
        struct zapi_nexthop *api_nh;
        int i;
+       struct in_addr **nhp_ary4 = nhp_ary;
+       struct in6_addr **nhp_ary6 = nhp_ary;
 
        if (!nhp_count) {
                vnc_zlog_debug_verbose("%s: empty nexthop list, skipping",
@@ -402,20 +404,16 @@ static void vnc_zebra_route_msg(struct prefix *p, unsigned int nhp_count,
        SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
        api.nexthop_num = MIN(nhp_count, multipath_num);
        for (i = 0; i < api.nexthop_num; i++) {
-               struct in_addr *nhp_ary4;
-               struct in6_addr *nhp_ary6;
 
                api_nh = &api.nexthops[i];
                switch (p->family) {
                case AF_INET:
-                       nhp_ary4 = nhp_ary;
-                       memcpy(&api_nh->gate.ipv4, &nhp_ary4[i],
+                       memcpy(&api_nh->gate.ipv4, nhp_ary4[i],
                               sizeof(api_nh->gate.ipv4));
                        api_nh->type = NEXTHOP_TYPE_IPV4;
                        break;
                case AF_INET6:
-                       nhp_ary6 = nhp_ary;
-                       memcpy(&api_nh->gate.ipv6, &nhp_ary6[i],
+                       memcpy(&api_nh->gate.ipv6, nhp_ary6[i],
                               sizeof(api_nh->gate.ipv6));
                        api_nh->type = NEXTHOP_TYPE_IPV6;
                        break;