2 * Copyright (C) 1997, 1998, 1999 Kunihiro Ishiguro <kunihiro@zebra.org>
3 * Copyright (C) 2018 NetDEF, Inc.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 #include "northbound.h"
33 #include "ripd/ripd.h"
34 #include "ripd/rip_nb.h"
35 #include "ripd/rip_debug.h"
36 #include "ripd/rip_interface.h"
39 * XPath: /frr-ripd:ripd/instance
41 int ripd_instance_create(struct nb_cb_create_args
*args
)
48 vrf_name
= yang_dnode_get_string(args
->dnode
, "./vrf");
49 vrf
= vrf_lookup_by_name(vrf_name
);
52 * Try to create a RIP socket only if the VRF is enabled, otherwise
53 * create a disabled RIP instance and wait for the VRF to be enabled.
55 switch (args
->event
) {
59 if (!vrf
|| !vrf_is_enabled(vrf
))
62 socket
= rip_create_socket(vrf
);
64 return NB_ERR_RESOURCE
;
65 args
->resource
->fd
= socket
;
68 if (!vrf
|| !vrf_is_enabled(vrf
))
71 socket
= args
->resource
->fd
;
75 if (vrf
&& vrf_is_enabled(vrf
))
76 socket
= args
->resource
->fd
;
80 rip
= rip_create(vrf_name
, vrf
, socket
);
81 nb_running_set_entry(args
->dnode
, rip
);
88 int ripd_instance_destroy(struct nb_cb_destroy_args
*args
)
92 if (args
->event
!= NB_EV_APPLY
)
95 rip
= nb_running_unset_entry(args
->dnode
);
102 * XPath: /frr-ripd:ripd/instance/allow-ecmp
104 int ripd_instance_allow_ecmp_modify(struct nb_cb_modify_args
*args
)
108 if (args
->event
!= NB_EV_APPLY
)
111 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
112 rip
->ecmp
= yang_dnode_get_bool(args
->dnode
, NULL
);
114 rip_ecmp_disable(rip
);
120 * XPath: /frr-ripd:ripd/instance/default-information-originate
122 int ripd_instance_default_information_originate_modify(
123 struct nb_cb_modify_args
*args
)
126 bool default_information
;
127 struct prefix_ipv4 p
;
129 if (args
->event
!= NB_EV_APPLY
)
132 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
133 default_information
= yang_dnode_get_bool(args
->dnode
, NULL
);
135 memset(&p
, 0, sizeof(p
));
137 if (default_information
) {
140 memset(&nh
, 0, sizeof(nh
));
141 nh
.type
= NEXTHOP_TYPE_IPV4
;
142 rip_redistribute_add(rip
, ZEBRA_ROUTE_RIP
, RIP_ROUTE_DEFAULT
,
145 rip_redistribute_delete(rip
, ZEBRA_ROUTE_RIP
, RIP_ROUTE_DEFAULT
,
153 * XPath: /frr-ripd:ripd/instance/default-metric
155 int ripd_instance_default_metric_modify(struct nb_cb_modify_args
*args
)
159 if (args
->event
!= NB_EV_APPLY
)
162 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
163 rip
->default_metric
= yang_dnode_get_uint8(args
->dnode
, NULL
);
164 /* rip_update_default_metric (); */
170 * XPath: /frr-ripd:ripd/instance/distance/default
172 int ripd_instance_distance_default_modify(struct nb_cb_modify_args
*args
)
176 if (args
->event
!= NB_EV_APPLY
)
179 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
180 rip
->distance
= yang_dnode_get_uint8(args
->dnode
, NULL
);
186 * XPath: /frr-ripd:ripd/instance/distance/source
188 int ripd_instance_distance_source_create(struct nb_cb_create_args
*args
)
191 struct prefix_ipv4 prefix
;
192 struct route_node
*rn
;
194 if (args
->event
!= NB_EV_APPLY
)
197 yang_dnode_get_ipv4p(&prefix
, args
->dnode
, "./prefix");
198 apply_mask_ipv4(&prefix
);
200 /* Get RIP distance node. */
201 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
202 rn
= route_node_get(rip
->distance_table
, (struct prefix
*)&prefix
);
203 rn
->info
= rip_distance_new();
204 nb_running_set_entry(args
->dnode
, rn
);
209 int ripd_instance_distance_source_destroy(struct nb_cb_destroy_args
*args
)
211 struct route_node
*rn
;
212 struct rip_distance
*rdistance
;
214 if (args
->event
!= NB_EV_APPLY
)
217 rn
= nb_running_unset_entry(args
->dnode
);
218 rdistance
= rn
->info
;
219 rip_distance_free(rdistance
);
221 route_unlock_node(rn
);
227 * XPath: /frr-ripd:ripd/instance/distance/source/distance
229 int ripd_instance_distance_source_distance_modify(
230 struct nb_cb_modify_args
*args
)
232 struct route_node
*rn
;
234 struct rip_distance
*rdistance
;
236 if (args
->event
!= NB_EV_APPLY
)
239 /* Set distance value. */
240 rn
= nb_running_get_entry(args
->dnode
, NULL
, true);
241 distance
= yang_dnode_get_uint8(args
->dnode
, NULL
);
242 rdistance
= rn
->info
;
243 rdistance
->distance
= distance
;
249 * XPath: /frr-ripd:ripd/instance/distance/source/access-list
251 int ripd_instance_distance_source_access_list_modify(
252 struct nb_cb_modify_args
*args
)
254 const char *acl_name
;
255 struct route_node
*rn
;
256 struct rip_distance
*rdistance
;
258 if (args
->event
!= NB_EV_APPLY
)
261 acl_name
= yang_dnode_get_string(args
->dnode
, NULL
);
263 /* Set access-list */
264 rn
= nb_running_get_entry(args
->dnode
, NULL
, true);
265 rdistance
= rn
->info
;
266 if (rdistance
->access_list
)
267 free(rdistance
->access_list
);
268 rdistance
->access_list
= strdup(acl_name
);
273 int ripd_instance_distance_source_access_list_destroy(
274 struct nb_cb_destroy_args
*args
)
276 struct route_node
*rn
;
277 struct rip_distance
*rdistance
;
279 if (args
->event
!= NB_EV_APPLY
)
282 /* Reset access-list configuration. */
283 rn
= nb_running_get_entry(args
->dnode
, NULL
, true);
284 rdistance
= rn
->info
;
285 free(rdistance
->access_list
);
286 rdistance
->access_list
= NULL
;
292 * XPath: /frr-ripd:ripd/instance/explicit-neighbor
294 int ripd_instance_explicit_neighbor_create(struct nb_cb_create_args
*args
)
297 struct prefix_ipv4 p
;
299 if (args
->event
!= NB_EV_APPLY
)
302 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
304 p
.prefixlen
= IPV4_MAX_BITLEN
;
305 yang_dnode_get_ipv4(&p
.prefix
, args
->dnode
, NULL
);
307 return rip_neighbor_add(rip
, &p
);
310 int ripd_instance_explicit_neighbor_destroy(struct nb_cb_destroy_args
*args
)
313 struct prefix_ipv4 p
;
315 if (args
->event
!= NB_EV_APPLY
)
318 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
320 p
.prefixlen
= IPV4_MAX_BITLEN
;
321 yang_dnode_get_ipv4(&p
.prefix
, args
->dnode
, NULL
);
323 return rip_neighbor_delete(rip
, &p
);
327 * XPath: /frr-ripd:ripd/instance/network
329 int ripd_instance_network_create(struct nb_cb_create_args
*args
)
334 if (args
->event
!= NB_EV_APPLY
)
337 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
338 yang_dnode_get_ipv4p(&p
, args
->dnode
, NULL
);
339 apply_mask_ipv4((struct prefix_ipv4
*)&p
);
341 return rip_enable_network_add(rip
, &p
);
344 int ripd_instance_network_destroy(struct nb_cb_destroy_args
*args
)
349 if (args
->event
!= NB_EV_APPLY
)
352 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
353 yang_dnode_get_ipv4p(&p
, args
->dnode
, NULL
);
354 apply_mask_ipv4((struct prefix_ipv4
*)&p
);
356 return rip_enable_network_delete(rip
, &p
);
360 * XPath: /frr-ripd:ripd/instance/interface
362 int ripd_instance_interface_create(struct nb_cb_create_args
*args
)
367 if (args
->event
!= NB_EV_APPLY
)
370 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
371 ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
373 return rip_enable_if_add(rip
, ifname
);
376 int ripd_instance_interface_destroy(struct nb_cb_destroy_args
*args
)
381 if (args
->event
!= NB_EV_APPLY
)
384 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
385 ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
387 return rip_enable_if_delete(rip
, ifname
);
391 * XPath: /frr-ripd:ripd/instance/offset-list
393 int ripd_instance_offset_list_create(struct nb_cb_create_args
*args
)
397 struct rip_offset_list
*offset
;
399 if (args
->event
!= NB_EV_APPLY
)
402 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
403 ifname
= yang_dnode_get_string(args
->dnode
, "./interface");
405 offset
= rip_offset_list_new(rip
, ifname
);
406 nb_running_set_entry(args
->dnode
, offset
);
411 int ripd_instance_offset_list_destroy(struct nb_cb_destroy_args
*args
)
414 struct rip_offset_list
*offset
;
416 if (args
->event
!= NB_EV_APPLY
)
419 direct
= yang_dnode_get_enum(args
->dnode
, "./direction");
421 offset
= nb_running_unset_entry(args
->dnode
);
422 if (offset
->direct
[direct
].alist_name
) {
423 free(offset
->direct
[direct
].alist_name
);
424 offset
->direct
[direct
].alist_name
= NULL
;
426 if (offset
->direct
[RIP_OFFSET_LIST_IN
].alist_name
== NULL
427 && offset
->direct
[RIP_OFFSET_LIST_OUT
].alist_name
== NULL
)
428 offset_list_del(offset
);
434 * XPath: /frr-ripd:ripd/instance/offset-list/access-list
436 int ripd_instance_offset_list_access_list_modify(struct nb_cb_modify_args
*args
)
439 struct rip_offset_list
*offset
;
440 const char *alist_name
;
442 if (args
->event
!= NB_EV_APPLY
)
445 direct
= yang_dnode_get_enum(args
->dnode
, "../direction");
446 alist_name
= yang_dnode_get_string(args
->dnode
, NULL
);
448 offset
= nb_running_get_entry(args
->dnode
, NULL
, true);
449 if (offset
->direct
[direct
].alist_name
)
450 free(offset
->direct
[direct
].alist_name
);
451 offset
->direct
[direct
].alist_name
= strdup(alist_name
);
457 * XPath: /frr-ripd:ripd/instance/offset-list/metric
459 int ripd_instance_offset_list_metric_modify(struct nb_cb_modify_args
*args
)
463 struct rip_offset_list
*offset
;
465 if (args
->event
!= NB_EV_APPLY
)
468 direct
= yang_dnode_get_enum(args
->dnode
, "../direction");
469 metric
= yang_dnode_get_uint8(args
->dnode
, NULL
);
471 offset
= nb_running_get_entry(args
->dnode
, NULL
, true);
472 offset
->direct
[direct
].metric
= metric
;
478 * XPath: /frr-ripd:ripd/instance/passive-default
480 int ripd_instance_passive_default_modify(struct nb_cb_modify_args
*args
)
484 if (args
->event
!= NB_EV_APPLY
)
487 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
488 rip
->passive_default
= yang_dnode_get_bool(args
->dnode
, NULL
);
489 rip_passive_nondefault_clean(rip
);
495 * XPath: /frr-ripd:ripd/instance/passive-interface
497 int ripd_instance_passive_interface_create(struct nb_cb_create_args
*args
)
502 if (args
->event
!= NB_EV_APPLY
)
505 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
506 ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
508 return rip_passive_nondefault_set(rip
, ifname
);
511 int ripd_instance_passive_interface_destroy(struct nb_cb_destroy_args
*args
)
516 if (args
->event
!= NB_EV_APPLY
)
519 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
520 ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
522 return rip_passive_nondefault_unset(rip
, ifname
);
526 * XPath: /frr-ripd:ripd/instance/non-passive-interface
528 int ripd_instance_non_passive_interface_create(struct nb_cb_create_args
*args
)
533 if (args
->event
!= NB_EV_APPLY
)
536 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
537 ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
539 return rip_passive_nondefault_unset(rip
, ifname
);
542 int ripd_instance_non_passive_interface_destroy(struct nb_cb_destroy_args
*args
)
547 if (args
->event
!= NB_EV_APPLY
)
550 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
551 ifname
= yang_dnode_get_string(args
->dnode
, NULL
);
553 return rip_passive_nondefault_set(rip
, ifname
);
557 * XPath: /frr-ripd:ripd/instance/redistribute
559 int ripd_instance_redistribute_create(struct nb_cb_create_args
*args
)
564 if (args
->event
!= NB_EV_APPLY
)
567 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
568 type
= yang_dnode_get_enum(args
->dnode
, "./protocol");
570 rip
->redist
[type
].enabled
= true;
575 int ripd_instance_redistribute_destroy(struct nb_cb_destroy_args
*args
)
580 if (args
->event
!= NB_EV_APPLY
)
583 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
584 type
= yang_dnode_get_enum(args
->dnode
, "./protocol");
586 rip
->redist
[type
].enabled
= false;
587 if (rip
->redist
[type
].route_map
.name
) {
588 free(rip
->redist
[type
].route_map
.name
);
589 rip
->redist
[type
].route_map
.name
= NULL
;
590 rip
->redist
[type
].route_map
.map
= NULL
;
592 rip
->redist
[type
].metric_config
= false;
593 rip
->redist
[type
].metric
= 0;
596 rip_redistribute_conf_delete(rip
, type
);
601 void ripd_instance_redistribute_apply_finish(
602 struct nb_cb_apply_finish_args
*args
)
607 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
608 type
= yang_dnode_get_enum(args
->dnode
, "./protocol");
611 rip_redistribute_conf_update(rip
, type
);
615 * XPath: /frr-ripd:ripd/instance/redistribute/route-map
617 int ripd_instance_redistribute_route_map_modify(struct nb_cb_modify_args
*args
)
621 const char *rmap_name
;
623 if (args
->event
!= NB_EV_APPLY
)
626 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
627 type
= yang_dnode_get_enum(args
->dnode
, "../protocol");
628 rmap_name
= yang_dnode_get_string(args
->dnode
, NULL
);
630 if (rip
->redist
[type
].route_map
.name
)
631 free(rip
->redist
[type
].route_map
.name
);
632 rip
->redist
[type
].route_map
.name
= strdup(rmap_name
);
633 rip
->redist
[type
].route_map
.map
= route_map_lookup_by_name(rmap_name
);
638 int ripd_instance_redistribute_route_map_destroy(
639 struct nb_cb_destroy_args
*args
)
644 if (args
->event
!= NB_EV_APPLY
)
647 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
648 type
= yang_dnode_get_enum(args
->dnode
, "../protocol");
650 free(rip
->redist
[type
].route_map
.name
);
651 rip
->redist
[type
].route_map
.name
= NULL
;
652 rip
->redist
[type
].route_map
.map
= NULL
;
658 * XPath: /frr-ripd:ripd/instance/redistribute/metric
660 int ripd_instance_redistribute_metric_modify(struct nb_cb_modify_args
*args
)
666 if (args
->event
!= NB_EV_APPLY
)
669 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
670 type
= yang_dnode_get_enum(args
->dnode
, "../protocol");
671 metric
= yang_dnode_get_uint8(args
->dnode
, NULL
);
673 rip
->redist
[type
].metric_config
= true;
674 rip
->redist
[type
].metric
= metric
;
679 int ripd_instance_redistribute_metric_destroy(struct nb_cb_destroy_args
*args
)
684 if (args
->event
!= NB_EV_APPLY
)
687 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
688 type
= yang_dnode_get_enum(args
->dnode
, "../protocol");
690 rip
->redist
[type
].metric_config
= false;
691 rip
->redist
[type
].metric
= 0;
697 * XPath: /frr-ripd:ripd/instance/static-route
699 int ripd_instance_static_route_create(struct nb_cb_create_args
*args
)
703 struct prefix_ipv4 p
;
705 if (args
->event
!= NB_EV_APPLY
)
708 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
709 yang_dnode_get_ipv4p(&p
, args
->dnode
, NULL
);
712 memset(&nh
, 0, sizeof(nh
));
713 nh
.type
= NEXTHOP_TYPE_IPV4
;
714 rip_redistribute_add(rip
, ZEBRA_ROUTE_RIP
, RIP_ROUTE_STATIC
, &p
, &nh
, 0,
720 int ripd_instance_static_route_destroy(struct nb_cb_destroy_args
*args
)
723 struct prefix_ipv4 p
;
725 if (args
->event
!= NB_EV_APPLY
)
728 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
729 yang_dnode_get_ipv4p(&p
, args
->dnode
, NULL
);
732 rip_redistribute_delete(rip
, ZEBRA_ROUTE_RIP
, RIP_ROUTE_STATIC
, &p
, 0);
738 * XPath: /frr-ripd:ripd/instance/timers/
740 void ripd_instance_timers_apply_finish(struct nb_cb_apply_finish_args
*args
)
744 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
746 /* Reset update timer thread. */
747 rip_event(rip
, RIP_UPDATE_EVENT
, 0);
751 * XPath: /frr-ripd:ripd/instance/timers/flush-interval
753 int ripd_instance_timers_flush_interval_modify(struct nb_cb_modify_args
*args
)
757 if (args
->event
!= NB_EV_APPLY
)
760 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
761 rip
->garbage_time
= yang_dnode_get_uint32(args
->dnode
, NULL
);
767 * XPath: /frr-ripd:ripd/instance/timers/holddown-interval
769 int ripd_instance_timers_holddown_interval_modify(
770 struct nb_cb_modify_args
*args
)
774 if (args
->event
!= NB_EV_APPLY
)
777 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
778 rip
->timeout_time
= yang_dnode_get_uint32(args
->dnode
, NULL
);
784 * XPath: /frr-ripd:ripd/instance/timers/update-interval
786 int ripd_instance_timers_update_interval_modify(struct nb_cb_modify_args
*args
)
790 if (args
->event
!= NB_EV_APPLY
)
793 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
794 rip
->update_time
= yang_dnode_get_uint32(args
->dnode
, NULL
);
800 * XPath: /frr-ripd:ripd/instance/version/receive
802 int ripd_instance_version_receive_modify(struct nb_cb_modify_args
*args
)
806 if (args
->event
!= NB_EV_APPLY
)
809 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
810 rip
->version_recv
= yang_dnode_get_enum(args
->dnode
, NULL
);
816 * XPath: /frr-ripd:ripd/instance/version/send
818 int ripd_instance_version_send_modify(struct nb_cb_modify_args
*args
)
822 if (args
->event
!= NB_EV_APPLY
)
825 rip
= nb_running_get_entry(args
->dnode
, NULL
, true);
826 rip
->version_send
= yang_dnode_get_enum(args
->dnode
, NULL
);
832 * XPath: /frr-interface:lib/interface/frr-ripd:rip/split-horizon
834 int lib_interface_rip_split_horizon_modify(struct nb_cb_modify_args
*args
)
836 struct interface
*ifp
;
837 struct rip_interface
*ri
;
839 if (args
->event
!= NB_EV_APPLY
)
842 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
844 ri
->split_horizon
= yang_dnode_get_enum(args
->dnode
, NULL
);
850 * XPath: /frr-interface:lib/interface/frr-ripd:rip/v2-broadcast
852 int lib_interface_rip_v2_broadcast_modify(struct nb_cb_modify_args
*args
)
854 struct interface
*ifp
;
855 struct rip_interface
*ri
;
857 if (args
->event
!= NB_EV_APPLY
)
860 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
862 ri
->v2_broadcast
= yang_dnode_get_bool(args
->dnode
, NULL
);
868 * XPath: /frr-interface:lib/interface/frr-ripd:rip/version-receive
870 int lib_interface_rip_version_receive_modify(struct nb_cb_modify_args
*args
)
872 struct interface
*ifp
;
873 struct rip_interface
*ri
;
875 if (args
->event
!= NB_EV_APPLY
)
878 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
880 ri
->ri_receive
= yang_dnode_get_enum(args
->dnode
, NULL
);
886 * XPath: /frr-interface:lib/interface/frr-ripd:rip/version-send
888 int lib_interface_rip_version_send_modify(struct nb_cb_modify_args
*args
)
890 struct interface
*ifp
;
891 struct rip_interface
*ri
;
893 if (args
->event
!= NB_EV_APPLY
)
896 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
898 ri
->ri_send
= yang_dnode_get_enum(args
->dnode
, NULL
);
904 * XPath: /frr-interface:lib/interface/frr-ripd:rip/authentication-scheme/mode
906 int lib_interface_rip_authentication_scheme_mode_modify(
907 struct nb_cb_modify_args
*args
)
909 struct interface
*ifp
;
910 struct rip_interface
*ri
;
912 if (args
->event
!= NB_EV_APPLY
)
915 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
917 ri
->auth_type
= yang_dnode_get_enum(args
->dnode
, NULL
);
924 * /frr-interface:lib/interface/frr-ripd:rip/authentication-scheme/md5-auth-length
926 int lib_interface_rip_authentication_scheme_md5_auth_length_modify(
927 struct nb_cb_modify_args
*args
)
929 struct interface
*ifp
;
930 struct rip_interface
*ri
;
932 if (args
->event
!= NB_EV_APPLY
)
935 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
937 ri
->md5_auth_len
= yang_dnode_get_enum(args
->dnode
, NULL
);
942 int lib_interface_rip_authentication_scheme_md5_auth_length_destroy(
943 struct nb_cb_destroy_args
*args
)
945 struct interface
*ifp
;
946 struct rip_interface
*ri
;
948 if (args
->event
!= NB_EV_APPLY
)
951 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
953 ri
->md5_auth_len
= yang_get_default_enum(
954 "%s/authentication-scheme/md5-auth-length", RIP_IFACE
);
960 * XPath: /frr-interface:lib/interface/frr-ripd:rip/authentication-password
962 int lib_interface_rip_authentication_password_modify(
963 struct nb_cb_modify_args
*args
)
965 struct interface
*ifp
;
966 struct rip_interface
*ri
;
968 if (args
->event
!= NB_EV_APPLY
)
971 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
973 XFREE(MTYPE_RIP_INTERFACE_STRING
, ri
->auth_str
);
974 ri
->auth_str
= XSTRDUP(MTYPE_RIP_INTERFACE_STRING
,
975 yang_dnode_get_string(args
->dnode
, NULL
));
980 int lib_interface_rip_authentication_password_destroy(
981 struct nb_cb_destroy_args
*args
)
983 struct interface
*ifp
;
984 struct rip_interface
*ri
;
986 if (args
->event
!= NB_EV_APPLY
)
989 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
991 XFREE(MTYPE_RIP_INTERFACE_STRING
, ri
->auth_str
);
997 * XPath: /frr-interface:lib/interface/frr-ripd:rip/authentication-key-chain
999 int lib_interface_rip_authentication_key_chain_modify(
1000 struct nb_cb_modify_args
*args
)
1002 struct interface
*ifp
;
1003 struct rip_interface
*ri
;
1005 if (args
->event
!= NB_EV_APPLY
)
1008 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
1010 XFREE(MTYPE_RIP_INTERFACE_STRING
, ri
->key_chain
);
1011 ri
->key_chain
= XSTRDUP(MTYPE_RIP_INTERFACE_STRING
,
1012 yang_dnode_get_string(args
->dnode
, NULL
));
1017 int lib_interface_rip_authentication_key_chain_destroy(
1018 struct nb_cb_destroy_args
*args
)
1020 struct interface
*ifp
;
1021 struct rip_interface
*ri
;
1023 if (args
->event
!= NB_EV_APPLY
)
1026 ifp
= nb_running_get_entry(args
->dnode
, NULL
, true);
1028 XFREE(MTYPE_RIP_INTERFACE_STRING
, ri
->key_chain
);