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
);
278 "interface delete %s vrf %s(%u) index %d flags %#llx metric %d mtu %d",
279 ifp
->name
, VRF_LOGNAME(vrf
), ifp
->vrf_id
, ifp
->ifindex
,
280 (unsigned long long)ifp
->flags
, ifp
->metric
, ifp
->mtu6
);
285 /* VRF update for an interface. */
286 int ripng_interface_vrf_update(ZAPI_CALLBACK_ARGS
)
288 struct interface
*ifp
;
291 ifp
= zebra_interface_vrf_update_read(zclient
->ibuf
, vrf_id
,
296 if (IS_RIPNG_DEBUG_ZEBRA
) {
297 struct vrf
*vrf
= vrf_lookup_by_id(ifp
->vrf_id
);
298 struct vrf
*nvrf
= vrf_lookup_by_id(new_vrf_id
);
300 zlog_debug("interface %s VRF change vrf %s(%u) new vrf %s(%u)",
301 ifp
->name
, VRF_LOGNAME(vrf
), vrf_id
,
302 VRF_LOGNAME(nvrf
), new_vrf_id
);
305 if_update_to_new_vrf(ifp
, new_vrf_id
);
306 ripng_interface_sync(ifp
);
311 void ripng_interface_clean(struct ripng
*ripng
)
313 struct interface
*ifp
;
314 struct ripng_interface
*ri
;
316 FOR_ALL_INTERFACES (ripng
->vrf
, ifp
) {
319 ri
->enable_network
= 0;
320 ri
->enable_interface
= 0;
324 thread_cancel(ri
->t_wakeup
);
330 static void ripng_apply_address_add(struct connected
*ifc
)
332 struct ripng_interface
*ri
= ifc
->ifp
->info
;
333 struct ripng
*ripng
= ri
->ripng
;
334 struct prefix_ipv6 address
;
340 if (!if_is_up(ifc
->ifp
))
345 memset(&address
, 0, sizeof(address
));
346 address
.family
= p
->family
;
347 address
.prefix
= p
->u
.prefix6
;
348 address
.prefixlen
= p
->prefixlen
;
349 apply_mask_ipv6(&address
);
351 /* Check if this interface is RIP enabled or not
352 or Check if this address's prefix is RIP enabled */
353 if ((ripng_enable_if_lookup(ripng
, ifc
->ifp
->name
) >= 0)
354 || (ripng_enable_network_lookup2(ifc
) >= 0))
355 ripng_redistribute_add(ripng
, ZEBRA_ROUTE_CONNECT
,
356 RIPNG_ROUTE_INTERFACE
, &address
,
357 ifc
->ifp
->ifindex
, NULL
, 0);
360 int ripng_interface_address_add(ZAPI_CALLBACK_ARGS
)
365 c
= zebra_interface_address_read(ZEBRA_INTERFACE_ADDRESS_ADD
,
366 zclient
->ibuf
, vrf_id
);
373 if (p
->family
== AF_INET6
) {
374 struct ripng_interface
*ri
= c
->ifp
->info
;
376 if (IS_RIPNG_DEBUG_ZEBRA
)
377 zlog_debug("RIPng connected address %s/%d add",
378 inet6_ntoa(p
->u
.prefix6
), p
->prefixlen
);
380 /* Check is this prefix needs to be redistributed. */
381 ripng_apply_address_add(c
);
383 /* Let's try once again whether the interface could be activated
386 /* Check if this interface is RIP enabled or not.*/
387 ripng_enable_apply(c
->ifp
);
389 /* Apply distribute list to the interface. */
390 ripng_distribute_update_interface(c
->ifp
);
392 /* Check interface routemap. */
393 ripng_if_rmap_update_interface(c
->ifp
);
400 static void ripng_apply_address_del(struct connected
*ifc
)
402 struct ripng_interface
*ri
= ifc
->ifp
->info
;
403 struct ripng
*ripng
= ri
->ripng
;
404 struct prefix_ipv6 address
;
410 if (!if_is_up(ifc
->ifp
))
415 memset(&address
, 0, sizeof(address
));
416 address
.family
= p
->family
;
417 address
.prefix
= p
->u
.prefix6
;
418 address
.prefixlen
= p
->prefixlen
;
419 apply_mask_ipv6(&address
);
421 ripng_redistribute_delete(ripng
, ZEBRA_ROUTE_CONNECT
,
422 RIPNG_ROUTE_INTERFACE
, &address
,
426 int ripng_interface_address_delete(ZAPI_CALLBACK_ARGS
)
428 struct connected
*ifc
;
430 char buf
[INET6_ADDRSTRLEN
];
432 ifc
= zebra_interface_address_read(ZEBRA_INTERFACE_ADDRESS_DELETE
,
433 zclient
->ibuf
, vrf_id
);
438 if (p
->family
== AF_INET6
) {
439 if (IS_RIPNG_DEBUG_ZEBRA
)
441 "RIPng connected address %s/%d delete",
442 inet_ntop(AF_INET6
, &p
->u
.prefix6
, buf
,
446 /* Check wether this prefix needs to be removed. */
447 ripng_apply_address_del(ifc
);
449 connected_free(&ifc
);
455 /* Lookup RIPng enable network. */
456 /* Check wether the interface has at least a connected prefix that
457 * is within the ripng->enable_network table. */
458 static int ripng_enable_network_lookup_if(struct interface
*ifp
)
460 struct ripng_interface
*ri
= ifp
->info
;
461 struct ripng
*ripng
= ri
->ripng
;
462 struct listnode
*node
;
463 struct connected
*connected
;
464 struct prefix_ipv6 address
;
469 for (ALL_LIST_ELEMENTS_RO(ifp
->connected
, node
, connected
)) {
473 p
= connected
->address
;
475 if (p
->family
== AF_INET6
) {
476 address
.family
= AF_INET6
;
477 address
.prefix
= p
->u
.prefix6
;
478 address
.prefixlen
= IPV6_MAX_BITLEN
;
480 n
= agg_node_match(ripng
->enable_network
,
481 (struct prefix
*)&address
);
491 /* Check wether connected is within the ripng->enable_network table. */
492 static int ripng_enable_network_lookup2(struct connected
*connected
)
494 struct ripng_interface
*ri
= connected
->ifp
->info
;
495 struct ripng
*ripng
= ri
->ripng
;
496 struct prefix_ipv6 address
;
502 p
= connected
->address
;
504 if (p
->family
== AF_INET6
) {
505 struct agg_node
*node
;
507 address
.family
= p
->family
;
508 address
.prefix
= p
->u
.prefix6
;
509 address
.prefixlen
= IPV6_MAX_BITLEN
;
511 /* LPM on p->family, p->u.prefix6/IPV6_MAX_BITLEN within
512 * ripng->enable_network */
513 node
= agg_node_match(ripng
->enable_network
,
514 (struct prefix
*)&address
);
517 agg_unlock_node(node
);
525 /* Add RIPng enable network. */
526 int ripng_enable_network_add(struct ripng
*ripng
, struct prefix
*p
)
528 struct agg_node
*node
;
530 node
= agg_node_get(ripng
->enable_network
, p
);
533 agg_unlock_node(node
);
534 return NB_ERR_INCONSISTENCY
;
536 node
->info
= (void *)1;
538 /* XXX: One should find a better solution than a generic one */
539 ripng_enable_apply_all(ripng
);
544 /* Delete RIPng enable network. */
545 int ripng_enable_network_delete(struct ripng
*ripng
, struct prefix
*p
)
547 struct agg_node
*node
;
549 node
= agg_node_lookup(ripng
->enable_network
, p
);
553 /* Unlock info lock. */
554 agg_unlock_node(node
);
556 /* Unlock lookup lock. */
557 agg_unlock_node(node
);
562 return NB_ERR_INCONSISTENCY
;
565 /* Lookup function. */
566 static int ripng_enable_if_lookup(struct ripng
*ripng
, const char *ifname
)
574 for (i
= 0; i
< vector_active(ripng
->enable_if
); i
++)
575 if ((str
= vector_slot(ripng
->enable_if
, i
)) != NULL
)
576 if (strcmp(str
, ifname
) == 0)
581 int ripng_enable_if_add(struct ripng
*ripng
, const char *ifname
)
585 ret
= ripng_enable_if_lookup(ripng
, ifname
);
587 return NB_ERR_INCONSISTENCY
;
589 vector_set(ripng
->enable_if
, strdup(ifname
));
591 ripng_enable_apply_all(ripng
);
596 int ripng_enable_if_delete(struct ripng
*ripng
, const char *ifname
)
601 index
= ripng_enable_if_lookup(ripng
, ifname
);
603 return NB_ERR_INCONSISTENCY
;
605 str
= vector_slot(ripng
->enable_if
, index
);
607 vector_unset(ripng
->enable_if
, index
);
609 ripng_enable_apply_all(ripng
);
614 /* Wake up interface. */
615 static int ripng_interface_wakeup(struct thread
*t
)
617 struct interface
*ifp
;
618 struct ripng_interface
*ri
;
626 /* Join to multicast group. */
627 if (ripng_multicast_join(ifp
, ri
->ripng
->sock
) < 0) {
628 flog_err_sys(EC_LIB_SOCKET
,
629 "multicast join failed, interface %s not running",
634 /* Set running flag. */
637 /* Send RIP request to the interface. */
643 static void ripng_connect_set(struct interface
*ifp
, int set
)
645 struct ripng_interface
*ri
= ifp
->info
;
646 struct ripng
*ripng
= ri
->ripng
;
647 struct listnode
*node
, *nnode
;
648 struct connected
*connected
;
649 struct prefix_ipv6 address
;
651 for (ALL_LIST_ELEMENTS(ifp
->connected
, node
, nnode
, connected
)) {
653 p
= connected
->address
;
655 if (p
->family
!= AF_INET6
)
658 address
.family
= AF_INET6
;
659 address
.prefix
= p
->u
.prefix6
;
660 address
.prefixlen
= p
->prefixlen
;
661 apply_mask_ipv6(&address
);
664 /* Check once more wether this prefix is within a
665 * "network IF_OR_PREF" one */
666 if ((ripng_enable_if_lookup(ripng
, connected
->ifp
->name
)
668 || (ripng_enable_network_lookup2(connected
) >= 0))
669 ripng_redistribute_add(
670 ripng
, ZEBRA_ROUTE_CONNECT
,
671 RIPNG_ROUTE_INTERFACE
, &address
,
672 connected
->ifp
->ifindex
, NULL
, 0);
674 ripng_redistribute_delete(ripng
, ZEBRA_ROUTE_CONNECT
,
675 RIPNG_ROUTE_INTERFACE
,
677 connected
->ifp
->ifindex
);
678 if (ripng_redistribute_check(ripng
,
679 ZEBRA_ROUTE_CONNECT
))
680 ripng_redistribute_add(
681 ripng
, ZEBRA_ROUTE_CONNECT
,
682 RIPNG_ROUTE_REDISTRIBUTE
, &address
,
683 connected
->ifp
->ifindex
, NULL
, 0);
688 /* Check RIPng is enabed on this interface. */
689 void ripng_enable_apply(struct interface
*ifp
)
692 struct ripng_interface
*ri
= NULL
;
694 /* Check interface. */
700 /* Is this interface a candidate for RIPng ? */
701 ret
= ripng_enable_network_lookup_if(ifp
);
703 /* If the interface is matched. */
705 ri
->enable_network
= 1;
707 ri
->enable_network
= 0;
709 /* Check interface name configuration. */
710 ret
= ripng_enable_if_lookup(ri
->ripng
, ifp
->name
);
712 ri
->enable_interface
= 1;
714 ri
->enable_interface
= 0;
716 /* any candidate interface MUST have a link-local IPv6 address */
717 if ((!ripng_if_ipv6_lladdress_check(ifp
))
718 && (ri
->enable_network
|| ri
->enable_interface
)) {
719 ri
->enable_network
= 0;
720 ri
->enable_interface
= 0;
721 zlog_warn("Interface %s does not have any link-local address",
725 /* Update running status of the interface. */
726 if (ri
->enable_network
|| ri
->enable_interface
) {
727 zlog_info("RIPng INTERFACE ON %s", ifp
->name
);
729 /* Add interface wake up thread. */
730 thread_add_timer(master
, ripng_interface_wakeup
, ifp
, 1,
733 ripng_connect_set(ifp
, 1);
736 /* Might as well clean up the route table as well
737 * ripng_if_down sets to 0 ri->running, and displays
742 ripng_connect_set(ifp
, 0);
747 /* Set distribute list to all interfaces. */
748 static void ripng_enable_apply_all(struct ripng
*ripng
)
750 struct interface
*ifp
;
752 FOR_ALL_INTERFACES (ripng
->vrf
, ifp
)
753 ripng_enable_apply(ifp
);
756 /* Clear all network and neighbor configuration */
757 void ripng_clean_network(struct ripng
*ripng
)
763 /* ripng->enable_network */
764 for (rn
= agg_route_top(ripng
->enable_network
); rn
;
765 rn
= agg_route_next(rn
))
771 /* ripng->enable_if */
772 for (i
= 0; i
< vector_active(ripng
->enable_if
); i
++)
773 if ((str
= vector_slot(ripng
->enable_if
, i
)) != NULL
) {
775 vector_slot(ripng
->enable_if
, i
) = NULL
;
779 /* Utility function for looking up passive interface settings. */
780 static int ripng_passive_interface_lookup(struct ripng
*ripng
,
786 for (i
= 0; i
< vector_active(ripng
->passive_interface
); i
++)
787 if ((str
= vector_slot(ripng
->passive_interface
, i
)) != NULL
)
788 if (strcmp(str
, ifname
) == 0)
793 void ripng_passive_interface_apply(struct interface
*ifp
)
796 struct ripng_interface
*ri
;
804 ret
= ripng_passive_interface_lookup(ripng
, ifp
->name
);
811 static void ripng_passive_interface_apply_all(struct ripng
*ripng
)
813 struct interface
*ifp
;
815 FOR_ALL_INTERFACES (ripng
->vrf
, ifp
)
816 ripng_passive_interface_apply(ifp
);
819 /* Passive interface. */
820 int ripng_passive_interface_set(struct ripng
*ripng
, const char *ifname
)
822 if (ripng_passive_interface_lookup(ripng
, ifname
) >= 0)
823 return NB_ERR_INCONSISTENCY
;
825 vector_set(ripng
->passive_interface
, strdup(ifname
));
827 ripng_passive_interface_apply_all(ripng
);
832 int ripng_passive_interface_unset(struct ripng
*ripng
, const char *ifname
)
837 i
= ripng_passive_interface_lookup(ripng
, ifname
);
839 return NB_ERR_INCONSISTENCY
;
841 str
= vector_slot(ripng
->passive_interface
, i
);
843 vector_unset(ripng
->passive_interface
, i
);
845 ripng_passive_interface_apply_all(ripng
);
850 /* Free all configured RIP passive-interface settings. */
851 void ripng_passive_interface_clean(struct ripng
*ripng
)
856 for (i
= 0; i
< vector_active(ripng
->passive_interface
); i
++)
857 if ((str
= vector_slot(ripng
->passive_interface
, i
)) != NULL
) {
859 vector_slot(ripng
->passive_interface
, i
) = NULL
;
861 ripng_passive_interface_apply_all(ripng
);
864 /* Write RIPng enable network and interface to the vty. */
865 int ripng_network_write(struct vty
*vty
, struct ripng
*ripng
)
869 struct agg_node
*node
;
871 /* Write enable network. */
872 for (node
= agg_route_top(ripng
->enable_network
); node
;
873 node
= agg_route_next(node
))
875 vty_out(vty
, " %pRN\n", node
);
877 /* Write enable interface. */
878 for (i
= 0; i
< vector_active(ripng
->enable_if
); i
++)
879 if ((ifname
= vector_slot(ripng
->enable_if
, i
)) != NULL
)
880 vty_out(vty
, " %s\n", ifname
);
885 static struct ripng_interface
*ri_new(void)
887 struct ripng_interface
*ri
;
889 ri
= XCALLOC(MTYPE_RIPNG_IF
, sizeof(struct ripng_interface
));
891 /* Set default split-horizon behavior. If the interface is Frame
892 Relay or SMDS is enabled, the default value for split-horizon is
893 off. But currently Zebra does detect Frame Relay or SMDS
894 interface. So all interface is set to split horizon. */
896 yang_get_default_enum("%s/split-horizon", RIPNG_IFACE
);
901 void ripng_interface_sync(struct interface
*ifp
)
905 vrf
= vrf_lookup_by_id(ifp
->vrf_id
);
907 struct ripng_interface
*ri
;
911 ri
->ripng
= vrf
->info
;
915 static int ripng_if_new_hook(struct interface
*ifp
)
917 ifp
->info
= ri_new();
918 ripng_interface_sync(ifp
);
923 /* Called when interface structure deleted. */
924 static int ripng_if_delete_hook(struct interface
*ifp
)
926 XFREE(MTYPE_RIPNG_IF
, ifp
->info
);
930 /* Configuration write function for ripngd. */
931 static int interface_config_write(struct vty
*vty
)
936 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
937 struct interface
*ifp
;
939 FOR_ALL_INTERFACES (vrf
, ifp
) {
940 struct lyd_node
*dnode
;
942 dnode
= yang_dnode_get(
943 running_config
->dnode
,
944 "/frr-interface:lib/interface[name='%s'][vrf='%s']",
945 ifp
->name
, vrf
->name
);
950 nb_cli_show_dnode_cmds(vty
, dnode
, false);
957 static int interface_config_write(struct vty
*vty
);
958 /* ripngd's interface node. */
959 static struct cmd_node interface_node
= {
961 .node
= INTERFACE_NODE
,
962 .parent_node
= CONFIG_NODE
,
963 .prompt
= "%s(config-if)# ",
964 .config_write
= interface_config_write
,
967 /* Initialization of interface. */
968 void ripng_if_init(void)
970 /* Interface initialize. */
971 hook_register_prio(if_add
, 0, ripng_if_new_hook
);
972 hook_register_prio(if_del
, 0, ripng_if_delete_hook
);
974 /* Install interface node. */
975 install_node(&interface_node
);
977 if_zapi_callbacks(ripng_ifp_create
, ripng_ifp_up
,
978 ripng_ifp_down
, ripng_ifp_destroy
);