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
18 * along with GNU Zebra; see the file COPYING. If not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
38 #include "ospfd/ospfd.h"
39 #include "ospfd/ospf_interface.h"
40 #include "ospfd/ospf_ism.h"
41 #include "ospfd/ospf_asbr.h"
42 #include "ospfd/ospf_asbr.h"
43 #include "ospfd/ospf_abr.h"
44 #include "ospfd/ospf_lsa.h"
45 #include "ospfd/ospf_dump.h"
46 #include "ospfd/ospf_route.h"
47 #include "ospfd/ospf_lsdb.h"
48 #include "ospfd/ospf_neighbor.h"
49 #include "ospfd/ospf_nsm.h"
50 #include "ospfd/ospf_zebra.h"
52 #include "ospfd/ospf_snmp.h"
53 #endif /* HAVE_SNMP */
55 /* Zebra structure to hold current status. */
56 struct zclient
*zclient
= NULL
;
58 /* For registering threads. */
59 extern struct thread_master
*master
;
60 struct in_addr router_id_zebra
;
62 /* Router-id update message from zebra. */
64 ospf_router_id_update_zebra (int command
, struct zclient
*zclient
,
65 zebra_size_t length
, vrf_id_t vrf_id
)
68 struct prefix router_id
;
69 zebra_router_id_update_read(zclient
->ibuf
,&router_id
);
71 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
;
80 ospf
= ospf_lookup ();
83 ospf_router_id_update (ospf
);
88 /* Inteface addition message from zebra. */
90 ospf_interface_add (int command
, struct zclient
*zclient
, zebra_size_t length
,
93 struct interface
*ifp
;
95 ifp
= zebra_interface_add_read (zclient
->ibuf
, vrf_id
);
97 if (IS_DEBUG_OSPF (zebra
, ZEBRA_INTERFACE
))
98 zlog_debug ("Zebra: interface add %s[%u] index %d flags %llx metric %d mtu %d",
99 ifp
->name
, ifp
->vrf_id
, ifp
->ifindex
, (unsigned long long)ifp
->flags
,
100 ifp
->metric
, ifp
->mtu
);
104 if (!OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp
), type
))
106 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), type
);
107 IF_DEF_PARAMS (ifp
)->type
= ospf_default_iftype(ifp
);
110 ospf_if_update (NULL
, ifp
);
113 ospf_snmp_if_update (ifp
);
114 #endif /* HAVE_SNMP */
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
);
144 ospf_snmp_if_delete (ifp
);
145 #endif /* HAVE_SNMP */
147 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
149 ospf_if_free ((struct ospf_interface
*) rn
->info
);
151 ifp
->ifindex
= IFINDEX_DELETED
;
155 static struct interface
*
156 zebra_interface_if_lookup (struct stream
*s
, vrf_id_t vrf_id
)
158 char ifname_tmp
[INTERFACE_NAMSIZ
];
160 /* Read interface name. */
161 stream_get (ifname_tmp
, s
, INTERFACE_NAMSIZ
);
163 /* And look it up. */
164 return if_lookup_by_name_len(ifname_tmp
,
165 strnlen(ifname_tmp
, INTERFACE_NAMSIZ
));
169 ospf_interface_state_up (int command
, struct zclient
*zclient
,
170 zebra_size_t length
, vrf_id_t vrf_id
)
172 struct interface
*ifp
;
173 struct ospf_interface
*oi
;
174 struct route_node
*rn
;
176 ifp
= zebra_interface_if_lookup (zclient
->ibuf
, vrf_id
);
181 /* Interface is already up. */
182 if (if_is_operative (ifp
))
184 /* Temporarily keep ifp values. */
185 struct interface if_tmp
;
186 memcpy (&if_tmp
, ifp
, sizeof (struct interface
));
188 zebra_interface_if_set_value (zclient
->ibuf
, ifp
);
190 if (IS_DEBUG_OSPF (zebra
, ZEBRA_INTERFACE
))
191 zlog_debug ("Zebra: Interface[%s] state update.", ifp
->name
);
193 if (if_tmp
.bandwidth
!= ifp
->bandwidth
)
195 if (IS_DEBUG_OSPF (zebra
, ZEBRA_INTERFACE
))
196 zlog_debug ("Zebra: Interface[%s] bandwidth change %d -> %d.",
197 ifp
->name
, if_tmp
.bandwidth
, ifp
->bandwidth
);
199 ospf_if_recalculate_output_cost (ifp
);
202 if (if_tmp
.mtu
!= ifp
->mtu
)
204 if (IS_DEBUG_OSPF (zebra
, ZEBRA_INTERFACE
))
205 zlog_debug ("Zebra: Interface[%s] MTU change %u -> %u.",
206 ifp
->name
, if_tmp
.mtu
, ifp
->mtu
);
208 /* Must reset the interface (simulate down/up) when MTU changes. */
214 zebra_interface_if_set_value (zclient
->ibuf
, ifp
);
216 if (IS_DEBUG_OSPF (zebra
, ZEBRA_INTERFACE
))
217 zlog_debug ("Zebra: Interface[%s] state change to up.", ifp
->name
);
219 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
221 if ((oi
= rn
->info
) == NULL
)
231 ospf_interface_state_down (int command
, struct zclient
*zclient
,
232 zebra_size_t length
, vrf_id_t vrf_id
)
234 struct interface
*ifp
;
235 struct ospf_interface
*oi
;
236 struct route_node
*node
;
238 ifp
= zebra_interface_state_read (zclient
->ibuf
, vrf_id
);
243 if (IS_DEBUG_OSPF (zebra
, ZEBRA_INTERFACE
))
244 zlog_debug ("Zebra: Interface[%s] state change to down.", ifp
->name
);
246 for (node
= route_top (IF_OIFS (ifp
)); node
; node
= route_next (node
))
248 if ((oi
= node
->info
) == NULL
)
257 ospf_interface_address_add (int command
, struct zclient
*zclient
,
258 zebra_size_t length
, vrf_id_t vrf_id
)
262 c
= zebra_interface_address_read (command
, zclient
->ibuf
, vrf_id
);
267 if (IS_DEBUG_OSPF (zebra
, ZEBRA_INTERFACE
))
269 char buf
[PREFIX2STR_BUFFER
];
270 prefix2str(c
->address
, buf
, sizeof(buf
));
271 zlog_debug("Zebra: interface %s address add %s", c
->ifp
->name
, buf
);
274 ospf_if_update (NULL
, c
->ifp
);
277 ospf_snmp_if_update (c
->ifp
);
278 #endif /* HAVE_SNMP */
284 ospf_interface_address_delete (int command
, struct zclient
*zclient
,
285 zebra_size_t length
, vrf_id_t vrf_id
)
288 struct interface
*ifp
;
289 struct ospf_interface
*oi
;
290 struct route_node
*rn
;
293 c
= zebra_interface_address_read (command
, zclient
->ibuf
, vrf_id
);
298 if (IS_DEBUG_OSPF (zebra
, ZEBRA_INTERFACE
))
300 char buf
[PREFIX2STR_BUFFER
];
301 prefix2str(c
->address
, buf
, sizeof(buf
));
302 zlog_debug("Zebra: interface %s address delete %s", c
->ifp
->name
, buf
);
307 p
.prefixlen
= IPV4_MAX_PREFIXLEN
;
309 rn
= route_node_lookup (IF_OIFS (ifp
), &p
);
319 /* Call interface hook functions to clean up */
323 ospf_snmp_if_update (c
->ifp
);
324 #endif /* HAVE_SNMP */
332 ospf_zebra_add (struct prefix_ipv4
*p
, struct ospf_route
*or)
339 struct ospf_path
*path
;
340 struct listnode
*node
;
341 struct ospf
*ospf
= ospf_lookup ();
343 if ((ospf
->instance
&&
344 redist_check_instance(&zclient
->mi_redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
], ospf
->instance
))
346 vrf_bitmap_check (zclient
->redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
], VRF_DEFAULT
))
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 and use only 16bit tags */
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
< UINT16_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_putc (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 if (path
->unnumbered
||
391 (path
->nexthop
.s_addr
!= INADDR_ANY
&&
394 stream_putc (s
, ZEBRA_NEXTHOP_IPV4_IFINDEX
);
395 stream_put_in_addr (s
, &path
->nexthop
);
396 stream_putl (s
, path
->ifindex
);
398 else if (path
->nexthop
.s_addr
!= INADDR_ANY
)
400 stream_putc (s
, ZEBRA_NEXTHOP_IPV4
);
401 stream_put_in_addr (s
, &path
->nexthop
);
405 stream_putc (s
, ZEBRA_NEXTHOP_IFINDEX
);
407 stream_putl (s
, path
->ifindex
);
411 #else /* HAVE_NETLINK */
412 if (path
->nexthop
.s_addr
!= INADDR_ANY
&&
415 stream_putc (s
, ZEBRA_NEXTHOP_IPV4_IFINDEX
);
416 stream_put_in_addr (s
, &path
->nexthop
);
417 stream_putl (s
, path
->ifindex
);
419 else if (path
->nexthop
.s_addr
!= INADDR_ANY
)
421 stream_putc (s
, ZEBRA_NEXTHOP_IPV4
);
422 stream_put_in_addr (s
, &path
->nexthop
);
426 stream_putc (s
, ZEBRA_NEXTHOP_IFINDEX
);
428 stream_putl (s
, path
->ifindex
);
432 #endif /* HAVE_NETLINK */
434 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
436 char buf
[2][INET_ADDRSTRLEN
];
437 zlog_debug("Zebra: Route add %s/%d nexthop %s, ifindex=%d",
438 inet_ntop(AF_INET
, &p
->prefix
,
439 buf
[0], sizeof(buf
[0])),
441 inet_ntop(AF_INET
, &path
->nexthop
,
442 buf
[1], sizeof(buf
[1])),
447 if (CHECK_FLAG (message
, ZAPI_MESSAGE_DISTANCE
))
448 stream_putc (s
, distance
);
449 if (CHECK_FLAG (message
, ZAPI_MESSAGE_METRIC
))
451 if (or->path_type
== OSPF_PATH_TYPE1_EXTERNAL
)
452 stream_putl (s
, or->cost
+ or->u
.ext
.type2_cost
);
453 else if (or->path_type
== OSPF_PATH_TYPE2_EXTERNAL
)
454 stream_putl (s
, or->u
.ext
.type2_cost
);
456 stream_putl (s
, or->cost
);
459 if (CHECK_FLAG (message
, ZAPI_MESSAGE_TAG
))
460 stream_putw (s
, (u_short
)or->u
.ext
.tag
);
462 stream_putw_at (s
, 0, stream_get_endp (s
));
464 zclient_send_message(zclient
);
469 ospf_zebra_delete (struct prefix_ipv4
*p
, struct ospf_route
*or)
476 struct ospf_path
*path
;
477 struct listnode
*node
;
478 struct ospf
*ospf
= ospf_lookup ();
480 if ((ospf
->instance
&&
481 redist_check_instance(&zclient
->mi_redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
], ospf
->instance
))
483 vrf_bitmap_check (zclient
->redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
], VRF_DEFAULT
))
487 /* Distance value. */
488 distance
= ospf_distance_apply (p
, or);
493 /* Put command, type, flags, message. */
494 zclient_create_header (s
, ZEBRA_IPV4_ROUTE_DELETE
, VRF_DEFAULT
);
495 stream_putc (s
, ZEBRA_ROUTE_OSPF
);
496 stream_putw (s
, ospf
->instance
);
497 stream_putc (s
, flags
);
498 stream_putc (s
, message
);
499 stream_putw (s
, SAFI_UNICAST
);
501 /* Put prefix information. */
502 psize
= PSIZE (p
->prefixlen
);
503 stream_putc (s
, p
->prefixlen
);
504 stream_write (s
, (u_char
*) & p
->prefix
, psize
);
507 stream_putc (s
, or->paths
->count
);
509 /* Nexthop, ifindex, distance and metric information. */
510 for (ALL_LIST_ELEMENTS_RO (or->paths
, node
, path
))
512 if (path
->nexthop
.s_addr
!= INADDR_ANY
&&
515 stream_putc (s
, ZEBRA_NEXTHOP_IPV4_IFINDEX
);
516 stream_put_in_addr (s
, &path
->nexthop
);
517 stream_putl (s
, path
->ifindex
);
519 else if (path
->nexthop
.s_addr
!= INADDR_ANY
)
521 stream_putc (s
, ZEBRA_NEXTHOP_IPV4
);
522 stream_put_in_addr (s
, &path
->nexthop
);
526 stream_putc (s
, ZEBRA_NEXTHOP_IFINDEX
);
527 stream_putl (s
, path
->ifindex
);
530 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
532 char buf
[2][INET_ADDRSTRLEN
];
533 zlog_debug("Zebra: Route delete %s/%d nexthop %s",
534 inet_ntop(AF_INET
, &p
->prefix
,
535 buf
[0], sizeof(buf
[0])),
537 inet_ntop(AF_INET
, &path
->nexthop
,
538 buf
[1], sizeof(buf
[1])));
542 if (CHECK_FLAG (message
, ZAPI_MESSAGE_DISTANCE
))
543 stream_putc (s
, distance
);
544 if (CHECK_FLAG (message
, ZAPI_MESSAGE_METRIC
))
546 if (or->path_type
== OSPF_PATH_TYPE1_EXTERNAL
)
547 stream_putl (s
, or->cost
+ or->u
.ext
.type2_cost
);
548 else if (or->path_type
== OSPF_PATH_TYPE2_EXTERNAL
)
549 stream_putl (s
, or->u
.ext
.type2_cost
);
551 stream_putl (s
, or->cost
);
554 stream_putw_at (s
, 0, stream_get_endp (s
));
556 zclient_send_message(zclient
);
561 ospf_zebra_add_discard (struct prefix_ipv4
*p
)
563 struct zapi_ipv4 api
;
564 struct ospf
*ospf
= ospf_lookup ();
566 if ((ospf
->instance
&&
567 redist_check_instance(&zclient
->mi_redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
], ospf
->instance
))
569 vrf_bitmap_check (zclient
->redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
], VRF_DEFAULT
))
571 api
.vrf_id
= VRF_DEFAULT
;
572 api
.type
= ZEBRA_ROUTE_OSPF
;
573 api
.instance
= ospf
->instance
;
574 api
.flags
= ZEBRA_FLAG_BLACKHOLE
;
576 api
.safi
= SAFI_UNICAST
;
577 SET_FLAG (api
.message
, ZAPI_MESSAGE_NEXTHOP
);
582 zapi_ipv4_route (ZEBRA_IPV4_ROUTE_ADD
, zclient
, p
, &api
);
584 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
585 zlog_debug ("Zebra: Route add discard %s/%d",
586 inet_ntoa (p
->prefix
), p
->prefixlen
);
591 ospf_zebra_delete_discard (struct prefix_ipv4
*p
)
593 struct zapi_ipv4 api
;
594 struct ospf
*ospf
= ospf_lookup ();
596 if ((ospf
->instance
&&
597 redist_check_instance(&zclient
->mi_redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
], ospf
->instance
))
599 vrf_bitmap_check (zclient
->redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
], VRF_DEFAULT
))
601 api
.vrf_id
= VRF_DEFAULT
;
602 api
.type
= ZEBRA_ROUTE_OSPF
;
603 api
.instance
= ospf
->instance
;
604 api
.flags
= ZEBRA_FLAG_BLACKHOLE
;
606 api
.safi
= SAFI_UNICAST
;
607 SET_FLAG (api
.message
, ZAPI_MESSAGE_NEXTHOP
);
612 zapi_ipv4_route (ZEBRA_IPV4_ROUTE_DELETE
, zclient
, p
, &api
);
614 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
615 zlog_debug ("Zebra: Route delete discard %s/%d",
616 inet_ntoa (p
->prefix
), p
->prefixlen
);
621 struct ospf_external
*
622 ospf_external_lookup (u_char type
, u_short instance
)
624 struct list
*ext_list
;
625 struct listnode
*node
;
626 struct ospf_external
*ext
;
628 ext_list
= om
->external
[type
];
632 for (ALL_LIST_ELEMENTS_RO(ext_list
, node
, ext
))
633 if (ext
->instance
== instance
)
639 struct ospf_external
*
640 ospf_external_add (u_char type
, u_short instance
)
642 struct list
*ext_list
;
643 struct ospf_external
*ext
;
645 ext
= ospf_external_lookup(type
, instance
);
649 if (!om
->external
[type
])
650 om
->external
[type
] = list_new();
652 ext_list
= om
->external
[type
];
653 ext
= (struct ospf_external
*)calloc (1, sizeof(struct ospf_external
));
654 ext
->instance
= instance
;
655 EXTERNAL_INFO (ext
) = route_table_init ();
657 listnode_add(ext_list
, ext
);
663 ospf_external_del (u_char type
, u_short instance
)
665 struct ospf_external
*ext
;
667 ext
= ospf_external_lookup(type
, instance
);
671 if (EXTERNAL_INFO (ext
))
672 route_table_finish(EXTERNAL_INFO (ext
));
674 listnode_delete(om
->external
[type
], ext
);
675 if (!om
->external
[type
]->count
)
677 list_free(om
->external
[type
]);
678 om
->external
[type
] = NULL
;
684 ospf_redist_lookup (struct ospf
*ospf
, u_char type
, u_short instance
)
686 struct list
*red_list
;
687 struct listnode
*node
;
688 struct ospf_redist
*red
;
690 red_list
= ospf
->redist
[type
];
694 for (ALL_LIST_ELEMENTS_RO(red_list
, node
, red
))
695 if (red
->instance
== instance
)
702 ospf_redist_add (struct ospf
*ospf
, u_char type
, u_short instance
)
704 struct list
*red_list
;
705 struct ospf_redist
*red
;
707 red
= ospf_redist_lookup(ospf
, type
, instance
);
711 if (!ospf
->redist
[type
])
712 ospf
->redist
[type
] = list_new();
714 red_list
= ospf
->redist
[type
];
715 red
= (struct ospf_redist
*)calloc (1, sizeof(struct ospf_redist
));
716 red
->instance
= instance
;
717 red
->dmetric
.type
= -1;
718 red
->dmetric
.value
= -1;
720 listnode_add(red_list
, red
);
726 ospf_redist_del (struct ospf
*ospf
, u_char type
, u_short instance
)
728 struct ospf_redist
*red
;
730 red
= ospf_redist_lookup(ospf
, type
, instance
);
734 listnode_delete(ospf
->redist
[type
], red
);
735 if (!ospf
->redist
[type
]->count
)
737 list_free(ospf
->redist
[type
]);
738 ospf
->redist
[type
] = NULL
;
745 ospf_is_type_redistributed (int type
, u_short instance
)
747 return (DEFAULT_ROUTE_TYPE (type
) ?
748 vrf_bitmap_check (zclient
->default_information
, VRF_DEFAULT
) :
749 ((instance
&& redist_check_instance(&zclient
->mi_redist
[AFI_IP
][type
], instance
))
750 || (!instance
&& vrf_bitmap_check (zclient
->redist
[AFI_IP
][type
], VRF_DEFAULT
))));
754 ospf_redistribute_set (struct ospf
*ospf
, int type
, u_short instance
, int mtype
,
758 struct ospf_redist
*red
;
760 red
= ospf_redist_lookup(ospf
, type
, instance
);
761 if (ospf_is_type_redistributed (type
, instance
))
763 if (mtype
!= red
->dmetric
.type
)
765 red
->dmetric
.type
= mtype
;
766 force
= LSA_REFRESH_FORCE
;
768 if (mvalue
!= red
->dmetric
.value
)
770 red
->dmetric
.value
= mvalue
;
771 force
= LSA_REFRESH_FORCE
;
774 ospf_external_lsa_refresh_type (ospf
, type
, instance
, force
);
776 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
777 zlog_debug ("Redistribute[%s][%d]: Refresh Type[%d], Metric[%d]",
778 ospf_redist_string(type
), instance
,
779 metric_type (ospf
, type
, instance
),
780 metric_value (ospf
, type
, instance
));
785 red
->dmetric
.type
= mtype
;
786 red
->dmetric
.value
= mvalue
;
788 ospf_external_add(type
, instance
);
790 zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD
, zclient
, AFI_IP
, type
,
791 instance
, VRF_DEFAULT
);
793 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
794 zlog_debug ("Redistribute[%s][%d]: Start Type[%d], Metric[%d]",
795 ospf_redist_string(type
), instance
,
796 metric_type (ospf
, type
, instance
), metric_value (ospf
, type
, instance
));
798 ospf_asbr_status_update (ospf
, ++ospf
->redistribute
);
804 ospf_redistribute_unset (struct ospf
*ospf
, int type
, u_short instance
)
806 if (type
== zclient
->redist_default
&& instance
== zclient
->instance
)
809 if (!ospf_is_type_redistributed (type
, instance
))
812 zclient_redistribute (ZEBRA_REDISTRIBUTE_DELETE
, zclient
, AFI_IP
, type
,
813 instance
, VRF_DEFAULT
);
815 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
816 zlog_debug ("Redistribute[%s][%d]: Stop",
817 ospf_redist_string(type
), instance
);
819 ospf_redist_del (ospf
, type
, instance
);
821 /* Remove the routes from OSPF table. */
822 ospf_redistribute_withdraw (ospf
, type
, instance
);
824 ospf_external_del(type
, instance
);
826 ospf_asbr_status_update (ospf
, --ospf
->redistribute
);
832 ospf_redistribute_default_set (struct ospf
*ospf
, int originate
,
833 int mtype
, int mvalue
)
835 struct ospf_redist
*red
;
837 ospf
->default_originate
= originate
;
839 red
= ospf_redist_add(ospf
, DEFAULT_ROUTE
, 0);
840 red
->dmetric
.type
= mtype
;
841 red
->dmetric
.value
= mvalue
;
843 ospf_external_add(DEFAULT_ROUTE
, 0);
845 if (ospf_is_type_redistributed (DEFAULT_ROUTE
, 0))
847 /* if ospf->default_originate changes value, is calling
848 ospf_external_lsa_refresh_default sufficient to implement
850 ospf_external_lsa_refresh_default (ospf
);
852 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
853 zlog_debug ("Redistribute[%s]: Refresh Type[%d], Metric[%d]",
854 ospf_redist_string(DEFAULT_ROUTE
),
855 metric_type (ospf
, DEFAULT_ROUTE
, 0),
856 metric_value (ospf
, DEFAULT_ROUTE
, 0));
860 zclient_redistribute_default (ZEBRA_REDISTRIBUTE_DEFAULT_ADD
, zclient
,
863 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
864 zlog_debug ("Redistribute[DEFAULT]: Start Type[%d], Metric[%d]",
865 metric_type (ospf
, DEFAULT_ROUTE
, 0),
866 metric_value (ospf
, DEFAULT_ROUTE
, 0));
868 if (ospf
->router_id
.s_addr
== 0)
869 ospf
->external_origin
|= (1 << DEFAULT_ROUTE
);
871 thread_add_timer (master
, ospf_default_originate_timer
, ospf
, 1);
873 ospf_asbr_status_update (ospf
, ++ospf
->redistribute
);
879 ospf_redistribute_default_unset (struct ospf
*ospf
)
881 if (!ospf_is_type_redistributed (DEFAULT_ROUTE
, 0))
884 ospf
->default_originate
= DEFAULT_ORIGINATE_NONE
;
885 ospf_redist_del(ospf
, DEFAULT_ROUTE
, 0);
887 zclient_redistribute_default (ZEBRA_REDISTRIBUTE_DEFAULT_DELETE
, zclient
,
890 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
891 zlog_debug ("Redistribute[DEFAULT]: Stop");
893 //Pending: how does the external_info cleanup work in this case?
895 ospf_asbr_status_update (ospf
, --ospf
->redistribute
);
901 ospf_external_lsa_originate_check (struct ospf
*ospf
,
902 struct external_info
*ei
)
904 /* If prefix is multicast, then do not originate LSA. */
905 if (IN_MULTICAST (htonl (ei
->p
.prefix
.s_addr
)))
907 zlog_info ("LSA[Type5:%s]: Not originate AS-external-LSA, "
908 "Prefix belongs multicast", inet_ntoa (ei
->p
.prefix
));
912 /* Take care of default-originate. */
913 if (is_prefix_default (&ei
->p
))
914 if (ospf
->default_originate
== DEFAULT_ORIGINATE_NONE
)
916 zlog_info ("LSA[Type5:0.0.0.0]: Not originate AS-external-LSA "
924 /* If connected prefix is OSPF enable interface, then do not announce. */
926 ospf_distribute_check_connected (struct ospf
*ospf
, struct external_info
*ei
)
928 struct listnode
*node
;
929 struct ospf_interface
*oi
;
932 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
933 if (prefix_match (oi
->address
, (struct prefix
*) &ei
->p
))
938 /* return 1 if external LSA must be originated, 0 otherwise */
940 ospf_redistribute_check (struct ospf
*ospf
,
941 struct external_info
*ei
, int *changed
)
943 struct route_map_set_values save_values
;
944 struct prefix_ipv4
*p
= &ei
->p
;
945 struct ospf_redist
*red
;
946 u_char type
= is_prefix_default (&ei
->p
) ? DEFAULT_ROUTE
: ei
->type
;
947 u_short instance
= is_prefix_default (&ei
->p
) ? 0 : ei
->instance
;
952 if (!ospf_external_lsa_originate_check (ospf
, ei
))
955 /* Take care connected route. */
956 if (type
== ZEBRA_ROUTE_CONNECT
&&
957 !ospf_distribute_check_connected (ospf
, ei
))
960 if (!DEFAULT_ROUTE_TYPE (type
) && DISTRIBUTE_NAME (ospf
, type
))
961 /* distirbute-list exists, but access-list may not? */
962 if (DISTRIBUTE_LIST (ospf
, type
))
963 if (access_list_apply (DISTRIBUTE_LIST (ospf
, type
), p
) == FILTER_DENY
)
965 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
966 zlog_debug ("Redistribute[%s]: %s/%d filtered by ditribute-list.",
967 ospf_redist_string(type
),
968 inet_ntoa (p
->prefix
), p
->prefixlen
);
972 save_values
= ei
->route_map_set
;
973 ospf_reset_route_map_set_values (&ei
->route_map_set
);
975 /* apply route-map if needed */
976 red
= ospf_redist_lookup (ospf
, type
, instance
);
977 if (red
&& ROUTEMAP_NAME(red
))
981 ret
= route_map_apply (ROUTEMAP (red
), (struct prefix
*) p
,
984 if (ret
== RMAP_DENYMATCH
)
986 ei
->route_map_set
= save_values
;
987 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
988 zlog_debug ("Redistribute[%s]: %s/%d filtered by route-map.",
989 ospf_redist_string(type
),
990 inet_ntoa (p
->prefix
), p
->prefixlen
);
994 /* check if 'route-map set' changed something */
996 *changed
= !ospf_route_map_set_compare (&ei
->route_map_set
,
1003 /* OSPF route-map set for redistribution */
1005 ospf_routemap_set (struct ospf_redist
*red
, const char *name
)
1007 if (ROUTEMAP_NAME (red
))
1008 free (ROUTEMAP_NAME (red
));
1010 ROUTEMAP_NAME (red
) = strdup (name
);
1011 ROUTEMAP (red
) = route_map_lookup_by_name (name
);
1015 ospf_routemap_unset (struct ospf_redist
*red
)
1017 if (ROUTEMAP_NAME (red
))
1018 free (ROUTEMAP_NAME (red
));
1020 ROUTEMAP_NAME (red
) = NULL
;
1021 ROUTEMAP (red
) = NULL
;
1024 /* Zebra route add and delete treatment. */
1026 ospf_zebra_read_ipv4 (int command
, struct zclient
*zclient
,
1027 zebra_size_t length
, vrf_id_t vrf_id
)
1030 struct zapi_ipv4 api
;
1031 unsigned long ifindex
;
1032 struct in_addr nexthop
;
1033 struct prefix_ipv4 p
;
1034 struct external_info
*ei
;
1042 /* Type, flags, message. */
1043 api
.type
= stream_getc (s
);
1044 api
.instance
= stream_getw (s
);
1045 api
.flags
= stream_getc (s
);
1046 api
.message
= stream_getc (s
);
1049 memset (&p
, 0, sizeof (struct prefix_ipv4
));
1051 p
.prefixlen
= stream_getc (s
);
1052 stream_get (&p
.prefix
, s
, PSIZE (p
.prefixlen
));
1054 if (IPV4_NET127(ntohl(p
.prefix
.s_addr
)))
1057 /* Nexthop, ifindex, distance, metric. */
1058 if (CHECK_FLAG (api
.message
, ZAPI_MESSAGE_NEXTHOP
))
1060 api
.nexthop_num
= stream_getc (s
);
1061 nexthop
.s_addr
= stream_get_ipv4 (s
);
1063 if (CHECK_FLAG (api
.message
, ZAPI_MESSAGE_IFINDEX
))
1065 api
.ifindex_num
= stream_getc (s
);
1066 /* XXX assert(api.ifindex_num == 1); */
1067 ifindex
= stream_getl (s
);
1069 if (CHECK_FLAG (api
.message
, ZAPI_MESSAGE_DISTANCE
))
1070 api
.distance
= stream_getc (s
);
1071 if (CHECK_FLAG (api
.message
, ZAPI_MESSAGE_METRIC
))
1072 api
.metric
= stream_getl (s
);
1073 if (CHECK_FLAG (api
.message
, ZAPI_MESSAGE_TAG
))
1074 api
.tag
= stream_getw (s
);
1078 ospf
= ospf_lookup ();
1082 if (command
== ZEBRA_REDISTRIBUTE_IPV4_ADD
)
1084 /* XXX|HACK|TODO|FIXME:
1085 * Maybe we should ignore reject/blackhole routes? Testing shows that
1086 * there is no problems though and this is only way to "summarize"
1087 * routes in ASBR at the moment. Maybe we need just a better generalised
1088 * solution for these types?
1090 * if ( CHECK_FLAG (api.flags, ZEBRA_FLAG_BLACKHOLE)
1091 * || CHECK_FLAG (api.flags, ZEBRA_FLAG_REJECT))
1095 /* Protocol tag overwrites all other tag value send by zebra */
1096 if (ospf
->dtag
[api
.type
] > 0)
1097 api
.tag
= ospf
->dtag
[api
.type
];
1100 * Given zebra sends update for a prefix via ADD message, it should
1101 * be considered as an implicit DEL for that prefix with other source
1104 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++)
1106 ospf_external_info_delete(i
, api
.instance
, p
);
1108 ei
= ospf_external_info_add (api
.type
, api
.instance
, p
, ifindex
,
1112 /* Nothing has changed, so nothing to do; return */
1115 if (ospf
->router_id
.s_addr
== 0)
1116 /* Set flags to generate AS-external-LSA originate event
1117 for each redistributed protocols later. */
1118 ospf
->external_origin
|= (1 << api
.type
);
1123 if (is_prefix_default (&p
))
1124 ospf_external_lsa_refresh_default (ospf
);
1127 struct ospf_lsa
*current
;
1129 current
= ospf_external_info_find_lsa (ospf
, &ei
->p
);
1131 ospf_external_lsa_originate (ospf
, ei
);
1134 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
1135 zlog_debug ("ospf_zebra_read_ipv4() : %s refreshing LSA",
1136 inet_ntoa (p
.prefix
));
1137 ospf_external_lsa_refresh (ospf
, current
,
1138 ei
, LSA_REFRESH_FORCE
);
1144 else /* if (command == ZEBRA_REDISTRIBUTE_IPV4_DEL) */
1146 ospf_external_info_delete (api
.type
, api
.instance
, p
);
1147 if (is_prefix_default (&p
))
1148 ospf_external_lsa_refresh_default (ospf
);
1150 ospf_external_lsa_flush (ospf
, api
.type
, &p
, ifindex
/*, nexthop */);
1158 ospf_distribute_list_out_set (struct ospf
*ospf
, int type
, const char *name
)
1160 /* Lookup access-list for distribute-list. */
1161 DISTRIBUTE_LIST (ospf
, type
) = access_list_lookup (AFI_IP
, name
);
1163 /* Clear previous distribute-name. */
1164 if (DISTRIBUTE_NAME (ospf
, type
))
1165 free (DISTRIBUTE_NAME (ospf
, type
));
1167 /* Set distribute-name. */
1168 DISTRIBUTE_NAME (ospf
, type
) = strdup (name
);
1170 /* If access-list have been set, schedule update timer. */
1171 if (DISTRIBUTE_LIST (ospf
, type
))
1172 ospf_distribute_list_update (ospf
, type
, 0);
1178 ospf_distribute_list_out_unset (struct ospf
*ospf
, int type
, const char *name
)
1180 /* Schedule update timer. */
1181 if (DISTRIBUTE_LIST (ospf
, type
))
1182 ospf_distribute_list_update (ospf
, type
, 0);
1184 /* Unset distribute-list. */
1185 DISTRIBUTE_LIST (ospf
, type
) = NULL
;
1187 /* Clear distribute-name. */
1188 if (DISTRIBUTE_NAME (ospf
, type
))
1189 free (DISTRIBUTE_NAME (ospf
, type
));
1191 DISTRIBUTE_NAME (ospf
, type
) = NULL
;
1196 /* distribute-list update timer. */
1198 ospf_distribute_list_update_timer (struct thread
*thread
)
1200 struct route_node
*rn
;
1201 struct external_info
*ei
;
1202 struct route_table
*rt
;
1203 struct ospf_lsa
*lsa
;
1204 int type
, default_refresh
= 0;
1207 ospf
= ospf_lookup ();
1211 ospf
->t_distribute_update
= NULL
;
1213 zlog_info ("Zebra[Redistribute]: distribute-list update timer fired!");
1215 /* foreach all external info. */
1216 for (type
= 0; type
<= ZEBRA_ROUTE_MAX
; type
++)
1218 struct list
*ext_list
;
1219 struct listnode
*node
;
1220 struct ospf_external
*ext
;
1222 ext_list
= om
->external
[type
];
1226 for (ALL_LIST_ELEMENTS_RO(ext_list
, node
, ext
))
1228 rt
= ext
->external_info
;
1231 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
1232 if ((ei
= rn
->info
) != NULL
)
1234 if (is_prefix_default (&ei
->p
))
1235 default_refresh
= 1;
1236 else if ((lsa
= ospf_external_info_find_lsa (ospf
, &ei
->p
)))
1237 ospf_external_lsa_refresh (ospf
, lsa
, ei
, LSA_REFRESH_IF_CHANGED
);
1239 ospf_external_lsa_originate (ospf
, ei
);
1243 if (default_refresh
)
1244 ospf_external_lsa_refresh_default (ospf
);
1248 /* Update distribute-list and set timer to apply access-list. */
1250 ospf_distribute_list_update (struct ospf
*ospf
, uintptr_t type
,
1253 struct route_table
*rt
;
1254 struct ospf_external
*ext
;
1256 /* External info does not exist. */
1257 ext
= ospf_external_lookup(type
, instance
);
1258 if (!ext
|| !(rt
= EXTERNAL_INFO (ext
)))
1261 /* If exists previously invoked thread, then let it continue. */
1262 if (ospf
->t_distribute_update
)
1266 ospf
->t_distribute_update
=
1267 thread_add_timer (master
, ospf_distribute_list_update_timer
,
1268 (void *) type
, ospf
->min_ls_interval
);
1271 /* If access-list is updated, apply some check. */
1273 ospf_filter_update (struct access_list
*access
)
1278 struct ospf_area
*area
;
1279 struct listnode
*node
;
1281 /* If OSPF instance does not exist, return right now. */
1282 ospf
= ospf_lookup ();
1286 /* Update distribute-list, and apply filter. */
1287 for (type
= 0; type
<= ZEBRA_ROUTE_MAX
; type
++)
1289 struct list
*red_list
;
1290 struct listnode
*node
;
1291 struct ospf_redist
*red
;
1293 red_list
= ospf
->redist
[type
];
1295 for (ALL_LIST_ELEMENTS_RO(red_list
, node
, red
))
1299 /* if route-map is not NULL it may be using this access list */
1300 ospf_distribute_list_update (ospf
, type
, red
->instance
);
1304 /* There is place for route-map for default-information (ZEBRA_ROUTE_MAX),
1305 * but no distribute list. */
1306 if (type
== ZEBRA_ROUTE_MAX
)
1309 if (DISTRIBUTE_NAME (ospf
, type
))
1311 /* Keep old access-list for distribute-list. */
1312 struct access_list
*old
= DISTRIBUTE_LIST (ospf
, type
);
1314 /* Update access-list for distribute-list. */
1315 DISTRIBUTE_LIST (ospf
, type
) =
1316 access_list_lookup (AFI_IP
, DISTRIBUTE_NAME (ospf
, type
));
1318 /* No update for this distribute type. */
1319 if (old
== NULL
&& DISTRIBUTE_LIST (ospf
, type
) == NULL
)
1322 /* Schedule distribute-list update timer. */
1323 if (DISTRIBUTE_LIST (ospf
, type
) == NULL
||
1324 strcmp (DISTRIBUTE_NAME (ospf
, type
), access
->name
) == 0)
1325 ospf_distribute_list_update (ospf
, type
, 0);
1329 /* Update Area access-list. */
1330 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, node
, area
))
1332 if (EXPORT_NAME (area
))
1334 EXPORT_LIST (area
) = NULL
;
1338 if (IMPORT_NAME (area
))
1340 IMPORT_LIST (area
) = NULL
;
1345 /* Schedule ABR tasks -- this will be changed -- takada. */
1346 if (IS_OSPF_ABR (ospf
) && abr_inv
)
1347 ospf_schedule_abr_task (ospf
);
1350 /* If prefix-list is updated, do some updates. */
1352 ospf_prefix_list_update (struct prefix_list
*plist
)
1357 struct ospf_area
*area
;
1358 struct listnode
*node
;
1360 /* If OSPF instatnce does not exist, return right now. */
1361 ospf
= ospf_lookup ();
1365 /* Update all route-maps which are used as redistribution filters.
1366 * They might use prefix-list.
1368 for (type
= 0; type
<= ZEBRA_ROUTE_MAX
; type
++)
1370 struct list
*red_list
;
1371 struct listnode
*node
;
1372 struct ospf_redist
*red
;
1374 red_list
= ospf
->redist
[type
];
1376 for (ALL_LIST_ELEMENTS_RO(red_list
, node
, red
))
1380 /* if route-map is not NULL it may be using this prefix list */
1381 ospf_distribute_list_update (ospf
, type
, red
->instance
);
1386 /* Update area filter-lists. */
1387 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, node
, area
))
1389 /* Update filter-list in. */
1390 if (PREFIX_NAME_IN (area
))
1391 if (strcmp (PREFIX_NAME_IN (area
), prefix_list_name (plist
)) == 0)
1393 PREFIX_LIST_IN (area
) =
1394 prefix_list_lookup (AFI_IP
, PREFIX_NAME_IN (area
));
1398 /* Update filter-list out. */
1399 if (PREFIX_NAME_OUT (area
))
1400 if (strcmp (PREFIX_NAME_OUT (area
), prefix_list_name (plist
)) == 0)
1402 PREFIX_LIST_IN (area
) =
1403 prefix_list_lookup (AFI_IP
, PREFIX_NAME_OUT (area
));
1408 /* Schedule ABR task. */
1409 if (IS_OSPF_ABR (ospf
) && abr_inv
)
1410 ospf_schedule_abr_task (ospf
);
1413 static struct ospf_distance
*
1414 ospf_distance_new (void)
1416 return XCALLOC (MTYPE_OSPF_DISTANCE
, sizeof (struct ospf_distance
));
1420 ospf_distance_free (struct ospf_distance
*odistance
)
1422 XFREE (MTYPE_OSPF_DISTANCE
, odistance
);
1426 ospf_distance_set (struct vty
*vty
, struct ospf
*ospf
,
1427 const char *distance_str
,
1429 const char *access_list_str
)
1432 struct prefix_ipv4 p
;
1434 struct route_node
*rn
;
1435 struct ospf_distance
*odistance
;
1437 ret
= str2prefix_ipv4 (ip_str
, &p
);
1440 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
1444 distance
= atoi (distance_str
);
1446 /* Get OSPF distance node. */
1447 rn
= route_node_get (ospf
->distance_table
, (struct prefix
*) &p
);
1450 odistance
= rn
->info
;
1451 route_unlock_node (rn
);
1455 odistance
= ospf_distance_new ();
1456 rn
->info
= odistance
;
1459 /* Set distance value. */
1460 odistance
->distance
= distance
;
1462 /* Reset access-list configuration. */
1463 if (odistance
->access_list
)
1465 free (odistance
->access_list
);
1466 odistance
->access_list
= NULL
;
1468 if (access_list_str
)
1469 odistance
->access_list
= strdup (access_list_str
);
1475 ospf_distance_unset (struct vty
*vty
, struct ospf
*ospf
,
1476 const char *distance_str
,
1477 const char *ip_str
, char
1478 const *access_list_str
)
1481 struct prefix_ipv4 p
;
1482 struct route_node
*rn
;
1483 struct ospf_distance
*odistance
;
1485 ret
= str2prefix_ipv4 (ip_str
, &p
);
1488 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
1492 rn
= route_node_lookup (ospf
->distance_table
, (struct prefix
*) &p
);
1495 vty_out (vty
, "Can't find specified prefix%s", VTY_NEWLINE
);
1499 odistance
= rn
->info
;
1501 if (odistance
->access_list
)
1502 free (odistance
->access_list
);
1503 ospf_distance_free (odistance
);
1506 route_unlock_node (rn
);
1507 route_unlock_node (rn
);
1513 ospf_distance_reset (struct ospf
*ospf
)
1515 struct route_node
*rn
;
1516 struct ospf_distance
*odistance
;
1518 for (rn
= route_top (ospf
->distance_table
); rn
; rn
= route_next (rn
))
1519 if ((odistance
= rn
->info
) != NULL
)
1521 if (odistance
->access_list
)
1522 free (odistance
->access_list
);
1523 ospf_distance_free (odistance
);
1525 route_unlock_node (rn
);
1530 ospf_distance_apply (struct prefix_ipv4
*p
, struct ospf_route
*or)
1534 ospf
= ospf_lookup ();
1538 if (ospf
->distance_intra
)
1539 if (or->path_type
== OSPF_PATH_INTRA_AREA
)
1540 return ospf
->distance_intra
;
1542 if (ospf
->distance_inter
)
1543 if (or->path_type
== OSPF_PATH_INTER_AREA
)
1544 return ospf
->distance_inter
;
1546 if (ospf
->distance_external
)
1547 if (or->path_type
== OSPF_PATH_TYPE1_EXTERNAL
1548 || or->path_type
== OSPF_PATH_TYPE2_EXTERNAL
)
1549 return ospf
->distance_external
;
1551 if (ospf
->distance_all
)
1552 return ospf
->distance_all
;
1558 ospf_zebra_connected (struct zclient
*zclient
)
1560 zclient_send_reg_requests (zclient
, VRF_DEFAULT
);
1564 ospf_zebra_init (struct thread_master
*master
, u_short instance
)
1566 /* Allocate zebra structure. */
1567 zclient
= zclient_new(master
);
1568 zclient_init (zclient
, ZEBRA_ROUTE_OSPF
, instance
);
1569 zclient
->zebra_connected
= ospf_zebra_connected
;
1570 zclient
->router_id_update
= ospf_router_id_update_zebra
;
1571 zclient
->interface_add
= ospf_interface_add
;
1572 zclient
->interface_delete
= ospf_interface_delete
;
1573 zclient
->interface_up
= ospf_interface_state_up
;
1574 zclient
->interface_down
= ospf_interface_state_down
;
1575 zclient
->interface_address_add
= ospf_interface_address_add
;
1576 zclient
->interface_address_delete
= ospf_interface_address_delete
;
1577 zclient
->ipv4_route_add
= ospf_zebra_read_ipv4
;
1578 zclient
->ipv4_route_delete
= ospf_zebra_read_ipv4
;
1579 zclient
->redistribute_route_ipv4_add
= ospf_zebra_read_ipv4
;
1580 zclient
->redistribute_route_ipv4_del
= ospf_zebra_read_ipv4
;
1582 access_list_add_hook (ospf_filter_update
);
1583 access_list_delete_hook (ospf_filter_update
);
1584 prefix_list_add_hook (ospf_prefix_list_update
);
1585 prefix_list_delete_hook (ospf_prefix_list_update
);