1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 1997, 1998, 1999 Kunihiro Ishiguro <kunihiro@zebra.org>
4 * Copyright (C) 2018 NetDEF, Inc.
6 * Copyright (C) 2023 LabN Consulting, L.L.C.
19 #include "northbound.h"
22 #include "ripd/ripd.h"
23 #include "ripd/rip_nb.h"
24 #include "ripd/rip_debug.h"
25 #include "ripd/rip_interface.h"
28 * XPath: /frr-ripd:ripd/instance
30 int ripd_instance_create(struct nb_cb_create_args
*args
)
37 vrf_name
= yang_dnode_get_string(args
->dnode
, "./vrf");
38 vrf
= vrf_lookup_by_name(vrf_name
);
41 * Try to create a RIP socket only if the VRF is enabled, otherwise
42 * create a disabled RIP instance and wait for the VRF to be enabled.
44 switch (args
->event
) {
48 if (!vrf
|| !vrf_is_enabled(vrf
))
51 socket
= rip_create_socket(vrf
);
53 return NB_ERR_RESOURCE
;
54 args
->resource
->fd
= socket
;
57 if (!vrf
|| !vrf_is_enabled(vrf
))
60 socket
= args
->resource
->fd
;
64 if (vrf
&& vrf_is_enabled(vrf
))
65 socket
= args
->resource
->fd
;
69 rip
= rip_create(vrf_name
, vrf
, socket
);
70 nb_running_set_entry(args
->dnode
, rip
);
77 int ripd_instance_destroy(struct nb_cb_destroy_args
*args
)
81 if (args
->event
!= NB_EV_APPLY
)
84 rip
= nb_running_unset_entry(args
->dnode
);
91 * XPath: /frr-ripd:ripd/instance/allow-ecmp
93 int ripd_instance_allow_ecmp_modify(struct nb_cb_modify_args
*args
)
97 if (args
->event
!= NB_EV_APPLY
)
100 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
101 rip
->ecmp
= yang_dnode_get_bool(args
->dnode
, NULL
);
103 rip_ecmp_disable(rip
);
109 * XPath: /frr-ripd:ripd/instance/default-information-originate
111 int ripd_instance_default_information_originate_modify(
112 struct nb_cb_modify_args
*args
)
115 bool default_information
;
116 struct prefix_ipv4 p
;
118 if (args
->event
!= NB_EV_APPLY
)
121 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
122 default_information
= yang_dnode_get_bool(args
->dnode
, NULL
);
124 memset(&p
, 0, sizeof(p
));
126 if (default_information
) {
129 memset(&nh
, 0, sizeof(nh
));
130 nh
.type
= NEXTHOP_TYPE_IPV4
;
131 rip_redistribute_add(rip
, ZEBRA_ROUTE_RIP
, RIP_ROUTE_DEFAULT
,
134 rip_redistribute_delete(rip
, ZEBRA_ROUTE_RIP
, RIP_ROUTE_DEFAULT
,
142 * XPath: /frr-ripd:ripd/instance/default-metric
144 int ripd_instance_default_metric_modify(struct nb_cb_modify_args
*args
)
148 if (args
->event
!= NB_EV_APPLY
)
151 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
152 rip
->default_metric
= yang_dnode_get_uint8(args
->dnode
, NULL
);
153 /* rip_update_default_metric (); */
159 * XPath: /frr-ripd:ripd/instance/distance/default
161 int ripd_instance_distance_default_modify(struct nb_cb_modify_args
*args
)
165 if (args
->event
!= NB_EV_APPLY
)
168 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
169 rip
->distance
= yang_dnode_get_uint8(args
->dnode
, NULL
);
175 * XPath: /frr-ripd:ripd/instance/distance/source
177 int ripd_instance_distance_source_create(struct nb_cb_create_args
*args
)
180 struct prefix_ipv4 prefix
;
181 struct route_node
*rn
;
183 if (args
->event
!= NB_EV_APPLY
)
186 yang_dnode_get_ipv4p(&prefix
, args
->dnode
, "./prefix");
187 apply_mask_ipv4(&prefix
);
189 /* Get RIP distance node. */
190 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
191 rn
= route_node_get(rip
->distance_table
, (struct prefix
*)&prefix
);
192 rn
->info
= rip_distance_new();
193 nb_running_set_entry(args
->dnode
, rn
);
198 int ripd_instance_distance_source_destroy(struct nb_cb_destroy_args
*args
)
200 struct route_node
*rn
;
201 struct rip_distance
*rdistance
;
203 if (args
->event
!= NB_EV_APPLY
)
206 rn
= nb_running_unset_entry(args
->dnode
);
207 rdistance
= rn
->info
;
208 rip_distance_free(rdistance
);
210 route_unlock_node(rn
);
216 * XPath: /frr-ripd:ripd/instance/distance/source/distance
218 int ripd_instance_distance_source_distance_modify(
219 struct nb_cb_modify_args
*args
)
221 struct route_node
*rn
;
223 struct rip_distance
*rdistance
;
225 if (args
->event
!= NB_EV_APPLY
)
228 /* Set distance value. */
229 rn
= nb_running_get_entry(args
->dnode
, NULL
, true);
230 distance
= yang_dnode_get_uint8(args
->dnode
, NULL
);
231 rdistance
= rn
->info
;
232 rdistance
->distance
= distance
;
238 * XPath: /frr-ripd:ripd/instance/distance/source/access-list
240 int ripd_instance_distance_source_access_list_modify(
241 struct nb_cb_modify_args
*args
)
243 const char *acl_name
;
244 struct route_node
*rn
;
245 struct rip_distance
*rdistance
;
247 if (args
->event
!= NB_EV_APPLY
)
250 acl_name
= yang_dnode_get_string(args
->dnode
, NULL
);
252 /* Set access-list */
253 rn
= nb_running_get_entry(args
->dnode
, NULL
, true);
254 rdistance
= rn
->info
;
255 if (rdistance
->access_list
)
256 free(rdistance
->access_list
);
257 rdistance
->access_list
= strdup(acl_name
);
262 int ripd_instance_distance_source_access_list_destroy(
263 struct nb_cb_destroy_args
*args
)
265 struct route_node
*rn
;
266 struct rip_distance
*rdistance
;
268 if (args
->event
!= NB_EV_APPLY
)
271 /* Reset access-list configuration. */
272 rn
= nb_running_get_entry(args
->dnode
, NULL
, true);
273 rdistance
= rn
->info
;
274 free(rdistance
->access_list
);
275 rdistance
->access_list
= NULL
;
281 * XPath: /frr-ripd:ripd/instance/explicit-neighbor
283 int ripd_instance_explicit_neighbor_create(struct nb_cb_create_args
*args
)
286 struct prefix_ipv4 p
;
288 if (args
->event
!= NB_EV_APPLY
)
291 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
293 p
.prefixlen
= IPV4_MAX_BITLEN
;
294 yang_dnode_get_ipv4(&p
.prefix
, args
->dnode
, NULL
);
296 return rip_neighbor_add(rip
, &p
);
299 int ripd_instance_explicit_neighbor_destroy(struct nb_cb_destroy_args
*args
)
302 struct prefix_ipv4 p
;
304 if (args
->event
!= NB_EV_APPLY
)
307 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
309 p
.prefixlen
= IPV4_MAX_BITLEN
;
310 yang_dnode_get_ipv4(&p
.prefix
, args
->dnode
, NULL
);
312 return rip_neighbor_delete(rip
, &p
);
316 * XPath: /frr-ripd:ripd/instance/network
318 int ripd_instance_network_create(struct nb_cb_create_args
*args
)
323 if (args
->event
!= NB_EV_APPLY
)
326 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
327 yang_dnode_get_ipv4p(&p
, args
->dnode
, NULL
);
328 apply_mask_ipv4((struct prefix_ipv4
*)&p
);
330 return rip_enable_network_add(rip
, &p
);
333 int ripd_instance_network_destroy(struct nb_cb_destroy_args
*args
)
338 if (args
->event
!= NB_EV_APPLY
)
341 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
342 yang_dnode_get_ipv4p(&p
, args
->dnode
, NULL
);
343 apply_mask_ipv4((struct prefix_ipv4
*)&p
);
345 return rip_enable_network_delete(rip
, &p
);
349 * XPath: /frr-ripd:ripd/instance/interface
351 int ripd_instance_interface_create(struct nb_cb_create_args
*args
)
356 if (args
->event
!= NB_EV_APPLY
)
359 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
360 ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
362 return rip_enable_if_add(rip
, ifname
);
365 int ripd_instance_interface_destroy(struct nb_cb_destroy_args
*args
)
370 if (args
->event
!= NB_EV_APPLY
)
373 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
374 ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
376 return rip_enable_if_delete(rip
, ifname
);
380 * XPath: /frr-ripd:ripd/instance/offset-list
382 int ripd_instance_offset_list_create(struct nb_cb_create_args
*args
)
386 struct rip_offset_list
*offset
;
388 if (args
->event
!= NB_EV_APPLY
)
391 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
392 ifname
= yang_dnode_get_string(args
->dnode
, "./interface");
394 offset
= rip_offset_list_new(rip
, ifname
);
395 nb_running_set_entry(args
->dnode
, offset
);
400 int ripd_instance_offset_list_destroy(struct nb_cb_destroy_args
*args
)
403 struct rip_offset_list
*offset
;
405 if (args
->event
!= NB_EV_APPLY
)
408 direct
= yang_dnode_get_enum(args
->dnode
, "./direction");
410 offset
= nb_running_unset_entry(args
->dnode
);
411 if (offset
->direct
[direct
].alist_name
) {
412 free(offset
->direct
[direct
].alist_name
);
413 offset
->direct
[direct
].alist_name
= NULL
;
415 if (offset
->direct
[RIP_OFFSET_LIST_IN
].alist_name
== NULL
416 && offset
->direct
[RIP_OFFSET_LIST_OUT
].alist_name
== NULL
)
417 offset_list_del(offset
);
423 * XPath: /frr-ripd:ripd/instance/offset-list/access-list
425 int ripd_instance_offset_list_access_list_modify(struct nb_cb_modify_args
*args
)
428 struct rip_offset_list
*offset
;
429 const char *alist_name
;
431 if (args
->event
!= NB_EV_APPLY
)
434 direct
= yang_dnode_get_enum(args
->dnode
, "../direction");
435 alist_name
= yang_dnode_get_string(args
->dnode
, NULL
);
437 offset
= nb_running_get_entry(args
->dnode
, NULL
, true);
438 if (offset
->direct
[direct
].alist_name
)
439 free(offset
->direct
[direct
].alist_name
);
440 offset
->direct
[direct
].alist_name
= strdup(alist_name
);
446 * XPath: /frr-ripd:ripd/instance/offset-list/metric
448 int ripd_instance_offset_list_metric_modify(struct nb_cb_modify_args
*args
)
452 struct rip_offset_list
*offset
;
454 if (args
->event
!= NB_EV_APPLY
)
457 direct
= yang_dnode_get_enum(args
->dnode
, "../direction");
458 metric
= yang_dnode_get_uint8(args
->dnode
, NULL
);
460 offset
= nb_running_get_entry(args
->dnode
, NULL
, true);
461 offset
->direct
[direct
].metric
= metric
;
467 * XPath: /frr-ripd:ripd/instance/passive-default
469 int ripd_instance_passive_default_modify(struct nb_cb_modify_args
*args
)
473 if (args
->event
!= NB_EV_APPLY
)
476 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
477 rip
->passive_default
= yang_dnode_get_bool(args
->dnode
, NULL
);
478 rip_passive_nondefault_clean(rip
);
484 * XPath: /frr-ripd:ripd/instance/passive-interface
486 int ripd_instance_passive_interface_create(struct nb_cb_create_args
*args
)
491 if (args
->event
!= NB_EV_APPLY
)
494 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
495 ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
497 return rip_passive_nondefault_set(rip
, ifname
);
500 int ripd_instance_passive_interface_destroy(struct nb_cb_destroy_args
*args
)
505 if (args
->event
!= NB_EV_APPLY
)
508 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
509 ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
511 return rip_passive_nondefault_unset(rip
, ifname
);
515 * XPath: /frr-ripd:ripd/instance/non-passive-interface
517 int ripd_instance_non_passive_interface_create(struct nb_cb_create_args
*args
)
522 if (args
->event
!= NB_EV_APPLY
)
525 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
526 ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
528 return rip_passive_nondefault_unset(rip
, ifname
);
531 int ripd_instance_non_passive_interface_destroy(struct nb_cb_destroy_args
*args
)
536 if (args
->event
!= NB_EV_APPLY
)
539 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
540 ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
542 return rip_passive_nondefault_set(rip
, ifname
);
546 * XPath: /frr-ripd:ripd/instance/redistribute
548 int ripd_instance_redistribute_create(struct nb_cb_create_args
*args
)
553 if (args
->event
!= NB_EV_APPLY
)
556 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
557 type
= yang_dnode_get_enum(args
->dnode
, "./protocol");
559 rip
->redist
[type
].enabled
= true;
564 int ripd_instance_redistribute_destroy(struct nb_cb_destroy_args
*args
)
569 if (args
->event
!= NB_EV_APPLY
)
572 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
573 type
= yang_dnode_get_enum(args
->dnode
, "./protocol");
575 rip
->redist
[type
].enabled
= false;
576 if (rip
->redist
[type
].route_map
.name
) {
577 free(rip
->redist
[type
].route_map
.name
);
578 rip
->redist
[type
].route_map
.name
= NULL
;
579 rip
->redist
[type
].route_map
.map
= NULL
;
581 rip
->redist
[type
].metric_config
= false;
582 rip
->redist
[type
].metric
= 0;
585 rip_redistribute_conf_delete(rip
, type
);
590 void ripd_instance_redistribute_apply_finish(
591 struct nb_cb_apply_finish_args
*args
)
596 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
597 type
= yang_dnode_get_enum(args
->dnode
, "./protocol");
600 rip_redistribute_conf_update(rip
, type
);
604 * XPath: /frr-ripd:ripd/instance/redistribute/route-map
606 int ripd_instance_redistribute_route_map_modify(struct nb_cb_modify_args
*args
)
610 const char *rmap_name
;
612 if (args
->event
!= NB_EV_APPLY
)
615 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
616 type
= yang_dnode_get_enum(args
->dnode
, "../protocol");
617 rmap_name
= yang_dnode_get_string(args
->dnode
, NULL
);
619 if (rip
->redist
[type
].route_map
.name
)
620 free(rip
->redist
[type
].route_map
.name
);
621 rip
->redist
[type
].route_map
.name
= strdup(rmap_name
);
622 rip
->redist
[type
].route_map
.map
= route_map_lookup_by_name(rmap_name
);
627 int ripd_instance_redistribute_route_map_destroy(
628 struct nb_cb_destroy_args
*args
)
633 if (args
->event
!= NB_EV_APPLY
)
636 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
637 type
= yang_dnode_get_enum(args
->dnode
, "../protocol");
639 free(rip
->redist
[type
].route_map
.name
);
640 rip
->redist
[type
].route_map
.name
= NULL
;
641 rip
->redist
[type
].route_map
.map
= NULL
;
647 * XPath: /frr-ripd:ripd/instance/redistribute/metric
649 int ripd_instance_redistribute_metric_modify(struct nb_cb_modify_args
*args
)
655 if (args
->event
!= NB_EV_APPLY
)
658 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
659 type
= yang_dnode_get_enum(args
->dnode
, "../protocol");
660 metric
= yang_dnode_get_uint8(args
->dnode
, NULL
);
662 rip
->redist
[type
].metric_config
= true;
663 rip
->redist
[type
].metric
= metric
;
668 int ripd_instance_redistribute_metric_destroy(struct nb_cb_destroy_args
*args
)
673 if (args
->event
!= NB_EV_APPLY
)
676 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
677 type
= yang_dnode_get_enum(args
->dnode
, "../protocol");
679 rip
->redist
[type
].metric_config
= false;
680 rip
->redist
[type
].metric
= 0;
686 * XPath: /frr-ripd:ripd/instance/if-route-maps/if-route-map
688 int ripd_instance_if_route_maps_if_route_map_create(
689 struct nb_cb_create_args
*args
)
691 /* if_rmap is created when first routemap is added */
695 int ripd_instance_if_route_maps_if_route_map_destroy(
696 struct nb_cb_destroy_args
*args
)
700 if (args
->event
!= NB_EV_APPLY
)
704 * YANG will prune edit deletes up to the most general deleted node so
705 * we need to handle deleting any existing state underneath and not
706 * count on those more specific callbacks being called individually.
709 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
710 if_rmap_yang_destroy_cb(rip
->if_rmap_ctx
, args
->dnode
);
715 static void if_route_map_modify(const struct lyd_node
*dnode
,
716 enum if_rmap_type type
, bool delete)
718 struct rip
*rip
= nb_running_get_entry(dnode
, NULL
, true);
720 if_rmap_yang_modify_cb(rip
->if_rmap_ctx
, dnode
, type
, delete);
724 * XPath: /frr-ripd:ripd/instance/if-route-maps/if-route-map/in-route-map
726 int ripd_instance_if_route_maps_if_route_map_in_route_map_modify(
727 struct nb_cb_modify_args
*args
)
729 if (args
->event
!= NB_EV_APPLY
)
732 if_route_map_modify(args
->dnode
, IF_RMAP_IN
, false);
737 int ripd_instance_if_route_maps_if_route_map_in_route_map_destroy(
738 struct nb_cb_destroy_args
*args
)
740 if (args
->event
!= NB_EV_APPLY
)
743 if_route_map_modify(args
->dnode
, IF_RMAP_IN
, true);
749 * XPath: /frr-ripd:ripd/instance/if-route-maps/if-route-map/out-route-map
751 int ripd_instance_if_route_maps_if_route_map_out_route_map_modify(
752 struct nb_cb_modify_args
*args
)
754 if (args
->event
!= NB_EV_APPLY
)
757 if_route_map_modify(args
->dnode
, IF_RMAP_OUT
, false);
762 int ripd_instance_if_route_maps_if_route_map_out_route_map_destroy(
763 struct nb_cb_destroy_args
*args
)
765 if (args
->event
!= NB_EV_APPLY
)
768 if_route_map_modify(args
->dnode
, IF_RMAP_OUT
, true);
774 * XPath: /frr-ripd:ripd/instance/static-route
776 int ripd_instance_static_route_create(struct nb_cb_create_args
*args
)
780 struct prefix_ipv4 p
;
782 if (args
->event
!= NB_EV_APPLY
)
785 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
786 yang_dnode_get_ipv4p(&p
, args
->dnode
, NULL
);
789 memset(&nh
, 0, sizeof(nh
));
790 nh
.type
= NEXTHOP_TYPE_IPV4
;
791 rip_redistribute_add(rip
, ZEBRA_ROUTE_RIP
, RIP_ROUTE_STATIC
, &p
, &nh
, 0,
797 int ripd_instance_static_route_destroy(struct nb_cb_destroy_args
*args
)
800 struct prefix_ipv4 p
;
802 if (args
->event
!= NB_EV_APPLY
)
805 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
806 yang_dnode_get_ipv4p(&p
, args
->dnode
, NULL
);
809 rip_redistribute_delete(rip
, ZEBRA_ROUTE_RIP
, RIP_ROUTE_STATIC
, &p
, 0);
815 * XPath: /frr-ripd:ripd/instance/timers/
817 void ripd_instance_timers_apply_finish(struct nb_cb_apply_finish_args
*args
)
821 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
823 /* Reset update timer thread. */
824 rip_event(rip
, RIP_UPDATE_EVENT
, 0);
828 * XPath: /frr-ripd:ripd/instance/timers/flush-interval
830 int ripd_instance_timers_flush_interval_modify(struct nb_cb_modify_args
*args
)
834 if (args
->event
!= NB_EV_APPLY
)
837 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
838 rip
->garbage_time
= yang_dnode_get_uint32(args
->dnode
, NULL
);
844 * XPath: /frr-ripd:ripd/instance/timers/holddown-interval
846 int ripd_instance_timers_holddown_interval_modify(
847 struct nb_cb_modify_args
*args
)
851 if (args
->event
!= NB_EV_APPLY
)
854 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
855 rip
->timeout_time
= yang_dnode_get_uint32(args
->dnode
, NULL
);
861 * XPath: /frr-ripd:ripd/instance/timers/update-interval
863 int ripd_instance_timers_update_interval_modify(struct nb_cb_modify_args
*args
)
867 if (args
->event
!= NB_EV_APPLY
)
870 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
871 rip
->update_time
= yang_dnode_get_uint32(args
->dnode
, NULL
);
877 * XPath: /frr-ripd:ripd/instance/version/receive
879 int ripd_instance_version_receive_modify(struct nb_cb_modify_args
*args
)
883 if (args
->event
!= NB_EV_APPLY
)
886 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
887 rip
->version_recv
= yang_dnode_get_enum(args
->dnode
, NULL
);
893 * XPath: /frr-ripd:ripd/instance/version/send
895 int ripd_instance_version_send_modify(struct nb_cb_modify_args
*args
)
899 if (args
->event
!= NB_EV_APPLY
)
902 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
903 rip
->version_send
= yang_dnode_get_enum(args
->dnode
, NULL
);
909 * XPath: /frr-interface:lib/interface/frr-ripd:rip/split-horizon
911 int lib_interface_rip_split_horizon_modify(struct nb_cb_modify_args
*args
)
913 struct interface
*ifp
;
914 struct rip_interface
*ri
;
916 if (args
->event
!= NB_EV_APPLY
)
919 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
921 ri
->split_horizon
= yang_dnode_get_enum(args
->dnode
, NULL
);
927 * XPath: /frr-interface:lib/interface/frr-ripd:rip/v2-broadcast
929 int lib_interface_rip_v2_broadcast_modify(struct nb_cb_modify_args
*args
)
931 struct interface
*ifp
;
932 struct rip_interface
*ri
;
934 if (args
->event
!= NB_EV_APPLY
)
937 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
939 ri
->v2_broadcast
= yang_dnode_get_bool(args
->dnode
, NULL
);
945 * XPath: /frr-interface:lib/interface/frr-ripd:rip/version-receive
947 int lib_interface_rip_version_receive_modify(struct nb_cb_modify_args
*args
)
949 struct interface
*ifp
;
950 struct rip_interface
*ri
;
952 if (args
->event
!= NB_EV_APPLY
)
955 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
957 ri
->ri_receive
= yang_dnode_get_enum(args
->dnode
, NULL
);
963 * XPath: /frr-interface:lib/interface/frr-ripd:rip/version-send
965 int lib_interface_rip_version_send_modify(struct nb_cb_modify_args
*args
)
967 struct interface
*ifp
;
968 struct rip_interface
*ri
;
970 if (args
->event
!= NB_EV_APPLY
)
973 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
975 ri
->ri_send
= yang_dnode_get_enum(args
->dnode
, NULL
);
981 * XPath: /frr-interface:lib/interface/frr-ripd:rip/authentication-scheme/mode
983 int lib_interface_rip_authentication_scheme_mode_modify(
984 struct nb_cb_modify_args
*args
)
986 struct interface
*ifp
;
987 struct rip_interface
*ri
;
989 if (args
->event
!= NB_EV_APPLY
)
992 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
994 ri
->auth_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
1001 * /frr-interface:lib/interface/frr-ripd:rip/authentication-scheme/md5-auth-length
1003 int lib_interface_rip_authentication_scheme_md5_auth_length_modify(
1004 struct nb_cb_modify_args
*args
)
1006 struct interface
*ifp
;
1007 struct rip_interface
*ri
;
1009 if (args
->event
!= NB_EV_APPLY
)
1012 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
1014 ri
->md5_auth_len
= yang_dnode_get_enum(args
->dnode
, NULL
);
1019 int lib_interface_rip_authentication_scheme_md5_auth_length_destroy(
1020 struct nb_cb_destroy_args
*args
)
1022 struct interface
*ifp
;
1023 struct rip_interface
*ri
;
1025 if (args
->event
!= NB_EV_APPLY
)
1028 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
1030 ri
->md5_auth_len
= yang_get_default_enum(
1031 "%s/authentication-scheme/md5-auth-length", RIP_IFACE
);
1037 * XPath: /frr-interface:lib/interface/frr-ripd:rip/authentication-password
1039 int lib_interface_rip_authentication_password_modify(
1040 struct nb_cb_modify_args
*args
)
1042 struct interface
*ifp
;
1043 struct rip_interface
*ri
;
1045 if (args
->event
!= NB_EV_APPLY
)
1048 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
1050 XFREE(MTYPE_RIP_INTERFACE_STRING
, ri
->auth_str
);
1051 ri
->auth_str
= XSTRDUP(MTYPE_RIP_INTERFACE_STRING
,
1052 yang_dnode_get_string(args
->dnode
, NULL
));
1057 int lib_interface_rip_authentication_password_destroy(
1058 struct nb_cb_destroy_args
*args
)
1060 struct interface
*ifp
;
1061 struct rip_interface
*ri
;
1063 if (args
->event
!= NB_EV_APPLY
)
1066 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
1068 XFREE(MTYPE_RIP_INTERFACE_STRING
, ri
->auth_str
);
1074 * XPath: /frr-interface:lib/interface/frr-ripd:rip/authentication-key-chain
1076 int lib_interface_rip_authentication_key_chain_modify(
1077 struct nb_cb_modify_args
*args
)
1079 struct interface
*ifp
;
1080 struct rip_interface
*ri
;
1082 if (args
->event
!= NB_EV_APPLY
)
1085 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
1087 XFREE(MTYPE_RIP_INTERFACE_STRING
, ri
->key_chain
);
1088 ri
->key_chain
= XSTRDUP(MTYPE_RIP_INTERFACE_STRING
,
1089 yang_dnode_get_string(args
->dnode
, NULL
));
1094 int lib_interface_rip_authentication_key_chain_destroy(
1095 struct nb_cb_destroy_args
*args
)
1097 struct interface
*ifp
;
1098 struct rip_interface
*ri
;
1100 if (args
->event
!= NB_EV_APPLY
)
1103 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
1105 XFREE(MTYPE_RIP_INTERFACE_STRING
, ri
->key_chain
);