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. */
66 ospf_router_id_update_zebra (int command
, struct zclient
*zclient
,
67 zebra_size_t length
, vrf_id_t vrf_id
)
70 struct prefix router_id
;
71 zebra_router_id_update_read(zclient
->ibuf
,&router_id
);
73 if (IS_DEBUG_OSPF (zebra
, ZEBRA_INTERFACE
))
75 char buf
[PREFIX2STR_BUFFER
];
76 prefix2str(&router_id
, buf
, sizeof(buf
));
77 zlog_debug("Zebra rcvd: router id update %s", buf
);
80 router_id_zebra
= router_id
.u
.prefix4
;
82 ospf
= ospf_lookup ();
85 ospf_router_id_update (ospf
);
90 /* Inteface addition message from zebra. */
92 ospf_interface_add (int command
, struct zclient
*zclient
, zebra_size_t length
,
95 struct interface
*ifp
;
97 ifp
= zebra_interface_add_read (zclient
->ibuf
, vrf_id
);
99 if (IS_DEBUG_OSPF (zebra
, ZEBRA_INTERFACE
))
100 zlog_debug ("Zebra: interface add %s[%u] index %d flags %llx metric %d mtu %d",
101 ifp
->name
, ifp
->vrf_id
, ifp
->ifindex
, (unsigned long long)ifp
->flags
,
102 ifp
->metric
, ifp
->mtu
);
106 if (!OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp
), type
))
108 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), type
);
109 IF_DEF_PARAMS (ifp
)->type
= ospf_default_iftype(ifp
);
112 ospf_if_update (NULL
, ifp
);
114 hook_call(ospf_if_update
, ifp
);
120 ospf_interface_delete (int command
, struct zclient
*zclient
,
121 zebra_size_t length
, vrf_id_t vrf_id
)
123 struct interface
*ifp
;
125 struct route_node
*rn
;
128 /* zebra_interface_state_read() updates interface structure in iflist */
129 ifp
= zebra_interface_state_read (s
, vrf_id
);
135 zlog_warn ("Zebra: got delete of %s, but interface is still up",
138 if (IS_DEBUG_OSPF (zebra
, ZEBRA_INTERFACE
))
140 ("Zebra: interface delete %s[%u] index %d flags %llx metric %d mtu %d",
141 ifp
->name
, ifp
->vrf_id
, ifp
->ifindex
, (unsigned long long)ifp
->flags
, ifp
->metric
, ifp
->mtu
);
143 hook_call(ospf_if_delete
, ifp
);
145 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
147 ospf_if_free ((struct ospf_interface
*) rn
->info
);
149 ifp
->ifindex
= IFINDEX_DELETED
;
153 static struct interface
*
154 zebra_interface_if_lookup (struct stream
*s
, vrf_id_t vrf_id
)
156 char ifname_tmp
[INTERFACE_NAMSIZ
];
158 /* Read interface name. */
159 stream_get (ifname_tmp
, s
, INTERFACE_NAMSIZ
);
161 /* And look it up. */
162 return if_lookup_by_name_len(ifname_tmp
,
163 strnlen(ifname_tmp
, INTERFACE_NAMSIZ
),
168 ospf_interface_state_up (int command
, struct zclient
*zclient
,
169 zebra_size_t length
, vrf_id_t vrf_id
)
171 struct interface
*ifp
;
172 struct ospf_interface
*oi
;
173 struct route_node
*rn
;
175 ifp
= zebra_interface_if_lookup (zclient
->ibuf
, vrf_id
);
180 /* Interface is already up. */
181 if (if_is_operative (ifp
))
183 /* Temporarily keep ifp values. */
184 struct interface if_tmp
;
185 memcpy (&if_tmp
, ifp
, sizeof (struct interface
));
187 zebra_interface_if_set_value (zclient
->ibuf
, ifp
);
189 if (IS_DEBUG_OSPF (zebra
, ZEBRA_INTERFACE
))
190 zlog_debug ("Zebra: Interface[%s] state update speed %u -> %u, bw %d -> %d",
191 ifp
->name
, if_tmp
.speed
, ifp
->speed
, if_tmp
.bandwidth
, ifp
->bandwidth
);
193 ospf_if_recalculate_output_cost (ifp
);
195 if (if_tmp
.mtu
!= ifp
->mtu
)
197 if (IS_DEBUG_OSPF (zebra
, ZEBRA_INTERFACE
))
198 zlog_debug ("Zebra: Interface[%s] MTU change %u -> %u.",
199 ifp
->name
, if_tmp
.mtu
, ifp
->mtu
);
201 /* Must reset the interface (simulate down/up) when MTU changes. */
207 zebra_interface_if_set_value (zclient
->ibuf
, ifp
);
209 if (IS_DEBUG_OSPF (zebra
, ZEBRA_INTERFACE
))
210 zlog_debug ("Zebra: Interface[%s] state change to up.", ifp
->name
);
212 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
214 if ((oi
= rn
->info
) == NULL
)
224 ospf_interface_state_down (int command
, struct zclient
*zclient
,
225 zebra_size_t length
, vrf_id_t vrf_id
)
227 struct interface
*ifp
;
228 struct ospf_interface
*oi
;
229 struct route_node
*node
;
231 ifp
= zebra_interface_state_read (zclient
->ibuf
, vrf_id
);
236 if (IS_DEBUG_OSPF (zebra
, ZEBRA_INTERFACE
))
237 zlog_debug ("Zebra: Interface[%s] state change to down.", ifp
->name
);
239 for (node
= route_top (IF_OIFS (ifp
)); node
; node
= route_next (node
))
241 if ((oi
= node
->info
) == NULL
)
250 ospf_interface_address_add (int command
, struct zclient
*zclient
,
251 zebra_size_t length
, vrf_id_t vrf_id
)
255 c
= zebra_interface_address_read (command
, zclient
->ibuf
, vrf_id
);
260 if (IS_DEBUG_OSPF (zebra
, ZEBRA_INTERFACE
))
262 char buf
[PREFIX2STR_BUFFER
];
263 prefix2str(c
->address
, buf
, sizeof(buf
));
264 zlog_debug("Zebra: interface %s address add %s", c
->ifp
->name
, buf
);
267 ospf_if_update (NULL
, c
->ifp
);
269 hook_call(ospf_if_update
, c
->ifp
);
275 ospf_interface_address_delete (int command
, struct zclient
*zclient
,
276 zebra_size_t length
, vrf_id_t vrf_id
)
279 struct interface
*ifp
;
280 struct ospf_interface
*oi
;
281 struct route_node
*rn
;
284 c
= zebra_interface_address_read (command
, zclient
->ibuf
, vrf_id
);
289 if (IS_DEBUG_OSPF (zebra
, ZEBRA_INTERFACE
))
291 char buf
[PREFIX2STR_BUFFER
];
292 prefix2str(c
->address
, buf
, sizeof(buf
));
293 zlog_debug("Zebra: interface %s address delete %s", c
->ifp
->name
, buf
);
298 p
.prefixlen
= IPV4_MAX_PREFIXLEN
;
300 rn
= route_node_lookup (IF_OIFS (ifp
), &p
);
309 route_unlock_node (rn
);
311 /* Call interface hook functions to clean up */
314 hook_call(ospf_if_update
, c
->ifp
);
322 ospf_interface_link_params (int command
, struct zclient
*zclient
,
325 struct interface
*ifp
;
327 ifp
= zebra_interface_link_params_read (zclient
->ibuf
);
333 ospf_mpls_te_update_if (ifp
);
340 ospf_zebra_add (struct prefix_ipv4
*p
, struct ospf_route
*or)
347 struct ospf_path
*path
;
348 struct listnode
*node
;
349 struct ospf
*ospf
= ospf_lookup ();
351 if ((ospf
->instance
&&
352 redist_check_instance(&zclient
->mi_redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
], ospf
->instance
))
354 vrf_bitmap_check (zclient
->redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
], VRF_DEFAULT
))
359 /* OSPF pass nexthop and metric */
360 SET_FLAG (message
, ZAPI_MESSAGE_NEXTHOP
);
361 SET_FLAG (message
, ZAPI_MESSAGE_METRIC
);
363 /* Distance value. */
364 distance
= ospf_distance_apply (p
, or);
366 SET_FLAG (message
, ZAPI_MESSAGE_DISTANCE
);
368 /* Check if path type is ASE */
369 if (((or->path_type
== OSPF_PATH_TYPE1_EXTERNAL
) ||
370 (or->path_type
== OSPF_PATH_TYPE2_EXTERNAL
)) &&
371 (or->u
.ext
.tag
> 0) && (or->u
.ext
.tag
<= ROUTE_TAG_MAX
))
372 SET_FLAG (message
, ZAPI_MESSAGE_TAG
);
378 /* Put command, type, flags, message. */
379 zclient_create_header (s
, ZEBRA_IPV4_ROUTE_ADD
, VRF_DEFAULT
);
380 stream_putc (s
, ZEBRA_ROUTE_OSPF
);
381 stream_putw (s
, ospf
->instance
);
382 stream_putl (s
, flags
);
383 stream_putc (s
, message
);
384 stream_putw (s
, SAFI_UNICAST
);
386 /* Put prefix information. */
387 psize
= PSIZE (p
->prefixlen
);
388 stream_putc (s
, p
->prefixlen
);
389 stream_write (s
, (u_char
*) & p
->prefix
, psize
);
392 stream_putc (s
, or->paths
->count
);
394 /* Nexthop, ifindex, distance and metric information. */
395 for (ALL_LIST_ELEMENTS_RO (or->paths
, node
, path
))
398 if (path
->unnumbered
||
399 (path
->nexthop
.s_addr
!= INADDR_ANY
&&
402 stream_putc (s
, NEXTHOP_TYPE_IPV4_IFINDEX
);
403 stream_put_in_addr (s
, &path
->nexthop
);
404 stream_putl (s
, path
->ifindex
);
406 else if (path
->nexthop
.s_addr
!= INADDR_ANY
)
408 stream_putc (s
, NEXTHOP_TYPE_IPV4
);
409 stream_put_in_addr (s
, &path
->nexthop
);
413 stream_putc (s
, NEXTHOP_TYPE_IFINDEX
);
415 stream_putl (s
, path
->ifindex
);
419 #else /* HAVE_NETLINK */
420 if (path
->nexthop
.s_addr
!= INADDR_ANY
&&
423 stream_putc (s
, NEXTHOP_TYPE_IPV4_IFINDEX
);
424 stream_put_in_addr (s
, &path
->nexthop
);
425 stream_putl (s
, path
->ifindex
);
427 else if (path
->nexthop
.s_addr
!= INADDR_ANY
)
429 stream_putc (s
, NEXTHOP_TYPE_IPV4
);
430 stream_put_in_addr (s
, &path
->nexthop
);
434 stream_putc (s
, NEXTHOP_TYPE_IFINDEX
);
436 stream_putl (s
, path
->ifindex
);
440 #endif /* HAVE_NETLINK */
442 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
444 char buf
[2][INET_ADDRSTRLEN
];
445 zlog_debug("Zebra: Route add %s/%d nexthop %s, ifindex=%d",
446 inet_ntop(AF_INET
, &p
->prefix
,
447 buf
[0], sizeof(buf
[0])),
449 inet_ntop(AF_INET
, &path
->nexthop
,
450 buf
[1], sizeof(buf
[1])),
455 if (CHECK_FLAG (message
, ZAPI_MESSAGE_DISTANCE
))
456 stream_putc (s
, distance
);
457 if (CHECK_FLAG (message
, ZAPI_MESSAGE_METRIC
))
459 if (or->path_type
== OSPF_PATH_TYPE1_EXTERNAL
)
460 stream_putl (s
, or->cost
+ or->u
.ext
.type2_cost
);
461 else if (or->path_type
== OSPF_PATH_TYPE2_EXTERNAL
)
462 stream_putl (s
, or->u
.ext
.type2_cost
);
464 stream_putl (s
, or->cost
);
467 if (CHECK_FLAG (message
, ZAPI_MESSAGE_TAG
))
468 stream_putl (s
, or->u
.ext
.tag
);
470 stream_putw_at (s
, 0, stream_get_endp (s
));
472 zclient_send_message(zclient
);
477 ospf_zebra_delete (struct prefix_ipv4
*p
, struct ospf_route
*or)
484 struct ospf_path
*path
;
485 struct listnode
*node
;
486 struct ospf
*ospf
= ospf_lookup ();
488 if ((ospf
->instance
&&
489 redist_check_instance(&zclient
->mi_redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
], ospf
->instance
))
491 vrf_bitmap_check (zclient
->redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
], VRF_DEFAULT
))
495 /* Distance value. */
496 distance
= ospf_distance_apply (p
, or);
501 /* Put command, type, flags, message. */
502 zclient_create_header (s
, ZEBRA_IPV4_ROUTE_DELETE
, VRF_DEFAULT
);
503 stream_putc (s
, ZEBRA_ROUTE_OSPF
);
504 stream_putw (s
, ospf
->instance
);
505 stream_putl (s
, flags
);
506 stream_putc (s
, message
);
507 stream_putw (s
, SAFI_UNICAST
);
509 /* Put prefix information. */
510 psize
= PSIZE (p
->prefixlen
);
511 stream_putc (s
, p
->prefixlen
);
512 stream_write (s
, (u_char
*) & p
->prefix
, psize
);
515 stream_putc (s
, or->paths
->count
);
517 /* Nexthop, ifindex, distance and metric information. */
518 for (ALL_LIST_ELEMENTS_RO (or->paths
, node
, path
))
520 if (path
->nexthop
.s_addr
!= INADDR_ANY
&&
523 stream_putc (s
, NEXTHOP_TYPE_IPV4_IFINDEX
);
524 stream_put_in_addr (s
, &path
->nexthop
);
525 stream_putl (s
, path
->ifindex
);
527 else if (path
->nexthop
.s_addr
!= INADDR_ANY
)
529 stream_putc (s
, NEXTHOP_TYPE_IPV4
);
530 stream_put_in_addr (s
, &path
->nexthop
);
534 stream_putc (s
, NEXTHOP_TYPE_IFINDEX
);
535 stream_putl (s
, path
->ifindex
);
538 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
540 char buf
[2][INET_ADDRSTRLEN
];
541 zlog_debug("Zebra: Route delete %s/%d nexthop %s",
542 inet_ntop(AF_INET
, &p
->prefix
,
543 buf
[0], sizeof(buf
[0])),
545 inet_ntop(AF_INET
, &path
->nexthop
,
546 buf
[1], sizeof(buf
[1])));
550 if (CHECK_FLAG (message
, ZAPI_MESSAGE_DISTANCE
))
551 stream_putc (s
, distance
);
552 if (CHECK_FLAG (message
, ZAPI_MESSAGE_METRIC
))
554 if (or->path_type
== OSPF_PATH_TYPE1_EXTERNAL
)
555 stream_putl (s
, or->cost
+ or->u
.ext
.type2_cost
);
556 else if (or->path_type
== OSPF_PATH_TYPE2_EXTERNAL
)
557 stream_putl (s
, or->u
.ext
.type2_cost
);
559 stream_putl (s
, or->cost
);
562 stream_putw_at (s
, 0, stream_get_endp (s
));
564 zclient_send_message(zclient
);
569 ospf_zebra_add_discard (struct prefix_ipv4
*p
)
571 struct zapi_ipv4 api
;
572 struct ospf
*ospf
= ospf_lookup ();
574 if ((ospf
->instance
&&
575 redist_check_instance(&zclient
->mi_redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
], ospf
->instance
))
577 vrf_bitmap_check (zclient
->redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
], VRF_DEFAULT
))
579 api
.vrf_id
= VRF_DEFAULT
;
580 api
.type
= ZEBRA_ROUTE_OSPF
;
581 api
.instance
= ospf
->instance
;
582 api
.flags
= ZEBRA_FLAG_BLACKHOLE
;
584 api
.safi
= SAFI_UNICAST
;
585 SET_FLAG (api
.message
, ZAPI_MESSAGE_NEXTHOP
);
590 zapi_ipv4_route (ZEBRA_IPV4_ROUTE_ADD
, zclient
, p
, &api
);
592 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
593 zlog_debug ("Zebra: Route add discard %s/%d",
594 inet_ntoa (p
->prefix
), p
->prefixlen
);
599 ospf_zebra_delete_discard (struct prefix_ipv4
*p
)
601 struct zapi_ipv4 api
;
602 struct ospf
*ospf
= ospf_lookup ();
604 if ((ospf
->instance
&&
605 redist_check_instance(&zclient
->mi_redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
], ospf
->instance
))
607 vrf_bitmap_check (zclient
->redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
], VRF_DEFAULT
))
609 api
.vrf_id
= VRF_DEFAULT
;
610 api
.type
= ZEBRA_ROUTE_OSPF
;
611 api
.instance
= ospf
->instance
;
612 api
.flags
= ZEBRA_FLAG_BLACKHOLE
;
614 api
.safi
= SAFI_UNICAST
;
615 SET_FLAG (api
.message
, ZAPI_MESSAGE_NEXTHOP
);
620 zapi_ipv4_route (ZEBRA_IPV4_ROUTE_DELETE
, zclient
, p
, &api
);
622 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
623 zlog_debug ("Zebra: Route delete discard %s/%d",
624 inet_ntoa (p
->prefix
), p
->prefixlen
);
629 struct ospf_external
*
630 ospf_external_lookup (u_char type
, u_short instance
)
632 struct list
*ext_list
;
633 struct listnode
*node
;
634 struct ospf_external
*ext
;
636 ext_list
= om
->external
[type
];
640 for (ALL_LIST_ELEMENTS_RO(ext_list
, node
, ext
))
641 if (ext
->instance
== instance
)
647 struct ospf_external
*
648 ospf_external_add (u_char type
, u_short instance
)
650 struct list
*ext_list
;
651 struct ospf_external
*ext
;
653 ext
= ospf_external_lookup(type
, instance
);
657 if (!om
->external
[type
])
658 om
->external
[type
] = list_new();
660 ext_list
= om
->external
[type
];
661 ext
= (struct ospf_external
*)calloc (1, sizeof(struct ospf_external
));
662 ext
->instance
= instance
;
663 EXTERNAL_INFO (ext
) = route_table_init ();
665 listnode_add(ext_list
, ext
);
671 ospf_external_del (u_char type
, u_short instance
)
673 struct ospf_external
*ext
;
675 ext
= ospf_external_lookup(type
, instance
);
679 if (EXTERNAL_INFO (ext
))
680 route_table_finish(EXTERNAL_INFO (ext
));
682 listnode_delete(om
->external
[type
], ext
);
683 if (!om
->external
[type
]->count
)
685 list_free(om
->external
[type
]);
686 om
->external
[type
] = NULL
;
692 ospf_redist_lookup (struct ospf
*ospf
, u_char type
, u_short instance
)
694 struct list
*red_list
;
695 struct listnode
*node
;
696 struct ospf_redist
*red
;
698 red_list
= ospf
->redist
[type
];
702 for (ALL_LIST_ELEMENTS_RO(red_list
, node
, red
))
703 if (red
->instance
== instance
)
710 ospf_redist_add (struct ospf
*ospf
, u_char type
, u_short instance
)
712 struct list
*red_list
;
713 struct ospf_redist
*red
;
715 red
= ospf_redist_lookup(ospf
, type
, instance
);
719 if (!ospf
->redist
[type
])
720 ospf
->redist
[type
] = list_new();
722 red_list
= ospf
->redist
[type
];
723 red
= (struct ospf_redist
*)calloc (1, sizeof(struct ospf_redist
));
724 red
->instance
= instance
;
725 red
->dmetric
.type
= -1;
726 red
->dmetric
.value
= -1;
728 listnode_add(red_list
, red
);
734 ospf_redist_del (struct ospf
*ospf
, u_char type
, u_short instance
)
736 struct ospf_redist
*red
;
738 red
= ospf_redist_lookup(ospf
, type
, instance
);
742 listnode_delete(ospf
->redist
[type
], red
);
743 if (!ospf
->redist
[type
]->count
)
745 list_free(ospf
->redist
[type
]);
746 ospf
->redist
[type
] = NULL
;
753 ospf_is_type_redistributed (int type
, u_short instance
)
755 return (DEFAULT_ROUTE_TYPE (type
) ?
756 vrf_bitmap_check (zclient
->default_information
, VRF_DEFAULT
) :
757 ((instance
&& redist_check_instance(&zclient
->mi_redist
[AFI_IP
][type
], instance
))
758 || (!instance
&& vrf_bitmap_check (zclient
->redist
[AFI_IP
][type
], VRF_DEFAULT
))));
762 ospf_redistribute_set (struct ospf
*ospf
, int type
, u_short instance
, int mtype
,
766 struct ospf_redist
*red
;
768 red
= ospf_redist_lookup(ospf
, type
, instance
);
769 if (ospf_is_type_redistributed (type
, instance
))
771 if (mtype
!= red
->dmetric
.type
)
773 red
->dmetric
.type
= mtype
;
774 force
= LSA_REFRESH_FORCE
;
776 if (mvalue
!= red
->dmetric
.value
)
778 red
->dmetric
.value
= mvalue
;
779 force
= LSA_REFRESH_FORCE
;
782 ospf_external_lsa_refresh_type (ospf
, type
, instance
, force
);
784 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
785 zlog_debug ("Redistribute[%s][%d]: Refresh Type[%d], Metric[%d]",
786 ospf_redist_string(type
), instance
,
787 metric_type (ospf
, type
, instance
),
788 metric_value (ospf
, type
, instance
));
793 red
->dmetric
.type
= mtype
;
794 red
->dmetric
.value
= mvalue
;
796 ospf_external_add(type
, instance
);
798 zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD
, zclient
, AFI_IP
, type
,
799 instance
, VRF_DEFAULT
);
801 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
802 zlog_debug ("Redistribute[%s][%d]: Start Type[%d], Metric[%d]",
803 ospf_redist_string(type
), instance
,
804 metric_type (ospf
, type
, instance
), metric_value (ospf
, type
, instance
));
806 ospf_asbr_status_update (ospf
, ++ospf
->redistribute
);
812 ospf_redistribute_unset (struct ospf
*ospf
, int type
, u_short instance
)
814 if (type
== zclient
->redist_default
&& instance
== zclient
->instance
)
817 if (!ospf_is_type_redistributed (type
, instance
))
820 zclient_redistribute (ZEBRA_REDISTRIBUTE_DELETE
, zclient
, AFI_IP
, type
,
821 instance
, VRF_DEFAULT
);
823 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
824 zlog_debug ("Redistribute[%s][%d]: Stop",
825 ospf_redist_string(type
), instance
);
827 ospf_redist_del (ospf
, type
, instance
);
829 /* Remove the routes from OSPF table. */
830 ospf_redistribute_withdraw (ospf
, type
, instance
);
832 ospf_external_del(type
, instance
);
834 ospf_asbr_status_update (ospf
, --ospf
->redistribute
);
840 ospf_redistribute_default_set (struct ospf
*ospf
, int originate
,
841 int mtype
, int mvalue
)
843 struct ospf_redist
*red
;
845 ospf
->default_originate
= originate
;
847 red
= ospf_redist_add(ospf
, DEFAULT_ROUTE
, 0);
848 red
->dmetric
.type
= mtype
;
849 red
->dmetric
.value
= mvalue
;
851 ospf_external_add(DEFAULT_ROUTE
, 0);
853 if (ospf_is_type_redistributed (DEFAULT_ROUTE
, 0))
855 /* if ospf->default_originate changes value, is calling
856 ospf_external_lsa_refresh_default sufficient to implement
858 ospf_external_lsa_refresh_default (ospf
);
860 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
861 zlog_debug ("Redistribute[%s]: Refresh Type[%d], Metric[%d]",
862 ospf_redist_string(DEFAULT_ROUTE
),
863 metric_type (ospf
, DEFAULT_ROUTE
, 0),
864 metric_value (ospf
, DEFAULT_ROUTE
, 0));
868 zclient_redistribute_default (ZEBRA_REDISTRIBUTE_DEFAULT_ADD
, zclient
,
871 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
872 zlog_debug ("Redistribute[DEFAULT]: Start Type[%d], Metric[%d]",
873 metric_type (ospf
, DEFAULT_ROUTE
, 0),
874 metric_value (ospf
, DEFAULT_ROUTE
, 0));
876 if (ospf
->router_id
.s_addr
== 0)
877 ospf
->external_origin
|= (1 << DEFAULT_ROUTE
);
879 thread_add_timer(master
, ospf_default_originate_timer
, ospf
, 1, NULL
);
881 ospf_asbr_status_update (ospf
, ++ospf
->redistribute
);
887 ospf_redistribute_default_unset (struct ospf
*ospf
)
889 if (!ospf_is_type_redistributed (DEFAULT_ROUTE
, 0))
892 ospf
->default_originate
= DEFAULT_ORIGINATE_NONE
;
893 ospf_redist_del(ospf
, DEFAULT_ROUTE
, 0);
895 zclient_redistribute_default (ZEBRA_REDISTRIBUTE_DEFAULT_DELETE
, zclient
,
898 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
899 zlog_debug ("Redistribute[DEFAULT]: Stop");
901 //Pending: how does the external_info cleanup work in this case?
903 ospf_asbr_status_update (ospf
, --ospf
->redistribute
);
909 ospf_external_lsa_originate_check (struct ospf
*ospf
,
910 struct external_info
*ei
)
912 /* If prefix is multicast, then do not originate LSA. */
913 if (IN_MULTICAST (htonl (ei
->p
.prefix
.s_addr
)))
915 zlog_info ("LSA[Type5:%s]: Not originate AS-external-LSA, "
916 "Prefix belongs multicast", inet_ntoa (ei
->p
.prefix
));
920 /* Take care of default-originate. */
921 if (is_prefix_default (&ei
->p
))
922 if (ospf
->default_originate
== DEFAULT_ORIGINATE_NONE
)
924 zlog_info ("LSA[Type5:0.0.0.0]: Not originate AS-external-LSA "
932 /* If connected prefix is OSPF enable interface, then do not announce. */
934 ospf_distribute_check_connected (struct ospf
*ospf
, struct external_info
*ei
)
936 struct listnode
*node
;
937 struct ospf_interface
*oi
;
940 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
941 if (prefix_match (oi
->address
, (struct prefix
*) &ei
->p
))
946 /* return 1 if external LSA must be originated, 0 otherwise */
948 ospf_redistribute_check (struct ospf
*ospf
,
949 struct external_info
*ei
, int *changed
)
951 struct route_map_set_values save_values
;
952 struct prefix_ipv4
*p
= &ei
->p
;
953 struct ospf_redist
*red
;
954 u_char type
= is_prefix_default (&ei
->p
) ? DEFAULT_ROUTE
: ei
->type
;
955 u_short instance
= is_prefix_default (&ei
->p
) ? 0 : ei
->instance
;
960 if (!ospf_external_lsa_originate_check (ospf
, ei
))
963 /* Take care connected route. */
964 if (type
== ZEBRA_ROUTE_CONNECT
&&
965 !ospf_distribute_check_connected (ospf
, ei
))
968 if (!DEFAULT_ROUTE_TYPE (type
) && DISTRIBUTE_NAME (ospf
, type
))
969 /* distirbute-list exists, but access-list may not? */
970 if (DISTRIBUTE_LIST (ospf
, type
))
971 if (access_list_apply (DISTRIBUTE_LIST (ospf
, type
), p
) == FILTER_DENY
)
973 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
974 zlog_debug ("Redistribute[%s]: %s/%d filtered by ditribute-list.",
975 ospf_redist_string(type
),
976 inet_ntoa (p
->prefix
), p
->prefixlen
);
980 save_values
= ei
->route_map_set
;
981 ospf_reset_route_map_set_values (&ei
->route_map_set
);
983 /* apply route-map if needed */
984 red
= ospf_redist_lookup (ospf
, type
, instance
);
985 if (red
&& ROUTEMAP_NAME(red
))
989 ret
= route_map_apply (ROUTEMAP (red
), (struct prefix
*) p
,
992 if (ret
== RMAP_DENYMATCH
)
994 ei
->route_map_set
= save_values
;
995 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
996 zlog_debug ("Redistribute[%s]: %s/%d filtered by route-map.",
997 ospf_redist_string(type
),
998 inet_ntoa (p
->prefix
), p
->prefixlen
);
1002 /* check if 'route-map set' changed something */
1004 *changed
= !ospf_route_map_set_compare (&ei
->route_map_set
,
1011 /* OSPF route-map set for redistribution */
1013 ospf_routemap_set (struct ospf_redist
*red
, const char *name
)
1015 if (ROUTEMAP_NAME (red
))
1016 free (ROUTEMAP_NAME (red
));
1018 ROUTEMAP_NAME (red
) = strdup (name
);
1019 ROUTEMAP (red
) = route_map_lookup_by_name (name
);
1023 ospf_routemap_unset (struct ospf_redist
*red
)
1025 if (ROUTEMAP_NAME (red
))
1026 free (ROUTEMAP_NAME (red
));
1028 ROUTEMAP_NAME (red
) = NULL
;
1029 ROUTEMAP (red
) = NULL
;
1032 /* Zebra route add and delete treatment. */
1034 ospf_zebra_read_ipv4 (int command
, struct zclient
*zclient
,
1035 zebra_size_t length
, vrf_id_t vrf_id
)
1038 struct zapi_ipv4 api
;
1039 unsigned long ifindex
;
1040 struct in_addr nexthop
;
1041 struct prefix_ipv4 p
;
1042 struct external_info
*ei
;
1050 /* Type, flags, message. */
1051 api
.type
= stream_getc (s
);
1052 api
.instance
= stream_getw (s
);
1053 api
.flags
= stream_getl (s
);
1054 api
.message
= stream_getc (s
);
1057 memset (&p
, 0, sizeof (struct prefix_ipv4
));
1059 p
.prefixlen
= MIN(IPV4_MAX_PREFIXLEN
, stream_getc (s
));
1060 stream_get (&p
.prefix
, s
, PSIZE (p
.prefixlen
));
1062 if (IPV4_NET127(ntohl(p
.prefix
.s_addr
)))
1065 /* Nexthop, ifindex, distance, metric. */
1066 if (CHECK_FLAG (api
.message
, ZAPI_MESSAGE_NEXTHOP
))
1068 api
.nexthop_num
= stream_getc (s
);
1069 nexthop
.s_addr
= stream_get_ipv4 (s
);
1071 if (CHECK_FLAG (api
.message
, ZAPI_MESSAGE_IFINDEX
))
1073 api
.ifindex_num
= stream_getc (s
);
1074 /* XXX assert(api.ifindex_num == 1); */
1075 ifindex
= stream_getl (s
);
1077 if (CHECK_FLAG (api
.message
, ZAPI_MESSAGE_DISTANCE
))
1078 api
.distance
= stream_getc (s
);
1079 if (CHECK_FLAG (api
.message
, ZAPI_MESSAGE_METRIC
))
1080 api
.metric
= stream_getl (s
);
1081 if (CHECK_FLAG (api
.message
, ZAPI_MESSAGE_TAG
))
1082 api
.tag
= stream_getl (s
);
1086 ospf
= ospf_lookup ();
1090 if (command
== ZEBRA_REDISTRIBUTE_IPV4_ADD
)
1092 /* XXX|HACK|TODO|FIXME:
1093 * Maybe we should ignore reject/blackhole routes? Testing shows that
1094 * there is no problems though and this is only way to "summarize"
1095 * routes in ASBR at the moment. Maybe we need just a better generalised
1096 * solution for these types?
1098 * if ( CHECK_FLAG (api.flags, ZEBRA_FLAG_BLACKHOLE)
1099 * || CHECK_FLAG (api.flags, ZEBRA_FLAG_REJECT))
1103 /* Protocol tag overwrites all other tag value send by zebra */
1104 if (ospf
->dtag
[api
.type
] > 0)
1105 api
.tag
= ospf
->dtag
[api
.type
];
1108 * Given zebra sends update for a prefix via ADD message, it should
1109 * be considered as an implicit DEL for that prefix with other source
1112 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++)
1114 ospf_external_info_delete(i
, api
.instance
, p
);
1116 ei
= ospf_external_info_add (api
.type
, api
.instance
, p
, ifindex
,
1120 /* Nothing has changed, so nothing to do; return */
1123 if (ospf
->router_id
.s_addr
== 0)
1124 /* Set flags to generate AS-external-LSA originate event
1125 for each redistributed protocols later. */
1126 ospf
->external_origin
|= (1 << api
.type
);
1131 if (is_prefix_default (&p
))
1132 ospf_external_lsa_refresh_default (ospf
);
1135 struct ospf_lsa
*current
;
1137 current
= ospf_external_info_find_lsa (ospf
, &ei
->p
);
1139 ospf_external_lsa_originate (ospf
, ei
);
1142 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
1143 zlog_debug ("ospf_zebra_read_ipv4() : %s refreshing LSA",
1144 inet_ntoa (p
.prefix
));
1145 ospf_external_lsa_refresh (ospf
, current
,
1146 ei
, LSA_REFRESH_FORCE
);
1152 else /* if (command == ZEBRA_REDISTRIBUTE_IPV4_DEL) */
1154 ospf_external_info_delete (api
.type
, api
.instance
, p
);
1155 if (is_prefix_default (&p
))
1156 ospf_external_lsa_refresh_default (ospf
);
1158 ospf_external_lsa_flush (ospf
, api
.type
, &p
, ifindex
/*, nexthop */);
1166 ospf_distribute_list_out_set (struct ospf
*ospf
, int type
, const char *name
)
1168 /* Lookup access-list for distribute-list. */
1169 DISTRIBUTE_LIST (ospf
, type
) = access_list_lookup (AFI_IP
, name
);
1171 /* Clear previous distribute-name. */
1172 if (DISTRIBUTE_NAME (ospf
, type
))
1173 free (DISTRIBUTE_NAME (ospf
, type
));
1175 /* Set distribute-name. */
1176 DISTRIBUTE_NAME (ospf
, type
) = strdup (name
);
1178 /* If access-list have been set, schedule update timer. */
1179 if (DISTRIBUTE_LIST (ospf
, type
))
1180 ospf_distribute_list_update (ospf
, type
, 0);
1186 ospf_distribute_list_out_unset (struct ospf
*ospf
, int type
, const char *name
)
1188 /* Schedule update timer. */
1189 if (DISTRIBUTE_LIST (ospf
, type
))
1190 ospf_distribute_list_update (ospf
, type
, 0);
1192 /* Unset distribute-list. */
1193 DISTRIBUTE_LIST (ospf
, type
) = NULL
;
1195 /* Clear distribute-name. */
1196 if (DISTRIBUTE_NAME (ospf
, type
))
1197 free (DISTRIBUTE_NAME (ospf
, type
));
1199 DISTRIBUTE_NAME (ospf
, type
) = NULL
;
1204 /* distribute-list update timer. */
1206 ospf_distribute_list_update_timer (struct thread
*thread
)
1208 struct route_node
*rn
;
1209 struct external_info
*ei
;
1210 struct route_table
*rt
;
1211 struct ospf_lsa
*lsa
;
1212 int type
, default_refresh
= 0;
1215 ospf
= ospf_lookup ();
1219 ospf
->t_distribute_update
= NULL
;
1221 zlog_info ("Zebra[Redistribute]: distribute-list update timer fired!");
1223 /* foreach all external info. */
1224 for (type
= 0; type
<= ZEBRA_ROUTE_MAX
; type
++)
1226 struct list
*ext_list
;
1227 struct listnode
*node
;
1228 struct ospf_external
*ext
;
1230 ext_list
= om
->external
[type
];
1234 for (ALL_LIST_ELEMENTS_RO(ext_list
, node
, ext
))
1236 rt
= ext
->external_info
;
1239 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
1240 if ((ei
= rn
->info
) != NULL
)
1242 if (is_prefix_default (&ei
->p
))
1243 default_refresh
= 1;
1244 else if ((lsa
= ospf_external_info_find_lsa (ospf
, &ei
->p
)))
1245 ospf_external_lsa_refresh (ospf
, lsa
, ei
, LSA_REFRESH_IF_CHANGED
);
1247 ospf_external_lsa_originate (ospf
, ei
);
1251 if (default_refresh
)
1252 ospf_external_lsa_refresh_default (ospf
);
1256 /* Update distribute-list and set timer to apply access-list. */
1258 ospf_distribute_list_update (struct ospf
*ospf
, uintptr_t type
,
1261 struct route_table
*rt
;
1262 struct ospf_external
*ext
;
1264 /* External info does not exist. */
1265 ext
= ospf_external_lookup(type
, instance
);
1266 if (!ext
|| !(rt
= EXTERNAL_INFO (ext
)))
1269 /* If exists previously invoked thread, then let it continue. */
1270 if (ospf
->t_distribute_update
)
1274 ospf
->t_distribute_update
= NULL
;
1275 thread_add_timer_msec(master
, ospf_distribute_list_update_timer
, (void *)type
, ospf
->min_ls_interval
,
1276 &ospf
->t_distribute_update
);
1279 /* If access-list is updated, apply some check. */
1281 ospf_filter_update (struct access_list
*access
)
1286 struct ospf_area
*area
;
1287 struct listnode
*node
;
1289 /* If OSPF instance does not exist, return right now. */
1290 ospf
= ospf_lookup ();
1294 /* Update distribute-list, and apply filter. */
1295 for (type
= 0; type
<= ZEBRA_ROUTE_MAX
; type
++)
1297 struct list
*red_list
;
1298 struct listnode
*node
;
1299 struct ospf_redist
*red
;
1301 red_list
= ospf
->redist
[type
];
1303 for (ALL_LIST_ELEMENTS_RO(red_list
, node
, red
))
1307 /* if route-map is not NULL it may be using this access list */
1308 ospf_distribute_list_update (ospf
, type
, red
->instance
);
1312 /* There is place for route-map for default-information (ZEBRA_ROUTE_MAX),
1313 * but no distribute list. */
1314 if (type
== ZEBRA_ROUTE_MAX
)
1317 if (DISTRIBUTE_NAME (ospf
, type
))
1319 /* Keep old access-list for distribute-list. */
1320 struct access_list
*old
= DISTRIBUTE_LIST (ospf
, type
);
1322 /* Update access-list for distribute-list. */
1323 DISTRIBUTE_LIST (ospf
, type
) =
1324 access_list_lookup (AFI_IP
, DISTRIBUTE_NAME (ospf
, type
));
1326 /* No update for this distribute type. */
1327 if (old
== NULL
&& DISTRIBUTE_LIST (ospf
, type
) == NULL
)
1330 /* Schedule distribute-list update timer. */
1331 if (DISTRIBUTE_LIST (ospf
, type
) == NULL
||
1332 strcmp (DISTRIBUTE_NAME (ospf
, type
), access
->name
) == 0)
1333 ospf_distribute_list_update (ospf
, type
, 0);
1337 /* Update Area access-list. */
1338 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, node
, area
))
1340 if (EXPORT_NAME (area
))
1342 EXPORT_LIST (area
) = NULL
;
1346 if (IMPORT_NAME (area
))
1348 IMPORT_LIST (area
) = NULL
;
1353 /* Schedule ABR tasks -- this will be changed -- takada. */
1354 if (IS_OSPF_ABR (ospf
) && abr_inv
)
1355 ospf_schedule_abr_task (ospf
);
1358 /* If prefix-list is updated, do some updates. */
1360 ospf_prefix_list_update (struct prefix_list
*plist
)
1365 struct ospf_area
*area
;
1366 struct listnode
*node
;
1368 /* If OSPF instatnce does not exist, return right now. */
1369 ospf
= ospf_lookup ();
1373 /* Update all route-maps which are used as redistribution filters.
1374 * They might use prefix-list.
1376 for (type
= 0; type
<= ZEBRA_ROUTE_MAX
; type
++)
1378 struct list
*red_list
;
1379 struct listnode
*node
;
1380 struct ospf_redist
*red
;
1382 red_list
= ospf
->redist
[type
];
1384 for (ALL_LIST_ELEMENTS_RO(red_list
, node
, red
))
1388 /* if route-map is not NULL it may be using this prefix list */
1389 ospf_distribute_list_update (ospf
, type
, red
->instance
);
1394 /* Update area filter-lists. */
1395 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, node
, area
))
1397 /* Update filter-list in. */
1398 if (PREFIX_NAME_IN (area
))
1399 if (strcmp (PREFIX_NAME_IN (area
), prefix_list_name (plist
)) == 0)
1401 PREFIX_LIST_IN (area
) =
1402 prefix_list_lookup (AFI_IP
, PREFIX_NAME_IN (area
));
1406 /* Update filter-list out. */
1407 if (PREFIX_NAME_OUT (area
))
1408 if (strcmp (PREFIX_NAME_OUT (area
), prefix_list_name (plist
)) == 0)
1410 PREFIX_LIST_IN (area
) =
1411 prefix_list_lookup (AFI_IP
, PREFIX_NAME_OUT (area
));
1416 /* Schedule ABR task. */
1417 if (IS_OSPF_ABR (ospf
) && abr_inv
)
1418 ospf_schedule_abr_task (ospf
);
1421 static struct ospf_distance
*
1422 ospf_distance_new (void)
1424 return XCALLOC (MTYPE_OSPF_DISTANCE
, sizeof (struct ospf_distance
));
1428 ospf_distance_free (struct ospf_distance
*odistance
)
1430 XFREE (MTYPE_OSPF_DISTANCE
, odistance
);
1434 ospf_distance_set (struct vty
*vty
, struct ospf
*ospf
,
1435 const char *distance_str
,
1437 const char *access_list_str
)
1440 struct prefix_ipv4 p
;
1442 struct route_node
*rn
;
1443 struct ospf_distance
*odistance
;
1445 ret
= str2prefix_ipv4 (ip_str
, &p
);
1448 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
1452 distance
= atoi (distance_str
);
1454 /* Get OSPF distance node. */
1455 rn
= route_node_get (ospf
->distance_table
, (struct prefix
*) &p
);
1458 odistance
= rn
->info
;
1459 route_unlock_node (rn
);
1463 odistance
= ospf_distance_new ();
1464 rn
->info
= odistance
;
1467 /* Set distance value. */
1468 odistance
->distance
= distance
;
1470 /* Reset access-list configuration. */
1471 if (odistance
->access_list
)
1473 free (odistance
->access_list
);
1474 odistance
->access_list
= NULL
;
1476 if (access_list_str
)
1477 odistance
->access_list
= strdup (access_list_str
);
1483 ospf_distance_unset (struct vty
*vty
, struct ospf
*ospf
,
1484 const char *distance_str
,
1485 const char *ip_str
, char
1486 const *access_list_str
)
1489 struct prefix_ipv4 p
;
1490 struct route_node
*rn
;
1491 struct ospf_distance
*odistance
;
1493 ret
= str2prefix_ipv4 (ip_str
, &p
);
1496 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
1500 rn
= route_node_lookup (ospf
->distance_table
, (struct prefix
*) &p
);
1503 vty_out (vty
, "Can't find specified prefix%s", VTY_NEWLINE
);
1507 odistance
= rn
->info
;
1509 if (odistance
->access_list
)
1510 free (odistance
->access_list
);
1511 ospf_distance_free (odistance
);
1514 route_unlock_node (rn
);
1515 route_unlock_node (rn
);
1521 ospf_distance_reset (struct ospf
*ospf
)
1523 struct route_node
*rn
;
1524 struct ospf_distance
*odistance
;
1526 for (rn
= route_top (ospf
->distance_table
); rn
; rn
= route_next (rn
))
1527 if ((odistance
= rn
->info
) != NULL
)
1529 if (odistance
->access_list
)
1530 free (odistance
->access_list
);
1531 ospf_distance_free (odistance
);
1533 route_unlock_node (rn
);
1538 ospf_distance_apply (struct prefix_ipv4
*p
, struct ospf_route
*or)
1542 ospf
= ospf_lookup ();
1546 if (ospf
->distance_intra
)
1547 if (or->path_type
== OSPF_PATH_INTRA_AREA
)
1548 return ospf
->distance_intra
;
1550 if (ospf
->distance_inter
)
1551 if (or->path_type
== OSPF_PATH_INTER_AREA
)
1552 return ospf
->distance_inter
;
1554 if (ospf
->distance_external
)
1555 if (or->path_type
== OSPF_PATH_TYPE1_EXTERNAL
1556 || or->path_type
== OSPF_PATH_TYPE2_EXTERNAL
)
1557 return ospf
->distance_external
;
1559 if (ospf
->distance_all
)
1560 return ospf
->distance_all
;
1566 ospf_zebra_connected (struct zclient
*zclient
)
1568 /* Send the client registration */
1569 bfd_client_sendmsg(zclient
, ZEBRA_BFD_CLIENT_REGISTER
);
1571 zclient_send_reg_requests (zclient
, VRF_DEFAULT
);
1575 ospf_zebra_init (struct thread_master
*master
, u_short instance
)
1577 /* Allocate zebra structure. */
1578 zclient
= zclient_new(master
);
1579 zclient_init (zclient
, ZEBRA_ROUTE_OSPF
, instance
);
1580 zclient
->zebra_connected
= ospf_zebra_connected
;
1581 zclient
->router_id_update
= ospf_router_id_update_zebra
;
1582 zclient
->interface_add
= ospf_interface_add
;
1583 zclient
->interface_delete
= ospf_interface_delete
;
1584 zclient
->interface_up
= ospf_interface_state_up
;
1585 zclient
->interface_down
= ospf_interface_state_down
;
1586 zclient
->interface_address_add
= ospf_interface_address_add
;
1587 zclient
->interface_address_delete
= ospf_interface_address_delete
;
1588 zclient
->interface_link_params
= ospf_interface_link_params
;
1590 zclient
->redistribute_route_ipv4_add
= ospf_zebra_read_ipv4
;
1591 zclient
->redistribute_route_ipv4_del
= ospf_zebra_read_ipv4
;
1593 access_list_add_hook (ospf_filter_update
);
1594 access_list_delete_hook (ospf_filter_update
);
1595 prefix_list_add_hook (ospf_prefix_list_update
);
1596 prefix_list_delete_hook (ospf_prefix_list_update
);