mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-27 11:19:13 +00:00
Merge pull request #3781 from donaldsharp/pbr_debug
pbrd: Add some missing debugs from external events
This commit is contained in:
commit
7e737f3d40
@ -409,7 +409,8 @@ void pbr_map_schedule_policy_from_nhg(const char *nh_group)
|
|||||||
pbrm->name);
|
pbrm->name);
|
||||||
for (ALL_LIST_ELEMENTS_RO(pbrm->seqnumbers, node, pbrms)) {
|
for (ALL_LIST_ELEMENTS_RO(pbrm->seqnumbers, node, pbrms)) {
|
||||||
DEBUGD(&pbr_dbg_map, "\tNH Grp name: %s",
|
DEBUGD(&pbr_dbg_map, "\tNH Grp name: %s",
|
||||||
pbrms->nhgrp_name ? pbrms->nhgrp_name : "NULL");
|
pbrms->nhgrp_name ?
|
||||||
|
pbrms->nhgrp_name : pbrms->internal_nhg_name);
|
||||||
|
|
||||||
if (pbrms->nhgrp_name
|
if (pbrms->nhgrp_name
|
||||||
&& (strcmp(nh_group, pbrms->nhgrp_name) == 0)) {
|
&& (strcmp(nh_group, pbrms->nhgrp_name) == 0)) {
|
||||||
@ -526,12 +527,9 @@ void pbr_map_check(struct pbr_map_sequence *pbrms)
|
|||||||
DEBUGD(&pbr_dbg_map, "%s: for %s(%u)", __PRETTY_FUNCTION__,
|
DEBUGD(&pbr_dbg_map, "%s: for %s(%u)", __PRETTY_FUNCTION__,
|
||||||
pbrm->name, pbrms->seqno);
|
pbrm->name, pbrms->seqno);
|
||||||
if (pbr_map_check_valid(pbrm->name))
|
if (pbr_map_check_valid(pbrm->name))
|
||||||
DEBUGD(&pbr_dbg_map, "We are totally valid %s\n",
|
DEBUGD(&pbr_dbg_map, "We are totally valid %s",
|
||||||
pbrm->name);
|
pbrm->name);
|
||||||
|
|
||||||
DEBUGD(&pbr_dbg_map, "%s: Installing %s(%u) reason: %" PRIu64,
|
|
||||||
__PRETTY_FUNCTION__, pbrm->name, pbrms->seqno, pbrms->reason);
|
|
||||||
|
|
||||||
if (pbrms->reason == PBR_MAP_VALID_SEQUENCE_NUMBER) {
|
if (pbrms->reason == PBR_MAP_VALID_SEQUENCE_NUMBER) {
|
||||||
install = true;
|
install = true;
|
||||||
DEBUGD(&pbr_dbg_map, "%s: Installing %s(%u) reason: %" PRIu64,
|
DEBUGD(&pbr_dbg_map, "%s: Installing %s(%u) reason: %" PRIu64,
|
||||||
|
@ -69,6 +69,9 @@ static int interface_add(int command, struct zclient *zclient,
|
|||||||
if (!ifp)
|
if (!ifp)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
DEBUGD(&pbr_dbg_zebra,
|
||||||
|
"%s: %s", __PRETTY_FUNCTION__, ifp->name);
|
||||||
|
|
||||||
if (!ifp->info)
|
if (!ifp->info)
|
||||||
pbr_if_new(ifp);
|
pbr_if_new(ifp);
|
||||||
|
|
||||||
@ -89,6 +92,9 @@ static int interface_delete(int command, struct zclient *zclient,
|
|||||||
if (ifp == NULL)
|
if (ifp == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
DEBUGD(&pbr_dbg_zebra,
|
||||||
|
"%s: %s", __PRETTY_FUNCTION__, ifp->name);
|
||||||
|
|
||||||
if_set_index(ifp, IFINDEX_INTERNAL);
|
if_set_index(ifp, IFINDEX_INTERNAL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -97,7 +103,14 @@ static int interface_delete(int command, struct zclient *zclient,
|
|||||||
static int interface_address_add(int command, struct zclient *zclient,
|
static int interface_address_add(int command, struct zclient *zclient,
|
||||||
zebra_size_t length, vrf_id_t vrf_id)
|
zebra_size_t length, vrf_id_t vrf_id)
|
||||||
{
|
{
|
||||||
zebra_interface_address_read(command, zclient->ibuf, vrf_id);
|
struct connected *c;
|
||||||
|
char buf[PREFIX_STRLEN];
|
||||||
|
|
||||||
|
c = zebra_interface_address_read(command, zclient->ibuf, vrf_id);
|
||||||
|
|
||||||
|
DEBUGD(&pbr_dbg_zebra,
|
||||||
|
"%s: %s added %s", __PRETTY_FUNCTION__, c->ifp->name,
|
||||||
|
prefix2str(c->address, buf, sizeof(buf)));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -106,12 +119,17 @@ static int interface_address_delete(int command, struct zclient *zclient,
|
|||||||
zebra_size_t length, vrf_id_t vrf_id)
|
zebra_size_t length, vrf_id_t vrf_id)
|
||||||
{
|
{
|
||||||
struct connected *c;
|
struct connected *c;
|
||||||
|
char buf[PREFIX_STRLEN];
|
||||||
|
|
||||||
c = zebra_interface_address_read(command, zclient->ibuf, vrf_id);
|
c = zebra_interface_address_read(command, zclient->ibuf, vrf_id);
|
||||||
|
|
||||||
if (!c)
|
if (!c)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
DEBUGD(&pbr_dbg_zebra,
|
||||||
|
"%s: %s deleted %s", __PRETTY_FUNCTION__, c->ifp->name,
|
||||||
|
prefix2str(c->address, buf, sizeof(buf)));
|
||||||
|
|
||||||
connected_free(c);
|
connected_free(c);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -119,8 +137,12 @@ static int interface_address_delete(int command, struct zclient *zclient,
|
|||||||
static int interface_state_up(int command, struct zclient *zclient,
|
static int interface_state_up(int command, struct zclient *zclient,
|
||||||
zebra_size_t length, vrf_id_t vrf_id)
|
zebra_size_t length, vrf_id_t vrf_id)
|
||||||
{
|
{
|
||||||
|
struct interface *ifp;
|
||||||
|
|
||||||
zebra_interface_state_read(zclient->ibuf, vrf_id);
|
ifp = zebra_interface_state_read(zclient->ibuf, vrf_id);
|
||||||
|
|
||||||
|
DEBUGD(&pbr_dbg_zebra,
|
||||||
|
"%s: %s is up", __PRETTY_FUNCTION__, ifp->name);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -128,8 +150,12 @@ static int interface_state_up(int command, struct zclient *zclient,
|
|||||||
static int interface_state_down(int command, struct zclient *zclient,
|
static int interface_state_down(int command, struct zclient *zclient,
|
||||||
zebra_size_t length, vrf_id_t vrf_id)
|
zebra_size_t length, vrf_id_t vrf_id)
|
||||||
{
|
{
|
||||||
|
struct interface *ifp;
|
||||||
|
|
||||||
zebra_interface_state_read(zclient->ibuf, vrf_id);
|
ifp = zebra_interface_state_read(zclient->ibuf, vrf_id);
|
||||||
|
|
||||||
|
DEBUGD(&pbr_dbg_zebra,
|
||||||
|
"%s: %s is down", __PRETTY_FUNCTION__, ifp->name);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -142,11 +168,11 @@ static int route_notify_owner(int command, struct zclient *zclient,
|
|||||||
uint32_t table_id;
|
uint32_t table_id;
|
||||||
char buf[PREFIX_STRLEN];
|
char buf[PREFIX_STRLEN];
|
||||||
|
|
||||||
prefix2str(&p, buf, sizeof(buf));
|
|
||||||
|
|
||||||
if (!zapi_route_notify_decode(zclient->ibuf, &p, &table_id, ¬e))
|
if (!zapi_route_notify_decode(zclient->ibuf, &p, &table_id, ¬e))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
prefix2str(&p, buf, sizeof(buf));
|
||||||
|
|
||||||
switch (note) {
|
switch (note) {
|
||||||
case ZAPI_ROUTE_FAIL_INSTALL:
|
case ZAPI_ROUTE_FAIL_INSTALL:
|
||||||
DEBUGD(&pbr_dbg_zebra,
|
DEBUGD(&pbr_dbg_zebra,
|
||||||
@ -207,20 +233,20 @@ static int rule_notify_owner(int command, struct zclient *zclient,
|
|||||||
|
|
||||||
switch (note) {
|
switch (note) {
|
||||||
case ZAPI_RULE_FAIL_INSTALL:
|
case ZAPI_RULE_FAIL_INSTALL:
|
||||||
DEBUGD(&pbr_dbg_zebra, "%s: Received RULE_FAIL_INSTALL",
|
|
||||||
__PRETTY_FUNCTION__);
|
|
||||||
pbrms->installed &= ~installed;
|
pbrms->installed &= ~installed;
|
||||||
|
DEBUGD(&pbr_dbg_zebra, "%s: Received RULE_FAIL_INSTALL: %lu",
|
||||||
|
__PRETTY_FUNCTION__, pbrms->installed);
|
||||||
break;
|
break;
|
||||||
case ZAPI_RULE_INSTALLED:
|
case ZAPI_RULE_INSTALLED:
|
||||||
pbrms->installed |= installed;
|
pbrms->installed |= installed;
|
||||||
DEBUGD(&pbr_dbg_zebra, "%s: Received RULE_INSTALLED",
|
DEBUGD(&pbr_dbg_zebra, "%s: Received RULE_INSTALLED: %lu",
|
||||||
__PRETTY_FUNCTION__);
|
__PRETTY_FUNCTION__, pbrms->installed);
|
||||||
break;
|
break;
|
||||||
case ZAPI_RULE_FAIL_REMOVE:
|
case ZAPI_RULE_FAIL_REMOVE:
|
||||||
case ZAPI_RULE_REMOVED:
|
case ZAPI_RULE_REMOVED:
|
||||||
pbrms->installed &= ~installed;
|
pbrms->installed &= ~installed;
|
||||||
DEBUGD(&pbr_dbg_zebra, "%s: Received RULE REMOVED",
|
DEBUGD(&pbr_dbg_zebra, "%s: Received RULE REMOVED: %lu",
|
||||||
__PRETTY_FUNCTION__);
|
__PRETTY_FUNCTION__, pbrms->installed);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,6 +255,8 @@ static int rule_notify_owner(int command, struct zclient *zclient,
|
|||||||
|
|
||||||
static void zebra_connected(struct zclient *zclient)
|
static void zebra_connected(struct zclient *zclient)
|
||||||
{
|
{
|
||||||
|
DEBUGD(&pbr_dbg_zebra, "%s: Registering for fun and profit",
|
||||||
|
__PRETTY_FUNCTION__);
|
||||||
zclient_send_reg_requests(zclient, VRF_DEFAULT);
|
zclient_send_reg_requests(zclient, VRF_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,11 +264,15 @@ static void route_add_helper(struct zapi_route *api, struct nexthop_group nhg,
|
|||||||
uint8_t install_afi)
|
uint8_t install_afi)
|
||||||
{
|
{
|
||||||
struct zapi_nexthop *api_nh;
|
struct zapi_nexthop *api_nh;
|
||||||
|
char buf[PREFIX_STRLEN];
|
||||||
struct nexthop *nhop;
|
struct nexthop *nhop;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
api->prefix.family = install_afi;
|
api->prefix.family = install_afi;
|
||||||
|
|
||||||
|
DEBUGD(&pbr_dbg_zebra, "\tEncoding %s",
|
||||||
|
prefix2str(&api->prefix, buf, sizeof(buf)));
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
for (ALL_NEXTHOPS(nhg, nhop)) {
|
for (ALL_NEXTHOPS(nhg, nhop)) {
|
||||||
api_nh = &api->nexthops[i];
|
api_nh = &api->nexthops[i];
|
||||||
@ -284,6 +316,9 @@ void route_add(struct pbr_nexthop_group_cache *pnhgc, struct nexthop_group nhg,
|
|||||||
{
|
{
|
||||||
struct zapi_route api;
|
struct zapi_route api;
|
||||||
|
|
||||||
|
DEBUGD(&pbr_dbg_zebra, "%s for Table: %d", __PRETTY_FUNCTION__,
|
||||||
|
pnhgc->table_id);
|
||||||
|
|
||||||
memset(&api, 0, sizeof(api));
|
memset(&api, 0, sizeof(api));
|
||||||
|
|
||||||
api.vrf_id = VRF_DEFAULT;
|
api.vrf_id = VRF_DEFAULT;
|
||||||
@ -323,6 +358,9 @@ void route_delete(struct pbr_nexthop_group_cache *pnhgc, afi_t afi)
|
|||||||
{
|
{
|
||||||
struct zapi_route api;
|
struct zapi_route api;
|
||||||
|
|
||||||
|
DEBUGD(&pbr_dbg_zebra, "%s for Table: %d", __PRETTY_FUNCTION__,
|
||||||
|
pnhgc->table_id);
|
||||||
|
|
||||||
memset(&api, 0, sizeof(api));
|
memset(&api, 0, sizeof(api));
|
||||||
api.vrf_id = VRF_DEFAULT;
|
api.vrf_id = VRF_DEFAULT;
|
||||||
api.type = ZEBRA_ROUTE_PBR;
|
api.type = ZEBRA_ROUTE_PBR;
|
||||||
|
Loading…
Reference in New Issue
Block a user