3 * Copyright (C) Cumulus Networks, Inc.
6 * This file is part of FRR.
8 * FRR is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
13 * FRR is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; see the file COPYING; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
32 #include "nexthop_group.h"
34 #include "sharp_globals.h"
35 #include "sharp_nht.h"
36 #include "sharp_zebra.h"
38 /* Zebra structure to hold current status. */
39 struct zclient
*zclient
= NULL
;
41 /* For registering threads. */
42 extern struct thread_master
*master
;
45 extern struct zebra_privs_t sharp_privs
;
47 DEFINE_MTYPE_STATIC(SHARPD
, ZC
, "Test zclients");
49 /* Struct to hold list of test zclients */
50 struct sharp_zclient
{
51 struct sharp_zclient
*prev
;
52 struct sharp_zclient
*next
;
53 struct zclient
*client
;
56 /* Head of test zclient list */
57 static struct sharp_zclient
*sharp_clients_head
;
59 static int sharp_opaque_handler(ZAPI_CALLBACK_ARGS
);
61 /* Utility to add a test zclient struct to the list */
62 static void add_zclient(struct zclient
*client
)
64 struct sharp_zclient
*node
;
66 node
= XCALLOC(MTYPE_ZC
, sizeof(struct sharp_zclient
));
68 node
->client
= client
;
70 node
->next
= sharp_clients_head
;
71 if (sharp_clients_head
)
72 sharp_clients_head
->prev
= node
;
73 sharp_clients_head
= node
;
76 /* Interface addition message from zebra. */
77 static int sharp_ifp_create(struct interface
*ifp
)
82 static int sharp_ifp_destroy(struct interface
*ifp
)
87 static int interface_address_add(ZAPI_CALLBACK_ARGS
)
89 zebra_interface_address_read(cmd
, zclient
->ibuf
, vrf_id
);
94 static int interface_address_delete(ZAPI_CALLBACK_ARGS
)
98 c
= zebra_interface_address_read(cmd
, zclient
->ibuf
, vrf_id
);
107 static int sharp_ifp_up(struct interface
*ifp
)
112 static int sharp_ifp_down(struct interface
*ifp
)
117 int sharp_install_lsps_helper(bool install_p
, bool update_p
,
118 const struct prefix
*p
, uint8_t type
,
119 int instance
, uint32_t in_label
,
120 const struct nexthop_group
*nhg
,
121 const struct nexthop_group
*backup_nhg
)
123 struct zapi_labels zl
= {};
124 struct zapi_nexthop
*znh
;
125 const struct nexthop
*nh
;
128 zl
.type
= ZEBRA_LSP_SHARP
;
129 zl
.local_label
= in_label
;
132 SET_FLAG(zl
.message
, ZAPI_LABELS_FTN
);
133 prefix_copy(&zl
.route
.prefix
, p
);
134 zl
.route
.type
= type
;
135 zl
.route
.instance
= instance
;
138 /* List of nexthops is optional for delete */
141 for (ALL_NEXTHOPS_PTR(nhg
, nh
)) {
142 znh
= &zl
.nexthops
[i
];
144 /* Must have labels to be useful */
145 if (nh
->nh_label
== NULL
||
146 nh
->nh_label
->num_labels
== 0)
149 if (nh
->type
== NEXTHOP_TYPE_IFINDEX
||
150 nh
->type
== NEXTHOP_TYPE_BLACKHOLE
)
151 /* Hmm - can't really deal with these types */
154 ret
= zapi_nexthop_from_nexthop(znh
, nh
);
159 if (i
>= MULTIPATH_NUM
)
164 /* Whoops - no nexthops isn't very useful for install */
165 if (i
== 0 && install_p
)
170 /* Add optional backup nexthop info. Since these are used by index,
171 * we can't just skip over an invalid backup nexthop: we will
172 * invalidate the entire operation.
174 if (backup_nhg
!= NULL
) {
176 for (ALL_NEXTHOPS_PTR(backup_nhg
, nh
)) {
177 znh
= &zl
.backup_nexthops
[i
];
179 /* Must have labels to be useful */
180 if (nh
->nh_label
== NULL
||
181 nh
->nh_label
->num_labels
== 0)
184 if (nh
->type
== NEXTHOP_TYPE_IFINDEX
||
185 nh
->type
== NEXTHOP_TYPE_BLACKHOLE
)
186 /* Hmm - can't really deal with these types */
189 ret
= zapi_nexthop_from_nexthop(znh
, nh
);
194 if (i
>= MULTIPATH_NUM
)
199 SET_FLAG(zl
.message
, ZAPI_LABELS_HAS_BACKUPS
);
201 zl
.backup_nexthop_num
= i
;
207 cmd
= ZEBRA_MPLS_LABELS_REPLACE
;
209 cmd
= ZEBRA_MPLS_LABELS_ADD
;
211 cmd
= ZEBRA_MPLS_LABELS_DELETE
;
214 if (zebra_send_mpls_labels(zclient
, cmd
, &zl
) == ZCLIENT_SEND_FAILURE
)
220 enum where_to_restart
{
221 SHARP_INSTALL_ROUTES_RESTART
,
222 SHARP_DELETE_ROUTES_RESTART
,
225 struct buffer_delay
{
232 const struct nexthop_group
*nhg
;
233 const struct nexthop_group
*backup_nhg
;
234 enum where_to_restart restart
;
239 * route_add - Encodes a route to zebra
241 * This function returns true when the route was buffered
242 * by the underlying stream system
244 static bool route_add(const struct prefix
*p
, vrf_id_t vrf_id
, uint8_t instance
,
245 uint32_t nhgid
, const struct nexthop_group
*nhg
,
246 const struct nexthop_group
*backup_nhg
, char *opaque
)
248 struct zapi_route api
;
249 struct zapi_nexthop
*api_nh
;
253 memset(&api
, 0, sizeof(api
));
255 api
.type
= ZEBRA_ROUTE_SHARP
;
256 api
.instance
= instance
;
257 api
.safi
= SAFI_UNICAST
;
258 memcpy(&api
.prefix
, p
, sizeof(*p
));
260 SET_FLAG(api
.flags
, ZEBRA_FLAG_ALLOW_RECURSION
);
261 SET_FLAG(api
.message
, ZAPI_MESSAGE_NEXTHOP
);
263 /* Only send via ID if nhgroup has been successfully installed */
264 if (nhgid
&& sharp_nhgroup_id_is_installed(nhgid
)) {
265 SET_FLAG(api
.message
, ZAPI_MESSAGE_NHG
);
268 for (ALL_NEXTHOPS_PTR(nhg
, nh
)) {
269 api_nh
= &api
.nexthops
[i
];
271 zapi_nexthop_from_nexthop(api_nh
, nh
);
278 /* Include backup nexthops, if present */
279 if (backup_nhg
&& backup_nhg
->nexthop
) {
280 SET_FLAG(api
.message
, ZAPI_MESSAGE_BACKUP_NEXTHOPS
);
283 for (ALL_NEXTHOPS_PTR(backup_nhg
, nh
)) {
284 api_nh
= &api
.backup_nexthops
[i
];
286 zapi_backup_nexthop_from_nexthop(api_nh
, nh
);
291 api
.backup_nexthop_num
= i
;
294 if (strlen(opaque
)) {
295 SET_FLAG(api
.message
, ZAPI_MESSAGE_OPAQUE
);
296 api
.opaque
.length
= strlen(opaque
) + 1;
297 assert(api
.opaque
.length
<= ZAPI_MESSAGE_OPAQUE_LENGTH
);
298 memcpy(api
.opaque
.data
, opaque
, api
.opaque
.length
);
301 if (zclient_route_send(ZEBRA_ROUTE_ADD
, zclient
, &api
)
302 == ZCLIENT_SEND_BUFFERED
)
309 * route_delete - Encodes a route for deletion to zebra
311 * This function returns true when the route sent was
312 * buffered by the underlying stream system.
314 static bool route_delete(struct prefix
*p
, vrf_id_t vrf_id
, uint8_t instance
)
316 struct zapi_route api
;
318 memset(&api
, 0, sizeof(api
));
320 api
.type
= ZEBRA_ROUTE_SHARP
;
321 api
.safi
= SAFI_UNICAST
;
322 api
.instance
= instance
;
323 memcpy(&api
.prefix
, p
, sizeof(*p
));
325 if (zclient_route_send(ZEBRA_ROUTE_DELETE
, zclient
, &api
)
326 == ZCLIENT_SEND_BUFFERED
)
332 static void sharp_install_routes_restart(struct prefix
*p
, uint32_t count
,
333 vrf_id_t vrf_id
, uint8_t instance
,
335 const struct nexthop_group
*nhg
,
336 const struct nexthop_group
*backup_nhg
,
337 uint32_t routes
, char *opaque
)
342 if (p
->family
== AF_INET
) {
344 temp
= ntohl(p
->u
.prefix4
.s_addr
);
346 temp
= ntohl(p
->u
.val32
[3]);
348 for (i
= count
; i
< routes
; i
++) {
349 bool buffered
= route_add(p
, vrf_id
, (uint8_t)instance
, nhgid
,
350 nhg
, backup_nhg
, opaque
);
352 p
->u
.prefix4
.s_addr
= htonl(++temp
);
354 p
->u
.val32
[3] = htonl(++temp
);
361 wb
.instance
= instance
;
364 wb
.backup_nhg
= backup_nhg
;
366 wb
.restart
= SHARP_INSTALL_ROUTES_RESTART
;
373 void sharp_install_routes_helper(struct prefix
*p
, vrf_id_t vrf_id
,
374 uint8_t instance
, uint32_t nhgid
,
375 const struct nexthop_group
*nhg
,
376 const struct nexthop_group
*backup_nhg
,
377 uint32_t routes
, char *opaque
)
379 zlog_debug("Inserting %u routes", routes
);
381 /* Only use backup route/nexthops if present */
382 if (backup_nhg
&& (backup_nhg
->nexthop
== NULL
))
385 monotime(&sg
.r
.t_start
);
386 sharp_install_routes_restart(p
, 0, vrf_id
, instance
, nhgid
, nhg
,
387 backup_nhg
, routes
, opaque
);
390 static void sharp_remove_routes_restart(struct prefix
*p
, uint32_t count
,
391 vrf_id_t vrf_id
, uint8_t instance
,
397 if (p
->family
== AF_INET
) {
399 temp
= ntohl(p
->u
.prefix4
.s_addr
);
401 temp
= ntohl(p
->u
.val32
[3]);
403 for (i
= count
; i
< routes
; i
++) {
404 bool buffered
= route_delete(p
, vrf_id
, (uint8_t)instance
);
407 p
->u
.prefix4
.s_addr
= htonl(++temp
);
409 p
->u
.val32
[3] = htonl(++temp
);
415 wb
.instance
= instance
;
417 wb
.restart
= SHARP_DELETE_ROUTES_RESTART
;
424 void sharp_remove_routes_helper(struct prefix
*p
, vrf_id_t vrf_id
,
425 uint8_t instance
, uint32_t routes
)
427 zlog_debug("Removing %u routes", routes
);
429 monotime(&sg
.r
.t_start
);
431 sharp_remove_routes_restart(p
, 0, vrf_id
, instance
, routes
);
434 static void handle_repeated(bool installed
)
436 struct prefix p
= sg
.r
.orig_prefix
;
439 if (sg
.r
.repeat
<= 0)
443 sg
.r
.removed_routes
= 0;
444 sharp_remove_routes_helper(&p
, sg
.r
.vrf_id
,
445 sg
.r
.inst
, sg
.r
.total_routes
);
449 sg
.r
.installed_routes
= 0;
450 sharp_install_routes_helper(&p
, sg
.r
.vrf_id
, sg
.r
.inst
,
451 sg
.r
.nhgid
, &sg
.r
.nhop_group
,
452 &sg
.r
.backup_nhop_group
,
453 sg
.r
.total_routes
, sg
.r
.opaque
);
457 static void sharp_zclient_buffer_ready(void)
459 switch (wb
.restart
) {
460 case SHARP_INSTALL_ROUTES_RESTART
:
461 sharp_install_routes_restart(
462 &wb
.p
, wb
.count
, wb
.vrf_id
, wb
.instance
, wb
.nhgid
,
463 wb
.nhg
, wb
.backup_nhg
, wb
.routes
, wb
.opaque
);
465 case SHARP_DELETE_ROUTES_RESTART
:
466 sharp_remove_routes_restart(&wb
.p
, wb
.count
, wb
.vrf_id
,
467 wb
.instance
, wb
.routes
);
472 static int route_notify_owner(ZAPI_CALLBACK_ARGS
)
476 enum zapi_route_notify_owner note
;
479 if (!zapi_route_notify_decode(zclient
->ibuf
, &p
, &table
, ¬e
,
484 case ZAPI_ROUTE_INSTALLED
:
485 sg
.r
.installed_routes
++;
486 if (sg
.r
.total_routes
== sg
.r
.installed_routes
) {
487 monotime(&sg
.r
.t_end
);
488 timersub(&sg
.r
.t_end
, &sg
.r
.t_start
, &r
);
489 zlog_debug("Installed All Items %jd.%ld",
490 (intmax_t)r
.tv_sec
, (long)r
.tv_usec
);
491 handle_repeated(true);
494 case ZAPI_ROUTE_FAIL_INSTALL
:
495 zlog_debug("Failed install of route");
497 case ZAPI_ROUTE_BETTER_ADMIN_WON
:
498 zlog_debug("Better Admin Distance won over us");
500 case ZAPI_ROUTE_REMOVED
:
501 sg
.r
.removed_routes
++;
502 if (sg
.r
.total_routes
== sg
.r
.removed_routes
) {
503 monotime(&sg
.r
.t_end
);
504 timersub(&sg
.r
.t_end
, &sg
.r
.t_start
, &r
);
505 zlog_debug("Removed all Items %jd.%ld",
506 (intmax_t)r
.tv_sec
, (long)r
.tv_usec
);
507 handle_repeated(false);
510 case ZAPI_ROUTE_REMOVE_FAIL
:
511 zlog_debug("Route removal Failure");
517 static void zebra_connected(struct zclient
*zclient
)
519 zclient_send_reg_requests(zclient
, VRF_DEFAULT
);
522 * Do not actually turn this on yet
523 * This is just the start of the infrastructure needed here
524 * This can be fixed at a later time.
526 * zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP,
527 * ZEBRA_ROUTE_ALL, 0, VRF_DEFAULT);
531 void vrf_label_add(vrf_id_t vrf_id
, afi_t afi
, mpls_label_t label
)
533 zclient_send_vrf_label(zclient
, vrf_id
, afi
, label
, ZEBRA_LSP_SHARP
);
536 void nhg_add(uint32_t id
, const struct nexthop_group
*nhg
,
537 const struct nexthop_group
*backup_nhg
)
539 struct zapi_nhg api_nhg
= {};
540 struct zapi_nexthop
*api_nh
;
542 bool is_valid
= true;
545 for (ALL_NEXTHOPS_PTR(nhg
, nh
)) {
546 if (api_nhg
.nexthop_num
>= MULTIPATH_NUM
) {
548 "%s: number of nexthops greater than max multipath size, truncating",
553 /* Unresolved nexthops will lead to failure - only send
554 * nexthops that zebra will consider valid.
556 if (nh
->ifindex
== 0)
559 api_nh
= &api_nhg
.nexthops
[api_nhg
.nexthop_num
];
561 zapi_nexthop_from_nexthop(api_nh
, nh
);
562 api_nhg
.nexthop_num
++;
565 if (api_nhg
.nexthop_num
== 0) {
566 zlog_debug("%s: nhg %u not sent: no valid nexthops",
573 for (ALL_NEXTHOPS_PTR(backup_nhg
, nh
)) {
574 if (api_nhg
.backup_nexthop_num
>= MULTIPATH_NUM
) {
576 "%s: number of backup nexthops greater than max multipath size, truncating",
581 /* Unresolved nexthop: will be rejected by zebra.
582 * That causes a problem, since the primary nexthops
583 * rely on array indexing into the backup nexthops. If
584 * that array isn't valid, the backup indexes won't be
587 if (nh
->ifindex
== 0) {
588 zlog_debug("%s: nhg %u: invalid backup nexthop",
594 api_nh
= &api_nhg
.backup_nexthops
595 [api_nhg
.backup_nexthop_num
];
597 zapi_backup_nexthop_from_nexthop(api_nh
, nh
);
598 api_nhg
.backup_nexthop_num
++;
604 zclient_nhg_send(zclient
, ZEBRA_NHG_ADD
, &api_nhg
);
607 void nhg_del(uint32_t id
)
609 struct zapi_nhg api_nhg
= {};
613 zclient_nhg_send(zclient
, ZEBRA_NHG_DEL
, &api_nhg
);
616 void sharp_zebra_nexthop_watch(struct prefix
*p
, vrf_id_t vrf_id
, bool import
,
617 bool watch
, bool connected
)
622 command
= ZEBRA_NEXTHOP_REGISTER
;
625 command
= ZEBRA_NEXTHOP_UNREGISTER
;
627 command
= ZEBRA_IMPORT_ROUTE_REGISTER
;
630 command
= ZEBRA_IMPORT_ROUTE_UNREGISTER
;
633 if (zclient_send_rnh(zclient
, command
, p
, connected
, vrf_id
)
634 == ZCLIENT_SEND_FAILURE
)
635 zlog_warn("%s: Failure to send nexthop to zebra", __func__
);
638 static int sharp_debug_nexthops(struct zapi_route
*api
)
641 char buf
[PREFIX_STRLEN
];
643 if (api
->nexthop_num
== 0) {
649 for (i
= 0; i
< api
->nexthop_num
; i
++) {
650 struct zapi_nexthop
*znh
= &api
->nexthops
[i
];
653 case NEXTHOP_TYPE_IPV4_IFINDEX
:
654 case NEXTHOP_TYPE_IPV4
:
656 " Nexthop %s, type: %d, ifindex: %d, vrf: %d, label_num: %d",
657 inet_ntop(AF_INET
, &znh
->gate
.ipv4
.s_addr
, buf
,
659 znh
->type
, znh
->ifindex
, znh
->vrf_id
,
662 case NEXTHOP_TYPE_IPV6_IFINDEX
:
663 case NEXTHOP_TYPE_IPV6
:
665 " Nexthop %s, type: %d, ifindex: %d, vrf: %d, label_num: %d",
666 inet_ntop(AF_INET6
, &znh
->gate
.ipv6
, buf
,
668 znh
->type
, znh
->ifindex
, znh
->vrf_id
,
671 case NEXTHOP_TYPE_IFINDEX
:
672 zlog_debug(" Nexthop IFINDEX: %d, ifindex: %d",
673 znh
->type
, znh
->ifindex
);
675 case NEXTHOP_TYPE_BLACKHOLE
:
676 zlog_debug(" Nexthop blackhole");
683 static int sharp_nexthop_update(ZAPI_CALLBACK_ARGS
)
685 struct sharp_nh_tracker
*nht
;
686 struct zapi_route nhr
;
688 if (!zapi_nexthop_update_decode(zclient
->ibuf
, &nhr
)) {
689 zlog_err("%s: Decode of update failed", __func__
);
693 zlog_debug("Received update for %pFX", &nhr
.prefix
);
695 nht
= sharp_nh_tracker_get(&nhr
.prefix
);
696 nht
->nhop_num
= nhr
.nexthop_num
;
699 sharp_debug_nexthops(&nhr
);
704 static int sharp_redistribute_route(ZAPI_CALLBACK_ARGS
)
706 struct zapi_route api
;
708 if (zapi_route_decode(zclient
->ibuf
, &api
) < 0)
709 zlog_warn("%s: Decode of redistribute failed: %d", __func__
,
710 ZEBRA_REDISTRIBUTE_ROUTE_ADD
);
712 zlog_debug("%s: %pFX (%s)", zserv_command_string(cmd
),
713 &api
.prefix
, zebra_route_string(api
.type
));
715 sharp_debug_nexthops(&api
);
720 /* Add a zclient with a specified session id, for testing. */
721 int sharp_zclient_create(uint32_t session_id
)
723 struct zclient
*client
;
724 struct sharp_zclient
*node
;
726 /* Check for duplicates */
727 for (node
= sharp_clients_head
; node
!= NULL
; node
= node
->next
) {
728 if (node
->client
->session_id
== session_id
)
732 client
= zclient_new(master
, &zclient_options_default
);
734 client
->session_id
= session_id
;
736 zclient_init(client
, ZEBRA_ROUTE_SHARP
, 0, &sharp_privs
);
738 /* Register handlers for messages we expect this session to see */
739 client
->opaque_msg_handler
= sharp_opaque_handler
;
741 /* Enqueue on the list of test clients */
747 /* Delete one of the extra test zclients */
748 int sharp_zclient_delete(uint32_t session_id
)
750 struct sharp_zclient
*node
;
752 /* Search for session */
753 for (node
= sharp_clients_head
; node
!= NULL
; node
= node
->next
) {
754 if (node
->client
->session_id
== session_id
) {
755 /* Dequeue from list */
757 node
->next
->prev
= node
->prev
;
759 node
->prev
->next
= node
->next
;
760 if (node
== sharp_clients_head
)
761 sharp_clients_head
= node
->next
;
763 /* Clean up zclient */
764 zclient_stop(node
->client
);
765 zclient_free(node
->client
);
768 XFREE(MTYPE_ZC
, node
);
776 /* Handler for opaque messages */
777 static int sharp_opaque_handler(ZAPI_CALLBACK_ARGS
)
780 struct zapi_opaque_msg info
;
784 if (zclient_opaque_decode(s
, &info
) != 0)
787 zlog_debug("%s: [%u] received opaque type %u", __func__
,
788 zclient
->session_id
, info
.type
);
794 * Send OPAQUE messages, using subtype 'type'.
796 void sharp_opaque_send(uint32_t type
, uint32_t proto
, uint32_t instance
,
797 uint32_t session_id
, uint32_t count
)
803 /* Prepare a small payload */
804 for (i
= 0; i
< sizeof(buf
); i
++) {
811 /* Send some messages - broadcast and unicast are supported */
812 for (i
= 0; i
< count
; i
++) {
814 ret
= zclient_send_opaque(zclient
, type
, buf
,
817 ret
= zclient_send_opaque_unicast(zclient
, type
, proto
,
818 instance
, session_id
,
820 if (ret
== ZCLIENT_SEND_FAILURE
) {
821 zlog_debug("%s: send_opaque() failed => %d",
830 * Send OPAQUE registration messages, using subtype 'type'.
832 void sharp_opaque_reg_send(bool is_reg
, uint32_t proto
, uint32_t instance
,
833 uint32_t session_id
, uint32_t type
)
841 zclient_create_header(s
, ZEBRA_OPAQUE_REGISTER
, VRF_DEFAULT
);
843 zclient_create_header(s
, ZEBRA_OPAQUE_UNREGISTER
, VRF_DEFAULT
);
846 stream_putl(s
, type
);
848 /* Add zclient info */
849 stream_putc(s
, proto
);
850 stream_putw(s
, instance
);
851 stream_putl(s
, session_id
);
853 /* Put length at the first point of the stream. */
854 stream_putw_at(s
, 0, stream_get_endp(s
));
856 (void)zclient_send_message(zclient
);
860 void sharp_zebra_send_arp(const struct interface
*ifp
, const struct prefix
*p
)
862 zclient_send_neigh_discovery_req(zclient
, ifp
, p
);
865 static int nhg_notify_owner(ZAPI_CALLBACK_ARGS
)
867 enum zapi_nhg_notify_owner note
;
870 if (!zapi_nhg_notify_decode(zclient
->ibuf
, &id
, ¬e
))
874 case ZAPI_NHG_INSTALLED
:
875 sharp_nhgroup_id_set_installed(id
, true);
876 zlog_debug("Installed nhg %u", id
);
878 case ZAPI_NHG_FAIL_INSTALL
:
879 zlog_debug("Failed install of nhg %u", id
);
881 case ZAPI_NHG_REMOVED
:
882 zlog_debug("Removed nhg %u", id
);
884 case ZAPI_NHG_REMOVE_FAIL
:
885 zlog_debug("Failed removal of nhg %u", id
);
892 void sharp_zebra_init(void)
894 struct zclient_options opt
= {.receive_notify
= true};
896 if_zapi_callbacks(sharp_ifp_create
, sharp_ifp_up
,
897 sharp_ifp_down
, sharp_ifp_destroy
);
899 zclient
= zclient_new(master
, &opt
);
901 zclient_init(zclient
, ZEBRA_ROUTE_SHARP
, 0, &sharp_privs
);
902 zclient
->zebra_connected
= zebra_connected
;
903 zclient
->interface_address_add
= interface_address_add
;
904 zclient
->interface_address_delete
= interface_address_delete
;
905 zclient
->route_notify_owner
= route_notify_owner
;
906 zclient
->nexthop_update
= sharp_nexthop_update
;
907 zclient
->import_check_update
= sharp_nexthop_update
;
908 zclient
->nhg_notify_owner
= nhg_notify_owner
;
909 zclient
->zebra_buffer_write_ready
= sharp_zclient_buffer_ready
;
910 zclient
->redistribute_route_add
= sharp_redistribute_route
;
911 zclient
->redistribute_route_del
= sharp_redistribute_route
;
912 zclient
->opaque_msg_handler
= sharp_opaque_handler
;