2003-07-15 Paul Jakma <paul@dishone.st>
* lib/version.h: add ZEBRA_URL (unused for now)
* lib/vty.c: CMD_ERR_NOTHING_TODO when reading conf file should not
be fatal. slight reformating.
* ospfd/ospf_zebra.c: ignore reject/blackhole routes if zebra sends
these type of routes. probably should be a new type of route to
allow daemons to more easily choose whether to redistribute them
- rathen than just a flag (eg for reject/blackhole).
reorder the is_prefix_default test for ZEBRA_IPV4_ROUTE_DELETE to
avoid the inverted test - slightly more readable.
* redhat/zebra.spec.in: Add ospfapi port to services file, if
with_ospfapi.
* zebra/rib.h: Change nexthop types to an enum.
* zebra/rt_netlink.c: run it through indent -nut.
Add nexthop_types_desc[] descriptive array for nexthop types.
(netlink_route_multipath) debug statements indicate which branch
they are in and print out nexthop type.
* zebra/zebra_rib.c: slight reformatting.
* zebra/zebra_vty.c: Pass ZEBRA_FLAG_BLACKHOLE flag to
static_add_ipv4() if Null0 route is configured. print out Null0 if
STATIC_IPV4_BLACKHOLE route, and ignore flags (shouldnt be
possible to set flags from vty) for config and show route.
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index 19ec3ae..ebb3694 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -136,7 +136,7 @@
return CMD_WARNING;
}
if (add_cmd)
- static_add_ipv4 (&p, NULL, NULL, 0, distance, 0);
+ static_add_ipv4 (&p, NULL, NULL, ZEBRA_FLAG_BLACKHOLE, distance, 0);
else
static_delete_ipv4 (&p, NULL, NULL, distance, 0);
return CMD_SUCCESS;
@@ -603,11 +603,9 @@
vty_out (vty, " directly connected, %s", nexthop->ifname);
break;
case NEXTHOP_TYPE_BLACKHOLE:
- vty_out (vty, " directly connected");
- if (!rib->flags)
- vty_out (vty, ", Null0");
+ vty_out (vty, " directly connected, Null0");
break;
- default:
+ default:
break;
}
if (! CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE))
@@ -688,11 +686,9 @@
vty_out (vty, " is directly connected, %s", nexthop->ifname);
break;
case NEXTHOP_TYPE_BLACKHOLE:
- vty_out (vty, " is directly connected");
- if (!rib->flags)
- vty_out (vty, ", Null0");
+ vty_out (vty, " is directly connected, Null0");
break;
- default:
+ default:
break;
}
if (! CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE))
@@ -1070,34 +1066,38 @@
for (rn = route_top (stable); rn; rn = route_next (rn))
for (si = rn->info; si; si = si->next)
{
- vty_out (vty, "ip route %s/%d", inet_ntoa (rn->p.u.prefix4),
- rn->p.prefixlen);
+ vty_out (vty, "ip route %s/%d", inet_ntoa (rn->p.u.prefix4),
+ rn->p.prefixlen);
- switch (si->type)
- {
- case STATIC_IPV4_GATEWAY:
- vty_out (vty, " %s", inet_ntoa (si->gate.ipv4));
- break;
- case STATIC_IPV4_IFNAME:
- vty_out (vty, " %s", si->gate.ifname);
- break;
- case STATIC_IPV4_BLACKHOLE:
- if (!si->flags)
- vty_out (vty, " Null0");
- break;
- }
+ switch (si->type)
+ {
+ case STATIC_IPV4_GATEWAY:
+ vty_out (vty, " %s", inet_ntoa (si->gate.ipv4));
+ break;
+ case STATIC_IPV4_IFNAME:
+ vty_out (vty, " %s", si->gate.ifname);
+ break;
+ case STATIC_IPV4_BLACKHOLE:
+ vty_out (vty, " Null0");
+ break;
+ }
+
+ /* flags are incompatible with STATIC_IPV4_BLACKHOLE */
+ if (si->type != STATIC_IPV4_BLACKHOLE)
+ {
+ if (CHECK_FLAG(si->flags, ZEBRA_FLAG_REJECT))
+ vty_out (vty, " %s", "reject");
- if (CHECK_FLAG(si->flags, ZEBRA_FLAG_REJECT))
- vty_out (vty, " %s", "reject");
+ if (CHECK_FLAG(si->flags, ZEBRA_FLAG_BLACKHOLE))
+ vty_out (vty, " %s", "blackhole");
+ }
- if (CHECK_FLAG(si->flags, ZEBRA_FLAG_BLACKHOLE))
- vty_out (vty, " %s", "blackhole");
+ if (si->distance != ZEBRA_STATIC_DISTANCE_DEFAULT)
+ vty_out (vty, " %d", si->distance);
- if (si->distance != ZEBRA_STATIC_DISTANCE_DEFAULT)
- vty_out (vty, " %d", si->distance);
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, "%s", VTY_NEWLINE);
- write = 1;
+ write = 1;
}
return write;
}