summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2010-02-05 06:05:39 +0100
committerDavid Lamparter <equinox@diac24.net>2010-02-05 06:05:39 +0100
commitbe8c228fad013d8488623dc6db46e28d4dfb72c2 (patch)
tree5fe0e8943cafeb3b663a0895e757f33b66c7851e /lib
parente473267ee96f48514b879f5dcaba2db64f0de9d1 (diff)
parent647e8e064d8e5316fc89587714a056b1240fa298 (diff)
downloadquagga-be8c228fad013d8488623dc6db46e28d4dfb72c2.tar.bz2
quagga-be8c228fad013d8488623dc6db46e28d4dfb72c2.tar.xz
Merge branch 'current' into dn42
Diffstat (limited to 'lib')
-rw-r--r--lib/zclient.c33
-rw-r--r--lib/zclient.h9
-rw-r--r--lib/zebra.h4
3 files changed, 27 insertions, 19 deletions
diff --git a/lib/zclient.c b/lib/zclient.c
index 0d531ce7..8be9d040 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -405,10 +405,10 @@ zclient_connect (struct thread *t)
* | IPv4 Nexthop address or Interface Index number |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
- * Alternatively, if the flags field has ZEBRA_FLAG_BLACKHOLE or
- * ZEBRA_FLAG_REJECT is set then Nexthop count is set to 1, then _no_
+ * Alternatively, if the route is a blackhole route (indicated to zapi
+ * by ZAPI_MESSAGE_BLACKHOLE), then Nexthop count is set to 1 and _no_
* nexthop information is provided, and the message describes a prefix
- * to blackhole or reject route.
+ * to blackhole route.
*
* If ZAPI_MESSAGE_DISTANCE is set, the distance value is written as a 1
* byte value.
@@ -424,8 +424,18 @@ zapi_ipv4_route (u_char cmd, struct zclient *zclient, struct prefix_ipv4 *p,
{
int i;
int psize;
+ int blackhole = 0;
struct stream *s;
+ /* blackhole routes are sent as containing a single nexthop
+ * of type blackhole. */
+ if (CHECK_FLAG (api->message, ZAPI_MESSAGE_BLACKHOLE))
+ {
+ blackhole = 1;
+ UNSET_FLAG (api->message, ZAPI_MESSAGE_BLACKHOLE);
+ SET_FLAG (api->message, ZAPI_MESSAGE_NEXTHOP);
+ }
+
/* Reset stream. */
s = zclient->obuf;
stream_reset (s);
@@ -443,17 +453,14 @@ zapi_ipv4_route (u_char cmd, struct zclient *zclient, struct prefix_ipv4 *p,
stream_write (s, (u_char *) & p->prefix, psize);
/* Nexthop, ifindex, distance and metric information. */
- if (CHECK_FLAG (api->message, ZAPI_MESSAGE_NEXTHOP))
+ if (blackhole)
{
- if (CHECK_FLAG (api->flags, ZEBRA_FLAG_BLACKHOLE))
- {
- stream_putc (s, 1);
- stream_putc (s, ZEBRA_NEXTHOP_BLACKHOLE);
- /* XXX assert(api->nexthop_num == 0); */
- /* XXX assert(api->ifindex_num == 0); */
- }
- else
- stream_putc (s, api->nexthop_num + api->ifindex_num);
+ stream_putc (s, 1);
+ stream_putc (s, ZEBRA_NEXTHOP_BLACKHOLE);
+ }
+ else if (CHECK_FLAG (api->message, ZAPI_MESSAGE_NEXTHOP))
+ {
+ stream_putc (s, api->nexthop_num + api->ifindex_num);
for (i = 0; i < api->nexthop_num; i++)
{
diff --git a/lib/zclient.h b/lib/zclient.h
index 6a63ffa4..7cce73f5 100644
--- a/lib/zclient.h
+++ b/lib/zclient.h
@@ -85,10 +85,11 @@ struct zclient
};
/* Zebra API message flag. */
-#define ZAPI_MESSAGE_NEXTHOP 0x01
-#define ZAPI_MESSAGE_IFINDEX 0x02
-#define ZAPI_MESSAGE_DISTANCE 0x04
-#define ZAPI_MESSAGE_METRIC 0x08
+#define ZAPI_MESSAGE_NEXTHOP 0x01
+#define ZAPI_MESSAGE_IFINDEX 0x02
+#define ZAPI_MESSAGE_DISTANCE 0x04
+#define ZAPI_MESSAGE_METRIC 0x08
+#define ZAPI_MESSAGE_BLACKHOLE 0x10 /* only for zapi_ipv4_route */
/* Zserv protocol message header */
struct zserv_header
diff --git a/lib/zebra.h b/lib/zebra.h
index 757a3757..63eb373a 100644
--- a/lib/zebra.h
+++ b/lib/zebra.h
@@ -469,12 +469,12 @@ extern const char *zserv_command_string (unsigned int command);
/* Zebra message flags */
#define ZEBRA_FLAG_INTERNAL 0x01
#define ZEBRA_FLAG_SELFROUTE 0x02
-#define ZEBRA_FLAG_BLACKHOLE 0x04
+/* 0x04 was: FLAG_BLACKHOLE */
#define ZEBRA_FLAG_IBGP 0x08
#define ZEBRA_FLAG_SELECTED 0x10
#define ZEBRA_FLAG_CHANGED 0x20
#define ZEBRA_FLAG_STATIC 0x40
-#define ZEBRA_FLAG_REJECT 0x80
+/* 0x80 was: FLAG_REJECT */
/* Zebra nexthop flags. */
#define ZEBRA_NEXTHOP_IFINDEX 1