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_MTYPE_STATIC(OSPFD
, OSPF_EXTERNAL
, "OSPF External route table")
55 DEFINE_MTYPE_STATIC(OSPFD
, OSPF_REDISTRIBUTE
, "OSPF Redistriute")
56 DEFINE_MTYPE_STATIC(OSPFD
, OSPF_DIST_ARGS
, "OSPF Distribute arguments")
58 DEFINE_HOOK(ospf_if_update
, (struct interface
* ifp
), (ifp
))
59 DEFINE_HOOK(ospf_if_delete
, (struct interface
* ifp
), (ifp
))
61 /* Zebra structure to hold current status. */
62 struct zclient
*zclient
= NULL
;
64 /* For registering threads. */
65 extern struct thread_master
*master
;
67 /* Router-id update message from zebra. */
68 static int ospf_router_id_update_zebra(int command
, struct zclient
*zclient
,
69 zebra_size_t length
, vrf_id_t vrf_id
)
71 struct ospf
*ospf
= NULL
;
72 struct prefix router_id
;
73 zebra_router_id_update_read(zclient
->ibuf
, &router_id
);
75 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
)) {
76 char buf
[PREFIX2STR_BUFFER
];
77 prefix2str(&router_id
, buf
, sizeof(buf
));
78 zlog_debug("Zebra rcvd: router id update %s vrf %s id %u",
79 buf
, ospf_vrf_id_to_name(vrf_id
), vrf_id
);
82 ospf
= ospf_lookup_by_vrf_id(vrf_id
);
85 ospf
->router_id_zebra
= router_id
.u
.prefix4
;
86 ospf_router_id_update(ospf
);
88 if (IS_DEBUG_OSPF_EVENT
) {
89 char buf
[PREFIX2STR_BUFFER
];
91 prefix2str(&router_id
, buf
, sizeof(buf
));
92 zlog_debug("%s: ospf instance not found for vrf %s id %u router_id %s",
94 ospf_vrf_id_to_name(vrf_id
), vrf_id
, buf
);
100 /* Inteface addition message from zebra. */
101 static int ospf_interface_add(int command
, struct zclient
*zclient
,
102 zebra_size_t length
, vrf_id_t vrf_id
)
104 struct interface
*ifp
= NULL
;
105 struct ospf
*ospf
= NULL
;
107 ifp
= zebra_interface_add_read(zclient
->ibuf
, vrf_id
);
111 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
113 "Zebra: interface add %s vrf %s[%u] index %d flags %llx metric %d mtu %d",
114 ifp
->name
, ospf_vrf_id_to_name(ifp
->vrf_id
),
115 ifp
->vrf_id
, ifp
->ifindex
,
116 (unsigned long long)ifp
->flags
, ifp
->metric
, ifp
->mtu
);
120 if (!OSPF_IF_PARAM_CONFIGURED(IF_DEF_PARAMS(ifp
), type
)) {
121 SET_IF_PARAM(IF_DEF_PARAMS(ifp
), type
);
122 IF_DEF_PARAMS(ifp
)->type
= ospf_default_iftype(ifp
);
125 ospf
= ospf_lookup_by_vrf_id(vrf_id
);
129 ospf_if_update(ospf
, ifp
);
131 hook_call(ospf_if_update
, ifp
);
136 static int ospf_interface_delete(int command
, struct zclient
*zclient
,
137 zebra_size_t length
, vrf_id_t vrf_id
)
139 struct interface
*ifp
;
141 struct route_node
*rn
;
144 /* zebra_interface_state_read() updates interface structure in iflist */
145 ifp
= zebra_interface_state_read(s
, vrf_id
);
151 zlog_warn("Zebra: got delete of %s, but interface is still up",
154 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
156 "Zebra: interface delete %s vrf %s[%u] index %d flags %llx metric %d mtu %d",
157 ifp
->name
, ospf_vrf_id_to_name(ifp
->vrf_id
),
158 ifp
->vrf_id
, ifp
->ifindex
,
159 (unsigned long long)ifp
->flags
, ifp
->metric
, ifp
->mtu
);
161 hook_call(ospf_if_delete
, ifp
);
163 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
))
165 ospf_if_free((struct ospf_interface
*)rn
->info
);
167 if_set_index(ifp
, IFINDEX_INTERNAL
);
171 static struct interface
*zebra_interface_if_lookup(struct stream
*s
,
174 char ifname_tmp
[INTERFACE_NAMSIZ
];
176 /* Read interface name. */
177 stream_get(ifname_tmp
, s
, INTERFACE_NAMSIZ
);
179 /* And look it up. */
180 return if_lookup_by_name(ifname_tmp
, vrf_id
);
183 static int ospf_interface_state_up(int command
, struct zclient
*zclient
,
184 zebra_size_t length
, vrf_id_t vrf_id
)
186 struct interface
*ifp
;
187 struct ospf_interface
*oi
;
188 struct route_node
*rn
;
190 ifp
= zebra_interface_if_lookup(zclient
->ibuf
, vrf_id
);
195 /* Interface is already up. */
196 if (if_is_operative(ifp
)) {
197 /* Temporarily keep ifp values. */
198 struct interface if_tmp
;
199 memcpy(&if_tmp
, ifp
, sizeof(struct interface
));
201 zebra_interface_if_set_value(zclient
->ibuf
, ifp
);
203 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
205 "Zebra: Interface[%s] state update speed %u -> %u, bw %d -> %d",
206 ifp
->name
, if_tmp
.speed
, ifp
->speed
,
207 if_tmp
.bandwidth
, ifp
->bandwidth
);
209 ospf_if_recalculate_output_cost(ifp
);
211 if (if_tmp
.mtu
!= ifp
->mtu
) {
212 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
214 "Zebra: Interface[%s] MTU change %u -> %u.",
215 ifp
->name
, if_tmp
.mtu
, ifp
->mtu
);
217 /* Must reset the interface (simulate down/up) when MTU
224 zebra_interface_if_set_value(zclient
->ibuf
, ifp
);
226 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
227 zlog_debug("Zebra: Interface[%s] state change to up.",
230 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next(rn
)) {
231 if ((oi
= rn
->info
) == NULL
)
240 static int ospf_interface_state_down(int command
, struct zclient
*zclient
,
241 zebra_size_t length
, vrf_id_t vrf_id
)
243 struct interface
*ifp
;
244 struct ospf_interface
*oi
;
245 struct route_node
*node
;
247 ifp
= zebra_interface_state_read(zclient
->ibuf
, vrf_id
);
252 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
))
253 zlog_debug("Zebra: Interface[%s] state change to down.",
256 for (node
= route_top(IF_OIFS(ifp
)); node
; node
= route_next(node
)) {
257 if ((oi
= node
->info
) == NULL
)
265 static int ospf_interface_address_add(int command
, struct zclient
*zclient
,
266 zebra_size_t length
, vrf_id_t vrf_id
)
269 struct ospf
*ospf
= NULL
;
272 c
= zebra_interface_address_read(command
, zclient
->ibuf
, vrf_id
);
277 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
)) {
278 char buf
[PREFIX2STR_BUFFER
];
279 prefix2str(c
->address
, buf
, sizeof(buf
));
280 zlog_debug("Zebra: interface %s address add %s vrf %s id %u",
281 c
->ifp
->name
, buf
, ospf_vrf_id_to_name(vrf_id
),
285 ospf
= ospf_lookup_by_vrf_id(vrf_id
);
289 ospf_if_update(ospf
, c
->ifp
);
291 hook_call(ospf_if_update
, c
->ifp
);
296 static int ospf_interface_address_delete(int command
, struct zclient
*zclient
,
297 zebra_size_t length
, vrf_id_t vrf_id
)
300 struct interface
*ifp
;
301 struct ospf_interface
*oi
;
302 struct route_node
*rn
;
305 c
= zebra_interface_address_read(command
, zclient
->ibuf
, vrf_id
);
310 if (IS_DEBUG_OSPF(zebra
, ZEBRA_INTERFACE
)) {
311 char buf
[PREFIX2STR_BUFFER
];
312 prefix2str(c
->address
, buf
, sizeof(buf
));
313 zlog_debug("Zebra: interface %s address delete %s",
319 p
.prefixlen
= IPV4_MAX_PREFIXLEN
;
321 rn
= route_node_lookup(IF_OIFS(ifp
), &p
);
329 route_unlock_node(rn
);
331 /* Call interface hook functions to clean up */
334 hook_call(ospf_if_update
, c
->ifp
);
341 static int ospf_interface_link_params(int command
, struct zclient
*zclient
,
344 struct interface
*ifp
;
346 ifp
= zebra_interface_link_params_read(zclient
->ibuf
);
352 ospf_mpls_te_update_if(ifp
);
357 /* VRF update for an interface. */
358 static int ospf_interface_vrf_update(int command
, struct zclient
*zclient
,
359 zebra_size_t length
, vrf_id_t vrf_id
)
361 struct interface
*ifp
= NULL
;
364 ifp
= zebra_interface_vrf_update_read(zclient
->ibuf
, vrf_id
,
369 if (IS_DEBUG_OSPF_EVENT
)
370 zlog_debug("%s: Rx Interface %s VRF change vrf_id %u New vrf %s id %u",
371 __PRETTY_FUNCTION__
, ifp
->name
, vrf_id
,
372 ospf_vrf_id_to_name(new_vrf_id
), new_vrf_id
);
374 /*if_update(ifp, ifp->name, strlen(ifp->name), new_vrf_id);*/
375 if_update_to_new_vrf(ifp
, new_vrf_id
);
380 void ospf_zebra_add(struct ospf
*ospf
, struct prefix_ipv4
*p
,
381 struct ospf_route
*or)
383 struct zapi_route api
;
384 struct zapi_nexthop
*api_nh
;
386 struct ospf_path
*path
;
387 struct listnode
*node
;
390 memset(&api
, 0, sizeof(api
));
391 api
.vrf_id
= ospf
->vrf_id
;
392 api
.nh_vrf_id
= ospf
->vrf_id
;
393 api
.type
= ZEBRA_ROUTE_OSPF
;
394 api
.instance
= ospf
->instance
;
395 api
.safi
= SAFI_UNICAST
;
397 memcpy(&api
.prefix
, p
, sizeof(*p
));
398 SET_FLAG(api
.message
, ZAPI_MESSAGE_NEXTHOP
);
401 SET_FLAG(api
.message
, ZAPI_MESSAGE_METRIC
);
402 if (or->path_type
== OSPF_PATH_TYPE1_EXTERNAL
)
403 api
.metric
= or->cost
+ or->u
.ext
.type2_cost
;
404 else if (or->path_type
== OSPF_PATH_TYPE2_EXTERNAL
)
405 api
.metric
= or->u
.ext
.type2_cost
;
407 api
.metric
= or->cost
;
409 /* Check if path type is ASE */
410 if (((or->path_type
== OSPF_PATH_TYPE1_EXTERNAL
)
411 || (or->path_type
== OSPF_PATH_TYPE2_EXTERNAL
))
412 && (or->u
.ext
.tag
> 0) && (or->u
.ext
.tag
<= ROUTE_TAG_MAX
)) {
413 SET_FLAG(api
.message
, ZAPI_MESSAGE_TAG
);
414 api
.tag
= or->u
.ext
.tag
;
417 /* Distance value. */
418 distance
= ospf_distance_apply(ospf
, p
, or);
420 SET_FLAG(api
.message
, ZAPI_MESSAGE_DISTANCE
);
421 api
.distance
= distance
;
424 /* Nexthop, ifindex, distance and metric information. */
425 for (ALL_LIST_ELEMENTS_RO(or->paths
, node
, path
)) {
426 if (count
>= MULTIPATH_NUM
)
428 api_nh
= &api
.nexthops
[count
];
430 if (path
->unnumbered
|| (path
->nexthop
.s_addr
!= INADDR_ANY
431 && path
->ifindex
!= 0)) {
432 #else /* HAVE_NETLINK */
433 if (path
->nexthop
.s_addr
!= INADDR_ANY
&& path
->ifindex
!= 0) {
434 #endif /* HAVE_NETLINK */
435 api_nh
->gate
.ipv4
= path
->nexthop
;
436 api_nh
->ifindex
= path
->ifindex
;
437 api_nh
->type
= NEXTHOP_TYPE_IPV4_IFINDEX
;
438 } else if (path
->nexthop
.s_addr
!= INADDR_ANY
) {
439 api_nh
->gate
.ipv4
= path
->nexthop
;
440 api_nh
->type
= NEXTHOP_TYPE_IPV4
;
442 api_nh
->ifindex
= path
->ifindex
;
443 api_nh
->type
= NEXTHOP_TYPE_IFINDEX
;
447 if (IS_DEBUG_OSPF(zebra
, ZEBRA_REDISTRIBUTE
)) {
448 char buf
[2][INET_ADDRSTRLEN
];
450 "Zebra: Route add %s/%d nexthop %s, ifindex=%d",
451 inet_ntop(AF_INET
, &p
->prefix
, buf
[0],
453 p
->prefixlen
, inet_ntop(AF_INET
, &path
->nexthop
,
454 buf
[1], sizeof(buf
[1])),
458 api
.nexthop_num
= count
;
460 zclient_route_send(ZEBRA_ROUTE_ADD
, zclient
, &api
);
463 void ospf_zebra_delete(struct ospf
*ospf
, struct prefix_ipv4
*p
,
464 struct ospf_route
*or)
466 struct zapi_route api
;
468 memset(&api
, 0, sizeof(api
));
469 api
.vrf_id
= ospf
->vrf_id
;
470 api
.nh_vrf_id
= ospf
->vrf_id
;
471 api
.type
= ZEBRA_ROUTE_OSPF
;
472 api
.instance
= ospf
->instance
;
473 api
.safi
= SAFI_UNICAST
;
474 memcpy(&api
.prefix
, p
, sizeof(*p
));
476 if (IS_DEBUG_OSPF(zebra
, ZEBRA_REDISTRIBUTE
)) {
477 char buf
[INET_ADDRSTRLEN
];
478 zlog_debug("Zebra: Route delete %s/%d",
479 inet_ntop(AF_INET
, &p
->prefix
, buf
, sizeof(buf
[0])),
483 zclient_route_send(ZEBRA_ROUTE_DELETE
, zclient
, &api
);
486 void ospf_zebra_add_discard(struct ospf
*ospf
, struct prefix_ipv4
*p
)
488 struct zapi_route api
;
490 memset(&api
, 0, sizeof(api
));
491 api
.vrf_id
= ospf
->vrf_id
;
492 api
.nh_vrf_id
= ospf
->vrf_id
;
493 api
.type
= ZEBRA_ROUTE_OSPF
;
494 api
.instance
= ospf
->instance
;
495 api
.safi
= SAFI_UNICAST
;
496 memcpy(&api
.prefix
, p
, sizeof(*p
));
497 zapi_route_set_blackhole(&api
, BLACKHOLE_NULL
);
499 zclient_route_send(ZEBRA_ROUTE_ADD
, zclient
, &api
);
501 if (IS_DEBUG_OSPF(zebra
, ZEBRA_REDISTRIBUTE
))
502 zlog_debug("Zebra: Route add discard %s/%d",
503 inet_ntoa(p
->prefix
), p
->prefixlen
);
506 void ospf_zebra_delete_discard(struct ospf
*ospf
, struct prefix_ipv4
*p
)
508 struct zapi_route api
;
510 memset(&api
, 0, sizeof(api
));
511 api
.vrf_id
= ospf
->vrf_id
;
512 api
.nh_vrf_id
= ospf
->vrf_id
;
513 api
.type
= ZEBRA_ROUTE_OSPF
;
514 api
.instance
= ospf
->instance
;
515 api
.safi
= SAFI_UNICAST
;
516 memcpy(&api
.prefix
, p
, sizeof(*p
));
517 zapi_route_set_blackhole(&api
, BLACKHOLE_NULL
);
519 zclient_route_send(ZEBRA_ROUTE_DELETE
, zclient
, &api
);
521 if (IS_DEBUG_OSPF(zebra
, ZEBRA_REDISTRIBUTE
))
522 zlog_debug("Zebra: Route delete discard %s/%d",
523 inet_ntoa(p
->prefix
), p
->prefixlen
);
526 struct ospf_external
*ospf_external_lookup(struct ospf
*ospf
, u_char type
,
529 struct list
*ext_list
;
530 struct listnode
*node
;
531 struct ospf_external
*ext
;
533 ext_list
= ospf
->external
[type
];
537 for (ALL_LIST_ELEMENTS_RO(ext_list
, node
, ext
))
538 if (ext
->instance
== instance
)
544 struct ospf_external
*ospf_external_add(struct ospf
*ospf
, u_char type
,
547 struct list
*ext_list
;
548 struct ospf_external
*ext
;
550 ext
= ospf_external_lookup(ospf
, type
, instance
);
554 if (!ospf
->external
[type
])
555 ospf
->external
[type
] = list_new();
557 ext_list
= ospf
->external
[type
];
558 ext
= (struct ospf_external
*)XCALLOC(MTYPE_OSPF_EXTERNAL
,
559 sizeof(struct ospf_external
));
560 ext
->instance
= instance
;
561 EXTERNAL_INFO(ext
) = route_table_init();
563 listnode_add(ext_list
, ext
);
568 void ospf_external_del(struct ospf
*ospf
, u_char type
, u_short instance
)
570 struct ospf_external
*ext
;
572 ext
= ospf_external_lookup(ospf
, type
, instance
);
575 if (EXTERNAL_INFO(ext
))
576 route_table_finish(EXTERNAL_INFO(ext
));
578 listnode_delete(ospf
->external
[type
], ext
);
580 if (!ospf
->external
[type
]->count
)
581 list_delete_and_null(&ospf
->external
[type
]);
583 XFREE(MTYPE_OSPF_EXTERNAL
, ext
);
587 struct ospf_redist
*ospf_redist_lookup(struct ospf
*ospf
, u_char type
,
590 struct list
*red_list
;
591 struct listnode
*node
;
592 struct ospf_redist
*red
;
594 red_list
= ospf
->redist
[type
];
598 for (ALL_LIST_ELEMENTS_RO(red_list
, node
, red
))
599 if (red
->instance
== instance
)
605 struct ospf_redist
*ospf_redist_add(struct ospf
*ospf
, u_char type
,
608 struct list
*red_list
;
609 struct ospf_redist
*red
;
611 red
= ospf_redist_lookup(ospf
, type
, instance
);
615 if (!ospf
->redist
[type
])
616 ospf
->redist
[type
] = list_new();
618 red_list
= ospf
->redist
[type
];
619 red
= (struct ospf_redist
*)XCALLOC(MTYPE_OSPF_REDISTRIBUTE
,
620 sizeof(struct ospf_redist
));
621 red
->instance
= instance
;
622 red
->dmetric
.type
= -1;
623 red
->dmetric
.value
= -1;
625 listnode_add(red_list
, red
);
630 void ospf_redist_del(struct ospf
*ospf
, u_char type
, u_short instance
)
632 struct ospf_redist
*red
;
634 red
= ospf_redist_lookup(ospf
, type
, instance
);
637 listnode_delete(ospf
->redist
[type
], red
);
638 if (!ospf
->redist
[type
]->count
) {
639 list_delete_and_null(&ospf
->redist
[type
]);
641 ospf_routemap_unset(red
);
642 XFREE(MTYPE_OSPF_REDISTRIBUTE
, red
);
647 int ospf_is_type_redistributed(struct ospf
*ospf
, int type
, u_short instance
)
649 return (DEFAULT_ROUTE_TYPE(type
)
650 ? vrf_bitmap_check(zclient
->default_information
,
653 && redist_check_instance(
654 &zclient
->mi_redist
[AFI_IP
][type
],
658 zclient
->redist
[AFI_IP
][type
],
662 int ospf_redistribute_set(struct ospf
*ospf
, int type
, u_short instance
,
663 int mtype
, int mvalue
)
666 struct ospf_redist
*red
;
668 red
= ospf_redist_lookup(ospf
, type
, instance
);
669 if (ospf_is_type_redistributed(ospf
, type
, instance
)) {
670 if (mtype
!= red
->dmetric
.type
) {
671 red
->dmetric
.type
= mtype
;
672 force
= LSA_REFRESH_FORCE
;
674 if (mvalue
!= red
->dmetric
.value
) {
675 red
->dmetric
.value
= mvalue
;
676 force
= LSA_REFRESH_FORCE
;
679 ospf_external_lsa_refresh_type(ospf
, type
, instance
, force
);
681 if (IS_DEBUG_OSPF(zebra
, ZEBRA_REDISTRIBUTE
))
683 "Redistribute[%s][%d]: Refresh Type[%d], Metric[%d]",
684 ospf_redist_string(type
), instance
,
685 metric_type(ospf
, type
, instance
),
686 metric_value(ospf
, type
, instance
));
691 red
->dmetric
.type
= mtype
;
692 red
->dmetric
.value
= mvalue
;
694 ospf_external_add(ospf
, type
, instance
);
696 zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD
, zclient
, AFI_IP
, type
,
697 instance
, ospf
->vrf_id
);
699 if (IS_DEBUG_OSPF(zebra
, ZEBRA_REDISTRIBUTE
))
700 zlog_debug("Redistribute[%s][%d] vrf id %u: Start Type[%d], Metric[%d]",
701 ospf_redist_string(type
), instance
, ospf
->vrf_id
,
702 metric_type(ospf
, type
, instance
),
703 metric_value(ospf
, type
, instance
));
705 ospf_asbr_status_update(ospf
, ++ospf
->redistribute
);
710 int ospf_redistribute_unset(struct ospf
*ospf
, int type
, u_short instance
)
712 if (type
== zclient
->redist_default
&& instance
== zclient
->instance
)
715 if (!ospf_is_type_redistributed(ospf
, type
, instance
))
718 zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE
, zclient
, AFI_IP
, type
,
719 instance
, ospf
->vrf_id
);
721 if (IS_DEBUG_OSPF(zebra
, ZEBRA_REDISTRIBUTE
))
722 zlog_debug("Redistribute[%s][%d] vrf id %u: Stop",
723 ospf_redist_string(type
), instance
, ospf
->vrf_id
);
725 ospf_redist_del(ospf
, type
, instance
);
727 /* Remove the routes from OSPF table. */
728 ospf_redistribute_withdraw(ospf
, type
, instance
);
730 ospf_external_del(ospf
, type
, instance
);
732 ospf_asbr_status_update(ospf
, --ospf
->redistribute
);
737 int ospf_redistribute_default_set(struct ospf
*ospf
, int originate
, int mtype
,
740 struct ospf_redist
*red
;
742 ospf
->default_originate
= originate
;
744 red
= ospf_redist_add(ospf
, DEFAULT_ROUTE
, 0);
745 red
->dmetric
.type
= mtype
;
746 red
->dmetric
.value
= mvalue
;
748 ospf_external_add(ospf
, DEFAULT_ROUTE
, 0);
750 if (ospf_is_type_redistributed(ospf
, DEFAULT_ROUTE
, 0)) {
751 /* if ospf->default_originate changes value, is calling
752 ospf_external_lsa_refresh_default sufficient to implement
754 ospf_external_lsa_refresh_default(ospf
);
756 if (IS_DEBUG_OSPF(zebra
, ZEBRA_REDISTRIBUTE
))
758 "Redistribute[%s]: Refresh Type[%d], Metric[%d]",
759 ospf_redist_string(DEFAULT_ROUTE
),
760 metric_type(ospf
, DEFAULT_ROUTE
, 0),
761 metric_value(ospf
, DEFAULT_ROUTE
, 0));
765 zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_ADD
, zclient
,
768 if (IS_DEBUG_OSPF(zebra
, ZEBRA_REDISTRIBUTE
))
769 zlog_debug("Redistribute[DEFAULT]: Start Type[%d], Metric[%d]",
770 metric_type(ospf
, DEFAULT_ROUTE
, 0),
771 metric_value(ospf
, DEFAULT_ROUTE
, 0));
773 if (ospf
->router_id
.s_addr
== 0)
774 ospf
->external_origin
|= (1 << DEFAULT_ROUTE
);
776 thread_add_timer(master
, ospf_default_originate_timer
, ospf
, 1,
779 ospf_asbr_status_update(ospf
, ++ospf
->redistribute
);
784 int ospf_redistribute_default_unset(struct ospf
*ospf
)
786 if (!ospf_is_type_redistributed(ospf
, DEFAULT_ROUTE
, 0))
789 ospf
->default_originate
= DEFAULT_ORIGINATE_NONE
;
790 ospf_redist_del(ospf
, DEFAULT_ROUTE
, 0);
792 zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_DELETE
, zclient
,
795 if (IS_DEBUG_OSPF(zebra
, ZEBRA_REDISTRIBUTE
))
796 zlog_debug("Redistribute[DEFAULT]: Stop");
798 // Pending: how does the external_info cleanup work in this case?
800 ospf_asbr_status_update(ospf
, --ospf
->redistribute
);
805 static int ospf_external_lsa_originate_check(struct ospf
*ospf
,
806 struct external_info
*ei
)
808 /* If prefix is multicast, then do not originate LSA. */
809 if (IN_MULTICAST(htonl(ei
->p
.prefix
.s_addr
))) {
811 "LSA[Type5:%s]: Not originate AS-external-LSA, "
812 "Prefix belongs multicast",
813 inet_ntoa(ei
->p
.prefix
));
817 /* Take care of default-originate. */
818 if (is_prefix_default(&ei
->p
))
819 if (ospf
->default_originate
== DEFAULT_ORIGINATE_NONE
) {
821 "LSA[Type5:0.0.0.0]: Not originate AS-external-LSA "
829 /* If connected prefix is OSPF enable interface, then do not announce. */
830 int ospf_distribute_check_connected(struct ospf
*ospf
, struct external_info
*ei
)
832 struct listnode
*node
;
833 struct ospf_interface
*oi
;
836 for (ALL_LIST_ELEMENTS_RO(ospf
->oiflist
, node
, oi
))
837 if (prefix_match(oi
->address
, (struct prefix
*)&ei
->p
))
842 /* return 1 if external LSA must be originated, 0 otherwise */
843 int ospf_redistribute_check(struct ospf
*ospf
, struct external_info
*ei
,
846 struct route_map_set_values save_values
;
847 struct prefix_ipv4
*p
= &ei
->p
;
848 struct ospf_redist
*red
;
849 u_char type
= is_prefix_default(&ei
->p
) ? DEFAULT_ROUTE
: ei
->type
;
850 u_short instance
= is_prefix_default(&ei
->p
) ? 0 : ei
->instance
;
855 if (!ospf_external_lsa_originate_check(ospf
, ei
))
858 /* Take care connected route. */
859 if (type
== ZEBRA_ROUTE_CONNECT
860 && !ospf_distribute_check_connected(ospf
, ei
))
863 if (!DEFAULT_ROUTE_TYPE(type
) && DISTRIBUTE_NAME(ospf
, type
))
864 /* distirbute-list exists, but access-list may not? */
865 if (DISTRIBUTE_LIST(ospf
, type
))
866 if (access_list_apply(DISTRIBUTE_LIST(ospf
, type
), p
)
868 if (IS_DEBUG_OSPF(zebra
, ZEBRA_REDISTRIBUTE
))
870 "Redistribute[%s]: %s/%d filtered by ditribute-list.",
871 ospf_redist_string(type
),
872 inet_ntoa(p
->prefix
),
877 save_values
= ei
->route_map_set
;
878 ospf_reset_route_map_set_values(&ei
->route_map_set
);
880 /* apply route-map if needed */
881 red
= ospf_redist_lookup(ospf
, type
, instance
);
882 if (red
&& ROUTEMAP_NAME(red
)) {
885 ret
= route_map_apply(ROUTEMAP(red
), (struct prefix
*)p
,
888 if (ret
== RMAP_DENYMATCH
) {
889 ei
->route_map_set
= save_values
;
890 if (IS_DEBUG_OSPF(zebra
, ZEBRA_REDISTRIBUTE
))
892 "Redistribute[%s]: %s/%d filtered by route-map.",
893 ospf_redist_string(type
),
894 inet_ntoa(p
->prefix
), p
->prefixlen
);
898 /* check if 'route-map set' changed something */
900 *changed
= !ospf_route_map_set_compare(
901 &ei
->route_map_set
, &save_values
);
907 /* OSPF route-map set for redistribution */
908 void ospf_routemap_set(struct ospf_redist
*red
, const char *name
)
910 if (ROUTEMAP_NAME(red
))
911 free(ROUTEMAP_NAME(red
));
913 ROUTEMAP_NAME(red
) = strdup(name
);
914 ROUTEMAP(red
) = route_map_lookup_by_name(name
);
917 void ospf_routemap_unset(struct ospf_redist
*red
)
919 if (ROUTEMAP_NAME(red
))
920 free(ROUTEMAP_NAME(red
));
922 ROUTEMAP_NAME(red
) = NULL
;
923 ROUTEMAP(red
) = NULL
;
926 /* Zebra route add and delete treatment. */
927 static int ospf_zebra_read_route(int command
, struct zclient
*zclient
,
928 zebra_size_t length
, vrf_id_t vrf_id
)
930 struct zapi_route api
;
931 struct prefix_ipv4 p
;
932 unsigned long ifindex
;
933 struct in_addr nexthop
;
934 struct external_info
*ei
;
938 ospf
= ospf_lookup_by_vrf_id(vrf_id
);
942 if (zapi_route_decode(zclient
->ibuf
, &api
) < 0)
945 ifindex
= api
.nexthops
[0].ifindex
;
946 nexthop
= api
.nexthops
[0].gate
.ipv4
;
948 memcpy(&p
, &api
.prefix
, sizeof(p
));
949 if (IPV4_NET127(ntohl(p
.prefix
.s_addr
)))
952 if (command
== ZEBRA_REDISTRIBUTE_ROUTE_ADD
) {
953 /* XXX|HACK|TODO|FIXME:
954 * Maybe we should ignore reject/blackhole routes? Testing
955 * shows that there is no problems though and this is only way
956 * to "summarize" routes in ASBR at the moment. Maybe we need
957 * just a better generalised solution for these types?
960 /* Protocol tag overwrites all other tag value sent by zebra */
961 if (ospf
->dtag
[api
.type
] > 0)
962 api
.tag
= ospf
->dtag
[api
.type
];
965 * Given zebra sends update for a prefix via ADD message, it
967 * be considered as an implicit DEL for that prefix with other
971 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++)
973 ospf_external_info_delete(ospf
, i
,
976 ei
= ospf_external_info_add(ospf
, api
.type
, api
.instance
, p
,
977 ifindex
, nexthop
, api
.tag
);
979 /* Nothing has changed, so nothing to do; return */
982 if (ospf
->router_id
.s_addr
== 0)
983 /* Set flags to generate AS-external-LSA originate event
984 for each redistributed protocols later. */
985 ospf
->external_origin
|= (1 << api
.type
);
988 if (is_prefix_default(&p
))
989 ospf_external_lsa_refresh_default(ospf
);
991 struct ospf_lsa
*current
;
993 current
= ospf_external_info_find_lsa(
996 ospf_external_lsa_originate(
1001 ZEBRA_REDISTRIBUTE
))
1003 "ospf_zebra_read_route() : %s refreshing LSA",
1006 ospf_external_lsa_refresh(
1013 } else /* if (command == ZEBRA_REDISTRIBUTE_ROUTE_DEL) */
1015 ospf_external_info_delete(ospf
, api
.type
, api
.instance
, p
);
1016 if (is_prefix_default(&p
))
1017 ospf_external_lsa_refresh_default(ospf
);
1019 ospf_external_lsa_flush(ospf
, api
.type
, &p
,
1020 ifindex
/*, nexthop */);
1027 int ospf_distribute_list_out_set(struct ospf
*ospf
, int type
, const char *name
)
1029 /* Lookup access-list for distribute-list. */
1030 DISTRIBUTE_LIST(ospf
, type
) = access_list_lookup(AFI_IP
, name
);
1032 /* Clear previous distribute-name. */
1033 if (DISTRIBUTE_NAME(ospf
, type
))
1034 free(DISTRIBUTE_NAME(ospf
, type
));
1036 /* Set distribute-name. */
1037 DISTRIBUTE_NAME(ospf
, type
) = strdup(name
);
1039 /* If access-list have been set, schedule update timer. */
1040 if (DISTRIBUTE_LIST(ospf
, type
))
1041 ospf_distribute_list_update(ospf
, type
, 0);
1046 int ospf_distribute_list_out_unset(struct ospf
*ospf
, int type
,
1049 /* Schedule update timer. */
1050 if (DISTRIBUTE_LIST(ospf
, type
))
1051 ospf_distribute_list_update(ospf
, type
, 0);
1053 /* Unset distribute-list. */
1054 DISTRIBUTE_LIST(ospf
, type
) = NULL
;
1056 /* Clear distribute-name. */
1057 if (DISTRIBUTE_NAME(ospf
, type
))
1058 free(DISTRIBUTE_NAME(ospf
, type
));
1060 DISTRIBUTE_NAME(ospf
, type
) = NULL
;
1065 /* distribute-list update timer. */
1066 static int ospf_distribute_list_update_timer(struct thread
*thread
)
1068 struct route_node
*rn
;
1069 struct external_info
*ei
;
1070 struct route_table
*rt
;
1071 struct ospf_lsa
*lsa
;
1072 int type
, default_refresh
= 0, arg_type
;
1073 struct ospf
*ospf
= NULL
;
1074 void **arg
= THREAD_ARG (thread
);
1076 ospf
= (struct ospf
*)arg
[0];
1077 arg_type
= (int)(intptr_t)arg
[1];
1082 ospf
->t_distribute_update
= NULL
;
1084 zlog_info("Zebra[Redistribute]: distribute-list update timer fired!");
1086 if (IS_DEBUG_OSPF_EVENT
) {
1087 zlog_debug("%s: ospf distribute-list update arg_type %d vrf %s id %d",
1088 __PRETTY_FUNCTION__
, arg_type
,
1089 ospf_vrf_id_to_name(ospf
->vrf_id
), ospf
->vrf_id
);
1092 /* foreach all external info. */
1093 for (type
= 0; type
<= ZEBRA_ROUTE_MAX
; type
++) {
1094 struct list
*ext_list
;
1095 struct listnode
*node
;
1096 struct ospf_external
*ext
;
1098 ext_list
= ospf
->external
[type
];
1102 for (ALL_LIST_ELEMENTS_RO(ext_list
, node
, ext
)) {
1103 rt
= ext
->external_info
;
1106 for (rn
= route_top(rt
); rn
; rn
= route_next(rn
))
1107 if ((ei
= rn
->info
) != NULL
) {
1108 if (is_prefix_default(&ei
->p
))
1109 default_refresh
= 1;
1111 (lsa
= ospf_external_info_find_lsa(
1113 ospf_external_lsa_refresh(
1115 LSA_REFRESH_IF_CHANGED
);
1117 ospf_external_lsa_originate(
1122 if (default_refresh
)
1123 ospf_external_lsa_refresh_default(ospf
);
1125 XFREE(MTYPE_OSPF_DIST_ARGS
, arg
);
1129 /* Update distribute-list and set timer to apply access-list. */
1130 void ospf_distribute_list_update(struct ospf
*ospf
, int type
,
1133 struct route_table
*rt
;
1134 struct ospf_external
*ext
;
1135 void **args
= XCALLOC(MTYPE_OSPF_DIST_ARGS
, sizeof(void *)*2);
1138 args
[1] = (void *)((ptrdiff_t) type
);
1140 /* External info does not exist. */
1141 ext
= ospf_external_lookup(ospf
, type
, instance
);
1142 if (!ext
|| !(rt
= EXTERNAL_INFO(ext
))) {
1143 XFREE(MTYPE_OSPF_DIST_ARGS
, args
);
1147 /* If exists previously invoked thread, then let it continue. */
1148 if (ospf
->t_distribute_update
) {
1149 XFREE(MTYPE_OSPF_DIST_ARGS
, args
);
1154 ospf
->t_distribute_update
= NULL
;
1155 thread_add_timer_msec(master
, ospf_distribute_list_update_timer
,
1156 (void **)args
, ospf
->min_ls_interval
,
1157 &ospf
->t_distribute_update
);
1160 /* If access-list is updated, apply some check. */
1161 static void ospf_filter_update(struct access_list
*access
)
1166 struct ospf_area
*area
;
1167 struct listnode
*node
, *n1
;
1169 /* If OSPF instance does not exist, return right now. */
1170 if (listcount(om
->ospf
) == 0)
1173 /* Iterate all ospf [VRF] instances */
1174 for (ALL_LIST_ELEMENTS_RO(om
->ospf
, n1
, ospf
)) {
1175 /* Update distribute-list, and apply filter. */
1176 for (type
= 0; type
<= ZEBRA_ROUTE_MAX
; type
++) {
1177 struct list
*red_list
;
1178 struct listnode
*node
;
1179 struct ospf_redist
*red
;
1181 red_list
= ospf
->redist
[type
];
1183 for (ALL_LIST_ELEMENTS_RO(red_list
, node
, red
)) {
1184 if (ROUTEMAP(red
)) {
1185 /* if route-map is not NULL it may be
1186 * using this access list */
1187 ospf_distribute_list_update(
1189 type
, red
->instance
);
1193 /* There is place for route-map for default-information
1194 * (ZEBRA_ROUTE_MAX),
1195 * but no distribute list. */
1196 if (type
== ZEBRA_ROUTE_MAX
)
1199 if (DISTRIBUTE_NAME(ospf
, type
)) {
1200 /* Keep old access-list for distribute-list. */
1201 struct access_list
*old
= DISTRIBUTE_LIST(ospf
,
1204 /* Update access-list for distribute-list. */
1205 DISTRIBUTE_LIST(ospf
, type
) = access_list_lookup(
1206 AFI_IP
, DISTRIBUTE_NAME(ospf
, type
));
1208 /* No update for this distribute type. */
1209 if (old
== NULL
&& DISTRIBUTE_LIST(ospf
, type
) == NULL
)
1212 /* Schedule distribute-list update timer. */
1213 if (DISTRIBUTE_LIST(ospf
, type
) == NULL
1214 || strcmp(DISTRIBUTE_NAME(ospf
, type
), access
->name
)
1216 ospf_distribute_list_update(ospf
, type
, 0);
1220 /* Update Area access-list. */
1221 for (ALL_LIST_ELEMENTS_RO(ospf
->areas
, node
, area
)) {
1222 if (EXPORT_NAME(area
)) {
1223 EXPORT_LIST(area
) = NULL
;
1227 if (IMPORT_NAME(area
)) {
1228 IMPORT_LIST(area
) = NULL
;
1233 /* Schedule ABR tasks -- this will be changed -- takada. */
1234 if (IS_OSPF_ABR(ospf
) && abr_inv
)
1235 ospf_schedule_abr_task(ospf
);
1239 /* If prefix-list is updated, do some updates. */
1240 void ospf_prefix_list_update(struct prefix_list
*plist
)
1242 struct ospf
*ospf
= NULL
;
1245 struct ospf_area
*area
;
1246 struct listnode
*node
, *n1
;
1248 /* If OSPF instatnce does not exist, return right now. */
1249 if (listcount(om
->ospf
) == 0)
1252 /* Iterate all ospf [VRF] instances */
1253 for (ALL_LIST_ELEMENTS_RO(om
->ospf
, n1
, ospf
)) {
1255 /* Update all route-maps which are used
1256 * as redistribution filters.
1257 * They might use prefix-list.
1259 for (type
= 0; type
<= ZEBRA_ROUTE_MAX
; type
++) {
1260 struct list
*red_list
;
1261 struct listnode
*node
;
1262 struct ospf_redist
*red
;
1264 red_list
= ospf
->redist
[type
];
1266 for (ALL_LIST_ELEMENTS_RO(red_list
,
1268 if (ROUTEMAP(red
)) {
1269 /* if route-map is not NULL
1271 * this prefix list */
1272 ospf_distribute_list_update(
1280 /* Update area filter-lists. */
1281 for (ALL_LIST_ELEMENTS_RO(ospf
->areas
, node
, area
)) {
1282 /* Update filter-list in. */
1283 if (PREFIX_NAME_IN(area
))
1284 if (strcmp(PREFIX_NAME_IN(area
),
1285 prefix_list_name(plist
)) == 0) {
1286 PREFIX_LIST_IN(area
) =
1289 PREFIX_NAME_IN(area
));
1293 /* Update filter-list out. */
1294 if (PREFIX_NAME_OUT(area
))
1295 if (strcmp(PREFIX_NAME_OUT(area
),
1296 prefix_list_name(plist
)) == 0) {
1297 PREFIX_LIST_IN(area
) =
1300 PREFIX_NAME_OUT(area
));
1305 /* Schedule ABR task. */
1306 if (IS_OSPF_ABR(ospf
) && abr_inv
)
1307 ospf_schedule_abr_task(ospf
);
1311 static struct ospf_distance
*ospf_distance_new(void)
1313 return XCALLOC(MTYPE_OSPF_DISTANCE
, sizeof(struct ospf_distance
));
1316 static void ospf_distance_free(struct ospf_distance
*odistance
)
1318 XFREE(MTYPE_OSPF_DISTANCE
, odistance
);
1321 int ospf_distance_set(struct vty
*vty
, struct ospf
*ospf
,
1322 const char *distance_str
, const char *ip_str
,
1323 const char *access_list_str
)
1326 struct prefix_ipv4 p
;
1328 struct route_node
*rn
;
1329 struct ospf_distance
*odistance
;
1331 ret
= str2prefix_ipv4(ip_str
, &p
);
1333 vty_out(vty
, "Malformed prefix\n");
1334 return CMD_WARNING_CONFIG_FAILED
;
1337 distance
= atoi(distance_str
);
1339 /* Get OSPF distance node. */
1340 rn
= route_node_get(ospf
->distance_table
, (struct prefix
*)&p
);
1342 odistance
= rn
->info
;
1343 route_unlock_node(rn
);
1345 odistance
= ospf_distance_new();
1346 rn
->info
= odistance
;
1349 /* Set distance value. */
1350 odistance
->distance
= distance
;
1352 /* Reset access-list configuration. */
1353 if (odistance
->access_list
) {
1354 free(odistance
->access_list
);
1355 odistance
->access_list
= NULL
;
1357 if (access_list_str
)
1358 odistance
->access_list
= strdup(access_list_str
);
1363 int ospf_distance_unset(struct vty
*vty
, struct ospf
*ospf
,
1364 const char *distance_str
, const char *ip_str
,
1365 char const *access_list_str
)
1368 struct prefix_ipv4 p
;
1369 struct route_node
*rn
;
1370 struct ospf_distance
*odistance
;
1372 ret
= str2prefix_ipv4(ip_str
, &p
);
1374 vty_out(vty
, "Malformed prefix\n");
1375 return CMD_WARNING_CONFIG_FAILED
;
1378 rn
= route_node_lookup(ospf
->distance_table
, (struct prefix
*)&p
);
1380 vty_out(vty
, "Can't find specified prefix\n");
1381 return CMD_WARNING_CONFIG_FAILED
;
1384 odistance
= rn
->info
;
1386 if (odistance
->access_list
)
1387 free(odistance
->access_list
);
1388 ospf_distance_free(odistance
);
1391 route_unlock_node(rn
);
1392 route_unlock_node(rn
);
1397 void ospf_distance_reset(struct ospf
*ospf
)
1399 struct route_node
*rn
;
1400 struct ospf_distance
*odistance
;
1402 for (rn
= route_top(ospf
->distance_table
); rn
; rn
= route_next(rn
))
1403 if ((odistance
= rn
->info
) != NULL
) {
1404 if (odistance
->access_list
)
1405 free(odistance
->access_list
);
1406 ospf_distance_free(odistance
);
1408 route_unlock_node(rn
);
1412 u_char
ospf_distance_apply(struct ospf
*ospf
, struct prefix_ipv4
*p
,
1413 struct ospf_route
*or)
1419 if (ospf
->distance_intra
)
1420 if (or->path_type
== OSPF_PATH_INTRA_AREA
)
1421 return ospf
->distance_intra
;
1423 if (ospf
->distance_inter
)
1424 if (or->path_type
== OSPF_PATH_INTER_AREA
)
1425 return ospf
->distance_inter
;
1427 if (ospf
->distance_external
)
1428 if (or->path_type
== OSPF_PATH_TYPE1_EXTERNAL
||
1429 or->path_type
== OSPF_PATH_TYPE2_EXTERNAL
)
1430 return ospf
->distance_external
;
1432 if (ospf
->distance_all
)
1433 return ospf
->distance_all
;
1438 void ospf_zebra_vrf_register(struct ospf
*ospf
)
1440 if (!zclient
|| zclient
->sock
< 0 || !ospf
)
1443 if (ospf
->vrf_id
!= VRF_UNKNOWN
) {
1444 if (IS_DEBUG_OSPF_EVENT
)
1445 zlog_debug("%s: Register VRF %s id %u",
1446 __PRETTY_FUNCTION__
,
1447 ospf_vrf_id_to_name(ospf
->vrf_id
),
1449 /* Deregister for router-id, interfaces,
1450 * redistributed routes. */
1451 zclient_send_reg_requests(zclient
, ospf
->vrf_id
);
1455 void ospf_zebra_vrf_deregister(struct ospf
*ospf
)
1457 if (!zclient
|| zclient
->sock
< 0 || !ospf
)
1460 if (ospf
->vrf_id
!= VRF_DEFAULT
&& ospf
->vrf_id
!= VRF_UNKNOWN
) {
1461 if (IS_DEBUG_OSPF_EVENT
)
1462 zlog_debug("%s: De-Register VRF %s id %u to Zebra.",
1463 __PRETTY_FUNCTION__
,
1464 ospf_vrf_id_to_name(ospf
->vrf_id
),
1466 /* Deregister for router-id, interfaces,
1467 * redistributed routes. */
1468 zclient_send_dereg_requests(zclient
, ospf
->vrf_id
);
1471 static void ospf_zebra_connected(struct zclient
*zclient
)
1473 /* Send the client registration */
1474 bfd_client_sendmsg(zclient
, ZEBRA_BFD_CLIENT_REGISTER
);
1476 zclient_send_reg_requests(zclient
, VRF_DEFAULT
);
1479 void ospf_zebra_init(struct thread_master
*master
, u_short instance
)
1481 /* Allocate zebra structure. */
1482 zclient
= zclient_new_notify(master
, &zclient_options_default
);
1483 zclient_init(zclient
, ZEBRA_ROUTE_OSPF
, instance
, &ospfd_privs
);
1484 zclient
->zebra_connected
= ospf_zebra_connected
;
1485 zclient
->router_id_update
= ospf_router_id_update_zebra
;
1486 zclient
->interface_add
= ospf_interface_add
;
1487 zclient
->interface_delete
= ospf_interface_delete
;
1488 zclient
->interface_up
= ospf_interface_state_up
;
1489 zclient
->interface_down
= ospf_interface_state_down
;
1490 zclient
->interface_address_add
= ospf_interface_address_add
;
1491 zclient
->interface_address_delete
= ospf_interface_address_delete
;
1492 zclient
->interface_link_params
= ospf_interface_link_params
;
1493 zclient
->interface_vrf_update
= ospf_interface_vrf_update
;
1495 zclient
->redistribute_route_add
= ospf_zebra_read_route
;
1496 zclient
->redistribute_route_del
= ospf_zebra_read_route
;
1498 access_list_add_hook(ospf_filter_update
);
1499 access_list_delete_hook(ospf_filter_update
);
1500 prefix_list_add_hook(ospf_prefix_list_update
);
1501 prefix_list_delete_hook(ospf_prefix_list_update
);