1 /* Redistribution Handler
2 * Copyright (C) 1998 Kunihiro Ishiguro
4 * This file is part of GNU Zebra.
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
33 #include "srcdest_table.h"
35 #include "zebra/rib.h"
36 #include "zebra/zebra_router.h"
37 #include "zebra/zebra_ns.h"
38 #include "zebra/zebra_vrf.h"
39 #include "zebra/zebra_routemap.h"
40 #include "zebra/redistribute.h"
41 #include "zebra/debug.h"
42 #include "zebra/router-id.h"
43 #include "zebra/zapi_msg.h"
44 #include "zebra/zebra_memory.h"
45 #include "zebra/zebra_vxlan.h"
46 #include "zebra/zebra_errors.h"
48 #define ZEBRA_PTM_SUPPORT
50 /* array holding redistribute info about table redistribution */
51 /* bit AFI is set if that AFI is redistributing routes from this table */
52 static int zebra_import_table_used
[AFI_MAX
][ZEBRA_KERNEL_TABLE_MAX
];
53 static uint32_t zebra_import_table_distance
[AFI_MAX
][ZEBRA_KERNEL_TABLE_MAX
];
55 int is_zebra_import_table_enabled(afi_t afi
, uint32_t table_id
)
58 * Make sure that what we are called with actualy makes sense
63 if (is_zebra_valid_kernel_table(table_id
) &&
64 table_id
< ZEBRA_KERNEL_TABLE_MAX
)
65 return zebra_import_table_used
[afi
][table_id
];
69 static void zebra_redistribute_default(struct zserv
*client
, vrf_id_t vrf_id
)
73 struct route_table
*table
;
74 struct route_node
*rn
;
75 struct route_entry
*newre
;
77 for (afi
= AFI_IP
; afi
<= AFI_IP6
; afi
++) {
79 table
= zebra_vrf_table(afi
, SAFI_UNICAST
, vrf_id
);
83 /* Lookup default route. */
84 memset(&p
, 0, sizeof(p
));
85 p
.family
= afi2family(afi
);
86 rn
= route_node_lookup(table
, &p
);
90 RNODE_FOREACH_RE (rn
, newre
) {
91 if (CHECK_FLAG(newre
->flags
, ZEBRA_FLAG_SELECTED
)
92 && newre
->distance
!= DISTANCE_INFINITY
)
93 zsend_redistribute_route(
94 ZEBRA_REDISTRIBUTE_ROUTE_ADD
, client
,
98 route_unlock_node(rn
);
102 /* Redistribute routes. */
103 static void zebra_redistribute(struct zserv
*client
, int type
,
104 unsigned short instance
, vrf_id_t vrf_id
,
107 struct route_entry
*newre
;
108 struct route_table
*table
;
109 struct route_node
*rn
;
111 table
= zebra_vrf_table(afi
, SAFI_UNICAST
, vrf_id
);
115 for (rn
= route_top(table
); rn
; rn
= srcdest_route_next(rn
))
116 RNODE_FOREACH_RE (rn
, newre
) {
117 const struct prefix
*dst_p
, *src_p
;
118 char buf
[PREFIX_STRLEN
];
120 srcdest_rnode_prefixes(rn
, &dst_p
, &src_p
);
122 if (IS_ZEBRA_DEBUG_EVENT
)
124 "%s: client %s %s(%u) checking: selected=%d, type=%d, distance=%d, metric=%d zebra_check_addr=%d",
126 zebra_route_string(client
->proto
),
127 prefix2str(dst_p
, buf
, sizeof(buf
)),
128 vrf_id
, CHECK_FLAG(newre
->flags
,
129 ZEBRA_FLAG_SELECTED
),
130 newre
->type
, newre
->distance
,
131 newre
->metric
, zebra_check_addr(dst_p
));
133 if (!CHECK_FLAG(newre
->flags
, ZEBRA_FLAG_SELECTED
))
135 if ((type
!= ZEBRA_ROUTE_ALL
136 && (newre
->type
!= type
137 || newre
->instance
!= instance
)))
139 if (newre
->distance
== DISTANCE_INFINITY
)
141 if (!zebra_check_addr(dst_p
))
144 zsend_redistribute_route(ZEBRA_REDISTRIBUTE_ROUTE_ADD
,
145 client
, dst_p
, src_p
, newre
);
149 /* Either advertise a route for redistribution to registered clients or */
150 /* withdraw redistribution if add cannot be done for client */
151 void redistribute_update(const struct prefix
*p
, const struct prefix
*src_p
,
152 struct route_entry
*re
, struct route_entry
*prev_re
)
154 struct listnode
*node
, *nnode
;
155 struct zserv
*client
;
156 int send_redistribute
;
158 char buf
[PREFIX_STRLEN
];
160 if (IS_ZEBRA_DEBUG_RIB
) {
162 "%u:%s: Redist update re %p (%s), old %p (%s)",
163 re
->vrf_id
, prefix2str(p
, buf
, sizeof(buf
)),
164 re
, zebra_route_string(re
->type
), prev_re
,
165 prev_re
? zebra_route_string(prev_re
->type
) : "None");
168 afi
= family2afi(p
->family
);
170 flog_warn(EC_ZEBRA_REDISTRIBUTE_UNKNOWN_AF
,
171 "%s: Unknown AFI/SAFI prefix received\n",
176 for (ALL_LIST_ELEMENTS(zrouter
.client_list
, node
, nnode
, client
)) {
177 send_redistribute
= 0;
179 if (is_default_prefix(p
)
180 && vrf_bitmap_check(client
->redist_default
[afi
],
182 send_redistribute
= 1;
183 else if (vrf_bitmap_check(client
->redist
[afi
][ZEBRA_ROUTE_ALL
],
185 send_redistribute
= 1;
186 else if (re
->instance
187 && redist_check_instance(
188 &client
->mi_redist
[afi
][re
->type
],
190 send_redistribute
= 1;
191 else if (vrf_bitmap_check(client
->redist
[afi
][re
->type
],
193 send_redistribute
= 1;
195 if (send_redistribute
) {
196 if (IS_ZEBRA_DEBUG_EVENT
) {
198 "%s: client %s %s(%u), type=%d, distance=%d, metric=%d",
200 zebra_route_string(client
->proto
),
201 prefix2str(p
, buf
, sizeof(buf
)),
202 re
->vrf_id
, re
->type
,
203 re
->distance
, re
->metric
);
205 zsend_redistribute_route(ZEBRA_REDISTRIBUTE_ROUTE_ADD
,
206 client
, p
, src_p
, re
);
209 && redist_check_instance(
210 &client
->mi_redist
[afi
]
214 client
->redist
[afi
][prev_re
->type
],
216 zsend_redistribute_route(ZEBRA_REDISTRIBUTE_ROUTE_DEL
,
217 client
, p
, src_p
, prev_re
);
222 void redistribute_delete(const struct prefix
*p
, const struct prefix
*src_p
,
223 struct route_entry
*re
)
225 struct listnode
*node
, *nnode
;
226 struct zserv
*client
;
227 char buf
[INET6_ADDRSTRLEN
];
230 if (IS_ZEBRA_DEBUG_RIB
) {
231 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, INET6_ADDRSTRLEN
);
232 zlog_debug("%u:%s/%d: Redist delete re %p (%s)",
233 re
->vrf_id
, buf
, p
->prefixlen
, re
,
234 zebra_route_string(re
->type
));
237 /* Add DISTANCE_INFINITY check. */
238 if (re
->distance
== DISTANCE_INFINITY
)
241 afi
= family2afi(p
->family
);
243 flog_warn(EC_ZEBRA_REDISTRIBUTE_UNKNOWN_AF
,
244 "%s: Unknown AFI/SAFI prefix received\n",
249 for (ALL_LIST_ELEMENTS(zrouter
.client_list
, node
, nnode
, client
)) {
250 if ((is_default_prefix(p
)
251 && vrf_bitmap_check(client
->redist_default
[afi
],
253 || vrf_bitmap_check(client
->redist
[afi
][ZEBRA_ROUTE_ALL
],
256 && redist_check_instance(
257 &client
->mi_redist
[afi
][re
->type
],
259 || vrf_bitmap_check(client
->redist
[afi
][re
->type
],
261 zsend_redistribute_route(ZEBRA_REDISTRIBUTE_ROUTE_DEL
,
262 client
, p
, src_p
, re
);
267 void zebra_redistribute_add(ZAPI_HANDLER_ARGS
)
271 unsigned short instance
;
273 STREAM_GETC(msg
, afi
);
274 STREAM_GETC(msg
, type
);
275 STREAM_GETW(msg
, instance
);
277 if (IS_ZEBRA_DEBUG_EVENT
)
279 "%s: client proto %s afi=%d, wants %s, vrf %u, instance=%d",
280 __func__
, zebra_route_string(client
->proto
), afi
,
281 zebra_route_string(type
), zvrf_id(zvrf
), instance
);
283 if (afi
== 0 || afi
>= AFI_MAX
) {
284 flog_warn(EC_ZEBRA_REDISTRIBUTE_UNKNOWN_AF
,
285 "%s: Specified afi %d does not exist",
286 __PRETTY_FUNCTION__
, afi
);
290 if (type
== 0 || type
>= ZEBRA_ROUTE_MAX
) {
291 zlog_debug("%s: Specified Route Type %d does not exist",
292 __PRETTY_FUNCTION__
, type
);
297 if (!redist_check_instance(&client
->mi_redist
[afi
][type
],
299 redist_add_instance(&client
->mi_redist
[afi
][type
],
301 zebra_redistribute(client
, type
, instance
,
305 if (!vrf_bitmap_check(client
->redist
[afi
][type
],
307 if (IS_ZEBRA_DEBUG_EVENT
)
308 zlog_debug("%s: setting vrf %u redist bitmap",
309 __func__
, zvrf_id(zvrf
));
310 vrf_bitmap_set(client
->redist
[afi
][type
],
312 zebra_redistribute(client
, type
, 0, zvrf_id(zvrf
), afi
);
320 void zebra_redistribute_delete(ZAPI_HANDLER_ARGS
)
324 unsigned short instance
;
326 STREAM_GETC(msg
, afi
);
327 STREAM_GETC(msg
, type
);
328 STREAM_GETW(msg
, instance
);
330 if (afi
== 0 || afi
>= AFI_MAX
) {
331 flog_warn(EC_ZEBRA_REDISTRIBUTE_UNKNOWN_AF
,
332 "%s: Specified afi %d does not exist",
333 __PRETTY_FUNCTION__
, afi
);
337 if (type
== 0 || type
>= ZEBRA_ROUTE_MAX
) {
338 zlog_debug("%s: Specified Route Type %d does not exist",
339 __PRETTY_FUNCTION__
, type
);
344 * NOTE: no need to withdraw the previously advertised routes. The
346 * themselves should keep track of the received routes from zebra and
347 * withdraw them when necessary.
350 redist_del_instance(&client
->mi_redist
[afi
][type
], instance
);
352 vrf_bitmap_unset(client
->redist
[afi
][type
], zvrf_id(zvrf
));
358 void zebra_redistribute_default_add(ZAPI_HANDLER_ARGS
)
362 STREAM_GETC(msg
, afi
);
364 if (afi
== 0 || afi
>= AFI_MAX
) {
365 flog_warn(EC_ZEBRA_REDISTRIBUTE_UNKNOWN_AF
,
366 "%s: Specified afi %u does not exist",
367 __PRETTY_FUNCTION__
, afi
);
371 vrf_bitmap_set(client
->redist_default
[afi
], zvrf_id(zvrf
));
372 zebra_redistribute_default(client
, zvrf_id(zvrf
));
378 void zebra_redistribute_default_delete(ZAPI_HANDLER_ARGS
)
382 STREAM_GETC(msg
, afi
);
384 if (afi
== 0 || afi
>= AFI_MAX
) {
385 flog_warn(EC_ZEBRA_REDISTRIBUTE_UNKNOWN_AF
,
386 "%s: Specified afi %u does not exist",
387 __PRETTY_FUNCTION__
, afi
);
391 vrf_bitmap_unset(client
->redist_default
[afi
], zvrf_id(zvrf
));
397 /* Interface up information. */
398 void zebra_interface_up_update(struct interface
*ifp
)
400 struct listnode
*node
, *nnode
;
401 struct zserv
*client
;
403 if (IS_ZEBRA_DEBUG_EVENT
)
404 zlog_debug("MESSAGE: ZEBRA_INTERFACE_UP %s(%u)",
405 ifp
->name
, ifp
->vrf_id
);
407 if (ifp
->ptm_status
|| !ifp
->ptm_enable
) {
408 for (ALL_LIST_ELEMENTS(zrouter
.client_list
, node
, nnode
,
410 zsend_interface_update(ZEBRA_INTERFACE_UP
,
412 zsend_interface_link_params(client
, ifp
);
417 /* Interface down information. */
418 void zebra_interface_down_update(struct interface
*ifp
)
420 struct listnode
*node
, *nnode
;
421 struct zserv
*client
;
423 if (IS_ZEBRA_DEBUG_EVENT
)
424 zlog_debug("MESSAGE: ZEBRA_INTERFACE_DOWN %s(%u)",
425 ifp
->name
, ifp
->vrf_id
);
427 for (ALL_LIST_ELEMENTS(zrouter
.client_list
, node
, nnode
, client
)) {
428 zsend_interface_update(ZEBRA_INTERFACE_DOWN
, client
, ifp
);
432 /* Interface information update. */
433 void zebra_interface_add_update(struct interface
*ifp
)
435 struct listnode
*node
, *nnode
;
436 struct zserv
*client
;
438 if (IS_ZEBRA_DEBUG_EVENT
)
439 zlog_debug("MESSAGE: ZEBRA_INTERFACE_ADD %s(%u)", ifp
->name
,
442 for (ALL_LIST_ELEMENTS(zrouter
.client_list
, node
, nnode
, client
)) {
444 zsend_interface_add(client
, ifp
);
445 zsend_interface_link_params(client
, ifp
);
449 void zebra_interface_delete_update(struct interface
*ifp
)
451 struct listnode
*node
, *nnode
;
452 struct zserv
*client
;
454 if (IS_ZEBRA_DEBUG_EVENT
)
455 zlog_debug("MESSAGE: ZEBRA_INTERFACE_DELETE %s(%u)",
456 ifp
->name
, ifp
->vrf_id
);
458 for (ALL_LIST_ELEMENTS(zrouter
.client_list
, node
, nnode
, client
)) {
460 zsend_interface_delete(client
, ifp
);
464 /* Interface address addition. */
465 void zebra_interface_address_add_update(struct interface
*ifp
,
466 struct connected
*ifc
)
468 struct listnode
*node
, *nnode
;
469 struct zserv
*client
;
472 if (IS_ZEBRA_DEBUG_EVENT
) {
473 char buf
[PREFIX_STRLEN
];
476 zlog_debug("MESSAGE: ZEBRA_INTERFACE_ADDRESS_ADD %s on %s(%u)",
477 prefix2str(p
, buf
, sizeof(buf
)), ifp
->name
,
481 if (!CHECK_FLAG(ifc
->conf
, ZEBRA_IFC_REAL
))
483 EC_ZEBRA_ADVERTISING_UNUSABLE_ADDR
,
484 "WARNING: advertising address to clients that is not yet usable.");
486 zebra_vxlan_add_del_gw_macip(ifp
, ifc
->address
, 1);
488 router_id_add_address(ifc
);
490 for (ALL_LIST_ELEMENTS(zrouter
.client_list
, node
, nnode
, client
))
491 if (CHECK_FLAG(ifc
->conf
, ZEBRA_IFC_REAL
)) {
492 client
->connected_rt_add_cnt
++;
493 zsend_interface_address(ZEBRA_INTERFACE_ADDRESS_ADD
,
498 /* Interface address deletion. */
499 void zebra_interface_address_delete_update(struct interface
*ifp
,
500 struct connected
*ifc
)
502 struct listnode
*node
, *nnode
;
503 struct zserv
*client
;
506 if (IS_ZEBRA_DEBUG_EVENT
) {
507 char buf
[PREFIX_STRLEN
];
510 zlog_debug("MESSAGE: ZEBRA_INTERFACE_ADDRESS_DELETE %s on %s(%u)",
511 prefix2str(p
, buf
, sizeof(buf
)),
512 ifp
->name
, ifp
->vrf_id
);
515 zebra_vxlan_add_del_gw_macip(ifp
, ifc
->address
, 0);
517 router_id_del_address(ifc
);
519 for (ALL_LIST_ELEMENTS(zrouter
.client_list
, node
, nnode
, client
))
520 if (CHECK_FLAG(ifc
->conf
, ZEBRA_IFC_REAL
)) {
521 client
->connected_rt_del_cnt
++;
522 zsend_interface_address(ZEBRA_INTERFACE_ADDRESS_DELETE
,
527 /* Interface VRF change. May need to delete from clients not interested in
528 * the new VRF. Note that this function is invoked *prior* to the VRF change.
530 void zebra_interface_vrf_update_del(struct interface
*ifp
, vrf_id_t new_vrf_id
)
532 struct listnode
*node
, *nnode
;
533 struct zserv
*client
;
535 if (IS_ZEBRA_DEBUG_EVENT
)
537 "MESSAGE: ZEBRA_INTERFACE_VRF_UPDATE/DEL %s VRF Id %u -> %u",
538 ifp
->name
, ifp
->vrf_id
, new_vrf_id
);
540 for (ALL_LIST_ELEMENTS(zrouter
.client_list
, node
, nnode
, client
)) {
541 /* Need to delete if the client is not interested in the new
543 zsend_interface_update(ZEBRA_INTERFACE_DOWN
, client
, ifp
);
545 zsend_interface_delete(client
, ifp
);
546 zsend_interface_vrf_update(client
, ifp
, new_vrf_id
);
550 /* Interface VRF change. This function is invoked *post* VRF change and sends an
551 * add to clients who are interested in the new VRF but not in the old VRF.
553 void zebra_interface_vrf_update_add(struct interface
*ifp
, vrf_id_t old_vrf_id
)
555 struct listnode
*node
, *nnode
;
556 struct zserv
*client
;
558 if (IS_ZEBRA_DEBUG_EVENT
)
560 "MESSAGE: ZEBRA_INTERFACE_VRF_UPDATE/ADD %s VRF Id %u -> %u",
561 ifp
->name
, old_vrf_id
, ifp
->vrf_id
);
563 for (ALL_LIST_ELEMENTS(zrouter
.client_list
, node
, nnode
, client
)) {
564 /* Need to add if the client is interested in the new VRF. */
566 zsend_interface_add(client
, ifp
);
567 zsend_interface_addresses(client
, ifp
);
571 int zebra_add_import_table_entry(struct route_node
*rn
, struct route_entry
*re
,
572 const char *rmap_name
)
574 struct route_entry
*newre
;
575 struct route_entry
*same
;
577 route_map_result_t ret
= RMAP_MATCH
;
580 afi
= family2afi(rn
->p
.family
);
582 ret
= zebra_import_table_route_map_check(
583 afi
, re
->type
, re
->instance
, &rn
->p
, re
->ng
.nexthop
,
584 re
->vrf_id
, re
->tag
, rmap_name
);
586 if (ret
!= RMAP_MATCH
) {
587 UNSET_FLAG(re
->flags
, ZEBRA_FLAG_SELECTED
);
588 zebra_del_import_table_entry(rn
, re
);
592 prefix_copy(&p
, &rn
->p
);
594 RNODE_FOREACH_RE (rn
, same
) {
595 if (CHECK_FLAG(same
->status
, ROUTE_ENTRY_REMOVED
))
598 if (same
->type
== re
->type
&& same
->instance
== re
->instance
599 && same
->table
== re
->table
600 && same
->type
!= ZEBRA_ROUTE_CONNECT
)
605 UNSET_FLAG(same
->flags
, ZEBRA_FLAG_SELECTED
);
606 zebra_del_import_table_entry(rn
, same
);
609 newre
= XCALLOC(MTYPE_RE
, sizeof(struct route_entry
));
610 newre
->type
= ZEBRA_ROUTE_TABLE
;
611 newre
->distance
= zebra_import_table_distance
[afi
][re
->table
];
612 newre
->flags
= re
->flags
;
613 newre
->metric
= re
->metric
;
614 newre
->mtu
= re
->mtu
;
616 newre
->nexthop_num
= 0;
617 newre
->uptime
= monotime(NULL
);
618 newre
->instance
= re
->table
;
619 route_entry_copy_nexthops(newre
, re
->ng
.nexthop
);
621 rib_add_multipath(afi
, SAFI_UNICAST
, &p
, NULL
, newre
);
626 int zebra_del_import_table_entry(struct route_node
*rn
, struct route_entry
*re
)
631 afi
= family2afi(rn
->p
.family
);
632 prefix_copy(&p
, &rn
->p
);
634 rib_delete(afi
, SAFI_UNICAST
, re
->vrf_id
, ZEBRA_ROUTE_TABLE
, re
->table
,
635 re
->flags
, &p
, NULL
, re
->ng
.nexthop
, 0, re
->metric
,
636 re
->distance
, false);
641 /* Assuming no one calls this with the main routing table */
642 int zebra_import_table(afi_t afi
, uint32_t table_id
, uint32_t distance
,
643 const char *rmap_name
, int add
)
645 struct route_table
*table
;
646 struct route_entry
*re
;
647 struct route_node
*rn
;
649 if (!is_zebra_valid_kernel_table(table_id
)
650 || (table_id
== RT_TABLE_MAIN
))
656 table
= zebra_vrf_table_with_table_id(afi
, SAFI_UNICAST
,
657 table_id
, VRF_DEFAULT
);
660 } else if (IS_ZEBRA_DEBUG_RIB
) {
661 zlog_debug("%s routes from table %d",
662 add
? "Importing" : "Unimporting", table_id
);
667 zebra_add_import_table_route_map(afi
, rmap_name
,
671 zebra_get_import_table_route_map(afi
, table_id
);
673 zebra_del_import_table_route_map(afi
, table_id
);
678 zebra_import_table_used
[afi
][table_id
] = 1;
679 zebra_import_table_distance
[afi
][table_id
] = distance
;
681 zebra_import_table_used
[afi
][table_id
] = 0;
682 zebra_import_table_distance
[afi
][table_id
] =
683 ZEBRA_TABLE_DISTANCE_DEFAULT
;
685 rmap_name
= zebra_get_import_table_route_map(afi
, table_id
);
687 zebra_del_import_table_route_map(afi
, table_id
);
692 for (rn
= route_top(table
); rn
; rn
= route_next(rn
)) {
693 /* For each entry in the non-default routing table,
694 * add the entry in the main table
699 RNODE_FOREACH_RE (rn
, re
) {
700 if (CHECK_FLAG(re
->status
, ROUTE_ENTRY_REMOVED
))
708 if (((afi
== AFI_IP
) && (rn
->p
.family
== AF_INET
))
709 || ((afi
== AFI_IP6
) && (rn
->p
.family
== AF_INET6
))) {
711 zebra_add_import_table_entry(rn
, re
, rmap_name
);
713 zebra_del_import_table_entry(rn
, re
);
719 int zebra_import_table_config(struct vty
*vty
)
724 char afi_str
[AFI_MAX
][10] = {"", "ip", "ipv6", "ethernet"};
725 const char *rmap_name
;
727 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++) {
728 for (i
= 1; i
< ZEBRA_KERNEL_TABLE_MAX
; i
++) {
729 if (!is_zebra_import_table_enabled(afi
, i
))
732 if (zebra_import_table_distance
[afi
][i
]
733 != ZEBRA_TABLE_DISTANCE_DEFAULT
) {
734 vty_out(vty
, "%s import-table %d distance %d",
736 zebra_import_table_distance
[afi
][i
]);
738 vty_out(vty
, "%s import-table %d", afi_str
[afi
],
742 rmap_name
= zebra_get_import_table_route_map(afi
, i
);
744 vty_out(vty
, " route-map %s", rmap_name
);
754 void zebra_import_table_rm_update(const char *rmap
)
758 struct route_table
*table
;
759 struct route_entry
*re
;
760 struct route_node
*rn
;
761 const char *rmap_name
;
763 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++) {
764 for (i
= 1; i
< ZEBRA_KERNEL_TABLE_MAX
; i
++) {
765 if (!is_zebra_import_table_enabled(afi
, i
))
768 rmap_name
= zebra_get_import_table_route_map(afi
, i
);
769 if ((!rmap_name
) || (strcmp(rmap_name
, rmap
) != 0))
771 table
= zebra_vrf_table_with_table_id(afi
, SAFI_UNICAST
,
773 for (rn
= route_top(table
); rn
; rn
= route_next(rn
)) {
774 /* For each entry in the non-default
776 * add the entry in the main table
781 RNODE_FOREACH_RE (rn
, re
) {
782 if (CHECK_FLAG(re
->status
,
783 ROUTE_ENTRY_REMOVED
))
792 && (rn
->p
.family
== AF_INET
))
794 && (rn
->p
.family
== AF_INET6
)))
795 zebra_add_import_table_entry(rn
, re
,
804 /* Interface parameters update */
805 void zebra_interface_parameters_update(struct interface
*ifp
)
807 struct listnode
*node
, *nnode
;
808 struct zserv
*client
;
810 if (IS_ZEBRA_DEBUG_EVENT
)
811 zlog_debug("MESSAGE: ZEBRA_INTERFACE_LINK_PARAMS %s(%u)",
812 ifp
->name
, ifp
->vrf_id
);
814 for (ALL_LIST_ELEMENTS(zrouter
.client_list
, node
, nnode
, client
))
815 zsend_interface_link_params(client
, ifp
);