2 * Zebra connect library for OSPFd
3 * Copyright (C) 1997, 98, 99, 2000 Kunihiro Ishiguro, Toshiaki Takada
5 * This file is part of GNU Zebra.
7 * GNU Zebra is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2, or (at your option) any
12 * GNU Zebra is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; see the file COPYING; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
39 #include "ospfd/ospfd.h"
40 #include "ospfd/ospf_interface.h"
41 #include "ospfd/ospf_ism.h"
42 #include "ospfd/ospf_asbr.h"
43 #include "ospfd/ospf_asbr.h"
44 #include "ospfd/ospf_abr.h"
45 #include "ospfd/ospf_lsa.h"
46 #include "ospfd/ospf_dump.h"
47 #include "ospfd/ospf_route.h"
48 #include "ospfd/ospf_lsdb.h"
49 #include "ospfd/ospf_neighbor.h"
50 #include "ospfd/ospf_nsm.h"
51 #include "ospfd/ospf_zebra.h"
52 #include "ospfd/ospf_te.h"
54 DEFINE_HOOK(ospf_if_update
, (struct interface
* ifp
), (ifp
))
55 DEFINE_HOOK(ospf_if_delete
, (struct interface
* ifp
), (ifp
))
57 /* Zebra structure to hold current status. */
58 struct zclient
*zclient
= NULL
;
60 /* For registering threads. */
61 extern struct thread_master
*master
;
62 struct in_addr router_id_zebra
;
64 /* Router-id update message from zebra. */
65 static int ospf_router_id_update_zebra(int command
, struct zclient
*zclient
,
66 zebra_size_t length
, vrf_id_t vrf_id
)
69 struct prefix router_id
;
70 zebra_router_id_update_read(zclient
->ibuf
, &router_id
);
72 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
)) {
73 char buf
[PREFIX2STR_BUFFER
];
74 prefix2str(&router_id
, buf
, sizeof(buf
));
75 zlog_debug("Zebra rcvd: router id update %s", buf
);
78 router_id_zebra
= router_id
.u
.prefix4
;
83 ospf_router_id_update(ospf
);
88 /* Inteface addition message from zebra. */
89 static int ospf_interface_add(int command
, struct zclient
*zclient
,
90 zebra_size_t length
, vrf_id_t vrf_id
)
92 struct interface
*ifp
;
94 ifp
= zebra_interface_add_read(zclient
->ibuf
, vrf_id
);
96 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
98 "Zebra: interface add %s[%u] index %d flags %llx metric %d mtu %d",
99 ifp
->name
, ifp
->vrf_id
, ifp
->ifindex
,
100 (unsigned long long)ifp
->flags
, ifp
->metric
, ifp
->mtu
);
104 if (!OSPF_IF_PARAM_CONFIGURED(IF_DEF_PARAMS(ifp
), type
)) {
105 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), type
);
106 IF_DEF_PARAMS(ifp
)->type
= ospf_default_iftype(ifp
);
109 ospf_if_update(NULL
, ifp
);
111 hook_call(ospf_if_update
, ifp
);
116 static int ospf_interface_delete(int command
, struct zclient
*zclient
,
117 zebra_size_t length
, vrf_id_t vrf_id
)
119 struct interface
*ifp
;
121 struct route_node
*rn
;
124 /* zebra_interface_state_read() updates interface structure in iflist */
125 ifp
= zebra_interface_state_read(s
, vrf_id
);
131 zlog_warn("Zebra: got delete of %s, but interface is still up",
134 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
136 "Zebra: interface delete %s[%u] index %d flags %llx metric %d mtu %d",
137 ifp
->name
, ifp
->vrf_id
, ifp
->ifindex
,
138 (unsigned long long)ifp
->flags
, ifp
->metric
, ifp
->mtu
);
140 hook_call(ospf_if_delete
, ifp
);
142 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
))
144 ospf_if_free((struct ospf_interface
*)rn
->info
);
146 ifp
->ifindex
= IFINDEX_DELETED
;
150 static struct interface
*zebra_interface_if_lookup(struct stream
*s
,
153 char ifname_tmp
[INTERFACE_NAMSIZ
];
155 /* Read interface name. */
156 stream_get(ifname_tmp
, s
, INTERFACE_NAMSIZ
);
158 /* And look it up. */
159 return if_lookup_by_name_len(
160 ifname_tmp
, strnlen(ifname_tmp
, INTERFACE_NAMSIZ
), VRF_DEFAULT
);
163 static int ospf_interface_state_up(int command
, struct zclient
*zclient
,
164 zebra_size_t length
, vrf_id_t vrf_id
)
166 struct interface
*ifp
;
167 struct ospf_interface
*oi
;
168 struct route_node
*rn
;
170 ifp
= zebra_interface_if_lookup(zclient
->ibuf
, vrf_id
);
175 /* Interface is already up. */
176 if (if_is_operative(ifp
)) {
177 /* Temporarily keep ifp values. */
178 struct interface if_tmp
;
179 memcpy(&if_tmp
, ifp
, sizeof(struct interface
));
181 zebra_interface_if_set_value(zclient
->ibuf
, ifp
);
183 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
185 "Zebra: Interface[%s] state update speed %u -> %u, bw %d -> %d",
186 ifp
->name
, if_tmp
.speed
, ifp
->speed
,
187 if_tmp
.bandwidth
, ifp
->bandwidth
);
189 ospf_if_recalculate_output_cost(ifp
);
191 if (if_tmp
.mtu
!= ifp
->mtu
) {
192 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
194 "Zebra: Interface[%s] MTU change %u -> %u.",
195 ifp
->name
, if_tmp
.mtu
, ifp
->mtu
);
197 /* Must reset the interface (simulate down/up) when MTU
204 zebra_interface_if_set_value(zclient
->ibuf
, ifp
);
206 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
207 zlog_debug("Zebra: Interface[%s] state change to up.",
210 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
)) {
211 if ((oi
= rn
->info
) == NULL
)
220 static int ospf_interface_state_down(int command
, struct zclient
*zclient
,
221 zebra_size_t length
, vrf_id_t vrf_id
)
223 struct interface
*ifp
;
224 struct ospf_interface
*oi
;
225 struct route_node
*node
;
227 ifp
= zebra_interface_state_read(zclient
->ibuf
, vrf_id
);
232 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
233 zlog_debug("Zebra: Interface[%s] state change to down.",
236 for (node
= route_top(IF_OIFS(ifp
)); node
; node
= route_next(node
)) {
237 if ((oi
= node
->info
) == NULL
)
245 static int ospf_interface_address_add(int command
, struct zclient
*zclient
,
246 zebra_size_t length
, vrf_id_t vrf_id
)
250 c
= zebra_interface_address_read(command
, zclient
->ibuf
, vrf_id
);
255 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
)) {
256 char buf
[PREFIX2STR_BUFFER
];
257 prefix2str(c
->address
, buf
, sizeof(buf
));
258 zlog_debug("Zebra: interface %s address add %s", c
->ifp
->name
,
262 ospf_if_update(NULL
, c
->ifp
);
264 hook_call(ospf_if_update
, c
->ifp
);
269 static int ospf_interface_address_delete(int command
, struct zclient
*zclient
,
270 zebra_size_t length
, vrf_id_t vrf_id
)
273 struct interface
*ifp
;
274 struct ospf_interface
*oi
;
275 struct route_node
*rn
;
278 c
= zebra_interface_address_read(command
, zclient
->ibuf
, vrf_id
);
283 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
)) {
284 char buf
[PREFIX2STR_BUFFER
];
285 prefix2str(c
->address
, buf
, sizeof(buf
));
286 zlog_debug("Zebra: interface %s address delete %s",
292 p
.prefixlen
= IPV4_MAX_PREFIXLEN
;
294 rn
= route_node_lookup(IF_OIFS(ifp
), &p
);
302 route_unlock_node(rn
);
304 /* Call interface hook functions to clean up */
307 hook_call(ospf_if_update
, c
->ifp
);
314 static int ospf_interface_link_params(int command
, struct zclient
*zclient
,
317 struct interface
*ifp
;
319 ifp
= zebra_interface_link_params_read(zclient
->ibuf
);
325 ospf_mpls_te_update_if(ifp
);
331 void ospf_zebra_add(struct prefix_ipv4
*p
, struct ospf_route
* or)
338 struct ospf_path
*path
;
339 struct listnode
*node
;
340 struct ospf
*ospf
= ospf_lookup();
343 && redist_check_instance(
344 &zclient
->mi_redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
],
346 || vrf_bitmap_check(zclient
->redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
],
351 /* OSPF pass nexthop and metric */
352 SET_FLAG(message
, ZAPI_MESSAGE_NEXTHOP
);
353 SET_FLAG(message
, ZAPI_MESSAGE_METRIC
);
355 /* Distance value. */
356 distance
= ospf_distance_apply(p
, or);
358 SET_FLAG(message
, ZAPI_MESSAGE_DISTANCE
);
360 /* Check if path type is ASE */
361 if (((or->path_type
== OSPF_PATH_TYPE1_EXTERNAL
)
362 || (or->path_type
== OSPF_PATH_TYPE2_EXTERNAL
))
363 && (or->u
.ext
.tag
> 0) && (or->u
.ext
.tag
<= ROUTE_TAG_MAX
))
364 SET_FLAG(message
, ZAPI_MESSAGE_TAG
);
370 /* Put command, type, flags, message. */
371 zclient_create_header(s
, ZEBRA_IPV4_ROUTE_ADD
, VRF_DEFAULT
);
372 stream_putc(s
, ZEBRA_ROUTE_OSPF
);
373 stream_putw(s
, ospf
->instance
);
374 stream_putl(s
, flags
);
375 stream_putc(s
, message
);
376 stream_putw(s
, SAFI_UNICAST
);
378 /* Put prefix information. */
379 psize
= PSIZE(p
->prefixlen
);
380 stream_putc(s
, p
->prefixlen
);
381 stream_write(s
, (u_char
*)&p
->prefix
, psize
);
384 stream_putc(s
, or->paths
->count
);
386 /* Nexthop, ifindex, distance and metric information. */
387 for (ALL_LIST_ELEMENTS_RO(or->paths
, node
, path
)) {
390 || (path
->nexthop
.s_addr
!= INADDR_ANY
391 && path
->ifindex
!= 0)) {
392 stream_putc(s
, NEXTHOP_TYPE_IPV4_IFINDEX
);
393 stream_put_in_addr(s
, &path
->nexthop
);
394 stream_putl(s
, path
->ifindex
);
395 } else if (path
->nexthop
.s_addr
!= INADDR_ANY
) {
396 stream_putc(s
, NEXTHOP_TYPE_IPV4
);
397 stream_put_in_addr(s
, &path
->nexthop
);
399 stream_putc(s
, NEXTHOP_TYPE_IFINDEX
);
401 stream_putl(s
, path
->ifindex
);
405 #else /* HAVE_NETLINK */
406 if (path
->nexthop
.s_addr
!= INADDR_ANY
407 && path
->ifindex
!= 0) {
408 stream_putc(s
, NEXTHOP_TYPE_IPV4_IFINDEX
);
409 stream_put_in_addr(s
, &path
->nexthop
);
410 stream_putl(s
, path
->ifindex
);
411 } else if (path
->nexthop
.s_addr
!= INADDR_ANY
) {
412 stream_putc(s
, NEXTHOP_TYPE_IPV4
);
413 stream_put_in_addr(s
, &path
->nexthop
);
415 stream_putc(s
, NEXTHOP_TYPE_IFINDEX
);
417 stream_putl(s
, path
->ifindex
);
421 #endif /* HAVE_NETLINK */
423 if (IS_DEBUG_OSPF(zebra
, ZEBRA_REDISTRIBUTE
)) {
424 char buf
[2][INET_ADDRSTRLEN
];
426 "Zebra: Route add %s/%d nexthop %s, ifindex=%d",
427 inet_ntop(AF_INET
, &p
->prefix
, buf
[0],
430 inet_ntop(AF_INET
, &path
->nexthop
,
431 buf
[1], sizeof(buf
[1])),
436 if (CHECK_FLAG(message
, ZAPI_MESSAGE_DISTANCE
))
437 stream_putc(s
, distance
);
438 if (CHECK_FLAG(message
, ZAPI_MESSAGE_METRIC
)) {
439 if (or->path_type
== OSPF_PATH_TYPE1_EXTERNAL
)
440 stream_putl(s
, or->cost
+ or->u
.ext
.type2_cost
);
441 else if (or->path_type
== OSPF_PATH_TYPE2_EXTERNAL
)
442 stream_putl(s
, or->u
.ext
.type2_cost
);
444 stream_putl(s
, or->cost
);
447 if (CHECK_FLAG(message
, ZAPI_MESSAGE_TAG
))
448 stream_putl(s
, or->u
.ext
.tag
);
450 stream_putw_at(s
, 0, stream_get_endp(s
));
452 zclient_send_message(zclient
);
456 void ospf_zebra_delete(struct prefix_ipv4
*p
, struct ospf_route
* or)
463 struct ospf_path
*path
;
464 struct listnode
*node
;
465 struct ospf
*ospf
= ospf_lookup();
468 && redist_check_instance(
469 &zclient
->mi_redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
],
471 || vrf_bitmap_check(zclient
->redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
],
475 /* Distance value. */
476 distance
= ospf_distance_apply(p
, or);
481 /* Put command, type, flags, message. */
482 zclient_create_header(s
, ZEBRA_IPV4_ROUTE_DELETE
, VRF_DEFAULT
);
483 stream_putc(s
, ZEBRA_ROUTE_OSPF
);
484 stream_putw(s
, ospf
->instance
);
485 stream_putl(s
, flags
);
486 stream_putc(s
, message
);
487 stream_putw(s
, SAFI_UNICAST
);
489 /* Put prefix information. */
490 psize
= PSIZE(p
->prefixlen
);
491 stream_putc(s
, p
->prefixlen
);
492 stream_write(s
, (u_char
*)&p
->prefix
, psize
);
495 stream_putc(s
, or->paths
->count
);
497 /* Nexthop, ifindex, distance and metric information. */
498 for (ALL_LIST_ELEMENTS_RO(or->paths
, node
, path
)) {
499 if (path
->nexthop
.s_addr
!= INADDR_ANY
500 && path
->ifindex
!= 0) {
501 stream_putc(s
, NEXTHOP_TYPE_IPV4_IFINDEX
);
502 stream_put_in_addr(s
, &path
->nexthop
);
503 stream_putl(s
, path
->ifindex
);
504 } else if (path
->nexthop
.s_addr
!= INADDR_ANY
) {
505 stream_putc(s
, NEXTHOP_TYPE_IPV4
);
506 stream_put_in_addr(s
, &path
->nexthop
);
508 stream_putc(s
, NEXTHOP_TYPE_IFINDEX
);
509 stream_putl(s
, path
->ifindex
);
512 if (IS_DEBUG_OSPF(zebra
, ZEBRA_REDISTRIBUTE
)) {
513 char buf
[2][INET_ADDRSTRLEN
];
515 "Zebra: Route delete %s/%d nexthop %s",
516 inet_ntop(AF_INET
, &p
->prefix
, buf
[0],
519 inet_ntop(AF_INET
, &path
->nexthop
,
520 buf
[1], sizeof(buf
[1])));
524 if (CHECK_FLAG(message
, ZAPI_MESSAGE_DISTANCE
))
525 stream_putc(s
, distance
);
526 if (CHECK_FLAG(message
, ZAPI_MESSAGE_METRIC
)) {
527 if (or->path_type
== OSPF_PATH_TYPE1_EXTERNAL
)
528 stream_putl(s
, or->cost
+ or->u
.ext
.type2_cost
);
529 else if (or->path_type
== OSPF_PATH_TYPE2_EXTERNAL
)
530 stream_putl(s
, or->u
.ext
.type2_cost
);
532 stream_putl(s
, or->cost
);
535 stream_putw_at(s
, 0, stream_get_endp(s
));
537 zclient_send_message(zclient
);
541 void ospf_zebra_add_discard(struct prefix_ipv4
*p
)
543 struct zapi_ipv4 api
;
544 struct ospf
*ospf
= ospf_lookup();
547 && redist_check_instance(
548 &zclient
->mi_redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
],
550 || vrf_bitmap_check(zclient
->redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
],
552 api
.vrf_id
= VRF_DEFAULT
;
553 api
.type
= ZEBRA_ROUTE_OSPF
;
554 api
.instance
= ospf
->instance
;
555 api
.flags
= ZEBRA_FLAG_BLACKHOLE
;
557 api
.safi
= SAFI_UNICAST
;
558 SET_FLAG(api
.message
, ZAPI_MESSAGE_NEXTHOP
);
563 zapi_ipv4_route(ZEBRA_IPV4_ROUTE_ADD
, zclient
, p
, &api
);
565 if (IS_DEBUG_OSPF(zebra
, ZEBRA_REDISTRIBUTE
))
566 zlog_debug("Zebra: Route add discard %s/%d",
567 inet_ntoa(p
->prefix
), p
->prefixlen
);
571 void ospf_zebra_delete_discard(struct prefix_ipv4
*p
)
573 struct zapi_ipv4 api
;
574 struct ospf
*ospf
= ospf_lookup();
577 && redist_check_instance(
578 &zclient
->mi_redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
],
580 || vrf_bitmap_check(zclient
->redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
],
582 api
.vrf_id
= VRF_DEFAULT
;
583 api
.type
= ZEBRA_ROUTE_OSPF
;
584 api
.instance
= ospf
->instance
;
585 api
.flags
= ZEBRA_FLAG_BLACKHOLE
;
587 api
.safi
= SAFI_UNICAST
;
588 SET_FLAG(api
.message
, ZAPI_MESSAGE_NEXTHOP
);
593 zapi_ipv4_route(ZEBRA_IPV4_ROUTE_DELETE
, zclient
, p
, &api
);
595 if (IS_DEBUG_OSPF(zebra
, ZEBRA_REDISTRIBUTE
))
596 zlog_debug("Zebra: Route delete discard %s/%d",
597 inet_ntoa(p
->prefix
), p
->prefixlen
);
601 struct ospf_external
*ospf_external_lookup(u_char type
, u_short instance
)
603 struct list
*ext_list
;
604 struct listnode
*node
;
605 struct ospf_external
*ext
;
607 ext_list
= om
->external
[type
];
611 for (ALL_LIST_ELEMENTS_RO(ext_list
, node
, ext
))
612 if (ext
->instance
== instance
)
618 struct ospf_external
*ospf_external_add(u_char type
, u_short instance
)
620 struct list
*ext_list
;
621 struct ospf_external
*ext
;
623 ext
= ospf_external_lookup(type
, instance
);
627 if (!om
->external
[type
])
628 om
->external
[type
] = list_new();
630 ext_list
= om
->external
[type
];
631 ext
= (struct ospf_external
*)calloc(1, sizeof(struct ospf_external
));
632 ext
->instance
= instance
;
633 EXTERNAL_INFO(ext
) = route_table_init();
635 listnode_add(ext_list
, ext
);
640 void ospf_external_del(u_char type
, u_short instance
)
642 struct ospf_external
*ext
;
644 ext
= ospf_external_lookup(type
, instance
);
647 if (EXTERNAL_INFO(ext
))
648 route_table_finish(EXTERNAL_INFO(ext
));
650 listnode_delete(om
->external
[type
], ext
);
651 if (!om
->external
[type
]->count
) {
652 list_free(om
->external
[type
]);
653 om
->external
[type
] = NULL
;
658 struct ospf_redist
*ospf_redist_lookup(struct ospf
*ospf
, u_char type
,
661 struct list
*red_list
;
662 struct listnode
*node
;
663 struct ospf_redist
*red
;
665 red_list
= ospf
->redist
[type
];
669 for (ALL_LIST_ELEMENTS_RO(red_list
, node
, red
))
670 if (red
->instance
== instance
)
676 struct ospf_redist
*ospf_redist_add(struct ospf
*ospf
, u_char type
,
679 struct list
*red_list
;
680 struct ospf_redist
*red
;
682 red
= ospf_redist_lookup(ospf
, type
, instance
);
686 if (!ospf
->redist
[type
])
687 ospf
->redist
[type
] = list_new();
689 red_list
= ospf
->redist
[type
];
690 red
= (struct ospf_redist
*)calloc(1, sizeof(struct ospf_redist
));
691 red
->instance
= instance
;
692 red
->dmetric
.type
= -1;
693 red
->dmetric
.value
= -1;
695 listnode_add(red_list
, red
);
700 void ospf_redist_del(struct ospf
*ospf
, u_char type
, u_short instance
)
702 struct ospf_redist
*red
;
704 red
= ospf_redist_lookup(ospf
, type
, instance
);
707 listnode_delete(ospf
->redist
[type
], red
);
708 if (!ospf
->redist
[type
]->count
) {
709 list_free(ospf
->redist
[type
]);
710 ospf
->redist
[type
] = NULL
;
716 int ospf_is_type_redistributed(int type
, u_short instance
)
718 return (DEFAULT_ROUTE_TYPE(type
)
719 ? vrf_bitmap_check(zclient
->default_information
,
722 && redist_check_instance(
723 &zclient
->mi_redist
[AFI_IP
][type
],
727 zclient
->redist
[AFI_IP
][type
],
731 int ospf_redistribute_set(struct ospf
*ospf
, int type
, u_short instance
,
732 int mtype
, int mvalue
)
735 struct ospf_redist
*red
;
737 red
= ospf_redist_lookup(ospf
, type
, instance
);
738 if (ospf_is_type_redistributed(type
, instance
)) {
739 if (mtype
!= red
->dmetric
.type
) {
740 red
->dmetric
.type
= mtype
;
741 force
= LSA_REFRESH_FORCE
;
743 if (mvalue
!= red
->dmetric
.value
) {
744 red
->dmetric
.value
= mvalue
;
745 force
= LSA_REFRESH_FORCE
;
748 ospf_external_lsa_refresh_type(ospf
, type
, instance
, force
);
750 if (IS_DEBUG_OSPF(zebra
, ZEBRA_REDISTRIBUTE
))
752 "Redistribute[%s][%d]: Refresh Type[%d], Metric[%d]",
753 ospf_redist_string(type
), instance
,
754 metric_type(ospf
, type
, instance
),
755 metric_value(ospf
, type
, instance
));
760 red
->dmetric
.type
= mtype
;
761 red
->dmetric
.value
= mvalue
;
763 ospf_external_add(type
, instance
);
765 zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD
, zclient
, AFI_IP
, type
,
766 instance
, VRF_DEFAULT
);
768 if (IS_DEBUG_OSPF(zebra
, ZEBRA_REDISTRIBUTE
))
769 zlog_debug("Redistribute[%s][%d]: Start Type[%d], Metric[%d]",
770 ospf_redist_string(type
), instance
,
771 metric_type(ospf
, type
, instance
),
772 metric_value(ospf
, type
, instance
));
774 ospf_asbr_status_update(ospf
, ++ospf
->redistribute
);
779 int ospf_redistribute_unset(struct ospf
*ospf
, int type
, u_short instance
)
781 if (type
== zclient
->redist_default
&& instance
== zclient
->instance
)
784 if (!ospf_is_type_redistributed(type
, instance
))
787 zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE
, zclient
, AFI_IP
, type
,
788 instance
, VRF_DEFAULT
);
790 if (IS_DEBUG_OSPF(zebra
, ZEBRA_REDISTRIBUTE
))
791 zlog_debug("Redistribute[%s][%d]: Stop",
792 ospf_redist_string(type
), instance
);
794 ospf_redist_del(ospf
, type
, instance
);
796 /* Remove the routes from OSPF table. */
797 ospf_redistribute_withdraw(ospf
, type
, instance
);
799 ospf_external_del(type
, instance
);
801 ospf_asbr_status_update(ospf
, --ospf
->redistribute
);
806 int ospf_redistribute_default_set(struct ospf
*ospf
, int originate
, int mtype
,
809 struct ospf_redist
*red
;
811 ospf
->default_originate
= originate
;
813 red
= ospf_redist_add(ospf
, DEFAULT_ROUTE
, 0);
814 red
->dmetric
.type
= mtype
;
815 red
->dmetric
.value
= mvalue
;
817 ospf_external_add(DEFAULT_ROUTE
, 0);
819 if (ospf_is_type_redistributed(DEFAULT_ROUTE
, 0)) {
820 /* if ospf->default_originate changes value, is calling
821 ospf_external_lsa_refresh_default sufficient to implement
823 ospf_external_lsa_refresh_default(ospf
);
825 if (IS_DEBUG_OSPF(zebra
, ZEBRA_REDISTRIBUTE
))
827 "Redistribute[%s]: Refresh Type[%d], Metric[%d]",
828 ospf_redist_string(DEFAULT_ROUTE
),
829 metric_type(ospf
, DEFAULT_ROUTE
, 0),
830 metric_value(ospf
, DEFAULT_ROUTE
, 0));
834 zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_ADD
, zclient
,
837 if (IS_DEBUG_OSPF(zebra
, ZEBRA_REDISTRIBUTE
))
838 zlog_debug("Redistribute[DEFAULT]: Start Type[%d], Metric[%d]",
839 metric_type(ospf
, DEFAULT_ROUTE
, 0),
840 metric_value(ospf
, DEFAULT_ROUTE
, 0));
842 if (ospf
->router_id
.s_addr
== 0)
843 ospf
->external_origin
|= (1 << DEFAULT_ROUTE
);
845 thread_add_timer(master
, ospf_default_originate_timer
, ospf
, 1,
848 ospf_asbr_status_update(ospf
, ++ospf
->redistribute
);
853 int ospf_redistribute_default_unset(struct ospf
*ospf
)
855 if (!ospf_is_type_redistributed(DEFAULT_ROUTE
, 0))
858 ospf
->default_originate
= DEFAULT_ORIGINATE_NONE
;
859 ospf_redist_del(ospf
, DEFAULT_ROUTE
, 0);
861 zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_DELETE
, zclient
,
864 if (IS_DEBUG_OSPF(zebra
, ZEBRA_REDISTRIBUTE
))
865 zlog_debug("Redistribute[DEFAULT]: Stop");
867 // Pending: how does the external_info cleanup work in this case?
869 ospf_asbr_status_update(ospf
, --ospf
->redistribute
);
874 static int ospf_external_lsa_originate_check(struct ospf
*ospf
,
875 struct external_info
*ei
)
877 /* If prefix is multicast, then do not originate LSA. */
878 if (IN_MULTICAST(htonl(ei
->p
.prefix
.s_addr
))) {
880 "LSA[Type5:%s]: Not originate AS-external-LSA, "
881 "Prefix belongs multicast",
882 inet_ntoa(ei
->p
.prefix
));
886 /* Take care of default-originate. */
887 if (is_prefix_default(&ei
->p
))
888 if (ospf
->default_originate
== DEFAULT_ORIGINATE_NONE
) {
890 "LSA[Type5:0.0.0.0]: Not originate AS-external-LSA "
898 /* If connected prefix is OSPF enable interface, then do not announce. */
899 int ospf_distribute_check_connected(struct ospf
*ospf
, struct external_info
*ei
)
901 struct listnode
*node
;
902 struct ospf_interface
*oi
;
905 for (ALL_LIST_ELEMENTS_RO(ospf
->oiflist
, node
, oi
))
906 if (prefix_match(oi
->address
, (struct prefix
*)&ei
->p
))
911 /* return 1 if external LSA must be originated, 0 otherwise */
912 int ospf_redistribute_check(struct ospf
*ospf
, struct external_info
*ei
,
915 struct route_map_set_values save_values
;
916 struct prefix_ipv4
*p
= &ei
->p
;
917 struct ospf_redist
*red
;
918 u_char type
= is_prefix_default(&ei
->p
) ? DEFAULT_ROUTE
: ei
->type
;
919 u_short instance
= is_prefix_default(&ei
->p
) ? 0 : ei
->instance
;
924 if (!ospf_external_lsa_originate_check(ospf
, ei
))
927 /* Take care connected route. */
928 if (type
== ZEBRA_ROUTE_CONNECT
929 && !ospf_distribute_check_connected(ospf
, ei
))
932 if (!DEFAULT_ROUTE_TYPE(type
) && DISTRIBUTE_NAME(ospf
, type
))
933 /* distirbute-list exists, but access-list may not? */
934 if (DISTRIBUTE_LIST(ospf
, type
))
935 if (access_list_apply(DISTRIBUTE_LIST(ospf
, type
), p
)
937 if (IS_DEBUG_OSPF(zebra
, ZEBRA_REDISTRIBUTE
))
939 "Redistribute[%s]: %s/%d filtered by ditribute-list.",
940 ospf_redist_string(type
),
941 inet_ntoa(p
->prefix
),
946 save_values
= ei
->route_map_set
;
947 ospf_reset_route_map_set_values(&ei
->route_map_set
);
949 /* apply route-map if needed */
950 red
= ospf_redist_lookup(ospf
, type
, instance
);
951 if (red
&& ROUTEMAP_NAME(red
)) {
954 ret
= route_map_apply(ROUTEMAP(red
), (struct prefix
*)p
,
957 if (ret
== RMAP_DENYMATCH
) {
958 ei
->route_map_set
= save_values
;
959 if (IS_DEBUG_OSPF(zebra
, ZEBRA_REDISTRIBUTE
))
961 "Redistribute[%s]: %s/%d filtered by route-map.",
962 ospf_redist_string(type
),
963 inet_ntoa(p
->prefix
), p
->prefixlen
);
967 /* check if 'route-map set' changed something */
969 *changed
= !ospf_route_map_set_compare(
970 &ei
->route_map_set
, &save_values
);
976 /* OSPF route-map set for redistribution */
977 void ospf_routemap_set(struct ospf_redist
*red
, const char *name
)
979 if (ROUTEMAP_NAME(red
))
980 free(ROUTEMAP_NAME(red
));
982 ROUTEMAP_NAME(red
) = strdup(name
);
983 ROUTEMAP(red
) = route_map_lookup_by_name(name
);
986 void ospf_routemap_unset(struct ospf_redist
*red
)
988 if (ROUTEMAP_NAME(red
))
989 free(ROUTEMAP_NAME(red
));
991 ROUTEMAP_NAME(red
) = NULL
;
992 ROUTEMAP(red
) = NULL
;
995 /* Zebra route add and delete treatment. */
996 static int ospf_zebra_read_ipv4(int command
, struct zclient
*zclient
,
997 zebra_size_t length
, vrf_id_t vrf_id
)
1000 struct zapi_ipv4 api
;
1001 unsigned long ifindex
;
1002 struct in_addr nexthop
;
1003 struct prefix_ipv4 p
;
1004 struct external_info
*ei
;
1012 /* Type, flags, message. */
1013 api
.type
= stream_getc(s
);
1014 api
.instance
= stream_getw(s
);
1015 api
.flags
= stream_getl(s
);
1016 api
.message
= stream_getc(s
);
1019 memset(&p
, 0, sizeof(struct prefix_ipv4
));
1021 p
.prefixlen
= MIN(IPV4_MAX_PREFIXLEN
, stream_getc(s
));
1022 stream_get(&p
.prefix
, s
, PSIZE(p
.prefixlen
));
1024 if (IPV4_NET127(ntohl(p
.prefix
.s_addr
)))
1027 /* Nexthop, ifindex, distance, metric. */
1028 if (CHECK_FLAG(api
.message
, ZAPI_MESSAGE_NEXTHOP
)) {
1029 api
.nexthop_num
= stream_getc(s
);
1030 nexthop
.s_addr
= stream_get_ipv4(s
);
1032 if (CHECK_FLAG(api
.message
, ZAPI_MESSAGE_IFINDEX
)) {
1033 api
.ifindex_num
= stream_getc(s
);
1034 /* XXX assert(api.ifindex_num == 1); */
1035 ifindex
= stream_getl(s
);
1037 if (CHECK_FLAG(api
.message
, ZAPI_MESSAGE_DISTANCE
))
1038 api
.distance
= stream_getc(s
);
1039 if (CHECK_FLAG(api
.message
, ZAPI_MESSAGE_METRIC
))
1040 api
.metric
= stream_getl(s
);
1041 if (CHECK_FLAG(api
.message
, ZAPI_MESSAGE_TAG
))
1042 api
.tag
= stream_getl(s
);
1046 ospf
= ospf_lookup();
1050 if (command
== ZEBRA_REDISTRIBUTE_IPV4_ADD
) {
1051 /* XXX|HACK|TODO|FIXME:
1052 * Maybe we should ignore reject/blackhole routes? Testing shows
1054 * there is no problems though and this is only way to
1056 * routes in ASBR at the moment. Maybe we need just a better
1058 * solution for these types?
1060 * if ( CHECK_FLAG (api.flags, ZEBRA_FLAG_BLACKHOLE)
1061 * || CHECK_FLAG (api.flags, ZEBRA_FLAG_REJECT))
1065 /* Protocol tag overwrites all other tag value send by zebra */
1066 if (ospf
->dtag
[api
.type
] > 0)
1067 api
.tag
= ospf
->dtag
[api
.type
];
1070 * Given zebra sends update for a prefix via ADD message, it
1072 * be considered as an implicit DEL for that prefix with other
1076 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++)
1078 ospf_external_info_delete(i
, api
.instance
, p
);
1080 ei
= ospf_external_info_add(api
.type
, api
.instance
, p
, ifindex
,
1083 /* Nothing has changed, so nothing to do; return */
1086 if (ospf
->router_id
.s_addr
== 0)
1087 /* Set flags to generate AS-external-LSA originate event
1088 for each redistributed protocols later. */
1089 ospf
->external_origin
|= (1 << api
.type
);
1092 if (is_prefix_default(&p
))
1093 ospf_external_lsa_refresh_default(ospf
);
1095 struct ospf_lsa
*current
;
1097 current
= ospf_external_info_find_lsa(
1100 ospf_external_lsa_originate(
1105 ZEBRA_REDISTRIBUTE
))
1107 "ospf_zebra_read_ipv4() : %s refreshing LSA",
1110 ospf_external_lsa_refresh(
1117 } else /* if (command == ZEBRA_REDISTRIBUTE_IPV4_DEL) */
1119 ospf_external_info_delete(api
.type
, api
.instance
, p
);
1120 if (is_prefix_default(&p
))
1121 ospf_external_lsa_refresh_default(ospf
);
1123 ospf_external_lsa_flush(ospf
, api
.type
, &p
,
1124 ifindex
/*, nexthop */);
1131 int ospf_distribute_list_out_set(struct ospf
*ospf
, int type
, const char *name
)
1133 /* Lookup access-list for distribute-list. */
1134 DISTRIBUTE_LIST(ospf
, type
) = access_list_lookup(AFI_IP
, name
);
1136 /* Clear previous distribute-name. */
1137 if (DISTRIBUTE_NAME(ospf
, type
))
1138 free(DISTRIBUTE_NAME(ospf
, type
));
1140 /* Set distribute-name. */
1141 DISTRIBUTE_NAME(ospf
, type
) = strdup(name
);
1143 /* If access-list have been set, schedule update timer. */
1144 if (DISTRIBUTE_LIST(ospf
, type
))
1145 ospf_distribute_list_update(ospf
, type
, 0);
1150 int ospf_distribute_list_out_unset(struct ospf
*ospf
, int type
,
1153 /* Schedule update timer. */
1154 if (DISTRIBUTE_LIST(ospf
, type
))
1155 ospf_distribute_list_update(ospf
, type
, 0);
1157 /* Unset distribute-list. */
1158 DISTRIBUTE_LIST(ospf
, type
) = NULL
;
1160 /* Clear distribute-name. */
1161 if (DISTRIBUTE_NAME(ospf
, type
))
1162 free(DISTRIBUTE_NAME(ospf
, type
));
1164 DISTRIBUTE_NAME(ospf
, type
) = NULL
;
1169 /* distribute-list update timer. */
1170 static int ospf_distribute_list_update_timer(struct thread
*thread
)
1172 struct route_node
*rn
;
1173 struct external_info
*ei
;
1174 struct route_table
*rt
;
1175 struct ospf_lsa
*lsa
;
1176 int type
, default_refresh
= 0;
1179 ospf
= ospf_lookup();
1183 ospf
->t_distribute_update
= NULL
;
1185 zlog_info("Zebra[Redistribute]: distribute-list update timer fired!");
1187 /* foreach all external info. */
1188 for (type
= 0; type
<= ZEBRA_ROUTE_MAX
; type
++) {
1189 struct list
*ext_list
;
1190 struct listnode
*node
;
1191 struct ospf_external
*ext
;
1193 ext_list
= om
->external
[type
];
1197 for (ALL_LIST_ELEMENTS_RO(ext_list
, node
, ext
)) {
1198 rt
= ext
->external_info
;
1201 for (rn
= route_top(rt
); rn
; rn
= route_next(rn
))
1202 if ((ei
= rn
->info
) != NULL
) {
1203 if (is_prefix_default(&ei
->p
))
1204 default_refresh
= 1;
1206 (lsa
= ospf_external_info_find_lsa(
1208 ospf_external_lsa_refresh(
1210 LSA_REFRESH_IF_CHANGED
);
1212 ospf_external_lsa_originate(
1217 if (default_refresh
)
1218 ospf_external_lsa_refresh_default(ospf
);
1222 /* Update distribute-list and set timer to apply access-list. */
1223 void ospf_distribute_list_update(struct ospf
*ospf
, uintptr_t type
,
1226 struct route_table
*rt
;
1227 struct ospf_external
*ext
;
1229 /* External info does not exist. */
1230 ext
= ospf_external_lookup(type
, instance
);
1231 if (!ext
|| !(rt
= EXTERNAL_INFO(ext
)))
1234 /* If exists previously invoked thread, then let it continue. */
1235 if (ospf
->t_distribute_update
)
1239 ospf
->t_distribute_update
= NULL
;
1240 thread_add_timer_msec(master
, ospf_distribute_list_update_timer
,
1241 (void *)type
, ospf
->min_ls_interval
,
1242 &ospf
->t_distribute_update
);
1245 /* If access-list is updated, apply some check. */
1246 static void ospf_filter_update(struct access_list
*access
)
1251 struct ospf_area
*area
;
1252 struct listnode
*node
;
1254 /* If OSPF instance does not exist, return right now. */
1255 ospf
= ospf_lookup();
1259 /* Update distribute-list, and apply filter. */
1260 for (type
= 0; type
<= ZEBRA_ROUTE_MAX
; type
++) {
1261 struct list
*red_list
;
1262 struct listnode
*node
;
1263 struct ospf_redist
*red
;
1265 red_list
= ospf
->redist
[type
];
1267 for (ALL_LIST_ELEMENTS_RO(red_list
, node
, red
)) {
1268 if (ROUTEMAP(red
)) {
1269 /* if route-map is not NULL it may be
1270 * using this access list */
1271 ospf_distribute_list_update(
1272 ospf
, type
, red
->instance
);
1276 /* There is place for route-map for default-information
1277 * (ZEBRA_ROUTE_MAX),
1278 * but no distribute list. */
1279 if (type
== ZEBRA_ROUTE_MAX
)
1282 if (DISTRIBUTE_NAME(ospf
, type
)) {
1283 /* Keep old access-list for distribute-list. */
1284 struct access_list
*old
= DISTRIBUTE_LIST(ospf
, type
);
1286 /* Update access-list for distribute-list. */
1287 DISTRIBUTE_LIST(ospf
, type
) = access_list_lookup(
1288 AFI_IP
, DISTRIBUTE_NAME(ospf
, type
));
1290 /* No update for this distribute type. */
1291 if (old
== NULL
&& DISTRIBUTE_LIST(ospf
, type
) == NULL
)
1294 /* Schedule distribute-list update timer. */
1295 if (DISTRIBUTE_LIST(ospf
, type
) == NULL
1296 || strcmp(DISTRIBUTE_NAME(ospf
, type
), access
->name
)
1298 ospf_distribute_list_update(ospf
, type
, 0);
1302 /* Update Area access-list. */
1303 for (ALL_LIST_ELEMENTS_RO(ospf
->areas
, node
, area
)) {
1304 if (EXPORT_NAME(area
)) {
1305 EXPORT_LIST(area
) = NULL
;
1309 if (IMPORT_NAME(area
)) {
1310 IMPORT_LIST(area
) = NULL
;
1315 /* Schedule ABR tasks -- this will be changed -- takada. */
1316 if (IS_OSPF_ABR(ospf
) && abr_inv
)
1317 ospf_schedule_abr_task(ospf
);
1320 /* If prefix-list is updated, do some updates. */
1321 void ospf_prefix_list_update(struct prefix_list
*plist
)
1326 struct ospf_area
*area
;
1327 struct listnode
*node
;
1329 /* If OSPF instatnce does not exist, return right now. */
1330 ospf
= ospf_lookup();
1334 /* Update all route-maps which are used as redistribution filters.
1335 * They might use prefix-list.
1337 for (type
= 0; type
<= ZEBRA_ROUTE_MAX
; type
++) {
1338 struct list
*red_list
;
1339 struct listnode
*node
;
1340 struct ospf_redist
*red
;
1342 red_list
= ospf
->redist
[type
];
1344 for (ALL_LIST_ELEMENTS_RO(red_list
, node
, red
)) {
1345 if (ROUTEMAP(red
)) {
1346 /* if route-map is not NULL it may be
1347 * using this prefix list */
1348 ospf_distribute_list_update(
1349 ospf
, type
, red
->instance
);
1354 /* Update area filter-lists. */
1355 for (ALL_LIST_ELEMENTS_RO(ospf
->areas
, node
, area
)) {
1356 /* Update filter-list in. */
1357 if (PREFIX_NAME_IN(area
))
1358 if (strcmp(PREFIX_NAME_IN(area
),
1359 prefix_list_name(plist
))
1361 PREFIX_LIST_IN(area
) = prefix_list_lookup(
1362 AFI_IP
, PREFIX_NAME_IN(area
));
1366 /* Update filter-list out. */
1367 if (PREFIX_NAME_OUT(area
))
1368 if (strcmp(PREFIX_NAME_OUT(area
),
1369 prefix_list_name(plist
))
1371 PREFIX_LIST_IN(area
) = prefix_list_lookup(
1372 AFI_IP
, PREFIX_NAME_OUT(area
));
1377 /* Schedule ABR task. */
1378 if (IS_OSPF_ABR(ospf
) && abr_inv
)
1379 ospf_schedule_abr_task(ospf
);
1382 static struct ospf_distance
*ospf_distance_new(void)
1384 return XCALLOC(MTYPE_OSPF_DISTANCE
, sizeof(struct ospf_distance
));
1387 static void ospf_distance_free(struct ospf_distance
*odistance
)
1389 XFREE(MTYPE_OSPF_DISTANCE
, odistance
);
1392 int ospf_distance_set(struct vty
*vty
, struct ospf
*ospf
,
1393 const char *distance_str
, const char *ip_str
,
1394 const char *access_list_str
)
1397 struct prefix_ipv4 p
;
1399 struct route_node
*rn
;
1400 struct ospf_distance
*odistance
;
1402 ret
= str2prefix_ipv4(ip_str
, &p
);
1404 vty_out(vty
, "Malformed prefix\n");
1405 return CMD_WARNING_CONFIG_FAILED
;
1408 distance
= atoi(distance_str
);
1410 /* Get OSPF distance node. */
1411 rn
= route_node_get(ospf
->distance_table
, (struct prefix
*)&p
);
1413 odistance
= rn
->info
;
1414 route_unlock_node(rn
);
1416 odistance
= ospf_distance_new();
1417 rn
->info
= odistance
;
1420 /* Set distance value. */
1421 odistance
->distance
= distance
;
1423 /* Reset access-list configuration. */
1424 if (odistance
->access_list
) {
1425 free(odistance
->access_list
);
1426 odistance
->access_list
= NULL
;
1428 if (access_list_str
)
1429 odistance
->access_list
= strdup(access_list_str
);
1434 int ospf_distance_unset(struct vty
*vty
, struct ospf
*ospf
,
1435 const char *distance_str
, const char *ip_str
,
1436 char const *access_list_str
)
1439 struct prefix_ipv4 p
;
1440 struct route_node
*rn
;
1441 struct ospf_distance
*odistance
;
1443 ret
= str2prefix_ipv4(ip_str
, &p
);
1445 vty_out(vty
, "Malformed prefix\n");
1446 return CMD_WARNING_CONFIG_FAILED
;
1449 rn
= route_node_lookup(ospf
->distance_table
, (struct prefix
*)&p
);
1451 vty_out(vty
, "Can't find specified prefix\n");
1452 return CMD_WARNING_CONFIG_FAILED
;
1455 odistance
= rn
->info
;
1457 if (odistance
->access_list
)
1458 free(odistance
->access_list
);
1459 ospf_distance_free(odistance
);
1462 route_unlock_node(rn
);
1463 route_unlock_node(rn
);
1468 void ospf_distance_reset(struct ospf
*ospf
)
1470 struct route_node
*rn
;
1471 struct ospf_distance
*odistance
;
1473 for (rn
= route_top(ospf
->distance_table
); rn
; rn
= route_next(rn
))
1474 if ((odistance
= rn
->info
) != NULL
) {
1475 if (odistance
->access_list
)
1476 free(odistance
->access_list
);
1477 ospf_distance_free(odistance
);
1479 route_unlock_node(rn
);
1483 u_char
ospf_distance_apply(struct prefix_ipv4
*p
, struct ospf_route
* or)
1487 ospf
= ospf_lookup();
1491 if (ospf
->distance_intra
)
1492 if (or->path_type
== OSPF_PATH_INTRA_AREA
)
1493 return ospf
->distance_intra
;
1495 if (ospf
->distance_inter
)
1496 if (or->path_type
== OSPF_PATH_INTER_AREA
)
1497 return ospf
->distance_inter
;
1499 if (ospf
->distance_external
)
1500 if (or->path_type
== OSPF_PATH_TYPE1_EXTERNAL
||
1501 or->path_type
== OSPF_PATH_TYPE2_EXTERNAL
)
1502 return ospf
->distance_external
;
1504 if (ospf
->distance_all
)
1505 return ospf
->distance_all
;
1510 static void ospf_zebra_connected(struct zclient
*zclient
)
1512 /* Send the client registration */
1513 bfd_client_sendmsg(zclient
, ZEBRA_BFD_CLIENT_REGISTER
);
1515 zclient_send_reg_requests(zclient
, VRF_DEFAULT
);
1518 void ospf_zebra_init(struct thread_master
*master
, u_short instance
)
1520 /* Allocate zebra structure. */
1521 zclient
= zclient_new(master
);
1522 zclient_init(zclient
, ZEBRA_ROUTE_OSPF
, instance
);
1523 zclient
->zebra_connected
= ospf_zebra_connected
;
1524 zclient
->router_id_update
= ospf_router_id_update_zebra
;
1525 zclient
->interface_add
= ospf_interface_add
;
1526 zclient
->interface_delete
= ospf_interface_delete
;
1527 zclient
->interface_up
= ospf_interface_state_up
;
1528 zclient
->interface_down
= ospf_interface_state_down
;
1529 zclient
->interface_address_add
= ospf_interface_address_add
;
1530 zclient
->interface_address_delete
= ospf_interface_address_delete
;
1531 zclient
->interface_link_params
= ospf_interface_link_params
;
1533 zclient
->redistribute_route_ipv4_add
= ospf_zebra_read_ipv4
;
1534 zclient
->redistribute_route_ipv4_del
= ospf_zebra_read_ipv4
;
1536 access_list_add_hook(ospf_filter_update
);
1537 access_list_delete_hook(ospf_filter_update
);
1538 prefix_list_add_hook(ospf_prefix_list_update
);
1539 prefix_list_delete_hook(ospf_prefix_list_update
);