]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospf6d/ospf6_asbr.c
Merge pull request #7261 from Niral-Networks/niral_dev_vrf_ospf6
[mirror_frr.git] / ospf6d / ospf6_asbr.c
index 8a467716ffc9374e905b93475147ac20f43ebf4f..c053716f26c8e792440db7543e2f1d522ebe41f7 100644 (file)
@@ -65,13 +65,11 @@ static void ospf6_as_external_lsa_originate(struct ospf6_route *route,
        struct ospf6_external_info *info = route->route_option;
 
        struct ospf6_as_external_lsa *as_external_lsa;
-       char buf[PREFIX2STR_BUFFER];
        caddr_t p;
 
-       if (IS_OSPF6_DEBUG_ASBR || IS_OSPF6_DEBUG_ORIGINATE(AS_EXTERNAL)) {
-               prefix2str(&route->prefix, buf, sizeof(buf));
-               zlog_debug("Originate AS-External-LSA for %s", buf);
-       }
+       if (IS_OSPF6_DEBUG_ASBR || IS_OSPF6_DEBUG_ORIGINATE(AS_EXTERNAL))
+               zlog_debug("Originate AS-External-LSA for %pFX",
+                          &route->prefix);
 
        /* prepare buffer */
        memset(buffer, 0, sizeof(buffer));
@@ -215,7 +213,6 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old,
        struct listnode *anode, *anext;
        struct listnode *nnode, *rnode, *rnext;
        struct ospf6_nexthop *nh, *rnh;
-       char buf[PREFIX2STR_BUFFER];
        bool route_found = false;
 
        /* check for old entry match with new route origin,
@@ -375,11 +372,9 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old,
                                listnode_add_sort(old_route->paths, ecmp_path);
 
                                if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) {
-                                       prefix2str(&route->prefix, buf,
-                                                  sizeof(buf));
                                        zlog_debug(
-                                               "%s: route %s another path added with nh %u, effective paths %u nh %u",
-                                               __func__, buf,
+                                               "%s: route %pFX another path added with nh %u, effective paths %u nh %u",
+                                               __func__, &route->prefix,
                                                listcount(ecmp_path->nh_list),
                                                old_route->paths ? listcount(
                                                        old_route->paths)
@@ -405,32 +400,27 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old,
                                                        &o_path->ls_prefix,
                                                        ospf6->brouter_table);
                                if (asbr_entry == NULL) {
-                                       if (IS_OSPF6_DEBUG_EXAMIN(
-                                                       AS_EXTERNAL)) {
-                                               prefix2str(&old_route->prefix,
-                                                          buf, sizeof(buf));
+                                       if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL))
                                                zlog_debug(
-                                                       "%s: ls_prfix %s asbr_entry not found.",
-                                                       __func__, buf);
-                                       }
+                                                       "%s: ls_prfix %pFX asbr_entry not found.",
+                                                       __func__,
+                                                       &old_route->prefix);
                                        continue;
                                }
                                ospf6_route_merge_nexthops(old_route,
                                                           asbr_entry);
                        }
 
-                       if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) {
-                               prefix2str(&route->prefix, buf, sizeof(buf));
+                       if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL))
                                zlog_debug(
-                                       "%s: route %s with effective paths %u nh %u",
-                                       __func__, buf,
+                                       "%s: route %pFX with effective paths %u nh %u",
+                                       __func__, &route->prefix,
                                        old_route->paths
                                                ? listcount(old_route->paths)
                                                : 0,
                                        old_route->nh_list
                                                ? listcount(old_route->nh_list)
                                                : 0);
-                       }
 
                        /* Update RIB/FIB */
                        if (ospf6->route_table->hook_add)
@@ -458,7 +448,6 @@ void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa, struct ospf6 *ospf6)
        struct prefix asbr_id;
        struct ospf6_route *asbr_entry, *route, *old;
        struct ospf6_path *path;
-       char buf[PREFIX2STR_BUFFER];
 
        external = (struct ospf6_as_external_lsa *)OSPF6_LSA_HEADER_END(
                lsa->header);
@@ -489,10 +478,8 @@ void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa, struct ospf6 *ospf6)
        asbr_entry = ospf6_route_lookup(&asbr_id, ospf6->brouter_table);
        if (asbr_entry == NULL
            || !CHECK_FLAG(asbr_entry->path.router_bits, OSPF6_ROUTER_BIT_E)) {
-               if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) {
-                       prefix2str(&asbr_id, buf, sizeof(buf));
-                       zlog_debug("ASBR entry not found: %s", buf);
-               }
+               if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL))
+                       zlog_debug("ASBR entry not found: %pFX", &asbr_id);
                return;
        }
 
@@ -532,15 +519,13 @@ void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa, struct ospf6 *ospf6)
        listnode_add_sort(route->paths, path);
 
 
