summaryrefslogtreecommitdiff
path: root/zebra/zserv.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zserv.c')
-rw-r--r--zebra/zserv.c86
1 files changed, 72 insertions, 14 deletions
diff --git a/zebra/zserv.c b/zebra/zserv.c
index 0def903803..57b1be4b8b 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -597,6 +597,17 @@ int zsend_redistribute_route(int cmd, struct zserv *client, struct prefix *p,
/* Encode route and send. */
if (zapi_route_encode(cmd, s, &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, s);
}
@@ -663,9 +674,9 @@ int zsend_route_notify_owner(struct route_entry *re, struct prefix *p,
char buff[PREFIX_STRLEN];
zlog_debug(
- "Not Notifying Owner: %u about prefix %s(%u) %d",
+ "Not Notifying Owner: %u about prefix %s(%u) %d vrf: %u",
re->type, prefix2str(p, buff, sizeof(buff)),
- re->table, note);
+ re->table, note, re->vrf_id);
}
return 0;
}
@@ -673,9 +684,9 @@ int zsend_route_notify_owner(struct route_entry *re, struct prefix *p,
if (IS_ZEBRA_DEBUG_PACKET) {
char buff[PREFIX_STRLEN];
- zlog_debug("Notifying Owner: %u about prefix %s(%u) %d",
+ zlog_debug("Notifying Owner: %u about prefix %s(%u) %d vrf: %u",
re->type, prefix2str(p, buff, sizeof(buff)),
- re->table, note);
+ re->table, note, re->vrf_id);
}
s = stream_new(ZEBRA_MAX_PACKET_SIZ);
@@ -849,9 +860,10 @@ static void zread_rnh_register(ZAPI_HANDLER_ARGS)
if (IS_ZEBRA_DEBUG_NHT)
zlog_debug(
- "rnh_register msg from client %s: hdr->length=%d, type=%s\n",
+ "rnh_register msg from client %s: hdr->length=%d, type=%s vrf=%u\n",
zebra_route_string(client->proto), hdr->length,
- (type == RNH_NEXTHOP_TYPE) ? "nexthop" : "route");
+ (type == RNH_NEXTHOP_TYPE) ? "nexthop" : "route",
+ zvrf->vrf->vrf_id);
s = msg;
@@ -924,8 +936,9 @@ static void zread_rnh_unregister(ZAPI_HANDLER_ARGS)
if (IS_ZEBRA_DEBUG_NHT)
zlog_debug(
- "rnh_unregister msg from client %s: hdr->length=%d\n",
- zebra_route_string(client->proto), hdr->length);
+ "rnh_unregister msg from client %s: hdr->length=%d vrf: %u\n",
+ zebra_route_string(client->proto), hdr->length,
+ zvrf->vrf->vrf_id);
s = msg;
@@ -1149,6 +1162,16 @@ static void zread_route_add(ZAPI_HANDLER_ARGS)
s = msg;
zapi_route_decode(s, &api);
+ 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));
@@ -1162,17 +1185,34 @@ static void zread_route_add(ZAPI_HANDLER_ARGS)
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);
@@ -1187,6 +1227,15 @@ static void zread_route_add(ZAPI_HANDLER_ARGS)
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);
@@ -1265,6 +1314,14 @@ static void zread_route_add(ZAPI_HANDLER_ARGS)
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]);
@@ -1997,8 +2054,9 @@ static void zread_hello(ZAPI_HANDLER_ARGS)
/* accept only dynamic routing protocols */
if ((proto < ZEBRA_ROUTE_MAX) && (proto > ZEBRA_ROUTE_STATIC)) {
zlog_notice(
- "client %d says hello and bids fair to announce only %s routes",
- client->sock, zebra_route_string(proto));
+ "client %d says hello and bids fair to announce only %s routes vrf=%u",
+ client->sock, zebra_route_string(proto),
+ zvrf->vrf->vrf_id);
if (instance)
zlog_notice("client protocol instance %d", instance);
@@ -2130,8 +2188,8 @@ static void zread_label_manager_connect(struct zserv *client,
zsend_label_manager_connect_response(client, vrf_id, 1);
return;
}
- zlog_notice("client %d with instance %u connected as %s", client->sock,
- instance, zebra_route_string(proto));
+ zlog_notice("client %d with vrf %u instance %u connected as %s",
+ client->sock, vrf_id, instance, zebra_route_string(proto));
client->proto = proto;
client->instance = instance;
@@ -2142,8 +2200,8 @@ static void zread_label_manager_connect(struct zserv *client,
release_daemon_chunks(proto, instance);
zlog_debug(
- " Label Manager client connected: sock %d, proto %s, instance %u",
- client->sock, zebra_route_string(proto), instance);
+ " Label Manager client connected: sock %d, proto %s, vrf %u instance %u",
+ client->sock, zebra_route_string(proto), vrf_id, instance);
/* send response back */
zsend_label_manager_connect_response(client, vrf_id, 0);