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.
40 #include "ospfd/ospfd.h"
41 #include "ospfd/ospf_interface.h"
42 #include "ospfd/ospf_ism.h"
43 #include "ospfd/ospf_asbr.h"
44 #include "ospfd/ospf_asbr.h"
45 #include "ospfd/ospf_abr.h"
46 #include "ospfd/ospf_lsa.h"
47 #include "ospfd/ospf_dump.h"
48 #include "ospfd/ospf_route.h"
49 #include "ospfd/ospf_lsdb.h"
50 #include "ospfd/ospf_neighbor.h"
51 #include "ospfd/ospf_nsm.h"
52 #include "ospfd/ospf_zebra.h"
53 #include "ospfd/ospf_te.h"
55 DEFINE_HOOK(ospf_if_update
, (struct interface
*ifp
), (ifp
))
56 DEFINE_HOOK(ospf_if_delete
, (struct interface
*ifp
), (ifp
))
58 /* Zebra structure to hold current status. */
59 struct zclient
*zclient
= NULL
;
61 /* For registering threads. */
62 extern struct thread_master
*master
;
63 struct in_addr router_id_zebra
;
65 /* Router-id update message from zebra. */
67 ospf_router_id_update_zebra (int command
, struct zclient
*zclient
,
68 zebra_size_t length
, vrf_id_t vrf_id
)
71 struct prefix router_id
;
72 zebra_router_id_update_read(zclient
->ibuf
,&router_id
);
74 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", buf
);
81 router_id_zebra
= router_id
.u
.prefix4
;
83 ospf
= ospf_lookup ();
86 ospf_router_id_update (ospf
);
91 /* Inteface addition message from zebra. */
93 ospf_interface_add (int command
, struct zclient
*zclient
, zebra_size_t length
,
96 struct interface
*ifp
;
98 ifp
= zebra_interface_add_read (zclient
->ibuf
, vrf_id
);
100 if (IS_DEBUG_OSPF (zebra
, ZEBRA_INTERFACE
))
101 zlog_debug ("Zebra: interface add %s[%u] index %d flags %llx metric %d mtu %d",
102 ifp
->name
, ifp
->vrf_id
, ifp
->ifindex
, (unsigned long long)ifp
->flags
,
103 ifp
->metric
, ifp
->mtu
);
107 if (!OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp
), type
))
109 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), type
);
110 IF_DEF_PARAMS (ifp
)->type
= ospf_default_iftype(ifp
);
113 ospf_if_update (NULL
, ifp
);
115 hook_call(ospf_if_update
, ifp
);
121 ospf_interface_delete (int command
, struct zclient
*zclient
,
122 zebra_size_t length
, vrf_id_t vrf_id
)
124 struct interface
*ifp
;
126 struct route_node
*rn
;
129 /* zebra_interface_state_read() updates interface structure in iflist */
130 ifp
= zebra_interface_state_read (s
, vrf_id
);
136 zlog_warn ("Zebra: got delete of %s, but interface is still up",
139 if (IS_DEBUG_OSPF (zebra
, ZEBRA_INTERFACE
))
141 ("Zebra: interface delete %s[%u] index %d flags %llx metric %d mtu %d",
142 ifp
->name
, ifp
->vrf_id
, ifp
->ifindex
, (unsigned long long)ifp
->flags
, ifp
->metric
, ifp
->mtu
);
144 hook_call(ospf_if_delete
, ifp
);
146 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
148 ospf_if_free ((struct ospf_interface
*) rn
->info
);
150 ifp
->ifindex
= IFINDEX_DELETED
;
154 static struct interface
*
155 zebra_interface_if_lookup (struct stream
*s
, vrf_id_t vrf_id
)
157 char ifname_tmp
[INTERFACE_NAMSIZ
];
159 /* Read interface name. */
160 stream_get (ifname_tmp
, s
, INTERFACE_NAMSIZ
);
162 /* And look it up. */
163 return if_lookup_by_name_len(ifname_tmp
,
164 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 speed %u -> %u, bw %d -> %d",
192 ifp
->name
, if_tmp
.speed
, ifp
->speed
, if_tmp
.bandwidth
, ifp
->bandwidth
);
194 ospf_if_recalculate_output_cost (ifp
);
196 if (if_tmp
.mtu
!= ifp
->mtu
)
198 if (IS_DEBUG_OSPF (zebra
, ZEBRA_INTERFACE
))
199 zlog_debug ("Zebra: Interface[%s] MTU change %u -> %u.",
200 ifp
->name
, if_tmp
.mtu
, ifp
->mtu
);
202 /* Must reset the interface (simulate down/up) when MTU changes. */
208 zebra_interface_if_set_value (zclient
->ibuf
, ifp
);
210 if (IS_DEBUG_OSPF (zebra
, ZEBRA_INTERFACE
))
211 zlog_debug ("Zebra: Interface[%s] state change to up.", ifp
->name
);
213 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
215 if ((oi
= rn
->info
) == NULL
)
225 ospf_interface_state_down (int command
, struct zclient
*zclient
,
226 zebra_size_t length
, vrf_id_t vrf_id
)
228 struct interface
*ifp
;
229 struct ospf_interface
*oi
;
230 struct route_node
*node
;
232 ifp
= zebra_interface_state_read (zclient
->ibuf
, vrf_id
);
237 if (IS_DEBUG_OSPF (zebra
, ZEBRA_INTERFACE
))
238 zlog_debug ("Zebra: Interface[%s] state change to down.", ifp
->name
);
240 for (node
= route_top (IF_OIFS (ifp
)); node
; node
= route_next (node
))
242 if ((oi
= node
->info
) == NULL
)
251 ospf_interface_address_add (int command
, struct zclient
*zclient
,
252 zebra_size_t length
, vrf_id_t vrf_id
)
256 c
= zebra_interface_address_read (command
, zclient
->ibuf
, vrf_id
);
261 if (IS_DEBUG_OSPF (zebra
, ZEBRA_INTERFACE
))
263 char buf
[PREFIX2STR_BUFFER
];
264 prefix2str(c
->address
, buf
, sizeof(buf
));
265 zlog_debug("Zebra: interface %s address add %s", c
->ifp
->name
, buf
);
268 ospf_if_update (NULL
, c
->ifp
);
270 hook_call(ospf_if_update
, c
->ifp
);
276 ospf_interface_address_delete (int command
, struct zclient
*zclient
,
277 zebra_size_t length
, vrf_id_t vrf_id
)
280 struct interface
*ifp
;
281 struct ospf_interface
*oi
;
282 struct route_node
*rn
;
285 c
= zebra_interface_address_read (command
, zclient
->ibuf
, vrf_id
);
290 if (IS_DEBUG_OSPF (zebra
, ZEBRA_INTERFACE
))
292 char buf
[PREFIX2STR_BUFFER
];
293 prefix2str(c
->address
, buf
, sizeof(buf
));
294 zlog_debug("Zebra: interface %s address delete %s", c
->ifp
->name
, buf
);
299 p
.prefixlen
= IPV4_MAX_PREFIXLEN
;
301 rn
= route_node_lookup (IF_OIFS (ifp
), &p
);
310 route_unlock_node (rn
);
312 /* Call interface hook functions to clean up */
315 hook_call(ospf_if_update
, c
->ifp
);
323 ospf_interface_link_params (int command
, struct zclient
*zclient
,
326 struct interface
*ifp
;
328 ifp
= zebra_interface_link_params_read (zclient
->ibuf
);
334 ospf_mpls_te_update_if (ifp
);
341 ospf_zebra_add (struct prefix_ipv4
*p
, struct ospf_route
*or)
348 struct ospf_path
*path
;
349 struct listnode
*node
;
350 struct ospf
*ospf
= ospf_lookup ();
352 if ((ospf
->instance
&&
353 redist_check_instance(&zclient
->mi_redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
], ospf
->instance
))
355 vrf_bitmap_check (zclient
->redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
], VRF_DEFAULT
))
360 /* OSPF pass nexthop and metric */
361 SET_FLAG (message
, ZAPI_MESSAGE_NEXTHOP
);
362 SET_FLAG (message
, ZAPI_MESSAGE_METRIC
);
364 /* Distance value. */
365 distance
= ospf_distance_apply (p
, or);
367 SET_FLAG (message
, ZAPI_MESSAGE_DISTANCE
);
369 /* Check if path type is ASE */
370 if (((or->path_type
== OSPF_PATH_TYPE1_EXTERNAL
) ||
371 (or->path_type
== OSPF_PATH_TYPE2_EXTERNAL
)) &&
372 (or->u
.ext
.tag
> 0) && (or->u
.ext
.tag
<= ROUTE_TAG_MAX
))
373 SET_FLAG (message
, ZAPI_MESSAGE_TAG
);
379 /* Put command, type, flags, message. */
380 zclient_create_header (s
, ZEBRA_IPV4_ROUTE_ADD
, VRF_DEFAULT
);
381 stream_putc (s
, ZEBRA_ROUTE_OSPF
);
382 stream_putw (s
, ospf
->instance
);
383 stream_putl (s
, flags
);
384 stream_putc (s
, message
);
385 stream_putw (s
, SAFI_UNICAST
);
387 /* Put prefix information. */
388 psize
= PSIZE (p
->prefixlen
);
389 stream_putc (s
, p
->prefixlen
);
390 stream_write (s
, (u_char
*) & p
->prefix
, psize
);
393 stream_putc (s
, or->paths
->count
);
395 /* Nexthop, ifindex, distance and metric information. */
396 for (ALL_LIST_ELEMENTS_RO (or->paths
, node
, path
))
399 if (path
->unnumbered
||
400 (path
->nexthop
.s_addr
!= INADDR_ANY
&&
403 stream_putc (s
, NEXTHOP_TYPE_IPV4_IFINDEX
);
404 stream_put_in_addr (s
, &path
->nexthop
);
405 stream_putl (s
, path
->ifindex
);
407 else if (path
->nexthop
.s_addr
!= INADDR_ANY
)
409 stream_putc (s
, NEXTHOP_TYPE_IPV4
);
410 stream_put_in_addr (s
, &path
->nexthop
);
414 stream_putc (s
, NEXTHOP_TYPE_IFINDEX
);
416 stream_putl (s
, path
->ifindex
);
420 #else /* HAVE_NETLINK */
421 if (path
->nexthop
.s_addr
!= INADDR_ANY
&&
424 stream_putc (s
, NEXTHOP_TYPE_IPV4_IFINDEX
);
425 stream_put_in_addr (s
, &path
->nexthop
);
426 stream_putl (s
, path
->ifindex
);
428 else if (path
->nexthop
.s_addr
!= INADDR_ANY
)
430 stream_putc (s
, NEXTHOP_TYPE_IPV4
);
431 stream_put_in_addr (s
, &path
->nexthop
);
435 stream_putc (s
, NEXTHOP_TYPE_IFINDEX
);
437 stream_putl (s
, path
->ifindex
);
441 #endif /* HAVE_NETLINK */
443 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
445 char buf
[2][INET_ADDRSTRLEN
];
446 zlog_debug("Zebra: Route add %s/%d nexthop %s, ifindex=%d",
447 inet_ntop(AF_INET
, &p
->prefix
,
448 buf
[0], sizeof(buf
[0])),
450 inet_ntop(AF_INET
, &path
->nexthop
,
451 buf
[1], sizeof(buf
[1])),
456 if (CHECK_FLAG (message
, ZAPI_MESSAGE_DISTANCE
))
457 stream_putc (s
, distance
);
458 if (CHECK_FLAG (message
, ZAPI_MESSAGE_METRIC
))
460 if (or->path_type
== OSPF_PATH_TYPE1_EXTERNAL
)
461 stream_putl (s
, or->cost
+ or->u
.ext
.type2_cost
);
462 else if (or->path_type
== OSPF_PATH_TYPE2_EXTERNAL
)
463 stream_putl (s
, or->u
.ext
.type2_cost
);
465 stream_putl (s
, or->cost
);
468 if (CHECK_FLAG (message
, ZAPI_MESSAGE_TAG
))
469 stream_putl (s
, or->u
.ext
.tag
);
471 stream_putw_at (s
, 0, stream_get_endp (s
));
473 zclient_send_message(zclient
);
478 ospf_zebra_delete (struct prefix_ipv4
*p
, struct ospf_route
*or)
485 struct ospf_path
*path
;
486 struct listnode
*node
;
487 struct ospf
*ospf
= ospf_lookup ();
489 if ((ospf
->instance
&&
490 redist_check_instance(&zclient
->mi_redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
], ospf
->instance
))
492 vrf_bitmap_check (zclient
->redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
], VRF_DEFAULT
))
496 /* Distance value. */
497 distance
= ospf_distance_apply (p
, or);
502 /* Put command, type, flags, message. */
503 zclient_create_header (s
, ZEBRA_IPV4_ROUTE_DELETE
, VRF_DEFAULT
);
504 stream_putc (s
, ZEBRA_ROUTE_OSPF
);
505 stream_putw (s
, ospf
->instance
);
506 stream_putl (s
, flags
);
507 stream_putc (s
, message
);
508 stream_putw (s
, SAFI_UNICAST
);
510 /* Put prefix information. */
511 psize
= PSIZE (p
->prefixlen
);
512 stream_putc (s
, p
->prefixlen
);
513 stream_write (s
, (u_char
*) & p
->prefix
, psize
);
516 stream_putc (s
, or->paths
->count
);
518 /* Nexthop, ifindex, distance and metric information. */
519 for (ALL_LIST_ELEMENTS_RO (or->paths
, node
, path
))
521 if (path
->nexthop
.s_addr
!= INADDR_ANY
&&
524 stream_putc (s
, NEXTHOP_TYPE_IPV4_IFINDEX
);
525 stream_put_in_addr (s
, &path
->nexthop
);
526 stream_putl (s
, path
->ifindex
);
528 else if (path
->nexthop
.s_addr
!= INADDR_ANY
)
530 stream_putc (s
, NEXTHOP_TYPE_IPV4
);
531 stream_put_in_addr (s
, &path
->nexthop
);
535 stream_putc (s
, NEXTHOP_TYPE_IFINDEX
);
536 stream_putl (s
, path
->ifindex
);
539 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
541 char buf
[2][INET_ADDRSTRLEN
];
542 zlog_debug("Zebra: Route delete %s/%d nexthop %s",
543 inet_ntop(AF_INET
, &p
->prefix
,
544 buf
[0], sizeof(buf
[0])),
546 inet_ntop(AF_INET
, &path
->nexthop
,
547 buf
[1], sizeof(buf
[1])));
551 if (CHECK_FLAG (message
, ZAPI_MESSAGE_DISTANCE
))
552 stream_putc (s
, distance
);
553 if (CHECK_FLAG (message
, ZAPI_MESSAGE_METRIC
))
555 if (or->path_type
== OSPF_PATH_TYPE1_EXTERNAL
)
556 stream_putl (s
, or->cost
+ or->u
.ext
.type2_cost
);
557 else if (or->path_type
== OSPF_PATH_TYPE2_EXTERNAL
)
558 stream_putl (s
, or->u
.ext
.type2_cost
);
560 stream_putl (s
, or->cost
);
563 stream_putw_at (s
, 0, stream_get_endp (s
));
565 zclient_send_message(zclient
);
570 ospf_zebra_add_discard (struct prefix_ipv4
*p
)
572 struct zapi_ipv4 api
;
573 struct ospf
*ospf
= ospf_lookup ();
575 if ((ospf
->instance
&&
576 redist_check_instance(&zclient
->mi_redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
], ospf
->instance
))
578 vrf_bitmap_check (zclient
->redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
], VRF_DEFAULT
))
580 api
.vrf_id
= VRF_DEFAULT
;
581 api
.type
= ZEBRA_ROUTE_OSPF
;
582 api
.instance
= ospf
->instance
;
583 api
.flags
= ZEBRA_FLAG_BLACKHOLE
;
585 api
.safi
= SAFI_UNICAST
;
586 SET_FLAG (api
.message
, ZAPI_MESSAGE_NEXTHOP
);
591 zapi_ipv4_route (ZEBRA_IPV4_ROUTE_ADD
, zclient
, p
, &api
);
593 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
594 zlog_debug ("Zebra: Route add discard %s/%d",
595 inet_ntoa (p
->prefix
), p
->prefixlen
);
600 ospf_zebra_delete_discard (struct prefix_ipv4
*p
)
602 struct zapi_ipv4 api
;
603 struct ospf
*ospf
= ospf_lookup ();
605 if ((ospf
->instance
&&
606 redist_check_instance(&zclient
->mi_redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
], ospf
->instance
))
608 vrf_bitmap_check (zclient
->redist
[AFI_IP
][ZEBRA_ROUTE_OSPF
], VRF_DEFAULT
))
610 api
.vrf_id
= VRF_DEFAULT
;
611 api
.type
= ZEBRA_ROUTE_OSPF
;
612 api
.instance
= ospf
->instance
;
613 api
.flags
= ZEBRA_FLAG_BLACKHOLE
;
615 api
.safi
= SAFI_UNICAST
;
616 SET_FLAG (api
.message
, ZAPI_MESSAGE_NEXTHOP
);
621 zapi_ipv4_route (ZEBRA_IPV4_ROUTE_DELETE
, zclient
, p
, &api
);
623 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
624 zlog_debug ("Zebra: Route delete discard %s/%d",
625 inet_ntoa (p
->prefix
), p
->prefixlen
);
630 struct ospf_external
*
631 ospf_external_lookup (u_char type
, u_short instance
)
633 struct list
*ext_list
;
634 struct listnode
*node
;
635 struct ospf_external
*ext
;
637 ext_list
= om
->external
[type
];
641 for (ALL_LIST_ELEMENTS_RO(ext_list
, node
, ext
))
642 if (ext
->instance
== instance
)
648 struct ospf_external
*
649 ospf_external_add (u_char type
, u_short instance
)
651 struct list
*ext_list
;
652 struct ospf_external
*ext
;
654 ext
= ospf_external_lookup(type
, instance
);
658 if (!om
->external
[type
])
659 om
->external
[type
] = list_new();
661 ext_list
= om
->external
[type
];
662 ext
= (struct ospf_external
*)calloc (1, sizeof(struct ospf_external
));
663 ext
->instance
= instance
;
664 EXTERNAL_INFO (ext
) = route_table_init ();
666 listnode_add(ext_list
, ext
);
672 ospf_external_del (u_char type
, u_short instance
)
674 struct ospf_external
*ext
;
676 ext
= ospf_external_lookup(type
, instance
);
680 if (EXTERNAL_INFO (ext
))
681 route_table_finish(EXTERNAL_INFO (ext
));
683 listnode_delete(om
->external
[type
], ext
);
684 if (!om
->external
[type
]->count
)
686 list_free(om
->external
[type
]);
687 om
->external
[type
] = NULL
;
693 ospf_redist_lookup (struct ospf
*ospf
, u_char type
, u_short instance
)
695 struct list
*red_list
;
696 struct listnode
*node
;
697 struct ospf_redist
*red
;
699 red_list
= ospf
->redist
[type
];
703 for (ALL_LIST_ELEMENTS_RO(red_list
, node
, red
))
704 if (red
->instance
== instance
)
711 ospf_redist_add (struct ospf
*ospf
, u_char type
, u_short instance
)
713 struct list
*red_list
;
714 struct ospf_redist
*red
;
716 red
= ospf_redist_lookup(ospf
, type
, instance
);
720 if (!ospf
->redist
[type
])
721 ospf
->redist
[type
] = list_new();
723 red_list
= ospf
->redist
[type
];
724 red
= (struct ospf_redist
*)calloc (1, sizeof(struct ospf_redist
));
725 red
->instance
= instance
;
726 red
->dmetric
.type
= -1;
727 red
->dmetric
.value
= -1;
729 listnode_add(red_list
, red
);
735 ospf_redist_del (struct ospf
*ospf
, u_char type
, u_short instance
)
737 struct ospf_redist
*red
;
739 red
= ospf_redist_lookup(ospf
, type
, instance
);
743 listnode_delete(ospf
->redist
[type
], red
);
744 if (!ospf
->redist
[type
]->count
)
746 list_free(ospf
->redist
[type
]);
747 ospf
->redist
[type
] = NULL
;
754 ospf_is_type_redistributed (int type
, u_short instance
)
756 return (DEFAULT_ROUTE_TYPE (type
) ?
757 vrf_bitmap_check (zclient
->default_information
, VRF_DEFAULT
) :
758 ((instance
&& redist_check_instance(&zclient
->mi_redist
[AFI_IP
][type
], instance
))
759 || (!instance
&& vrf_bitmap_check (zclient
->redist
[AFI_IP
][type
], VRF_DEFAULT
))));
763 ospf_redistribute_set (struct ospf
*ospf
, int type
, u_short instance
, int mtype
,
767 struct ospf_redist
*red
;
769 red
= ospf_redist_lookup(ospf
, type
, instance
);
770 if (ospf_is_type_redistributed (type
, instance
))
772 if (mtype
!= red
->dmetric
.type
)
774 red
->dmetric
.type
= mtype
;
775 force
= LSA_REFRESH_FORCE
;
777 if (mvalue
!= red
->dmetric
.value
)
779 red
->dmetric
.value
= mvalue
;
780 force
= LSA_REFRESH_FORCE
;
783 ospf_external_lsa_refresh_type (ospf
, type
, instance
, force
);
785 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
786 zlog_debug ("Redistribute[%s][%d]: Refresh Type[%d], Metric[%d]",
787 ospf_redist_string(type
), instance
,
788 metric_type (ospf
, type
, instance
),
789 metric_value (ospf
, type
, instance
));
794 red
->dmetric
.type
= mtype
;
795 red
->dmetric
.value
= mvalue
;
797 ospf_external_add(type
, instance
);
799 zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD
, zclient
, AFI_IP
, type
,
800 instance
, VRF_DEFAULT
);
802 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
803 zlog_debug ("Redistribute[%s][%d]: Start Type[%d], Metric[%d]",
804 ospf_redist_string(type
), instance
,
805 metric_type (ospf
, type
, instance
), metric_value (ospf
, type
, instance
));
807 ospf_asbr_status_update (ospf
, ++ospf
->redistribute
);
813 ospf_redistribute_unset (struct ospf
*ospf
, int type
, u_short instance
)
815 if (type
== zclient
->redist_default
&& instance
== zclient
->instance
)
818 if (!ospf_is_type_redistributed (type
, instance
))
821 zclient_redistribute (ZEBRA_REDISTRIBUTE_DELETE
, zclient
, AFI_IP
, type
,
822 instance
, VRF_DEFAULT
);
824 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
825 zlog_debug ("Redistribute[%s][%d]: Stop",
826 ospf_redist_string(type
), instance
);
828 ospf_redist_del (ospf
, type
, instance
);
830 /* Remove the routes from OSPF table. */
831 ospf_redistribute_withdraw (ospf
, type
, instance
);
833 ospf_external_del(type
, instance
);
835 ospf_asbr_status_update (ospf
, --ospf
->redistribute
);
841 ospf_redistribute_default_set (struct ospf
*ospf
, int originate
,
842 int mtype
, int mvalue
)
844 struct ospf_redist
*red
;
846 ospf
->default_originate
= originate
;
848 red
= ospf_redist_add(ospf
, DEFAULT_ROUTE
, 0);
849 red
->dmetric
.type
= mtype
;
850 red
->dmetric
.value
= mvalue
;
852 ospf_external_add(DEFAULT_ROUTE
, 0);
854 if (ospf_is_type_redistributed (DEFAULT_ROUTE
, 0))
856 /* if ospf->default_originate changes value, is calling
857 ospf_external_lsa_refresh_default sufficient to implement
859 ospf_external_lsa_refresh_default (ospf
);
861 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
862 zlog_debug ("Redistribute[%s]: Refresh Type[%d], Metric[%d]",
863 ospf_redist_string(DEFAULT_ROUTE
),
864 metric_type (ospf
, DEFAULT_ROUTE
, 0),
865 metric_value (ospf
, DEFAULT_ROUTE
, 0));
869 zclient_redistribute_default (ZEBRA_REDISTRIBUTE_DEFAULT_ADD
, zclient
,
872 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
873 zlog_debug ("Redistribute[DEFAULT]: Start Type[%d], Metric[%d]",
874 metric_type (ospf
, DEFAULT_ROUTE
, 0),
875 metric_value (ospf
, DEFAULT_ROUTE
, 0));
877 if (ospf
->router_id
.s_addr
== 0)
878 ospf
->external_origin
|= (1 << DEFAULT_ROUTE
);
880 thread_add_timer (master
, ospf_default_originate_timer
, ospf
, 1);
882 ospf_asbr_status_update (ospf
, ++ospf
->redistribute
);
888 ospf_redistribute_default_unset (struct ospf
*ospf
)
890 if (!ospf_is_type_redistributed (DEFAULT_ROUTE
, 0))
893 ospf
->default_originate
= DEFAULT_ORIGINATE_NONE
;
894 ospf_redist_del(ospf
, DEFAULT_ROUTE
, 0);
896 zclient_redistribute_default (ZEBRA_REDISTRIBUTE_DEFAULT_DELETE
, zclient
,
899 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
900 zlog_debug ("Redistribute[DEFAULT]: Stop");
902 //Pending: how does the external_info cleanup work in this case?
904 ospf_asbr_status_update (ospf
, --ospf
->redistribute
);
910 ospf_external_lsa_originate_check (struct ospf
*ospf
,
911 struct external_info
*ei
)
913 /* If prefix is multicast, then do not originate LSA. */
914 if (IN_MULTICAST (htonl (ei
->p
.prefix
.s_addr
)))
916 zlog_info ("LSA[Type5:%s]: Not originate AS-external-LSA, "
917 "Prefix belongs multicast", inet_ntoa (ei
->p
.prefix
));
921 /* Take care of default-originate. */
922 if (is_prefix_default (&ei
->p
))
923 if (ospf
->default_originate
== DEFAULT_ORIGINATE_NONE
)
925 zlog_info ("LSA[Type5:0.0.0.0]: Not originate AS-external-LSA "
933 /* If connected prefix is OSPF enable interface, then do not announce. */
935 ospf_distribute_check_connected (struct ospf
*ospf
, struct external_info
*ei
)
937 struct listnode
*node
;
938 struct ospf_interface
*oi
;
941 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
942 if (prefix_match (oi
->address
, (struct prefix
*) &ei
->p
))
947 /* return 1 if external LSA must be originated, 0 otherwise */
949 ospf_redistribute_check (struct ospf
*ospf
,
950 struct external_info
*ei
, int *changed
)
952 struct route_map_set_values save_values
;
953 struct prefix_ipv4
*p
= &ei
->p
;
954 struct ospf_redist
*red
;
955 u_char type
= is_prefix_default (&ei
->p
) ? DEFAULT_ROUTE
: ei
->type
;
956 u_short instance
= is_prefix_default (&ei
->p
) ? 0 : ei
->instance
;
961 if (!ospf_external_lsa_originate_check (ospf
, ei
))
964 /* Take care connected route. */
965 if (type
== ZEBRA_ROUTE_CONNECT
&&
966 !ospf_distribute_check_connected (ospf
, ei
))
969 if (!DEFAULT_ROUTE_TYPE (type
) && DISTRIBUTE_NAME (ospf
, type
))
970 /* distirbute-list exists, but access-list may not? */
971 if (DISTRIBUTE_LIST (ospf
, type
))
972 if (access_list_apply (DISTRIBUTE_LIST (ospf
, type
), p
) == FILTER_DENY
)
974 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
975 zlog_debug ("Redistribute[%s]: %s/%d filtered by ditribute-list.",
976 ospf_redist_string(type
),
977 inet_ntoa (p
->prefix
), p
->prefixlen
);
981 save_values
= ei
->route_map_set
;
982 ospf_reset_route_map_set_values (&ei
->route_map_set
);
984 /* apply route-map if needed */
985 red
= ospf_redist_lookup (ospf
, type
, instance
);
986 if (red
&& ROUTEMAP_NAME(red
))
990 ret
= route_map_apply (ROUTEMAP (red
), (struct prefix
*) p
,
993 if (ret
== RMAP_DENYMATCH
)
995 ei
->route_map_set
= save_values
;
996 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
997 zlog_debug ("Redistribute[%s]: %s/%d filtered by route-map.",
998 ospf_redist_string(type
),
999 inet_ntoa (p
->prefix
), p
->prefixlen
);
1003 /* check if 'route-map set' changed something */
1005 *changed
= !ospf_route_map_set_compare (&ei
->route_map_set
,
1012 /* OSPF route-map set for redistribution */
1014 ospf_routemap_set (struct ospf_redist
*red
, const char *name
)
1016 if (ROUTEMAP_NAME (red
))
1017 free (ROUTEMAP_NAME (red
));
1019 ROUTEMAP_NAME (red
) = strdup (name
);
1020 ROUTEMAP (red
) = route_map_lookup_by_name (name
);
1024 ospf_routemap_unset (struct ospf_redist
*red
)
1026 if (ROUTEMAP_NAME (red
))
1027 free (ROUTEMAP_NAME (red
));
1029 ROUTEMAP_NAME (red
) = NULL
;
1030 ROUTEMAP (red
) = NULL
;
1033 /* Zebra route add and delete treatment. */
1035 ospf_zebra_read_ipv4 (int command
, struct zclient
*zclient
,
1036 zebra_size_t length
, vrf_id_t vrf_id
)
1039 struct zapi_ipv4 api
;
1040 unsigned long ifindex
;
1041 struct in_addr nexthop
;
1042 struct prefix_ipv4 p
;
1043 struct external_info
*ei
;
1051 /* Type, flags, message. */
1052 api
.type
= stream_getc (s
);
1053 api
.instance
= stream_getw (s
);
1054 api
.flags
= stream_getl (s
);
1055 api
.message
= stream_getc (s
);
1058 memset (&p
, 0, sizeof (struct prefix_ipv4
));
1060 p
.prefixlen
= MIN(IPV4_MAX_PREFIXLEN
, stream_getc (s
));
1061 stream_get (&p
.prefix
, s
, PSIZE (p
.prefixlen
));
1063 if (IPV4_NET127(ntohl(p
.prefix
.s_addr
)))
1066 /* Nexthop, ifindex, distance, metric. */
1067 if (CHECK_FLAG (api
.message
, ZAPI_MESSAGE_NEXTHOP
))
1069 api
.nexthop_num
= stream_getc (s
);
1070 nexthop
.s_addr
= stream_get_ipv4 (s
);
1072 if (CHECK_FLAG (api
.message
, ZAPI_MESSAGE_IFINDEX
))
1074 api
.ifindex_num
= stream_getc (s
);
1075 /* XXX assert(api.ifindex_num == 1); */
1076 ifindex
= stream_getl (s
);
1078 if (CHECK_FLAG (api
.message
, ZAPI_MESSAGE_DISTANCE
))
1079 api
.distance
= stream_getc (s
);
1080 if (CHECK_FLAG (api
.message
, ZAPI_MESSAGE_METRIC
))
1081 api
.metric
= stream_getl (s
);
1082 if (CHECK_FLAG (api
.message
, ZAPI_MESSAGE_TAG
))
1083 api
.tag
= stream_getl (s
);
1087 ospf
= ospf_lookup ();
1091 if (command
== ZEBRA_REDISTRIBUTE_IPV4_ADD
)
1093 /* XXX|HACK|TODO|FIXME:
1094 * Maybe we should ignore reject/blackhole routes? Testing shows that
1095 * there is no problems though and this is only way to "summarize"
1096 * routes in ASBR at the moment. Maybe we need just a better generalised
1097 * solution for these types?
1099 * if ( CHECK_FLAG (api.flags, ZEBRA_FLAG_BLACKHOLE)
1100 * || CHECK_FLAG (api.flags, ZEBRA_FLAG_REJECT))
1104 /* Protocol tag overwrites all other tag value send by zebra */
1105 if (ospf
->dtag
[api
.type
] > 0)
1106 api
.tag
= ospf
->dtag
[api
.type
];
1109 * Given zebra sends update for a prefix via ADD message, it should
1110 * be considered as an implicit DEL for that prefix with other source
1113 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++)
1115 ospf_external_info_delete(i
, api
.instance
, p
);
1117 ei
= ospf_external_info_add (api
.type
, api
.instance
, p
, ifindex
,
1121 /* Nothing has changed, so nothing to do; return */
1124 if (ospf
->router_id
.s_addr
== 0)
1125 /* Set flags to generate AS-external-LSA originate event
1126 for each redistributed protocols later. */
1127 ospf
->external_origin
|= (1 << api
.type
);
1132 if (is_prefix_default (&p
))
1133 ospf_external_lsa_refresh_default (ospf
);
1136 struct ospf_lsa
*current
;
1138 current
= ospf_external_info_find_lsa (ospf
, &ei
->p
);
1140 ospf_external_lsa_originate (ospf
, ei
);
1143 if (IS_DEBUG_OSPF (zebra
, ZEBRA_REDISTRIBUTE
))
1144 zlog_debug ("ospf_zebra_read_ipv4() : %s refreshing LSA",
1145 inet_ntoa (p
.prefix
));
1146 ospf_external_lsa_refresh (ospf
, current
,
1147 ei
, LSA_REFRESH_FORCE
);
1153 else /* if (command == ZEBRA_REDISTRIBUTE_IPV4_DEL) */
1155 ospf_external_info_delete (api
.type
, api
.instance
, p
);
1156 if (is_prefix_default (&p
))
1157 ospf_external_lsa_refresh_default (ospf
);
1159 ospf_external_lsa_flush (ospf
, api
.type
, &p
, ifindex
/*, nexthop */);
1167 ospf_distribute_list_out_set (struct ospf
*ospf
, int type
, const char *name
)
1169 /* Lookup access-list for distribute-list. */
1170 DISTRIBUTE_LIST (ospf
, type
) = access_list_lookup (AFI_IP
, name
);
1172 /* Clear previous distribute-name. */
1173 if (DISTRIBUTE_NAME (ospf
, type
))
1174 free (DISTRIBUTE_NAME (ospf
, type
));
1176 /* Set distribute-name. */
1177 DISTRIBUTE_NAME (ospf
, type
) = strdup (name
);
1179 /* If access-list have been set, schedule update timer. */
1180 if (DISTRIBUTE_LIST (ospf
, type
))
1181 ospf_distribute_list_update (ospf
, type
, 0);
1187 ospf_distribute_list_out_unset (struct ospf
*ospf
, int type
, const char *name
)
1189 /* Schedule update timer. */
1190 if (DISTRIBUTE_LIST (ospf
, type
))
1191 ospf_distribute_list_update (ospf
, type
, 0);
1193 /* Unset distribute-list. */
1194 DISTRIBUTE_LIST (ospf
, type
) = NULL
;
1196 /* Clear distribute-name. */
1197 if (DISTRIBUTE_NAME (ospf
, type
))
1198 free (DISTRIBUTE_NAME (ospf
, type
));
1200 DISTRIBUTE_NAME (ospf
, type
) = NULL
;
1205 /* distribute-list update timer. */
1207 ospf_distribute_list_update_timer (struct thread
*thread
)
1209 struct route_node
*rn
;
1210 struct external_info
*ei
;
1211 struct route_table
*rt
;
1212 struct ospf_lsa
*lsa
;
1213 int type
, default_refresh
= 0;
1216 ospf
= ospf_lookup ();
1220 ospf
->t_distribute_update
= NULL
;
1222 zlog_info ("Zebra[Redistribute]: distribute-list update timer fired!");
1224 /* foreach all external info. */
1225 for (type
= 0; type
<= ZEBRA_ROUTE_MAX
; type
++)
1227 struct list
*ext_list
;
1228 struct listnode
*node
;
1229 struct ospf_external
*ext
;
1231 ext_list
= om
->external
[type
];
1235 for (ALL_LIST_ELEMENTS_RO(ext_list
, node
, ext
))
1237 rt
= ext
->external_info
;
1240 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
1241 if ((ei
= rn
->info
) != NULL
)
1243 if (is_prefix_default (&ei
->p
))
1244 default_refresh
= 1;
1245 else if ((lsa
= ospf_external_info_find_lsa (ospf
, &ei
->p
)))
1246 ospf_external_lsa_refresh (ospf
, lsa
, ei
, LSA_REFRESH_IF_CHANGED
);
1248 ospf_external_lsa_originate (ospf
, ei
);
1252 if (default_refresh
)
1253 ospf_external_lsa_refresh_default (ospf
);
1257 /* Update distribute-list and set timer to apply access-list. */
1259 ospf_distribute_list_update (struct ospf
*ospf
, uintptr_t type
,
1262 struct route_table
*rt
;
1263 struct ospf_external
*ext
;
1265 /* External info does not exist. */
1266 ext
= ospf_external_lookup(type
, instance
);
1267 if (!ext
|| !(rt
= EXTERNAL_INFO (ext
)))
1270 /* If exists previously invoked thread, then let it continue. */
1271 if (ospf
->t_distribute_update
)
1275 ospf
->t_distribute_update
=
1276 thread_add_timer_msec (master
, ospf_distribute_list_update_timer
,
1277 (void *) type
, ospf
->min_ls_interval
);
1280 /* If access-list is updated, apply some check. */
1282 ospf_filter_update (struct access_list
*access
)
1287 struct ospf_area
*area
;
1288 struct listnode
*node
;
1290 /* If OSPF instance does not exist, return right now. */
1291 ospf
= ospf_lookup ();
1295 /* Update distribute-list, and apply filter. */
1296 for (type
= 0; type
<= ZEBRA_ROUTE_MAX
; type
++)
1298 struct list
*red_list
;
1299 struct listnode
*node
;
1300 struct ospf_redist
*red
;
1302 red_list
= ospf
->redist
[type
];
1304 for (ALL_LIST_ELEMENTS_RO(red_list
, node
, red
))
1308 /* if route-map is not NULL it may be using this access list */
1309 ospf_distribute_list_update (ospf
, type
, red
->instance
);
1313 /* There is place for route-map for default-information (ZEBRA_ROUTE_MAX),
1314 * but no distribute list. */
1315 if (type
== ZEBRA_ROUTE_MAX
)
1318 if (DISTRIBUTE_NAME (ospf
, type
))
1320 /* Keep old access-list for distribute-list. */
1321 struct access_list
*old
= DISTRIBUTE_LIST (ospf
, type
);
1323 /* Update access-list for distribute-list. */
1324 DISTRIBUTE_LIST (ospf
, type
) =
1325 access_list_lookup (AFI_IP
, DISTRIBUTE_NAME (ospf
, type
));
1327 /* No update for this distribute type. */
1328 if (old
== NULL
&& DISTRIBUTE_LIST (ospf
, type
) == NULL
)
1331 /* Schedule distribute-list update timer. */
1332 if (DISTRIBUTE_LIST (ospf
, type
) == NULL
||
1333 strcmp (DISTRIBUTE_NAME (ospf
, type
), access
->name
) == 0)
1334 ospf_distribute_list_update (ospf
, type
, 0);
1338 /* Update Area access-list. */
1339 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, node
, area
))
1341 if (EXPORT_NAME (area
))
1343 EXPORT_LIST (area
) = NULL
;
1347 if (IMPORT_NAME (area
))
1349 IMPORT_LIST (area
) = NULL
;
1354 /* Schedule ABR tasks -- this will be changed -- takada. */
1355 if (IS_OSPF_ABR (ospf
) && abr_inv
)
1356 ospf_schedule_abr_task (ospf
);
1359 /* If prefix-list is updated, do some updates. */
1361 ospf_prefix_list_update (struct prefix_list
*plist
)
1366 struct ospf_area
*area
;
1367 struct listnode
*node
;
1369 /* If OSPF instatnce does not exist, return right now. */
1370 ospf
= ospf_lookup ();
1374 /* Update all route-maps which are used as redistribution filters.
1375 * They might use prefix-list.
1377 for (type
= 0; type
<= ZEBRA_ROUTE_MAX
; type
++)
1379 struct list
*red_list
;
1380 struct listnode
*node
;
1381 struct ospf_redist
*red
;
1383 red_list
= ospf
->redist
[type
];
1385 for (ALL_LIST_ELEMENTS_RO(red_list
, node
, red
))
1389 /* if route-map is not NULL it may be using this prefix list */
1390 ospf_distribute_list_update (ospf
, type
, red
->instance
);
1395 /* Update area filter-lists. */
1396 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, node
, area
))
1398 /* Update filter-list in. */
1399 if (PREFIX_NAME_IN (area
))
1400 if (strcmp (PREFIX_NAME_IN (area
), prefix_list_name (plist
)) == 0)
1402 PREFIX_LIST_IN (area
) =
1403 prefix_list_lookup (AFI_IP
, PREFIX_NAME_IN (area
));
1407 /* Update filter-list out. */
1408 if (PREFIX_NAME_OUT (area
))
1409 if (strcmp (PREFIX_NAME_OUT (area
), prefix_list_name (plist
)) == 0)
1411 PREFIX_LIST_IN (area
) =
1412 prefix_list_lookup (AFI_IP
, PREFIX_NAME_OUT (area
));
1417 /* Schedule ABR task. */
1418 if (IS_OSPF_ABR (ospf
) && abr_inv
)
1419 ospf_schedule_abr_task (ospf
);
1422 static struct ospf_distance
*
1423 ospf_distance_new (void)
1425 return XCALLOC (MTYPE_OSPF_DISTANCE
, sizeof (struct ospf_distance
));
1429 ospf_distance_free (struct ospf_distance
*odistance
)
1431 XFREE (MTYPE_OSPF_DISTANCE
, odistance
);
1435 ospf_distance_set (struct vty
*vty
, struct ospf
*ospf
,
1436 const char *distance_str
,
1438 const char *access_list_str
)
1441 struct prefix_ipv4 p
;
1443 struct route_node
*rn
;
1444 struct ospf_distance
*odistance
;
1446 ret
= str2prefix_ipv4 (ip_str
, &p
);
1449 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
1453 distance
= atoi (distance_str
);
1455 /* Get OSPF distance node. */
1456 rn
= route_node_get (ospf
->distance_table
, (struct prefix
*) &p
);
1459 odistance
= rn
->info
;
1460 route_unlock_node (rn
);
1464 odistance
= ospf_distance_new ();
1465 rn
->info
= odistance
;
1468 /* Set distance value. */
1469 odistance
->distance
= distance
;
1471 /* Reset access-list configuration. */
1472 if (odistance
->access_list
)
1474 free (odistance
->access_list
);
1475 odistance
->access_list
= NULL
;
1477 if (access_list_str
)
1478 odistance
->access_list
= strdup (access_list_str
);
1484 ospf_distance_unset (struct vty
*vty
, struct ospf
*ospf
,
1485 const char *distance_str
,
1486 const char *ip_str
, char
1487 const *access_list_str
)
1490 struct prefix_ipv4 p
;
1491 struct route_node
*rn
;
1492 struct ospf_distance
*odistance
;
1494 ret
= str2prefix_ipv4 (ip_str
, &p
);
1497 vty_out (vty
, "Malformed prefix%s", VTY_NEWLINE
);
1501 rn
= route_node_lookup (ospf
->distance_table
, (struct prefix
*) &p
);
1504 vty_out (vty
, "Can't find specified prefix%s", VTY_NEWLINE
);
1508 odistance
= rn
->info
;
1510 if (odistance
->access_list
)
1511 free (odistance
->access_list
);
1512 ospf_distance_free (odistance
);
1515 route_unlock_node (rn
);
1516 route_unlock_node (rn
);
1522 ospf_distance_reset (struct ospf
*ospf
)
1524 struct route_node
*rn
;
1525 struct ospf_distance
*odistance
;
1527 for (rn
= route_top (ospf
->distance_table
); rn
; rn
= route_next (rn
))
1528 if ((odistance
= rn
->info
) != NULL
)
1530 if (odistance
->access_list
)
1531 free (odistance
->access_list
);
1532 ospf_distance_free (odistance
);
1534 route_unlock_node (rn
);
1539 ospf_distance_apply (struct prefix_ipv4
*p
, struct ospf_route
*or)
1543 ospf
= ospf_lookup ();
1547 if (ospf
->distance_intra
)
1548 if (or->path_type
== OSPF_PATH_INTRA_AREA
)
1549 return ospf
->distance_intra
;
1551 if (ospf
->distance_inter
)
1552 if (or->path_type
== OSPF_PATH_INTER_AREA
)
1553 return ospf
->distance_inter
;
1555 if (ospf
->distance_external
)
1556 if (or->path_type
== OSPF_PATH_TYPE1_EXTERNAL
1557 || or->path_type
== OSPF_PATH_TYPE2_EXTERNAL
)
1558 return ospf
->distance_external
;
1560 if (ospf
->distance_all
)
1561 return ospf
->distance_all
;
1567 ospf_zebra_connected (struct zclient
*zclient
)
1569 /* Send the client registration */
1570 bfd_client_sendmsg(zclient
, ZEBRA_BFD_CLIENT_REGISTER
);
1572 zclient_send_reg_requests (zclient
, VRF_DEFAULT
);
1576 ospf_zebra_init (struct thread_master
*master
, u_short instance
)
1578 /* Allocate zebra structure. */
1579 zclient
= zclient_new(master
);
1580 zclient_init (zclient
, ZEBRA_ROUTE_OSPF
, instance
);
1581 zclient
->zebra_connected
= ospf_zebra_connected
;
1582 zclient
->router_id_update
= ospf_router_id_update_zebra
;
1583 zclient
->interface_add
= ospf_interface_add
;
1584 zclient
->interface_delete
= ospf_interface_delete
;
1585 zclient
->interface_up
= ospf_interface_state_up
;
1586 zclient
->interface_down
= ospf_interface_state_down
;
1587 zclient
->interface_address_add
= ospf_interface_address_add
;
1588 zclient
->interface_address_delete
= ospf_interface_address_delete
;
1589 zclient
->interface_link_params
= ospf_interface_link_params
;
1591 zclient
->redistribute_route_ipv4_add
= ospf_zebra_read_ipv4
;
1592 zclient
->redistribute_route_ipv4_del
= ospf_zebra_read_ipv4
;
1594 access_list_add_hook (ospf_filter_update
);
1595 access_list_delete_hook (ospf_filter_update
);
1596 prefix_list_add_hook (ospf_prefix_list_update
);
1597 prefix_list_delete_hook (ospf_prefix_list_update
);