Now usage of `-r -f` with fpm_listener now causes all
routes to be rejected.
r1# sharp install routes 10.0.0.0 nexthop 192.168.44.5 5
r1# show ip route
Codes: K - kernel route, C - connected, L - local, S - static,
R - RIP, O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
F - PBR, f - OpenFabric, t - Table-Direct,
> - selected route, * - FIB route, q - queued, r - rejected, b - backup
t - trapped, o - offload failure
IPv4 unicast VRF default:
D>o 10.0.0.0/32 [150/0] via 192.168.44.5, r1-eth0, weight 1, 00:00:02
D>o 10.0.0.1/32 [150/0] via 192.168.44.5, r1-eth0, weight 1, 00:00:02
D>o 10.0.0.2/32 [150/0] via 192.168.44.5, r1-eth0, weight 1, 00:00:02
D>o 10.0.0.3/32 [150/0] via 192.168.44.5, r1-eth0, weight 1, 00:00:02
D>o 10.0.0.4/32 [150/0] via 192.168.44.5, r1-eth0, weight 1, 00:00:02
C>* 192.168.44.0/24 is directly connected, r1-eth0, weight 1, 00:00:37
L>* 192.168.44.1/32 is directly connected, r1-eth0, weight 1, 00:00:37
r1#
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
int server_sock;
int sock;
bool reflect;
+ bool reflect_fail_all;
bool dump_hex;
FILE *output_file;
};
if (glob->reflect && hdr->nlmsg_type == RTM_NEWROUTE &&
ctx->rtmsg->rtm_protocol > RTPROT_STATIC) {
- fprintf(glob->output_file, " Route %s(%u) reflecting back\n",
+ fprintf(glob->output_file, " Route %s(%u) reflecting back as %s\n",
netlink_prot_to_s(ctx->rtmsg->rtm_protocol),
- ctx->rtmsg->rtm_protocol);
- ctx->rtmsg->rtm_flags |= RTM_F_OFFLOAD;
+ ctx->rtmsg->rtm_protocol,
+ glob->reflect_fail_all ? "Offload Failed" : "Offloaded");
+ if (glob->reflect_fail_all)
+ ctx->rtmsg->rtm_flags |= RTM_F_OFFLOAD_FAILED;
+ else
+ ctx->rtmsg->rtm_flags |= RTM_F_OFFLOAD;
write(glob->sock, fpm, fpm_msg_len(fpm));
}
break;
memset(glob, 0, sizeof(*glob));
glob->output_file = stdout;
- while ((r = getopt(argc, argv, "rdvo:")) != -1) {
+ while ((r = getopt(argc, argv, "rfdvo:")) != -1) {
switch (r) {
case 'r':
glob->reflect = true;
break;
+ case 'f':
+ glob->reflect_fail_all = true;
+ break;
case 'd':
fork_daemon = true;
break;