]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib, zebra: carry blackhole type over ZAPI 1060/head
authorDavid Lamparter <equinox@opensourcerouting.org>
Mon, 28 Aug 2017 04:01:13 +0000 (06:01 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Mon, 28 Aug 2017 04:03:36 +0000 (06:03 +0200)
Allow daemons to add blackholes of specific types (reject/drop.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/zclient.c
zebra/zserv.c

index 992b2549398257e820493d0774057e4d3dcab242..910e05cb47f8ee1ab8cffdd5123ab0dabe65145e 100644 (file)
@@ -928,6 +928,7 @@ int zapi_route_encode(u_char cmd, struct stream *s, struct zapi_route *api)
                        stream_putc(s, api_nh->type);
                        switch (api_nh->type) {
                        case NEXTHOP_TYPE_BLACKHOLE:
+                               stream_putc(s, api_nh->bh_type);
                                break;
                        case NEXTHOP_TYPE_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);
                        switch (api_nh->type) {
                        case NEXTHOP_TYPE_BLACKHOLE:
+                               api_nh->bh_type = stream_getc(s);
                                break;
                        case NEXTHOP_TYPE_IPV4:
                                api_nh->gate.ipv4.s_addr = stream_get_ipv4(s);
index 46dfe378182a4c3c431f16574ad88aca1f951ea2..d60c8c93689ca5f18851bc72dae492c900e89665 100644 (file)
@@ -626,6 +626,7 @@ int zsend_redistribute_route(int cmd, struct zserv *client, struct prefix *p,
                api_nh->type = nexthop->type;
                switch (nexthop->type) {
                case NEXTHOP_TYPE_BLACKHOLE:
+                       api_nh->bh_type = nexthop->bh_type;
                        break;
                case NEXTHOP_TYPE_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 nexthop *nexthop = NULL;
        int i, ret;
-       enum blackhole_type bh_type = BLACKHOLE_NULL;
 
        s = client->ibuf;
        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);
                                break;
                        case NEXTHOP_TYPE_BLACKHOLE:
-                               route_entry_nexthop_blackhole_add(re, bh_type);
+                               route_entry_nexthop_blackhole_add(re,
+                                       api_nh->bh_type);
                                break;
                        }