]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: debug additional detail for route announce/redist
authorG. Paul Ziemba <paulz@labn.net>
Fri, 9 Mar 2018 15:53:32 +0000 (10:53 -0500)
committerLou Berger <lberger@labn.net>
Fri, 9 Mar 2018 21:42:40 +0000 (16:42 -0500)
       alos add a comment

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
zebra/redistribute.c
zebra/zserv.c

index a7b2361ac68dfd636510bbbf8d8b14189072d5cb..36168a5f2a2ebdcdca1ee5cdab9feff8d8e80445 100644 (file)
@@ -115,11 +115,12 @@ static void zebra_redistribute(struct zserv *client, int type, u_short instance,
 
                        if (IS_ZEBRA_DEBUG_EVENT)
                                zlog_debug(
-                                       "%s: checking: selected=%d, type=%d, distance=%d, "
+                                       "%s: client %s vrf %d checking: selected=%d, type=%d, distance=%d, "
                                        "zebra_check_addr=%d",
                                        __func__,
-                                       CHECK_FLAG(newre->flags,
-                                                  ZEBRA_FLAG_SELECTED),
+                                       zebra_route_string(client->proto),
+                                       vrf_id, CHECK_FLAG(newre->flags,
+                                                          ZEBRA_FLAG_SELECTED),
                                        newre->type, newre->distance,
                                        zebra_check_addr(dst_p));
 
@@ -254,6 +255,12 @@ void zebra_redistribute_add(int command, struct zserv *client, int length,
        STREAM_GETC(client->ibuf, type);
        STREAM_GETW(client->ibuf, instance);
 
+       if (IS_ZEBRA_DEBUG_EVENT)
+               zlog_debug(
+                       "%s: client proto %s afi=%d, wants %s, vrf %d, instance=%d",
+                       __func__, zebra_route_string(client->proto), afi,
+                       zebra_route_string(type), zvrf_id(zvrf), instance);
+
        if (afi == 0 || afi > AFI_MAX) {
                zlog_warn("%s: Specified afi %d does not exist",
                          __PRETTY_FUNCTION__, afi);
@@ -277,6 +284,9 @@ void zebra_redistribute_add(int command, struct zserv *client, int length,
        } else {
                if (!vrf_bitmap_check(client->redist[afi][type],
                                      zvrf_id(zvrf))) {
+                       if (IS_ZEBRA_DEBUG_EVENT)
+                               zlog_debug("%s: setting vrf %d redist bitmap",
+                                          __func__, zvrf_id(zvrf));
                        vrf_bitmap_set(client->redist[afi][type],
                                       zvrf_id(zvrf));
                        zebra_redistribute(client, type, 0, zvrf_id(zvrf), afi);
index 1a2ad7f8b4f594d304f6b77818ab3eb7da916a71..54e688ebcd174285c13e54ed75ad538c292b16c0 100644 (file)
@@ -663,6 +663,17 @@ int zsend_redistribute_route(int cmd, struct zserv *client, struct prefix *p,
        /* Encode route and send. */
        if (zapi_route_encode(cmd, client->obuf, &api) < 0)
                return -1;
+
+       if (IS_ZEBRA_DEBUG_SEND) {
+               char buf_prefix[PREFIX_STRLEN];
+               prefix2str(&api.prefix, buf_prefix, sizeof(buf_prefix));
+
+               zlog_debug("%s: %s to client %s: type %s, vrf_id %d, p %s",
+                          __func__, zserv_command_string(cmd),
+                          zebra_route_string(client->proto),
+                          zebra_route_string(api.type), api.vrf_id,
+                          buf_prefix);
+       }
        return zebra_server_send_message(client);
 }
 
@@ -1195,6 +1206,16 @@ static int zread_route_add(struct zserv *client, u_short length,
        if (zapi_route_decode(s, &api) < 0)
                return -1;
 
+       if (IS_ZEBRA_DEBUG_RECV) {
+               char buf_prefix[PREFIX_STRLEN];
+               prefix2str(&api.prefix, buf_prefix, sizeof(buf_prefix));
+               zlog_debug("%s: p=%s, ZAPI_MESSAGE_LABEL: %sset, flags=0x%x",
+                          __func__, buf_prefix,
+                          (CHECK_FLAG(api.message, ZAPI_MESSAGE_LABEL) ? ""
+                                                                       : "un"),
+                          api.flags);
+       }
+
        /* Allocate new route. */
        vrf_id = zvrf_id(zvrf);
        re = XCALLOC(MTYPE_RE, sizeof(struct route_entry));
@@ -1208,17 +1229,34 @@ static int zread_route_add(struct zserv *client, u_short length,
        else
                re->table = zvrf->table_id;
 
+       /*
+        * TBD should _all_ of the nexthop add operations use
+        * api_nh->vrf_id instead of re->vrf_id ? I only changed
+        * for cases NEXTHOP_TYPE_IPV4 and NEXTHOP_TYPE_IPV6.
+        */
        if (CHECK_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP)) {
                for (i = 0; i < api.nexthop_num; i++) {
                        api_nh = &api.nexthops[i];
                        ifindex_t ifindex = 0;
 
+                       if (IS_ZEBRA_DEBUG_RECV) {
+                               zlog_debug("nh type %d", api_nh->type);
+                       }
+
                        switch (api_nh->type) {
                        case NEXTHOP_TYPE_IFINDEX:
                                nexthop = route_entry_nexthop_ifindex_add(
                                        re, api_nh->ifindex, api_nh->vrf_id);
                                break;
                        case NEXTHOP_TYPE_IPV4:
+                               if (IS_ZEBRA_DEBUG_RECV) {
+                                       char nhbuf[INET6_ADDRSTRLEN] = {0};
+                                       inet_ntop(AF_INET, &api_nh->gate.ipv4,
+                                                 nhbuf, INET6_ADDRSTRLEN);
+                                       zlog_debug("%s: nh=%s, vrf_id=%d",
+                                                  __func__, nhbuf,
+                                                  api_nh->vrf_id);
+                               }
                                nexthop = route_entry_nexthop_ipv4_add(
                                        re, &api_nh->gate.ipv4, NULL,
                                        api_nh->vrf_id);
@@ -1235,6 +1273,15 @@ static int zread_route_add(struct zserv *client, u_short length,
                                        ifindex = api_nh->ifindex;
                                }
 
+                               if (IS_ZEBRA_DEBUG_RECV) {
+                                       char nhbuf[INET6_ADDRSTRLEN] = {0};
+                                       inet_ntop(AF_INET, &api_nh->gate.ipv4,
+                                                 nhbuf, INET6_ADDRSTRLEN);
+                                       zlog_debug(
+                                               "%s: nh=%s, vrf_id=%d (re->vrf_id=%d), ifindex=%d",
+                                               __func__, nhbuf, api_nh->vrf_id,
+                                               re->vrf_id, ifindex);
+                               }
                                nexthop = route_entry_nexthop_ipv4_ifindex_add(
                                        re, &api_nh->gate.ipv4, NULL, ifindex,
                                        api_nh->vrf_id);
@@ -1287,6 +1334,14 @@ static int zread_route_add(struct zserv *client, u_short length,
 
                                label_type =
                                        lsp_type_from_re_type(client->proto);
+
+                               if (IS_ZEBRA_DEBUG_RECV) {
+                                       zlog_debug(
+                                               "%s: adding %d labels of type %d (1st=%u)",
+                                               __func__, api_nh->label_num,
+                                               label_type, api_nh->labels[0]);
+                               }
+
                                nexthop_add_labels(nexthop, label_type,
                                                   api_nh->label_num,
                                                   &api_nh->labels[0]);