mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-11 20:48:27 +00:00
lib, zebra: Add ability to read kernel notice of TRAP/OFFLOAD
The linux kernel is getting RTM_F_TRAP and RTM_F_OFFLOAD for kernel routes that have an underlying asic offload. Write the code to receive these notifications from the linux kernel and to store that data for display about the routes. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
4c56ce1cea
commit
5a3cf85391
@ -121,7 +121,10 @@ sub codelist {
|
||||
}
|
||||
$str =~ s/ $//;
|
||||
push @lines, $str . "\\n\" \\\n";
|
||||
push @lines, " \" > - selected route, * - FIB route, q - queued, r - rejected, b - backup\\n\\n\"";
|
||||
push @lines, " \" > - selected route, * - FIB route, q - queued, r - rejected, b - backup\\n\"";
|
||||
push @lines, " \" t - trapped, o - offload failure\\n\"";
|
||||
|
||||
|
||||
return join("", @lines);
|
||||
}
|
||||
|
||||
|
@ -480,6 +480,20 @@ struct zapi_route {
|
||||
* route entry. This mainly is used for backup static routes.
|
||||
*/
|
||||
#define ZEBRA_FLAG_RR_USE_DISTANCE 0x40
|
||||
/*
|
||||
* This flag tells everyone that the route was intentionally
|
||||
* not offloaded and the route will be sent to the cpu for
|
||||
* forwarding. This flag makes no sense unless you are in
|
||||
* an asic offload situation
|
||||
*/
|
||||
#define ZEBRA_FLAG_TRAPPED 0x80
|
||||
/*
|
||||
* This flag tells everyone that the route has been
|
||||
* successfully offloaded to an asic for forwarding.
|
||||
* This flag makes no sense unless you are in an asic
|
||||
* offload situation.
|
||||
*/
|
||||
#define ZEBRA_FLAG_OFFLOADED 0x100
|
||||
|
||||
/* The older XXX_MESSAGE flags live here */
|
||||
uint32_t message;
|
||||
|
@ -628,7 +628,7 @@ def ip4_route_zebra(node, vrf_name=None):
|
||||
lines = output.splitlines()
|
||||
header_found = False
|
||||
while lines and (not lines[0].strip() or not header_found):
|
||||
if "> - selected route" in lines[0]:
|
||||
if "o - offload failure" in lines[0]:
|
||||
header_found = True
|
||||
lines = lines[1:]
|
||||
return "\n".join(lines)
|
||||
@ -654,7 +654,7 @@ def ip6_route_zebra(node, vrf_name=None):
|
||||
lines = output.splitlines()
|
||||
header_found = False
|
||||
while lines and (not lines[0].strip() or not header_found):
|
||||
if "> - selected route" in lines[0]:
|
||||
if "o - offload failure" in lines[0]:
|
||||
header_found = True
|
||||
lines = lines[1:]
|
||||
|
||||
|
@ -643,6 +643,11 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (rtm->rtm_flags & RTM_F_TRAP)
|
||||
flags |= ZEBRA_FLAG_TRAPPED;
|
||||
if (rtm->rtm_flags & RTM_F_OFFLOAD)
|
||||
flags |= ZEBRA_FLAG_OFFLOADED;
|
||||
|
||||
/* Route which inserted by Zebra. */
|
||||
if (selfroute) {
|
||||
flags |= ZEBRA_FLAG_SELFROUTE;
|
||||
|
@ -192,6 +192,14 @@ static char re_status_output_char(const struct route_entry *re,
|
||||
star_p = true;
|
||||
}
|
||||
|
||||
if (zrouter.asic_offloaded
|
||||
&& CHECK_FLAG(re->flags, ZEBRA_FLAG_TRAPPED))
|
||||
return 't';
|
||||
|
||||
if (zrouter.asic_offloaded
|
||||
&& !CHECK_FLAG(re->flags, ZEBRA_FLAG_OFFLOADED))
|
||||
return 'o';
|
||||
|
||||
if (star_p)
|
||||
return '*';
|
||||
else
|
||||
@ -862,6 +870,12 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn,
|
||||
if (CHECK_FLAG(re->status, ROUTE_ENTRY_QUEUED))
|
||||
json_object_boolean_true_add(json_route, "queued");
|
||||
|
||||
if (CHECK_FLAG(re->flags, ZEBRA_FLAG_TRAPPED))
|
||||
json_object_boolean_true_add(json_route, "trapped");
|
||||
|
||||
if (CHECK_FLAG(re->flags, ZEBRA_FLAG_OFFLOADED))
|
||||
json_object_boolean_true_add(json_route, "offloaded");
|
||||
|
||||
if (re->tag)
|
||||
json_object_int_add(json_route, "tag", re->tag);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user