mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 03:27:25 +00:00
lib, zebra: carry blackhole type over ZAPI
Allow daemons to add blackholes of specific types (reject/drop.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
parent
e655a03c18
commit
94758e6681
@ -928,6 +928,7 @@ int zapi_route_encode(u_char cmd, struct stream *s, struct zapi_route *api)
|
|||||||
stream_putc(s, api_nh->type);
|
stream_putc(s, api_nh->type);
|
||||||
switch (api_nh->type) {
|
switch (api_nh->type) {
|
||||||
case NEXTHOP_TYPE_BLACKHOLE:
|
case NEXTHOP_TYPE_BLACKHOLE:
|
||||||
|
stream_putc(s, api_nh->bh_type);
|
||||||
break;
|
break;
|
||||||
case NEXTHOP_TYPE_IPV4:
|
case NEXTHOP_TYPE_IPV4:
|
||||||
stream_put_in_addr(s, &api_nh->gate.ipv4);
|
stream_put_in_addr(s, &api_nh->gate.ipv4);
|
||||||
@ -1040,6 +1041,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api)
|
|||||||
api_nh->type = stream_getc(s);
|
api_nh->type = stream_getc(s);
|
||||||
switch (api_nh->type) {
|
switch (api_nh->type) {
|
||||||
case NEXTHOP_TYPE_BLACKHOLE:
|
case NEXTHOP_TYPE_BLACKHOLE:
|
||||||
|
api_nh->bh_type = stream_getc(s);
|
||||||
break;
|
break;
|
||||||
case NEXTHOP_TYPE_IPV4:
|
case NEXTHOP_TYPE_IPV4:
|
||||||
api_nh->gate.ipv4.s_addr = stream_get_ipv4(s);
|
api_nh->gate.ipv4.s_addr = stream_get_ipv4(s);
|
||||||
|
@ -626,6 +626,7 @@ int zsend_redistribute_route(int cmd, struct zserv *client, struct prefix *p,
|
|||||||
api_nh->type = nexthop->type;
|
api_nh->type = nexthop->type;
|
||||||
switch (nexthop->type) {
|
switch (nexthop->type) {
|
||||||
case NEXTHOP_TYPE_BLACKHOLE:
|
case NEXTHOP_TYPE_BLACKHOLE:
|
||||||
|
api_nh->bh_type = nexthop->bh_type;
|
||||||
break;
|
break;
|
||||||
case NEXTHOP_TYPE_IPV4:
|
case NEXTHOP_TYPE_IPV4:
|
||||||
api_nh->gate.ipv4 = nexthop->gate.ipv4;
|
api_nh->gate.ipv4 = nexthop->gate.ipv4;
|
||||||
@ -1051,7 +1052,6 @@ static int zread_route_add(struct zserv *client, u_short length,
|
|||||||
struct route_entry *re;
|
struct route_entry *re;
|
||||||
struct nexthop *nexthop = NULL;
|
struct nexthop *nexthop = NULL;
|
||||||
int i, ret;
|
int i, ret;
|
||||||
enum blackhole_type bh_type = BLACKHOLE_NULL;
|
|
||||||
|
|
||||||
s = client->ibuf;
|
s = client->ibuf;
|
||||||
if (zapi_route_decode(s, &api) < 0)
|
if (zapi_route_decode(s, &api) < 0)
|
||||||
@ -1094,7 +1094,8 @@ static int zread_route_add(struct zserv *client, u_short length,
|
|||||||
api_nh->ifindex);
|
api_nh->ifindex);
|
||||||
break;
|
break;
|
||||||
case NEXTHOP_TYPE_BLACKHOLE:
|
case NEXTHOP_TYPE_BLACKHOLE:
|
||||||
route_entry_nexthop_blackhole_add(re, bh_type);
|
route_entry_nexthop_blackhole_add(re,
|
||||||
|
api_nh->bh_type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user