2 * Interface related function for RIPng.
3 * Copyright (C) 1998 Kunihiro Ishiguro
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 along
18 * with this program; see the file COPYING; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
34 #include "agg_table.h"
38 #include "lib_errors.h"
39 #include "northbound_cli.h"
41 #include "ripngd/ripngd.h"
42 #include "ripngd/ripng_debug.h"
44 /* If RFC2133 definition is used. */
45 #ifndef IPV6_JOIN_GROUP
46 #define IPV6_JOIN_GROUP IPV6_ADD_MEMBERSHIP
48 #ifndef IPV6_LEAVE_GROUP
49 #define IPV6_LEAVE_GROUP IPV6_DROP_MEMBERSHIP
52 DEFINE_MTYPE_STATIC(RIPNGD
, RIPNG_IF
, "ripng interface")
54 /* Static utility function. */
55 static void ripng_enable_apply(struct interface
*);
56 static void ripng_passive_interface_apply(struct interface
*);
57 static int ripng_enable_if_lookup(struct ripng
*ripng
, const char *ifname
);
58 static int ripng_enable_network_lookup2(struct connected
*);
59 static void ripng_enable_apply_all(struct ripng
*ripng
);
61 /* Join to the all rip routers multicast group. */
62 static int ripng_multicast_join(struct interface
*ifp
, int sock
)
65 struct ipv6_mreq mreq
;
68 if (if_is_multicast(ifp
)) {
69 memset(&mreq
, 0, sizeof(mreq
));
70 inet_pton(AF_INET6
, RIPNG_GROUP
, &mreq
.ipv6mr_multiaddr
);
71 mreq
.ipv6mr_interface
= ifp
->ifindex
;
74 * NetBSD 1.6.2 requires root to join groups on gif(4).
75 * While this is bogus, privs are available and easy to use
76 * for this call as a workaround.
78 frr_with_privs(&ripngd_privs
) {
80 ret
= setsockopt(sock
, IPPROTO_IPV6
, IPV6_JOIN_GROUP
,
81 (char *)&mreq
, sizeof(mreq
));
86 if (ret
< 0 && save_errno
== EADDRINUSE
) {
88 * Group is already joined. This occurs due to sloppy
90 * management, in particular declining to leave the
92 * an interface that has just gone down.
94 zlog_warn("ripng join on %s EADDRINUSE (ignoring)",
96 return 0; /* not an error */
100 zlog_warn("can't setsockopt IPV6_JOIN_GROUP: %s",
101 safe_strerror(save_errno
));
103 if (IS_RIPNG_DEBUG_EVENT
)
105 "RIPng %s join to all-rip-routers multicast group",
114 /* Leave from the all rip routers multicast group. */
115 static int ripng_multicast_leave(struct interface
*ifp
, int sock
)
118 struct ipv6_mreq mreq
;
120 if (if_is_multicast(ifp
)) {
121 memset(&mreq
, 0, sizeof(mreq
));
122 inet_pton(AF_INET6
, RIPNG_GROUP
, &mreq
.ipv6mr_multiaddr
);
123 mreq
.ipv6mr_interface
= ifp
->ifindex
;
125 ret
= setsockopt(sock
, IPPROTO_IPV6
, IPV6_LEAVE_GROUP
,
126 (char *)&mreq
, sizeof(mreq
));
128 zlog_warn("can't setsockopt IPV6_LEAVE_GROUP: %s",
129 safe_strerror(errno
));
131 if (IS_RIPNG_DEBUG_EVENT
)
133 "RIPng %s leave from all-rip-routers multicast group",
143 /* How many link local IPv6 address could be used on the interface ? */
144 static int ripng_if_ipv6_lladdress_check(struct interface
*ifp
)
147 struct connected
*connected
;
150 for (ALL_LIST_ELEMENTS_RO(ifp
->connected
, nn
, connected
)) {
152 p
= connected
->address
;
154 if ((p
->family
== AF_INET6
)
155 && IN6_IS_ADDR_LINKLOCAL(&p
->u
.prefix6
))
162 static int ripng_if_down(struct interface
*ifp
)
165 struct ripng_info
*rinfo
;
166 struct ripng_interface
*ri
;
168 struct list
*list
= NULL
;
169 struct listnode
*listnode
= NULL
, *nextnode
= NULL
;
175 for (rp
= agg_route_top(ripng
->table
); rp
;
176 rp
= agg_route_next(rp
))
177 if ((list
= rp
->info
) != NULL
)
178 for (ALL_LIST_ELEMENTS(list
, listnode
, nextnode
,
180 if (rinfo
->ifindex
== ifp
->ifindex
)
181 ripng_ecmp_delete(ripng
, rinfo
);
185 if (IS_RIPNG_DEBUG_EVENT
)
186 zlog_debug("turn off %s", ifp
->name
);
188 /* Leave from multicast group. */
190 ripng_multicast_leave(ifp
, ripng
->sock
);
198 /* Inteface link up message processing. */
199 static int ripng_ifp_up(struct interface
*ifp
)
201 if (IS_RIPNG_DEBUG_ZEBRA
) {
202 struct vrf
*vrf
= vrf_lookup_by_id(ifp
->vrf_id
);
205 "interface up %s vrf %s(%u) index %d flags %llx metric %d mtu %d",
206 ifp
->name
, VRF_LOGNAME(vrf
), ifp
->vrf_id
, ifp
->ifindex
,
207 (unsigned long long)ifp
->flags
, ifp
->metric
, ifp
->mtu6
);
210 ripng_interface_sync(ifp
);
212 /* Check if this interface is RIPng enabled or not. */
213 ripng_enable_apply(ifp
);
215 /* Check for a passive interface. */
216 ripng_passive_interface_apply(ifp
);
218 /* Apply distribute list to the all interface. */
219 ripng_distribute_update_interface(ifp
);
224 /* Inteface link down message processing. */
225 static int ripng_ifp_down(struct interface
*ifp
)
227 ripng_interface_sync(ifp
);
230 if (IS_RIPNG_DEBUG_ZEBRA
) {
231 struct vrf
*vrf
= vrf_lookup_by_id(ifp
->vrf_id
);
234 "interface down %s vrf %s(%u) index %d flags %#llx metric %d mtu %d",
235 ifp
->name
, VRF_LOGNAME(vrf
), ifp
->vrf_id
, ifp
->ifindex
,
236 (unsigned long long)ifp
->flags
, ifp
->metric
, ifp
->mtu6
);
242 /* Inteface addition message from zebra. */
243 static int ripng_ifp_create(struct interface
*ifp
)
245 ripng_interface_sync(ifp
);
247 if (IS_RIPNG_DEBUG_ZEBRA
) {
248 struct vrf
*vrf
= vrf_lookup_by_id(ifp
->vrf_id
);
251 "RIPng interface add %s vrf %s(%u) index %d flags %#llx metric %d mtu %d",
252 ifp
->name
, VRF_LOGNAME(vrf
), ifp
->vrf_id
, ifp
->ifindex
,
253 (unsigned long long)ifp
->flags
, ifp
->metric
, ifp
->mtu6
);
256 /* Check is this interface is RIP enabled or not.*/
257 ripng_enable_apply(ifp
);
259 /* Apply distribute list to the interface. */
260 ripng_distribute_update_interface(ifp
);
262 /* Check interface routemap. */
263 ripng_if_rmap_update_interface(ifp
);
268 static int ripng_ifp_destroy(struct interface
*ifp
)
270 struct vrf
*vrf
= vrf_lookup_by_id(ifp
->vrf_id
);
272 ripng_interface_sync(ifp
);
277 if (IS_RIPNG_DEBUG_ZEBRA
)
279 "interface delete %s vrf %s(%u) index %d flags %#llx metric %d mtu %d",
280 ifp
->name
, VRF_LOGNAME(vrf
), ifp
->vrf_id
, ifp
->ifindex
,
281 (unsigned long long)ifp
->flags
, ifp
->metric
, ifp
->mtu6
);
286 /* VRF update for an interface. */
287 int ripng_interface_vrf_update(ZAPI_CALLBACK_ARGS
)
289 struct interface
*ifp
;
292 ifp
= zebra_interface_vrf_update_read(zclient
->ibuf
, vrf_id
,
297 if (IS_RIPNG_DEBUG_ZEBRA
) {
298 struct vrf
*vrf
= vrf_lookup_by_id(ifp
->vrf_id
);
299 struct vrf
*nvrf
= vrf_lookup_by_id(new_vrf_id
);
301 zlog_debug("interface %s VRF change vrf %s(%u) new vrf %s(%u)",
302 ifp
->name
, VRF_LOGNAME(vrf
), vrf_id
,
303 VRF_LOGNAME(nvrf
), new_vrf_id
);
306 if_update_to_new_vrf(ifp
, new_vrf_id
);
307 ripng_interface_sync(ifp
);
312 void ripng_interface_clean(struct ripng
*ripng
)
314 struct interface
*ifp
;
315 struct ripng_interface
*ri
;
317 FOR_ALL_INTERFACES (ripng
->vrf
, ifp
) {
320 ri
->enable_network
= 0;
321 ri
->enable_interface
= 0;
324 thread_cancel(&ri
->t_wakeup
);
328 static void ripng_apply_address_add(struct connected
*ifc
)
330 struct ripng_interface
*ri
= ifc
->ifp
->info
;
331 struct ripng
*ripng
= ri
->ripng
;
332 struct prefix_ipv6 address
;
338 if (!if_is_up(ifc
->ifp
))
343 memset(&address
, 0, sizeof(address
));
344 address
.family
= p
->family
;
345 address
.prefix
= p
->u
.prefix6
;
346 address
.prefixlen
= p
->prefixlen
;
347 apply_mask_ipv6(&address
);
349 /* Check if this interface is RIP enabled or not
350 or Check if this address's prefix is RIP enabled */
351 if ((ripng_enable_if_lookup(ripng
, ifc
->ifp
->name
) >= 0)
352 || (ripng_enable_network_lookup2(ifc
) >= 0))
353 ripng_redistribute_add(ripng
, ZEBRA_ROUTE_CONNECT
,
354 RIPNG_ROUTE_INTERFACE
, &address
,
355 ifc
->ifp
->ifindex
, NULL
, 0);
358 int ripng_interface_address_add(ZAPI_CALLBACK_ARGS
)
363 c
= zebra_interface_address_read(ZEBRA_INTERFACE_ADDRESS_ADD
,
364 zclient
->ibuf
, vrf_id
);
371 if (p
->family
== AF_INET6
) {
372 struct ripng_interface
*ri
= c
->ifp
->info
;
374 if (IS_RIPNG_DEBUG_ZEBRA
)
375 zlog_debug("RIPng connected address %pFX add", p
);
377 /* Check is this prefix needs to be redistributed. */
378 ripng_apply_address_add(c
);
380 /* Let's try once again whether the interface could be activated
383 /* Check if this interface is RIP enabled or not.*/
384 ripng_enable_apply(c
->ifp
);
386 /* Apply distribute list to the interface. */
387 ripng_distribute_update_interface(c
->ifp
);
389 /* Check interface routemap. */
390 ripng_if_rmap_update_interface(c
->ifp
);
397 static void ripng_apply_address_del(struct connected
*ifc
)
399 struct ripng_interface
*ri
= ifc
->ifp
->info
;
400 struct ripng
*ripng
= ri
->ripng
;
401 struct prefix_ipv6 address
;
407 if (!if_is_up(ifc
->ifp
))
412 memset(&address
, 0, sizeof(address
));
413 address
.family
= p
->family
;
414 address
.prefix
= p
->u
.prefix6
;
415 address
.prefixlen
= p
->prefixlen
;
416 apply_mask_ipv6(&address
);
418 ripng_redistribute_delete(ripng
, ZEBRA_ROUTE_CONNECT
,
419 RIPNG_ROUTE_INTERFACE
, &address
,
423 int ripng_interface_address_delete(ZAPI_CALLBACK_ARGS
)
425 struct connected
*ifc
;
428 ifc
= zebra_interface_address_read(ZEBRA_INTERFACE_ADDRESS_DELETE
,
429 zclient
->ibuf
, vrf_id
);
434 if (p
->family
== AF_INET6
) {
435 if (IS_RIPNG_DEBUG_ZEBRA
)
437 "RIPng connected address %pFX delete",
440 /* Check wether this prefix needs to be removed. */
441 ripng_apply_address_del(ifc
);
443 connected_free(&ifc
);
449 /* Lookup RIPng enable network. */
450 /* Check wether the interface has at least a connected prefix that
451 * is within the ripng->enable_network table. */
452 static int ripng_enable_network_lookup_if(struct interface
*ifp
)
454 struct ripng_interface
*ri
= ifp
->info
;
455 struct ripng
*ripng
= ri
->ripng
;
456 struct listnode
*node
;
457 struct connected
*connected
;
458 struct prefix_ipv6 address
;
463 for (ALL_LIST_ELEMENTS_RO(ifp
->connected
, node
, connected
)) {
467 p
= connected
->address
;
469 if (p
->family
== AF_INET6
) {
470 address
.family
= AF_INET6
;
471 address
.prefix
= p
->u
.prefix6
;
472 address
.prefixlen
= IPV6_MAX_BITLEN
;
474 n
= agg_node_match(ripng
->enable_network
,
475 (struct prefix
*)&address
);
485 /* Check wether connected is within the ripng->enable_network table. */
486 static int ripng_enable_network_lookup2(struct connected
*connected
)
488 struct ripng_interface
*ri
= connected
->ifp
->info
;
489 struct ripng
*ripng
= ri
->ripng
;
490 struct prefix_ipv6 address
;
496 p
= connected
->address
;
498 if (p
->family
== AF_INET6
) {
499 struct agg_node
*node
;
501 address
.family
= p
->family
;
502 address
.prefix
= p
->u
.prefix6
;
503 address
.prefixlen
= IPV6_MAX_BITLEN
;
505 /* LPM on p->family, p->u.prefix6/IPV6_MAX_BITLEN within
506 * ripng->enable_network */
507 node
= agg_node_match(ripng
->enable_network
,
508 (struct prefix
*)&address
);
511 agg_unlock_node(node
);
519 /* Add RIPng enable network. */
520 int ripng_enable_network_add(struct ripng
*ripng
, struct prefix
*p
)
522 struct agg_node
*node
;
524 node
= agg_node_get(ripng
->enable_network
, p
);
527 agg_unlock_node(node
);
528 return NB_ERR_INCONSISTENCY
;
530 node
->info
= (void *)1;
532 /* XXX: One should find a better solution than a generic one */
533 ripng_enable_apply_all(ripng
);
538 /* Delete RIPng enable network. */
539 int ripng_enable_network_delete(struct ripng
*ripng
, struct prefix
*p
)
541 struct agg_node
*node
;
543 node
= agg_node_lookup(ripng
->enable_network
, p
);
547 /* Unlock info lock. */
548 agg_unlock_node(node
);
550 /* Unlock lookup lock. */
551 agg_unlock_node(node
);
556 return NB_ERR_INCONSISTENCY
;
559 /* Lookup function. */
560 static int ripng_enable_if_lookup(struct ripng
*ripng
, const char *ifname
)
568 for (i
= 0; i
< vector_active(ripng
->enable_if
); i
++)
569 if ((str
= vector_slot(ripng
->enable_if
, i
)) != NULL
)
570 if (strcmp(str
, ifname
) == 0)
575 int ripng_enable_if_add(struct ripng
*ripng
, const char *ifname
)
579 ret
= ripng_enable_if_lookup(ripng
, ifname
);
581 return NB_ERR_INCONSISTENCY
;
583 vector_set(ripng
->enable_if
, strdup(ifname
));
585 ripng_enable_apply_all(ripng
);
590 int ripng_enable_if_delete(struct ripng
*ripng
, const char *ifname
)
595 index
= ripng_enable_if_lookup(ripng
, ifname
);
597 return NB_ERR_INCONSISTENCY
;
599 str
= vector_slot(ripng
->enable_if
, index
);
601 vector_unset(ripng
->enable_if
, index
);
603 ripng_enable_apply_all(ripng
);
608 /* Wake up interface. */
609 static int ripng_interface_wakeup(struct thread
*t
)
611 struct interface
*ifp
;
612 struct ripng_interface
*ri
;
620 /* Join to multicast group. */
621 if (ripng_multicast_join(ifp
, ri
->ripng
->sock
) < 0) {
622 flog_err_sys(EC_LIB_SOCKET
,
623 "multicast join failed, interface %s not running",
628 /* Set running flag. */
631 /* Send RIP request to the interface. */
637 static void ripng_connect_set(struct interface
*ifp
, int set
)
639 struct ripng_interface
*ri
= ifp
->info
;
640 struct ripng
*ripng
= ri
->ripng
;
641 struct listnode
*node
, *nnode
;
642 struct connected
*connected
;
643 struct prefix_ipv6 address
;
645 for (ALL_LIST_ELEMENTS(ifp
->connected
, node
, nnode
, connected
)) {
647 p
= connected
->address
;
649 if (p
->family
!= AF_INET6
)
652 address
.family
= AF_INET6
;
653 address
.prefix
= p
->u
.prefix6
;
654 address
.prefixlen
= p
->prefixlen
;
655 apply_mask_ipv6(&address
);
658 /* Check once more wether this prefix is within a
659 * "network IF_OR_PREF" one */
660 if ((ripng_enable_if_lookup(ripng
, connected
->ifp
->name
)
662 || (ripng_enable_network_lookup2(connected
) >= 0))
663 ripng_redistribute_add(
664 ripng
, ZEBRA_ROUTE_CONNECT
,
665 RIPNG_ROUTE_INTERFACE
, &address
,
666 connected
->ifp
->ifindex
, NULL
, 0);
668 ripng_redistribute_delete(ripng
, ZEBRA_ROUTE_CONNECT
,
669 RIPNG_ROUTE_INTERFACE
,
671 connected
->ifp
->ifindex
);
672 if (ripng_redistribute_check(ripng
,
673 ZEBRA_ROUTE_CONNECT
))
674 ripng_redistribute_add(
675 ripng
, ZEBRA_ROUTE_CONNECT
,
676 RIPNG_ROUTE_REDISTRIBUTE
, &address
,
677 connected
->ifp
->ifindex
, NULL
, 0);
682 /* Check RIPng is enabed on this interface. */
683 void ripng_enable_apply(struct interface
*ifp
)
686 struct ripng_interface
*ri
= NULL
;
688 /* Check interface. */
694 /* Is this interface a candidate for RIPng ? */
695 ret
= ripng_enable_network_lookup_if(ifp
);
697 /* If the interface is matched. */
699 ri
->enable_network
= 1;
701 ri
->enable_network
= 0;
703 /* Check interface name configuration. */
704 ret
= ripng_enable_if_lookup(ri
->ripng
, ifp
->name
);
706 ri
->enable_interface
= 1;
708 ri
->enable_interface
= 0;
710 /* any candidate interface MUST have a link-local IPv6 address */
711 if ((!ripng_if_ipv6_lladdress_check(ifp
))
712 && (ri
->enable_network
|| ri
->enable_interface
)) {
713 ri
->enable_network
= 0;
714 ri
->enable_interface
= 0;
715 zlog_warn("Interface %s does not have any link-local address",
719 /* Update running status of the interface. */
720 if (ri
->enable_network
|| ri
->enable_interface
) {
721 zlog_info("RIPng INTERFACE ON %s", ifp
->name
);
723 /* Add interface wake up thread. */
724 thread_add_timer(master
, ripng_interface_wakeup
, ifp
, 1,
727 ripng_connect_set(ifp
, 1);
730 /* Might as well clean up the route table as well
731 * ripng_if_down sets to 0 ri->running, and displays
736 ripng_connect_set(ifp
, 0);
741 /* Set distribute list to all interfaces. */
742 static void ripng_enable_apply_all(struct ripng
*ripng
)
744 struct interface
*ifp
;
746 FOR_ALL_INTERFACES (ripng
->vrf
, ifp
)
747 ripng_enable_apply(ifp
);
750 /* Clear all network and neighbor configuration */
751 void ripng_clean_network(struct ripng
*ripng
)
757 /* ripng->enable_network */
758 for (rn
= agg_route_top(ripng
->enable_network
); rn
;
759 rn
= agg_route_next(rn
))
765 /* ripng->enable_if */
766 for (i
= 0; i
< vector_active(ripng
->enable_if
); i
++)
767 if ((str
= vector_slot(ripng
->enable_if
, i
)) != NULL
) {
769 vector_slot(ripng
->enable_if
, i
) = NULL
;
773 /* Utility function for looking up passive interface settings. */
774 static int ripng_passive_interface_lookup(struct ripng
*ripng
,
780 for (i
= 0; i
< vector_active(ripng
->passive_interface
); i
++)
781 if ((str
= vector_slot(ripng
->passive_interface
, i
)) != NULL
)
782 if (strcmp(str
, ifname
) == 0)
787 void ripng_passive_interface_apply(struct interface
*ifp
)
790 struct ripng_interface
*ri
;
798 ret
= ripng_passive_interface_lookup(ripng
, ifp
->name
);
805 static void ripng_passive_interface_apply_all(struct ripng
*ripng
)
807 struct interface
*ifp
;
809 FOR_ALL_INTERFACES (ripng
->vrf
, ifp
)
810 ripng_passive_interface_apply(ifp
);
813 /* Passive interface. */
814 int ripng_passive_interface_set(struct ripng
*ripng
, const char *ifname
)
816 if (ripng_passive_interface_lookup(ripng
, ifname
) >= 0)
817 return NB_ERR_INCONSISTENCY
;
819 vector_set(ripng
->passive_interface
, strdup(ifname
));
821 ripng_passive_interface_apply_all(ripng
);
826 int ripng_passive_interface_unset(struct ripng
*ripng
, const char *ifname
)
831 i
= ripng_passive_interface_lookup(ripng
, ifname
);
833 return NB_ERR_INCONSISTENCY
;
835 str
= vector_slot(ripng
->passive_interface
, i
);
837 vector_unset(ripng
->passive_interface
, i
);
839 ripng_passive_interface_apply_all(ripng
);
844 /* Free all configured RIP passive-interface settings. */
845 void ripng_passive_interface_clean(struct ripng
*ripng
)
850 for (i
= 0; i
< vector_active(ripng
->passive_interface
); i
++)
851 if ((str
= vector_slot(ripng
->passive_interface
, i
)) != NULL
) {
853 vector_slot(ripng
->passive_interface
, i
) = NULL
;
855 ripng_passive_interface_apply_all(ripng
);
858 /* Write RIPng enable network and interface to the vty. */
859 int ripng_network_write(struct vty
*vty
, struct ripng
*ripng
)
863 struct agg_node
*node
;
865 /* Write enable network. */
866 for (node
= agg_route_top(ripng
->enable_network
); node
;
867 node
= agg_route_next(node
))
869 vty_out(vty
, " %pRN\n", node
);
871 /* Write enable interface. */
872 for (i
= 0; i
< vector_active(ripng
->enable_if
); i
++)
873 if ((ifname
= vector_slot(ripng
->enable_if
, i
)) != NULL
)
874 vty_out(vty
, " %s\n", ifname
);
879 static struct ripng_interface
*ri_new(void)
881 struct ripng_interface
*ri
;
883 ri
= XCALLOC(MTYPE_RIPNG_IF
, sizeof(struct ripng_interface
));
885 /* Set default split-horizon behavior. If the interface is Frame
886 Relay or SMDS is enabled, the default value for split-horizon is
887 off. But currently Zebra does detect Frame Relay or SMDS
888 interface. So all interface is set to split horizon. */
890 yang_get_default_enum("%s/split-horizon", RIPNG_IFACE
);
895 void ripng_interface_sync(struct interface
*ifp
)
899 vrf
= vrf_lookup_by_id(ifp
->vrf_id
);
901 struct ripng_interface
*ri
;
905 ri
->ripng
= vrf
->info
;
909 static int ripng_if_new_hook(struct interface
*ifp
)
911 ifp
->info
= ri_new();
912 ripng_interface_sync(ifp
);
917 /* Called when interface structure deleted. */
918 static int ripng_if_delete_hook(struct interface
*ifp
)
920 XFREE(MTYPE_RIPNG_IF
, ifp
->info
);
924 /* Configuration write function for ripngd. */
925 static int interface_config_write(struct vty
*vty
)
930 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
931 struct interface
*ifp
;
933 FOR_ALL_INTERFACES (vrf
, ifp
) {
934 struct lyd_node
*dnode
;
936 dnode
= yang_dnode_get(
937 running_config
->dnode
,
938 "/frr-interface:lib/interface[name='%s'][vrf='%s']",
939 ifp
->name
, vrf
->name
);
944 nb_cli_show_dnode_cmds(vty
, dnode
, false);
951 static int interface_config_write(struct vty
*vty
);
952 /* ripngd's interface node. */
953 static struct cmd_node interface_node
= {
955 .node
= INTERFACE_NODE
,
956 .parent_node
= CONFIG_NODE
,
957 .prompt
= "%s(config-if)# ",
958 .config_write
= interface_config_write
,
961 /* Initialization of interface. */
962 void ripng_if_init(void)
964 /* Interface initialize. */
965 hook_register_prio(if_add
, 0, ripng_if_new_hook
);
966 hook_register_prio(if_del
, 0, ripng_if_delete_hook
);
968 /* Install interface node. */
969 install_node(&interface_node
);
971 if_zapi_callbacks(ripng_ifp_create
, ripng_ifp_up
,
972 ripng_ifp_down
, ripng_ifp_destroy
);