diff options
Diffstat (limited to 'isisd/isis_zebra.c')
-rw-r--r-- | isisd/isis_zebra.c | 55 |
1 files changed, 35 insertions, 20 deletions
diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c index 1ba0100d..6d0c1571 100644 --- a/isisd/isis_zebra.c +++ b/isisd/isis_zebra.c @@ -32,6 +32,7 @@ #include "zclient.h" #include "stream.h" #include "linklist.h" +#include "vrf.h" #include "isisd/dict.h" #include "isisd/isis_constants.h" @@ -52,7 +53,7 @@ struct zclient *zclient = NULL; /* Router-id update message from zebra. */ static int isis_router_id_update_zebra (int command, struct zclient *zclient, - zebra_size_t length) + zebra_size_t length, vrf_id_t vrf_id) { struct isis_area *area; struct listnode *node; @@ -71,11 +72,12 @@ isis_router_id_update_zebra (int command, struct zclient *zclient, } static int -isis_zebra_if_add (int command, struct zclient *zclient, zebra_size_t length) +isis_zebra_if_add (int command, struct zclient *zclient, zebra_size_t length, + vrf_id_t vrf_id) { struct interface *ifp; - ifp = zebra_interface_add_read (zclient->ibuf); + ifp = zebra_interface_add_read (zclient->ibuf, vrf_id); if (isis->debugs & DEBUG_ZEBRA) zlog_debug ("Zebra I/F add: %s index %d flags %ld metric %d mtu %d", @@ -88,13 +90,14 @@ isis_zebra_if_add (int command, struct zclient *zclient, zebra_size_t length) } static int -isis_zebra_if_del (int command, struct zclient *zclient, zebra_size_t length) +isis_zebra_if_del (int command, struct zclient *zclient, zebra_size_t length, + vrf_id_t vrf_id) { struct interface *ifp; struct stream *s; s = zclient->ibuf; - ifp = zebra_interface_state_read (s); + ifp = zebra_interface_state_read (s, vrf_id); if (!ifp) return 0; @@ -120,11 +123,11 @@ isis_zebra_if_del (int command, struct zclient *zclient, zebra_size_t length) static int isis_zebra_if_state_up (int command, struct zclient *zclient, - zebra_size_t length) + zebra_size_t length, vrf_id_t vrf_id) { struct interface *ifp; - ifp = zebra_interface_state_read (zclient->ibuf); + ifp = zebra_interface_state_read (zclient->ibuf, vrf_id); if (ifp == NULL) return 0; @@ -136,12 +139,12 @@ isis_zebra_if_state_up (int command, struct zclient *zclient, static int isis_zebra_if_state_down (int command, struct zclient *zclient, - zebra_size_t length) + zebra_size_t length, vrf_id_t vrf_id) { struct interface *ifp; struct isis_circuit *circuit; - ifp = zebra_interface_state_read (zclient->ibuf); + ifp = zebra_interface_state_read (zclient->ibuf, vrf_id); if (ifp == NULL) return 0; @@ -156,14 +159,14 @@ isis_zebra_if_state_down (int command, struct zclient *zclient, static int isis_zebra_if_address_add (int command, struct zclient *zclient, - zebra_size_t length) + zebra_size_t length, vrf_id_t vrf_id) { struct connected *c; struct prefix *p; char buf[BUFSIZ]; c = zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_ADD, - zclient->ibuf); + zclient->ibuf, vrf_id); if (c == NULL) return 0; @@ -187,7 +190,7 @@ isis_zebra_if_address_add (int command, struct zclient *zclient, static int isis_zebra_if_address_del (int command, struct zclient *client, - zebra_size_t length) + zebra_size_t length, vrf_id_t vrf_id) { struct connected *c; struct interface *ifp; @@ -197,7 +200,7 @@ isis_zebra_if_address_del (int command, struct zclient *client, #endif /* EXTREME_DEBUG */ c = zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_DELETE, - zclient->ibuf); + zclient->ibuf, vrf_id); if (c == NULL) return 0; @@ -236,7 +239,7 @@ isis_zebra_route_add_ipv4 (struct prefix *prefix, if (CHECK_FLAG (route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED)) return; - if (zclient->redist[ZEBRA_ROUTE_ISIS]) + if (vrf_bitmap_check (zclient->redist[ZEBRA_ROUTE_ISIS], VRF_DEFAULT)) { message = 0; flags = 0; @@ -249,7 +252,7 @@ isis_zebra_route_add_ipv4 (struct prefix *prefix, stream = zclient->obuf; stream_reset (stream); - zclient_create_header (stream, ZEBRA_IPV4_ROUTE_ADD); + zclient_create_header (stream, ZEBRA_IPV4_ROUTE_ADD, VRF_DEFAULT); /* type */ stream_putc (stream, ZEBRA_ROUTE_ISIS); /* flags */ @@ -301,8 +304,9 @@ isis_zebra_route_del_ipv4 (struct prefix *prefix, struct zapi_ipv4 api; struct prefix_ipv4 prefix4; - if (zclient->redist[ZEBRA_ROUTE_ISIS]) + if (vrf_bitmap_check (zclient->redist[ZEBRA_ROUTE_ISIS], VRF_DEFAULT)) { + api.vrf_id = VRF_DEFAULT; api.type = ZEBRA_ROUTE_ISIS; api.flags = 0; api.message = 0; @@ -333,6 +337,7 @@ isis_zebra_route_add_ipv6 (struct prefix *prefix, if (CHECK_FLAG (route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED)) return; + api.vrf_id = VRF_DEFAULT; api.type = ZEBRA_ROUTE_ISIS; api.flags = 0; api.message = 0; @@ -418,6 +423,7 @@ isis_zebra_route_del_ipv6 (struct prefix *prefix, if (CHECK_FLAG (route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED)) return; + api.vrf_id = VRF_DEFAULT; api.type = ZEBRA_ROUTE_ISIS; api.flags = 0; api.message = 0; @@ -488,7 +494,7 @@ isis_zebra_route_update (struct prefix *prefix, if (zclient->sock < 0) return; - if (!zclient->redist[ZEBRA_ROUTE_ISIS]) + if (!vrf_bitmap_check (zclient->redist[ZEBRA_ROUTE_ISIS], VRF_DEFAULT)) return; if (CHECK_FLAG (route_info->flag, ISIS_ROUTE_FLAG_ACTIVE)) @@ -514,7 +520,7 @@ isis_zebra_route_update (struct prefix *prefix, static int isis_zebra_read_ipv4 (int command, struct zclient *zclient, - zebra_size_t length) + zebra_size_t length, vrf_id_t vrf_id) { struct stream *stream; struct zapi_ipv4 api; @@ -563,14 +569,16 @@ isis_zebra_read_ipv4 (int command, struct zclient *zclient, #ifdef HAVE_IPV6 static int isis_zebra_read_ipv6 (int command, struct zclient *zclient, - zebra_size_t length) + zebra_size_t length, vrf_id_t vrf_id) { return 0; } #endif #define ISIS_TYPE_IS_REDISTRIBUTED(T) \ -T == ZEBRA_ROUTE_MAX ? zclient->default_information : zclient->redist[type] +T == ZEBRA_ROUTE_MAX ? \ + vrf_bitmap_check (zclient->default_information, VRF_DEFAULT) : \ + vrf_bitmap_check (zclient->redist[type], VRF_DEFAULT) int isis_distribute_list_update (int routetype) @@ -587,11 +595,18 @@ isis_redistribute_default_set (int routetype, int metric_type, } #endif /* 0 */ +static void +isis_zebra_connected (struct zclient *zclient) +{ + zclient_send_requests (zclient, VRF_DEFAULT); +} + void isis_zebra_init () { zclient = zclient_new (); zclient_init (zclient, ZEBRA_ROUTE_ISIS); + zclient->zebra_connected = isis_zebra_connected; zclient->router_id_update = isis_router_id_update_zebra; zclient->interface_add = isis_zebra_if_add; zclient->interface_delete = isis_zebra_if_del; |