]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospf6d/ospf6_zebra.c
Merge pull request #7261 from Niral-Networks/niral_dev_vrf_ospf6
[mirror_frr.git] / ospf6d / ospf6_zebra.c
index 6ab6153798c0a8b78635b800ddbbaebab8274364..b6c712176a5b4d8eea39d37c718233c56dee2c82 100644 (file)
@@ -133,7 +133,6 @@ void ospf6_zebra_no_redistribute(int type, vrf_id_t vrf_id)
 static int ospf6_zebra_if_address_update_add(ZAPI_CALLBACK_ARGS)
 {
        struct connected *c;
-       char buf[128];
 
        c = zebra_interface_address_read(ZEBRA_INTERFACE_ADDRESS_ADD,
                                         zclient->ibuf, vrf_id);
@@ -141,11 +140,9 @@ static int ospf6_zebra_if_address_update_add(ZAPI_CALLBACK_ARGS)
                return 0;
 
        if (IS_OSPF6_DEBUG_ZEBRA(RECV))
-               zlog_debug("Zebra Interface address add: %s %5s %s/%d",
+               zlog_debug("Zebra Interface address add: %s %5s %pFX",
                           c->ifp->name, prefix_family_str(c->address),
-                          inet_ntop(c->address->family, &c->address->u.prefix,
-                                    buf, sizeof(buf)),
-                          c->address->prefixlen);
+                          c->address);
 
        if (c->address->family == AF_INET6) {
                ospf6_interface_state_update(c->ifp);
@@ -157,7 +154,6 @@ static int ospf6_zebra_if_address_update_add(ZAPI_CALLBACK_ARGS)
 static int ospf6_zebra_if_address_update_delete(ZAPI_CALLBACK_ARGS)
 {
        struct connected *c;
-       char buf[128];
 
        c = zebra_interface_address_read(ZEBRA_INTERFACE_ADDRESS_DELETE,
                                         zclient->ibuf, vrf_id);
@@ -165,11 +161,9 @@ static int ospf6_zebra_if_address_update_delete(ZAPI_CALLBACK_ARGS)
                return 0;
 
        if (IS_OSPF6_DEBUG_ZEBRA(RECV))
-               zlog_debug("Zebra Interface address delete: %s %5s %s/%d",
+               zlog_debug("Zebra Interface address delete: %s %5s %pFX",
                           c->ifp->name, prefix_family_str(c->address),
-                          inet_ntop(c->address->family, &c->address->u.prefix,
-                                    buf, sizeof(buf)),
-                          c->address->prefixlen);
+                          c->address);
 
        if (c->address->family == AF_INET6) {
                ospf6_interface_connected_route_update(c->ifp);
@@ -206,19 +200,13 @@ static int ospf6_zebra_read_route(ZAPI_CALLBACK_ARGS)
        ifindex = api.nexthops[0].ifindex;
        nexthop = &api.nexthops[0].gate.ipv6;
 
-       if (IS_OSPF6_DEBUG_ZEBRA(RECV)) {
-               char prefixstr[PREFIX2STR_BUFFER], nexthopstr[128];
-
-               prefix2str(&api.prefix, prefixstr, sizeof(prefixstr));
-               inet_ntop(AF_INET6, nexthop, nexthopstr, sizeof(nexthopstr));
-
+       if (IS_OSPF6_DEBUG_ZEBRA(RECV))
                zlog_debug(
-                       "Zebra Receive route %s: %s %s nexthop %s ifindex %ld tag %" ROUTE_TAG_PRI,
+                       "Zebra Receive route %s: %s %pFX nexthop %pI6 ifindex %ld tag %" ROUTE_TAG_PRI,
                        (cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD ? "add"
                                                             : "delete"),
-                       zebra_route_string(api.type), prefixstr, nexthopstr,
+                       zebra_route_string(api.type), &api.prefix, nexthop,
                        ifindex, api.tag);
-       }
 
        if (cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD)
                ospf6_asbr_redistribute_add(api.type, ifindex, &api.prefix,
@@ -265,16 +253,13 @@ static void ospf6_zebra_route_update(int type, struct ospf6_route *request,
                                     struct ospf6 *ospf6)
 {
        struct zapi_route api;
-       char buf[PREFIX2STR_BUFFER];
        int nhcount;
        int ret = 0;
        struct prefix *dest;
 
-       if (IS_OSPF6_DEBUG_ZEBRA(SEND)) {
-               prefix2str(&request->prefix, buf, sizeof(buf));
-               zlog_debug("Send %s route: %s",
-                          (type == REM ? "remove" : "add"), buf);
-       }
+       if (IS_OSPF6_DEBUG_ZEBRA(SEND))
+               zlog_debug("Send %s route: %pFX",
+                          (type == REM ? "remove" : "add"), &request->prefix);
 
        if (zclient->sock < 0) {
                if (IS_OSPF6_DEBUG_ZEBRA(SEND))
@@ -367,7 +352,6 @@ void ospf6_zebra_route_update_remove(struct ospf6_route *request,
 void ospf6_zebra_add_discard(struct ospf6_route *request, struct ospf6 *ospf6)
 {
        struct zapi_route api;
-       char buf[INET6_ADDRSTRLEN];
        struct prefix *dest = &request->prefix;
 
        if (!CHECK_FLAG(request->flag, OSPF6_ROUTE_BLACKHOLE_ADDED)) {
@@ -381,19 +365,14 @@ void ospf6_zebra_add_discard(struct ospf6_route *request, struct ospf6 *ospf6)
                zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api);
 
                if (IS_OSPF6_DEBUG_ZEBRA(SEND))
-                       zlog_debug("Zebra: Route add discard %s/%d",
-                                  inet_ntop(AF_INET6, &dest->u.prefix6, buf,
-                                            INET6_ADDRSTRLEN),
-                                  dest->prefixlen);
+                       zlog_debug("Zebra: Route add discard %pFX", dest);
 
                SET_FLAG(request->flag, OSPF6_ROUTE_BLACKHOLE_ADDED);
        } else {
                if (IS_OSPF6_DEBUG_ZEBRA(SEND))
                        zlog_debug(
-                               "Zebra: Blackhole route present already %s/%d",
-                               inet_ntop(AF_INET6, &dest->u.prefix6, buf,
-                                         INET6_ADDRSTRLEN),
-                               dest->prefixlen);
+                               "Zebra: Blackhole route present already %pFX",
+                               dest);
        }
 }
 
@@ -401,7 +380,6 @@ void ospf6_zebra_delete_discard(struct ospf6_route *request,
                                struct ospf6 *ospf6)
 {
        struct zapi_route api;
-       char buf[INET6_ADDRSTRLEN];
        struct prefix *dest = &request->prefix;
 
        if (CHECK_FLAG(request->flag, OSPF6_ROUTE_BLACKHOLE_ADDED)) {
@@ -415,19 +393,14 @@ void ospf6_zebra_delete_discard(struct ospf6_route *request,
                zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
 
                if (IS_OSPF6_DEBUG_ZEBRA(SEND))
-                       zlog_debug("Zebra: Route delete discard %s/%d",
-                                  inet_ntop(AF_INET6, &dest->u.prefix6, buf,
-                                            INET6_ADDRSTRLEN),
-                                  dest->prefixlen);
+                       zlog_debug("Zebra: Route delete discard %pFX", dest);
 
                UNSET_FLAG(request->flag, OSPF6_ROUTE_BLACKHOLE_ADDED);
        } else {
                if (IS_OSPF6_DEBUG_ZEBRA(SEND))
                        zlog_debug(
-                               "Zebra: Blackhole route already deleted %s/%d",
-                               inet_ntop(AF_INET6, &dest->u.prefix6, buf,
-                                         INET6_ADDRSTRLEN),
-                               dest->prefixlen);
+                               "Zebra: Blackhole route already deleted %pFX",
+                               dest);
        }
 }