-       if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL)) {
-               prefix2str(&route->prefix, buf, sizeof(buf));
-               zlog_debug("%s: AS-External %u route add %s cost %u(%u) nh %u",
-                          __func__,
-                          (route->path.type == OSPF6_PATH_TYPE_EXTERNAL1) ? 1
-                                                                          : 2,
-                          buf, route->path.cost, route->path.u.cost_e2,
-                          listcount(route->nh_list));
-       }
+       if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL))
+               zlog_debug(
+                       "%s: AS-External %u route add %pFX cost %u(%u) nh %u",
+                       __func__,
+                       (route->path.type == OSPF6_PATH_TYPE_EXTERNAL1) ? 1 : 2,
+                       &route->prefix, route->path.cost, route->path.u.cost_e2,
+                       listcount(route->nh_list));
 
        old = ospf6_route_lookup(&route->prefix, ospf6->route_table);
        if (!old) {
@@ -1079,7 +1064,7 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,
        struct ospf6_external_info *info;
        struct prefix prefix_id;
        struct route_node *node;
-       char pbuf[PREFIX2STR_BUFFER], ibuf[16];
+       char ibuf[16];
        struct listnode *lnode, *lnnode;
        struct ospf6_area *oa;
 
@@ -1089,10 +1074,8 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,
        memset(&troute, 0, sizeof(troute));
        memset(&tinfo, 0, sizeof(tinfo));
 
-       if (IS_OSPF6_DEBUG_ASBR) {
-               prefix2str(prefix, pbuf, sizeof(pbuf));
-               zlog_debug("Redistribute %s (%s)", pbuf, ZROUTE_NAME(type));
-       }
+       if (IS_OSPF6_DEBUG_ASBR)
+               zlog_debug("Redistribute %pFX (%s)", prefix, ZROUTE_NAME(type));
 
        /* if route-map was specified but not found, do not advertise */
        if (ospf6->rmap[type].name) {
@@ -1160,10 +1143,9 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,
                if (IS_OSPF6_DEBUG_ASBR) {
                        inet_ntop(AF_INET, &prefix_id.u.prefix4, ibuf,
                                  sizeof(ibuf));
-                       prefix2str(prefix, pbuf, sizeof(pbuf));
                        zlog_debug(
-                               "Advertise as AS-External Id:%s prefix %s metric %u",
-                               ibuf, pbuf, match->path.metric_type);
+                               "Advertise as AS-External Id:%s prefix %pFX metric %u",
+                               ibuf, prefix, match->path.metric_type);
                }
 
                match->path.origin.id = htonl(info->id);
@@ -1214,9 +1196,9 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,
 
        if (IS_OSPF6_DEBUG_ASBR) {
                inet_ntop(AF_INET, &prefix_id.u.prefix4, ibuf, sizeof(ibuf));
-               prefix2str(prefix, pbuf, sizeof(pbuf));
-               zlog_debug("Advertise as AS-External Id:%s prefix %s metric %u",
-                          ibuf, pbuf, route->path.metric_type);
+               zlog_debug(
+                       "Advertise as AS-External Id:%s prefix %pFX metric %u",
+                       ibuf, prefix, route->path.metric_type);
        }
 
        route->path.origin.id = htonl(info->id);
@@ -1235,16 +1217,14 @@ void ospf6_asbr_redistribute_remove(int type, ifindex_t ifindex,
        struct route_node *node;
        struct ospf6_lsa *lsa;
        struct prefix prefix_id;
-       char pbuf[PREFIX2STR_BUFFER], ibuf[16];
+       char ibuf[16];
        struct listnode *lnode, *lnnode;
        struct ospf6_area *oa;
 
        match = ospf6_route_lookup(prefix, ospf6->external_table);
        if (match == NULL) {
-               if (IS_OSPF6_DEBUG_ASBR) {
-                       prefix2str(prefix, pbuf, sizeof(pbuf));
-                       zlog_debug("No such route %s to withdraw", pbuf);
-               }
+               if (IS_OSPF6_DEBUG_ASBR)
+                       zlog_debug("No such route %pFX to withdraw", prefix);
                return;
        }
 
@@ -1252,17 +1232,14 @@ void ospf6_asbr_redistribute_remove(int type, ifindex_t ifindex,
        assert(info);
 
        if (info->type != type) {
-               if (IS_OSPF6_DEBUG_ASBR) {
-                       prefix2str(prefix, pbuf, sizeof(pbuf));
-                       zlog_debug("Original protocol mismatch: %s", pbuf);
-               }
+               if (IS_OSPF6_DEBUG_ASBR)
+                       zlog_debug("Original protocol mismatch: %pFX", prefix);
                return;
        }
 
        if (IS_OSPF6_DEBUG_ASBR) {
-               prefix2str(prefix, pbuf, sizeof(pbuf));
                inet_ntop(AF_INET, &prefix_id.u.prefix4, ibuf, sizeof(ibuf));
-               zlog_debug("Withdraw %s (AS-External Id:%s)", pbuf, ibuf);
+               zlog_debug("Withdraw %pFX (AS-External Id:%s)", prefix, ibuf);
        }
 
        lsa = ospf6_lsdb_lookup(htons(OSPF6_LSTYPE_AS_EXTERNAL),
@@ -1877,10 +1854,9 @@ static void ospf6_asbr_external_route_show(struct vty *vty,
                                           struct ospf6_route *route)
 {
        struct ospf6_external_info *info = route->route_option;
-       char prefix[PREFIX2STR_BUFFER], id[16], forwarding[64];
+       char id[16], forwarding[64];
        uint32_t tmp_id;
 
-       prefix2str(&route->prefix, prefix, sizeof(prefix));
        tmp_id = ntohl(info->id);
        inet_ntop(AF_INET, &tmp_id, id, sizeof(id));
        if (!IN6_IS_ADDR_UNSPECIFIED(&info->forwarding))
@@ -1890,8 +1866,8 @@ static void ospf6_asbr_external_route_show(struct vty *vty,
                snprintf(forwarding, sizeof(forwarding), ":: (ifindex %d)",
                         ospf6_route_get_first_nh_index(route));
 
-       vty_out(vty, "%c %-32s %-15s type-%d %5lu %s\n",
-               zebra_route_char(info->type), prefix, id,
+       vty_out(vty, "%c %-32pFX %-15s type-%d %5lu %s\n",
+               zebra_route_char(info->type), &route->prefix, id,
                route->path.metric_type,
                (unsigned long)(route->path.metric_type == 2
                                        ? route->path.u.cost_e2