3 * Copyright (C) 1997, 98 Kunihiro Ishiguro
5 * This file is part of GNU Zebra.
7 * GNU Zebra is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published
9 * by the Free Software Foundation; either version 2, or (at your
10 * option) any later version.
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
26 #include "lib_errors.h"
31 #include "sockunion.h"
37 #include "northbound_cli.h"
38 #ifndef VTYSH_EXTRACT_PL
39 #include "lib/if_clippy.c"
42 DEFINE_MTYPE_STATIC(LIB
, IF
, "Interface")
43 DEFINE_MTYPE_STATIC(LIB
, CONNECTED
, "Connected")
44 DEFINE_MTYPE_STATIC(LIB
, NBR_CONNECTED
, "Neighbor Connected")
45 DEFINE_MTYPE(LIB
, CONNECTED_LABEL
, "Connected interface label")
46 DEFINE_MTYPE_STATIC(LIB
, IF_LINK_PARAMS
, "Informational Link Parameters")
48 static struct interface
*if_lookup_by_ifindex(ifindex_t ifindex
,
50 static int if_cmp_func(const struct interface
*, const struct interface
*);
51 static int if_cmp_index_func(const struct interface
*ifp1
,
52 const struct interface
*ifp2
);
53 RB_GENERATE(if_name_head
, interface
, name_entry
, if_cmp_func
);
54 RB_GENERATE(if_index_head
, interface
, index_entry
, if_cmp_index_func
);
56 DEFINE_QOBJ_TYPE(interface
)
58 DEFINE_HOOK(if_add
, (struct interface
* ifp
), (ifp
))
59 DEFINE_KOOH(if_del
, (struct interface
* ifp
), (ifp
))
61 struct interface_master
{
62 int (*create_hook
)(struct interface
*ifp
);
63 int (*up_hook
)(struct interface
*ifp
);
64 int (*down_hook
)(struct interface
*ifp
);
65 int (*destroy_hook
)(struct interface
*ifp
);
66 } ifp_master
= { 0, };
68 /* Compare interface names, returning an integer greater than, equal to, or
69 * less than 0, (following the strcmp convention), according to the
70 * relationship between ifp1 and ifp2. Interface names consist of an
71 * alphabetic prefix and a numeric suffix. The primary sort key is
72 * lexicographic by name, and then numeric by number. No number sorts
73 * before all numbers. Examples: de0 < de1, de100 < fxp0 < xl0, devpty <
76 int if_cmp_name_func(const char *p1
, const char *p2
)
83 /* look up to any number */
84 l1
= strcspn(p1
, "0123456789");
85 l2
= strcspn(p2
, "0123456789");
87 /* name lengths are different -> compare names */
89 return (strcmp(p1
, p2
));
91 /* Note that this relies on all numbers being less than all
95 res
= strncmp(p1
, p2
, l1
);
97 /* names are different -> compare them */
101 /* with identical name part, go to numeric part */
112 x1
= strtol(p1
, (char **)&p1
, 10);
113 x2
= strtol(p2
, (char **)&p2
, 10);
115 /* let's compare numbers now */
121 /* numbers were equal, lets do it again..
122 (it happens with name like "eth123.456:789") */
131 static int if_cmp_func(const struct interface
*ifp1
,
132 const struct interface
*ifp2
)
134 return if_cmp_name_func(ifp1
->name
, ifp2
->name
);
137 static int if_cmp_index_func(const struct interface
*ifp1
,
138 const struct interface
*ifp2
)
140 return ifp1
->ifindex
- ifp2
->ifindex
;
143 /* Create new interface structure. */
144 static struct interface
*if_create_backend(const char *name
, ifindex_t ifindex
,
147 struct vrf
*vrf
= vrf_get(vrf_id
, NULL
);
148 struct interface
*ifp
;
150 ifp
= XCALLOC(MTYPE_IF
, sizeof(struct interface
));
151 ifp
->vrf_id
= vrf_id
;
154 strlcpy(ifp
->name
, name
, sizeof(ifp
->name
));
155 IFNAME_RB_INSERT(vrf
, ifp
);
159 if (ifindex
!= IFINDEX_INTERNAL
)
160 if_set_index(ifp
, ifindex
);
162 ifp
->ifindex
= ifindex
; /* doesn't add it to the list */
164 ifp
->connected
= list_new();
165 ifp
->connected
->del
= (void (*)(void *))connected_free
;
167 ifp
->nbr_connected
= list_new();
168 ifp
->nbr_connected
->del
= (void (*)(void *))nbr_connected_free
;
170 /* Enable Link-detection by default */
171 SET_FLAG(ifp
->status
, ZEBRA_INTERFACE_LINKDETECTION
);
173 QOBJ_REG(ifp
, interface
);
174 hook_call(if_add
, ifp
);
178 void if_new_via_zapi(struct interface
*ifp
)
180 if (ifp_master
.create_hook
)
181 (*ifp_master
.create_hook
)(ifp
);
184 void if_up_via_zapi(struct interface
*ifp
)
186 if (ifp_master
.up_hook
)
187 (*ifp_master
.up_hook
)(ifp
);
190 struct interface
*if_create(const char *name
, vrf_id_t vrf_id
)
192 return if_create_backend(name
, IFINDEX_INTERNAL
, vrf_id
);
195 struct interface
*if_create_ifindex(ifindex_t ifindex
, vrf_id_t vrf_id
)
197 return if_create_backend(NULL
, ifindex
, vrf_id
);
200 /* Create new interface structure. */
201 void if_update_to_new_vrf(struct interface
*ifp
, vrf_id_t vrf_id
)
203 struct vrf
*old_vrf
, *vrf
;
205 /* remove interface from old master vrf list */
206 old_vrf
= vrf_lookup_by_id(ifp
->vrf_id
);
208 IFNAME_RB_REMOVE(old_vrf
, ifp
);
209 if (ifp
->ifindex
!= IFINDEX_INTERNAL
)
210 IFINDEX_RB_REMOVE(old_vrf
, ifp
);
213 ifp
->vrf_id
= vrf_id
;
214 vrf
= vrf_get(ifp
->vrf_id
, NULL
);
216 IFNAME_RB_INSERT(vrf
, ifp
);
217 if (ifp
->ifindex
!= IFINDEX_INTERNAL
)
218 IFINDEX_RB_INSERT(vrf
, ifp
);
221 * HACK: Change the interface VRF in the running configuration directly,
222 * bypassing the northbound layer. This is necessary to avoid deleting
223 * the interface and readding it in the new VRF, which would have
224 * several implications.
226 if (yang_module_find("frr-interface")) {
227 struct lyd_node
*if_dnode
;
229 if_dnode
= yang_dnode_get(
230 running_config
->dnode
,
231 "/frr-interface:lib/interface[name='%s'][vrf='%s']/vrf",
232 ifp
->name
, old_vrf
->name
);
234 yang_dnode_change_leaf(if_dnode
, vrf
->name
);
235 running_config
->version
++;
241 /* Delete interface structure. */
242 void if_delete_retain(struct interface
*ifp
)
244 hook_call(if_del
, ifp
);
247 /* Free connected address list */
248 list_delete_all_node(ifp
->connected
);
250 /* Free connected nbr address list */
251 list_delete_all_node(ifp
->nbr_connected
);
254 /* Delete and free interface structure. */
255 void if_delete(struct interface
*ifp
)
259 vrf
= vrf_lookup_by_id(ifp
->vrf_id
);
262 IFNAME_RB_REMOVE(vrf
, ifp
);
263 if (ifp
->ifindex
!= IFINDEX_INTERNAL
)
264 IFINDEX_RB_REMOVE(vrf
, ifp
);
266 if_delete_retain(ifp
);
268 list_delete(&ifp
->connected
);
269 list_delete(&ifp
->nbr_connected
);
271 if_link_params_free(ifp
);
273 XFREE(MTYPE_TMP
, ifp
->desc
);
275 XFREE(MTYPE_IF
, ifp
);
278 /* Used only internally to check within VRF only */
279 static struct interface
*if_lookup_by_ifindex(ifindex_t ifindex
,
283 struct interface if_tmp
;
285 vrf
= vrf_lookup_by_id(vrf_id
);
289 if_tmp
.ifindex
= ifindex
;
290 return RB_FIND(if_index_head
, &vrf
->ifaces_by_index
, &if_tmp
);
293 /* Interface existance check by index. */
294 struct interface
*if_lookup_by_index(ifindex_t ifindex
, vrf_id_t vrf_id
)
296 switch (vrf_get_backend()) {
297 case VRF_BACKEND_UNKNOWN
:
298 case VRF_BACKEND_NETNS
:
299 return(if_lookup_by_ifindex(ifindex
, vrf_id
));
300 case VRF_BACKEND_VRF_LITE
:
301 return(if_lookup_by_index_all_vrf(ifindex
));
306 const char *ifindex2ifname(ifindex_t ifindex
, vrf_id_t vrf_id
)
308 struct interface
*ifp
;
310 return ((ifp
= if_lookup_by_index(ifindex
, vrf_id
)) != NULL
)
315 ifindex_t
ifname2ifindex(const char *name
, vrf_id_t vrf_id
)
317 struct interface
*ifp
;
319 return ((ifp
= if_lookup_by_name(name
, vrf_id
)) != NULL
)
324 /* Interface existance check by interface name. */
325 struct interface
*if_lookup_by_name(const char *name
, vrf_id_t vrf_id
)
327 struct vrf
*vrf
= vrf_lookup_by_id(vrf_id
);
328 struct interface if_tmp
;
331 || strnlen(name
, INTERFACE_NAMSIZ
) == INTERFACE_NAMSIZ
)
334 strlcpy(if_tmp
.name
, name
, sizeof(if_tmp
.name
));
335 return RB_FIND(if_name_head
, &vrf
->ifaces_by_name
, &if_tmp
);
338 struct interface
*if_lookup_by_name_all_vrf(const char *name
)
341 struct interface
*ifp
;
343 if (!name
|| strnlen(name
, INTERFACE_NAMSIZ
) == INTERFACE_NAMSIZ
)
346 RB_FOREACH (vrf
, vrf_id_head
, &vrfs_by_id
) {
347 ifp
= if_lookup_by_name(name
, vrf
->vrf_id
);
355 struct interface
*if_lookup_by_index_all_vrf(ifindex_t ifindex
)
358 struct interface
*ifp
;
360 if (ifindex
== IFINDEX_INTERNAL
)
363 RB_FOREACH (vrf
, vrf_id_head
, &vrfs_by_id
) {
364 ifp
= if_lookup_by_ifindex(ifindex
, vrf
->vrf_id
);
372 /* Lookup interface by IP address. */
373 struct interface
*if_lookup_exact_address(void *src
, int family
,
376 struct vrf
*vrf
= vrf_lookup_by_id(vrf_id
);
377 struct listnode
*cnode
;
378 struct interface
*ifp
;
382 FOR_ALL_INTERFACES (vrf
, ifp
) {
383 for (ALL_LIST_ELEMENTS_RO(ifp
->connected
, cnode
, c
)) {
386 if (p
&& (p
->family
== family
)) {
387 if (family
== AF_INET
) {
390 (struct in_addr
*)src
))
392 } else if (family
== AF_INET6
) {
395 (struct in6_addr
*)src
))
404 /* Lookup interface by IP address. */
405 struct connected
*if_lookup_address(void *matchaddr
, int family
,
408 struct vrf
*vrf
= vrf_lookup_by_id(vrf_id
);
411 struct listnode
*cnode
;
412 struct interface
*ifp
;
414 struct connected
*match
;
416 if (family
== AF_INET
) {
417 addr
.family
= AF_INET
;
418 addr
.u
.prefix4
= *((struct in_addr
*)matchaddr
);
419 addr
.prefixlen
= IPV4_MAX_BITLEN
;
420 } else if (family
== AF_INET6
) {
421 addr
.family
= AF_INET6
;
422 addr
.u
.prefix6
= *((struct in6_addr
*)matchaddr
);
423 addr
.prefixlen
= IPV6_MAX_BITLEN
;
428 FOR_ALL_INTERFACES (vrf
, ifp
) {
429 for (ALL_LIST_ELEMENTS_RO(ifp
->connected
, cnode
, c
)) {
430 if (c
->address
&& (c
->address
->family
== AF_INET
)
431 && prefix_match(CONNECTED_PREFIX(c
), &addr
)
432 && (c
->address
->prefixlen
> bestlen
)) {
433 bestlen
= c
->address
->prefixlen
;
441 /* Lookup interface by prefix */
442 struct interface
*if_lookup_prefix(struct prefix
*prefix
, vrf_id_t vrf_id
)
444 struct vrf
*vrf
= vrf_lookup_by_id(vrf_id
);
445 struct listnode
*cnode
;
446 struct interface
*ifp
;
449 FOR_ALL_INTERFACES (vrf
, ifp
) {
450 for (ALL_LIST_ELEMENTS_RO(ifp
->connected
, cnode
, c
)) {
451 if (prefix_cmp(c
->address
, prefix
) == 0) {
459 size_t if_lookup_by_hwaddr(const uint8_t *hw_addr
, size_t addrsz
,
460 struct interface
***result
, vrf_id_t vrf_id
)
462 struct vrf
*vrf
= vrf_lookup_by_id(vrf_id
);
464 struct list
*rs
= list_new();
465 struct interface
*ifp
;
467 FOR_ALL_INTERFACES (vrf
, ifp
) {
468 if (ifp
->hw_addr_len
== (int)addrsz
469 && !memcmp(hw_addr
, ifp
->hw_addr
, addrsz
))
470 listnode_add(rs
, ifp
);
474 *result
= XCALLOC(MTYPE_TMP
,
475 sizeof(struct interface
*) * rs
->count
);
476 list_to_array(rs
, (void **)*result
, rs
->count
);
479 int count
= rs
->count
;
487 /* Get interface by name if given name interface doesn't exist create
489 struct interface
*if_get_by_name(const char *name
, vrf_id_t vrf_id
)
491 struct interface
*ifp
;
493 switch (vrf_get_backend()) {
494 case VRF_BACKEND_UNKNOWN
:
495 case VRF_BACKEND_NETNS
:
496 ifp
= if_lookup_by_name(name
, vrf_id
);
499 return if_create(name
, vrf_id
);
500 case VRF_BACKEND_VRF_LITE
:
501 ifp
= if_lookup_by_name_all_vrf(name
);
503 if (ifp
->vrf_id
== vrf_id
)
505 /* If it came from the kernel or by way of zclient,
506 * believe it and update the ifp accordingly.
508 if_update_to_new_vrf(ifp
, vrf_id
);
511 return if_create(name
, vrf_id
);
517 struct interface
*if_get_by_ifindex(ifindex_t ifindex
, vrf_id_t vrf_id
)
519 struct interface
*ifp
;
521 switch (vrf_get_backend()) {
522 case VRF_BACKEND_UNKNOWN
:
523 case VRF_BACKEND_NETNS
:
524 ifp
= if_lookup_by_ifindex(ifindex
, vrf_id
);
527 return if_create_ifindex(ifindex
, vrf_id
);
528 case VRF_BACKEND_VRF_LITE
:
529 ifp
= if_lookup_by_index_all_vrf(ifindex
);
531 if (ifp
->vrf_id
== vrf_id
)
533 /* If it came from the kernel or by way of zclient,
534 * believe it and update the ifp accordingly.
536 if_update_to_new_vrf(ifp
, vrf_id
);
539 return if_create_ifindex(ifindex
, vrf_id
);
545 void if_set_index(struct interface
*ifp
, ifindex_t ifindex
)
549 vrf
= vrf_lookup_by_id(ifp
->vrf_id
);
552 if (ifp
->ifindex
== ifindex
)
555 if (ifp
->ifindex
!= IFINDEX_INTERNAL
)
556 IFINDEX_RB_REMOVE(vrf
, ifp
)
558 ifp
->ifindex
= ifindex
;
560 if (ifp
->ifindex
!= IFINDEX_INTERNAL
)
561 IFINDEX_RB_INSERT(vrf
, ifp
)
564 /* Does interface up ? */
565 int if_is_up(const struct interface
*ifp
)
567 return ifp
->flags
& IFF_UP
;
570 /* Is interface running? */
571 int if_is_running(const struct interface
*ifp
)
573 return ifp
->flags
& IFF_RUNNING
;
576 /* Is the interface operative, eg. either UP & RUNNING
577 or UP & !ZEBRA_INTERFACE_LINK_DETECTION and
578 if ptm checking is enabled, then ptm check has passed */
579 int if_is_operative(const struct interface
*ifp
)
581 return ((ifp
->flags
& IFF_UP
)
582 && (((ifp
->flags
& IFF_RUNNING
)
583 && (ifp
->ptm_status
|| !ifp
->ptm_enable
))
584 || !CHECK_FLAG(ifp
->status
,
585 ZEBRA_INTERFACE_LINKDETECTION
)));
588 /* Is the interface operative, eg. either UP & RUNNING
589 or UP & !ZEBRA_INTERFACE_LINK_DETECTION, without PTM check */
590 int if_is_no_ptm_operative(const struct interface
*ifp
)
592 return ((ifp
->flags
& IFF_UP
)
593 && ((ifp
->flags
& IFF_RUNNING
)
594 || !CHECK_FLAG(ifp
->status
,
595 ZEBRA_INTERFACE_LINKDETECTION
)));
598 /* Is this loopback interface ? */
599 int if_is_loopback(const struct interface
*ifp
)
601 /* XXX: Do this better, eg what if IFF_WHATEVER means X on platform M
602 * but Y on platform N?
604 return (ifp
->flags
& (IFF_LOOPBACK
| IFF_NOXMIT
| IFF_VIRTUAL
));
607 /* Check interface is VRF */
608 int if_is_vrf(const struct interface
*ifp
)
610 return CHECK_FLAG(ifp
->status
, ZEBRA_INTERFACE_VRF_LOOPBACK
);
613 bool if_is_loopback_or_vrf(const struct interface
*ifp
)
615 if (if_is_loopback(ifp
) || if_is_vrf(ifp
))
621 /* Does this interface support broadcast ? */
622 int if_is_broadcast(const struct interface
*ifp
)
624 return ifp
->flags
& IFF_BROADCAST
;
627 /* Does this interface support broadcast ? */
628 int if_is_pointopoint(const struct interface
*ifp
)
630 return ifp
->flags
& IFF_POINTOPOINT
;
633 /* Does this interface support multicast ? */
634 int if_is_multicast(const struct interface
*ifp
)
636 return ifp
->flags
& IFF_MULTICAST
;
639 /* Printout flag information into log */
640 const char *if_flag_dump(unsigned long flag
)
643 static char logbuf
[BUFSIZ
];
645 #define IFF_OUT_LOG(X, STR) \
648 strlcat(logbuf, ",", sizeof(logbuf)); \
651 strlcat(logbuf, STR, sizeof(logbuf)); \
654 strlcpy(logbuf
, "<", BUFSIZ
);
655 IFF_OUT_LOG(IFF_UP
, "UP");
656 IFF_OUT_LOG(IFF_BROADCAST
, "BROADCAST");
657 IFF_OUT_LOG(IFF_DEBUG
, "DEBUG");
658 IFF_OUT_LOG(IFF_LOOPBACK
, "LOOPBACK");
659 IFF_OUT_LOG(IFF_POINTOPOINT
, "POINTOPOINT");
660 IFF_OUT_LOG(IFF_NOTRAILERS
, "NOTRAILERS");
661 IFF_OUT_LOG(IFF_RUNNING
, "RUNNING");
662 IFF_OUT_LOG(IFF_NOARP
, "NOARP");
663 IFF_OUT_LOG(IFF_PROMISC
, "PROMISC");
664 IFF_OUT_LOG(IFF_ALLMULTI
, "ALLMULTI");
665 IFF_OUT_LOG(IFF_OACTIVE
, "OACTIVE");
666 IFF_OUT_LOG(IFF_SIMPLEX
, "SIMPLEX");
667 IFF_OUT_LOG(IFF_LINK0
, "LINK0");
668 IFF_OUT_LOG(IFF_LINK1
, "LINK1");
669 IFF_OUT_LOG(IFF_LINK2
, "LINK2");
670 IFF_OUT_LOG(IFF_MULTICAST
, "MULTICAST");
671 IFF_OUT_LOG(IFF_NOXMIT
, "NOXMIT");
672 IFF_OUT_LOG(IFF_NORTEXCH
, "NORTEXCH");
673 IFF_OUT_LOG(IFF_VIRTUAL
, "VIRTUAL");
674 IFF_OUT_LOG(IFF_IPV4
, "IPv4");
675 IFF_OUT_LOG(IFF_IPV6
, "IPv6");
677 strlcat(logbuf
, ">", sizeof(logbuf
));
684 static void if_dump(const struct interface
*ifp
)
686 struct listnode
*node
;
687 struct connected
*c
__attribute__((unused
));
689 for (ALL_LIST_ELEMENTS_RO(ifp
->connected
, node
, c
))
691 "Interface %s vrf %u index %d metric %d mtu %d "
693 ifp
->name
, ifp
->vrf_id
, ifp
->ifindex
, ifp
->metric
,
694 ifp
->mtu
, ifp
->mtu6
, if_flag_dump(ifp
->flags
));
697 /* Interface printing for all interface. */
698 void if_dump_all(void)
703 RB_FOREACH (vrf
, vrf_id_head
, &vrfs_by_id
)
704 FOR_ALL_INTERFACES (vrf
, ifp
)
709 /* Need to handle upgrade from SUNWzebra to Quagga. SUNWzebra created
710 * a seperate struct interface for each logical interface, so config
711 * file may be full of 'interface fooX:Y'. Solaris however does not
712 * expose logical interfaces via PF_ROUTE, so trying to track logical
713 * interfaces can be fruitless, for that reason Quagga only tracks
714 * the primary IP interface.
716 * We try accomodate SUNWzebra by:
717 * - looking up the interface name, to see whether it exists, if so
719 * - for protocol daemons, this could only because zebra told us of
721 * - for zebra, only because it learnt from kernel
723 * - search the name to see if it contains a sub-ipif / logical interface
724 * seperator, the ':' char. If it does:
725 * - text up to that char must be the primary name - get that name.
727 * - no idea, just get the name in its entirety.
729 static struct interface
*if_sunwzebra_get(const char *name
, vrf_id_t vrf_id
)
731 struct interface
*ifp
;
734 if ((ifp
= if_lookup_by_name(name
, vrf_id
)) != NULL
)
737 /* hunt the primary interface name... */
738 cp
= strchr(name
, ':');
742 return if_get_by_name(name
, vrf_id
);
747 /* For debug purpose. */
750 "show address [vrf NAME]",
756 struct listnode
*node
;
757 struct interface
*ifp
;
758 struct connected
*ifc
;
760 vrf_id_t vrf_id
= VRF_DEFAULT
;
763 VRF_GET_ID (vrf_id
, argv
[idx_vrf
]->arg
);
765 FOR_ALL_INTERFACES (vrf
, ifp
)
767 for (ALL_LIST_ELEMENTS_RO (ifp
->connected
, node
, ifc
))
771 if (p
->family
== AF_INET
)
772 vty_out (vty
, "%s/%d\n", inet_ntoa (p
->u
.prefix4
), p
->prefixlen
);
778 DEFUN (show_address_vrf_all
,
779 show_address_vrf_all_cmd
,
780 "show address vrf all",
783 VRF_ALL_CMD_HELP_STR
)
786 struct listnode
*node
;
787 struct interface
*ifp
;
788 struct connected
*ifc
;
791 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
)
793 if (RB_EMPTY (if_name_head
, &vrf
->ifaces_by_name
))
796 vty_out (vty
, "\nVRF %u\n\n", vrf
->vrf_id
);
798 FOR_ALL_INTERFACES (vrf
, ifp
)
800 for (ALL_LIST_ELEMENTS_RO (ifp
->connected
, node
, ifc
))
804 if (p
->family
== AF_INET
)
805 vty_out (vty
, "%s/%d\n", inet_ntoa (p
->u
.prefix4
), p
->prefixlen
);
813 /* Allocate connected structure. */
814 struct connected
*connected_new(void)
816 return XCALLOC(MTYPE_CONNECTED
, sizeof(struct connected
));
819 /* Allocate nbr connected structure. */
820 struct nbr_connected
*nbr_connected_new(void)
822 return XCALLOC(MTYPE_NBR_CONNECTED
, sizeof(struct nbr_connected
));
825 /* Free connected structure. */
826 void connected_free(struct connected
*connected
)
828 if (connected
->address
)
829 prefix_free(connected
->address
);
831 if (connected
->destination
)
832 prefix_free(connected
->destination
);
834 XFREE(MTYPE_CONNECTED_LABEL
, connected
->label
);
836 XFREE(MTYPE_CONNECTED
, connected
);
839 /* Free nbr connected structure. */
840 void nbr_connected_free(struct nbr_connected
*connected
)
842 if (connected
->address
)
843 prefix_free(connected
->address
);
845 XFREE(MTYPE_NBR_CONNECTED
, connected
);
848 /* If same interface nbr address already exists... */
849 struct nbr_connected
*nbr_connected_check(struct interface
*ifp
,
852 struct nbr_connected
*ifc
;
853 struct listnode
*node
;
855 for (ALL_LIST_ELEMENTS_RO(ifp
->nbr_connected
, node
, ifc
))
856 if (prefix_same(ifc
->address
, p
))
862 /* Print if_addr structure. */
863 static void __attribute__((unused
))
864 connected_log(struct connected
*connected
, char *str
)
867 struct interface
*ifp
;
871 ifp
= connected
->ifp
;
872 p
= connected
->address
;
874 snprintf(logbuf
, BUFSIZ
, "%s interface %s vrf %u %s %s/%d ", str
,
875 ifp
->name
, ifp
->vrf_id
, prefix_family_str(p
),
876 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, BUFSIZ
), p
->prefixlen
);
878 p
= connected
->destination
;
880 strncat(logbuf
, inet_ntop(p
->family
, &p
->u
.prefix
, buf
, BUFSIZ
),
881 BUFSIZ
- strlen(logbuf
));
883 zlog_info("%s", logbuf
);
886 /* Print if_addr structure. */
887 static void __attribute__((unused
))
888 nbr_connected_log(struct nbr_connected
*connected
, char *str
)
891 struct interface
*ifp
;
895 ifp
= connected
->ifp
;
896 p
= connected
->address
;
898 snprintf(logbuf
, BUFSIZ
, "%s interface %s %s %s/%d ", str
, ifp
->name
,
899 prefix_family_str(p
),
900 inet_ntop(p
->family
, &p
->u
.prefix
, buf
, BUFSIZ
), p
->prefixlen
);
902 zlog_info("%s", logbuf
);
905 /* If two connected address has same prefix return 1. */
906 static int connected_same_prefix(struct prefix
*p1
, struct prefix
*p2
)
908 if (p1
->family
== p2
->family
) {
909 if (p1
->family
== AF_INET
910 && IPV4_ADDR_SAME(&p1
->u
.prefix4
, &p2
->u
.prefix4
))
912 if (p1
->family
== AF_INET6
913 && IPV6_ADDR_SAME(&p1
->u
.prefix6
, &p2
->u
.prefix6
))
919 struct connected
*connected_lookup_prefix_exact(struct interface
*ifp
,
922 struct listnode
*node
;
923 struct listnode
*next
;
924 struct connected
*ifc
;
926 for (node
= listhead(ifp
->connected
); node
; node
= next
) {
927 ifc
= listgetdata(node
);
930 if (connected_same_prefix(ifc
->address
, p
))
936 struct connected
*connected_delete_by_prefix(struct interface
*ifp
,
939 struct listnode
*node
;
940 struct listnode
*next
;
941 struct connected
*ifc
;
943 /* In case of same prefix come, replace it with new one. */
944 for (node
= listhead(ifp
->connected
); node
; node
= next
) {
945 ifc
= listgetdata(node
);
948 if (connected_same_prefix(ifc
->address
, p
)) {
949 listnode_delete(ifp
->connected
, ifc
);
956 /* Find the address on our side that will be used when packets
958 struct connected
*connected_lookup_prefix(struct interface
*ifp
,
961 struct listnode
*cnode
;
963 struct connected
*match
;
967 for (ALL_LIST_ELEMENTS_RO(ifp
->connected
, cnode
, c
)) {
968 if (c
->address
&& (c
->address
->family
== addr
->family
)
969 && prefix_match(CONNECTED_PREFIX(c
), addr
)
971 || (c
->address
->prefixlen
> match
->address
->prefixlen
)))
977 struct connected
*connected_add_by_prefix(struct interface
*ifp
,
979 struct prefix
*destination
)
981 struct connected
*ifc
;
983 /* Allocate new connected address. */
984 ifc
= connected_new();
987 /* Fetch interface address */
988 ifc
->address
= prefix_new();
989 memcpy(ifc
->address
, p
, sizeof(struct prefix
));
991 /* Fetch dest address */
993 ifc
->destination
= prefix_new();
994 memcpy(ifc
->destination
, destination
, sizeof(struct prefix
));
997 /* Add connected address to the interface. */
998 listnode_add(ifp
->connected
, ifc
);
1002 struct connected
*connected_get_linklocal(struct interface
*ifp
)
1005 struct connected
*c
= NULL
;
1007 for (ALL_LIST_ELEMENTS_RO(ifp
->connected
, n
, c
)) {
1008 if (c
->address
->family
== AF_INET6
1009 && IN6_IS_ADDR_LINKLOCAL(&c
->address
->u
.prefix6
))
1015 #if 0 /* this route_table of struct connected's is unused \
1016 * however, it would be good to use a route_table rather than \
1019 /* Interface looking up by interface's address. */
1020 /* Interface's IPv4 address reverse lookup table. */
1021 struct route_table
*ifaddr_ipv4_table
;
1022 /* struct route_table *ifaddr_ipv6_table; */
1025 ifaddr_ipv4_add (struct in_addr
*ifaddr
, struct interface
*ifp
)
1027 struct route_node
*rn
;
1028 struct prefix_ipv4 p
;
1031 p
.prefixlen
= IPV4_MAX_PREFIXLEN
;
1034 rn
= route_node_get (ifaddr_ipv4_table
, (struct prefix
*) &p
);
1037 route_unlock_node (rn
);
1038 zlog_info ("ifaddr_ipv4_add(): address %s is already added",
1039 inet_ntoa (*ifaddr
));
1046 ifaddr_ipv4_delete (struct in_addr
*ifaddr
, struct interface
*ifp
)
1048 struct route_node
*rn
;
1049 struct prefix_ipv4 p
;
1052 p
.prefixlen
= IPV4_MAX_PREFIXLEN
;
1055 rn
= route_node_lookup (ifaddr_ipv4_table
, (struct prefix
*) &p
);
1058 zlog_info ("ifaddr_ipv4_delete(): can't find address %s",
1059 inet_ntoa (*ifaddr
));
1063 route_unlock_node (rn
);
1064 route_unlock_node (rn
);
1067 /* Lookup interface by interface's IP address or interface index. */
1068 static struct interface
*
1069 ifaddr_ipv4_lookup (struct in_addr
*addr
, ifindex_t ifindex
)
1071 struct prefix_ipv4 p
;
1072 struct route_node
*rn
;
1073 struct interface
*ifp
;
1078 p
.prefixlen
= IPV4_MAX_PREFIXLEN
;
1081 rn
= route_node_lookup (ifaddr_ipv4_table
, (struct prefix
*) &p
);
1086 route_unlock_node (rn
);
1090 return if_lookup_by_index(ifindex
, VRF_DEFAULT
);
1092 #endif /* ifaddr_ipv4_table */
1094 void if_terminate(struct vrf
*vrf
)
1096 struct interface
*ifp
;
1098 while (!RB_EMPTY(if_name_head
, &vrf
->ifaces_by_name
)) {
1099 ifp
= RB_ROOT(if_name_head
, &vrf
->ifaces_by_name
);
1102 ifp
->node
->info
= NULL
;
1103 route_unlock_node(ifp
->node
);
1109 const char *if_link_type_str(enum zebra_link_type llt
)
1112 #define llts(T,S) case (T): return (S)
1113 llts(ZEBRA_LLT_UNKNOWN
, "Unknown");
1114 llts(ZEBRA_LLT_ETHER
, "Ethernet");
1115 llts(ZEBRA_LLT_EETHER
, "Experimental Ethernet");
1116 llts(ZEBRA_LLT_AX25
, "AX.25 Level 2");
1117 llts(ZEBRA_LLT_PRONET
, "PROnet token ring");
1118 llts(ZEBRA_LLT_IEEE802
, "IEEE 802.2 Ethernet/TR/TB");
1119 llts(ZEBRA_LLT_ARCNET
, "ARCnet");
1120 llts(ZEBRA_LLT_APPLETLK
, "AppleTalk");
1121 llts(ZEBRA_LLT_DLCI
, "Frame Relay DLCI");
1122 llts(ZEBRA_LLT_ATM
, "ATM");
1123 llts(ZEBRA_LLT_METRICOM
, "Metricom STRIP");
1124 llts(ZEBRA_LLT_IEEE1394
, "IEEE 1394 IPv4");
1125 llts(ZEBRA_LLT_EUI64
, "EUI-64");
1126 llts(ZEBRA_LLT_INFINIBAND
, "InfiniBand");
1127 llts(ZEBRA_LLT_SLIP
, "SLIP");
1128 llts(ZEBRA_LLT_CSLIP
, "Compressed SLIP");
1129 llts(ZEBRA_LLT_SLIP6
, "SLIPv6");
1130 llts(ZEBRA_LLT_CSLIP6
, "Compressed SLIPv6");
1131 llts(ZEBRA_LLT_ROSE
, "ROSE packet radio");
1132 llts(ZEBRA_LLT_X25
, "CCITT X.25");
1133 llts(ZEBRA_LLT_PPP
, "PPP");
1134 llts(ZEBRA_LLT_CHDLC
, "Cisco HDLC");
1135 llts(ZEBRA_LLT_RAWHDLC
, "Raw HDLC");
1136 llts(ZEBRA_LLT_LAPB
, "LAPB");
1137 llts(ZEBRA_LLT_IPIP
, "IPIP Tunnel");
1138 llts(ZEBRA_LLT_IPIP6
, "IPIP6 Tunnel");
1139 llts(ZEBRA_LLT_FRAD
, "FRAD");
1140 llts(ZEBRA_LLT_SKIP
, "SKIP vif");
1141 llts(ZEBRA_LLT_LOOPBACK
, "Loopback");
1142 llts(ZEBRA_LLT_LOCALTLK
, "Localtalk");
1143 llts(ZEBRA_LLT_FDDI
, "FDDI");
1144 llts(ZEBRA_LLT_SIT
, "IPv6-in-IPv4 SIT");
1145 llts(ZEBRA_LLT_IPDDP
, "IP-in-DDP tunnel");
1146 llts(ZEBRA_LLT_IPGRE
, "GRE over IP");
1147 llts(ZEBRA_LLT_PIMREG
, "PIMSM registration");
1148 llts(ZEBRA_LLT_HIPPI
, "HiPPI");
1149 llts(ZEBRA_LLT_IRDA
, "IrDA");
1150 llts(ZEBRA_LLT_FCPP
, "Fibre-Channel PtP");
1151 llts(ZEBRA_LLT_FCAL
, "Fibre-Channel Arbitrated Loop");
1152 llts(ZEBRA_LLT_FCPL
, "Fibre-Channel Public Loop");
1153 llts(ZEBRA_LLT_FCFABRIC
, "Fibre-Channel Fabric");
1154 llts(ZEBRA_LLT_IEEE802_TR
, "IEEE 802.2 Token Ring");
1155 llts(ZEBRA_LLT_IEEE80211
, "IEEE 802.11");
1156 llts(ZEBRA_LLT_IEEE80211_RADIOTAP
, "IEEE 802.11 Radiotap");
1157 llts(ZEBRA_LLT_IEEE802154
, "IEEE 802.15.4");
1158 llts(ZEBRA_LLT_IEEE802154_PHY
, "IEEE 802.15.4 Phy");
1160 flog_err(EC_LIB_DEVELOPMENT
, "Unknown value %d", llt
);
1161 return "Unknown type!";
1167 struct if_link_params
*if_link_params_get(struct interface
*ifp
)
1171 if (ifp
->link_params
!= NULL
)
1172 return ifp
->link_params
;
1174 struct if_link_params
*iflp
=
1175 XCALLOC(MTYPE_IF_LINK_PARAMS
, sizeof(struct if_link_params
));
1179 /* Set TE metric equal to standard metric */
1180 iflp
->te_metric
= ifp
->metric
;
1182 /* Compute default bandwidth based on interface */
1184 ((ifp
->bandwidth
? ifp
->bandwidth
: DEFAULT_BANDWIDTH
)
1185 * TE_KILO_BIT
/ TE_BYTE
);
1187 /* Set Max, Reservable and Unreserved Bandwidth */
1188 iflp
->max_bw
= iflp
->default_bw
;
1189 iflp
->max_rsv_bw
= iflp
->default_bw
;
1190 for (i
= 0; i
< MAX_CLASS_TYPE
; i
++)
1191 iflp
->unrsv_bw
[i
] = iflp
->default_bw
;
1193 /* Update Link parameters status */
1195 LP_TE_METRIC
| LP_MAX_BW
| LP_MAX_RSV_BW
| LP_UNRSV_BW
;
1197 /* Finally attach newly created Link Parameters */
1198 ifp
->link_params
= iflp
;
1203 void if_link_params_free(struct interface
*ifp
)
1205 if (ifp
->link_params
== NULL
)
1207 XFREE(MTYPE_IF_LINK_PARAMS
, ifp
->link_params
);
1208 ifp
->link_params
= NULL
;
1211 /* ----------- CLI commands ----------- */
1214 * XPath: /frr-interface:lib/interface
1216 DEFPY_NOSH (interface
,
1218 "interface IFNAME [vrf NAME$vrfname]",
1219 "Select an interface to configure\n"
1220 "Interface's name\n"
1223 char xpath_list
[XPATH_MAXLEN
];
1225 struct interface
*ifp
;
1229 vrfname
= VRF_DEFAULT_NAME
;
1232 * This command requires special handling to maintain backward
1233 * compatibility. If a VRF name is not specified, it means we're willing
1234 * to accept any interface with the given name on any VRF. If no
1235 * interface is found, then a new one should be created on the default
1238 VRF_GET_ID(vrf_id
, vrfname
, false);
1239 ifp
= if_lookup_by_name_all_vrf(ifname
);
1240 if (ifp
&& ifp
->vrf_id
!= vrf_id
) {
1244 * Special case 1: a VRF name was specified, but the found
1245 * interface is associated to different VRF. Reject the command.
1247 if (vrf_id
!= VRF_DEFAULT
) {
1248 vty_out(vty
, "%% interface %s not in %s vrf\n", ifname
,
1250 return CMD_WARNING_CONFIG_FAILED
;
1254 * Special case 2: a VRF name was *not* specified, and the found
1255 * interface is associated to a VRF other than the default one.
1256 * Update vrf_id and vrfname to account for that.
1258 vrf
= vrf_lookup_by_id(ifp
->vrf_id
);
1260 vrf_id
= ifp
->vrf_id
;
1261 vrfname
= vrf
->name
;
1264 snprintf(xpath_list
, sizeof(xpath_list
),
1265 "/frr-interface:lib/interface[name='%s'][vrf='%s']", ifname
,
1268 nb_cli_enqueue_change(vty
, ".", NB_OP_CREATE
, NULL
);
1269 ret
= nb_cli_apply_changes(vty
, xpath_list
);
1270 if (ret
== CMD_SUCCESS
) {
1271 VTY_PUSH_XPATH(INTERFACE_NODE
, xpath_list
);
1274 * For backward compatibility with old commands we still need
1275 * to use the qobj infrastructure. This can be removed once
1276 * all interface-level commands are converted to the new
1279 ifp
= if_lookup_by_name(ifname
, vrf_id
);
1281 VTY_PUSH_CONTEXT(INTERFACE_NODE
, ifp
);
1287 DEFPY (no_interface
,
1289 "no interface IFNAME [vrf NAME$vrfname]",
1291 "Delete a pseudo interface's configuration\n"
1292 "Interface's name\n"
1296 vrfname
= VRF_DEFAULT_NAME
;
1298 nb_cli_enqueue_change(vty
, ".", NB_OP_DESTROY
, NULL
);
1300 return nb_cli_apply_changes(
1301 vty
, "/frr-interface:lib/interface[name='%s'][vrf='%s']",
1305 static void cli_show_interface(struct vty
*vty
, struct lyd_node
*dnode
,
1310 vrf
= yang_dnode_get_string(dnode
, "./vrf");
1312 vty_out(vty
, "!\n");
1313 vty_out(vty
, "interface %s", yang_dnode_get_string(dnode
, "./name"));
1314 if (!strmatch(vrf
, VRF_DEFAULT_NAME
))
1315 vty_out(vty
, " vrf %s", vrf
);
1320 * XPath: /frr-interface:lib/interface/description
1322 DEFPY (interface_desc
,
1324 "description LINE...",
1325 "Interface specific description\n"
1326 "Characters describing this interface\n")
1331 desc
= argv_concat(argv
, argc
, 1);
1332 nb_cli_enqueue_change(vty
, "./description", NB_OP_MODIFY
, desc
);
1333 ret
= nb_cli_apply_changes(vty
, NULL
);
1334 XFREE(MTYPE_TMP
, desc
);
1339 DEFPY (no_interface_desc
,
1340 no_interface_desc_cmd
,
1343 "Interface specific description\n")
1345 nb_cli_enqueue_change(vty
, "./description", NB_OP_DESTROY
, NULL
);
1347 return nb_cli_apply_changes(vty
, NULL
);
1350 static void cli_show_interface_desc(struct vty
*vty
, struct lyd_node
*dnode
,
1353 vty_out(vty
, " description %s\n", yang_dnode_get_string(dnode
, NULL
));
1356 /* Interface autocomplete. */
1357 static void if_autocomplete(vector comps
, struct cmd_token
*token
)
1359 struct interface
*ifp
;
1362 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
1363 FOR_ALL_INTERFACES (vrf
, ifp
) {
1364 vector_set(comps
, XSTRDUP(MTYPE_COMPLETION
, ifp
->name
));
1369 static const struct cmd_variable_handler if_var_handlers
[] = {
1370 {/* "interface NAME" */
1371 .varname
= "interface",
1372 .completions
= if_autocomplete
},
1373 {.tokenname
= "IFNAME", .completions
= if_autocomplete
},
1374 {.tokenname
= "INTERFACE", .completions
= if_autocomplete
},
1375 {.completions
= NULL
}};
1377 void if_cmd_init(void)
1379 cmd_variable_handler_register(if_var_handlers
);
1381 install_element(CONFIG_NODE
, &interface_cmd
);
1382 install_element(CONFIG_NODE
, &no_interface_cmd
);
1384 install_default(INTERFACE_NODE
);
1385 install_element(INTERFACE_NODE
, &interface_desc_cmd
);
1386 install_element(INTERFACE_NODE
, &no_interface_desc_cmd
);
1389 void if_zapi_callbacks(int (*create
)(struct interface
*ifp
),
1390 int (*up
)(struct interface
*ifp
),
1391 int (*down
)(struct interface
*ifp
),
1392 int (*destroy
)(struct interface
*ifp
))
1394 ifp_master
.create_hook
= create
;
1395 ifp_master
.up_hook
= up
;
1396 ifp_master
.down_hook
= down
;
1397 ifp_master
.destroy_hook
= destroy
;
1400 /* ------- Northbound callbacks ------- */
1403 * XPath: /frr-interface:lib/interface
1405 static int lib_interface_create(enum nb_event event
,
1406 const struct lyd_node
*dnode
,
1407 union nb_resource
*resource
)
1410 const char *vrfname
;
1412 struct interface
*ifp
;
1414 ifname
= yang_dnode_get_string(dnode
, "./name");
1415 vrfname
= yang_dnode_get_string(dnode
, "./vrf");
1418 case NB_EV_VALIDATE
:
1419 vrf
= vrf_lookup_by_name(vrfname
);
1421 zlog_warn("%s: VRF %s doesn't exist", __func__
,
1423 return NB_ERR_VALIDATION
;
1425 if (vrf
->vrf_id
== VRF_UNKNOWN
) {
1426 zlog_warn("%s: VRF %s is not active", __func__
,
1428 return NB_ERR_VALIDATION
;
1431 /* if VRF is netns or not yet known - init for instance
1432 * then assumption is that passed config is exact
1433 * then the user intent was not to use an other iface
1435 if (vrf_get_backend() == VRF_BACKEND_VRF_LITE
) {
1436 ifp
= if_lookup_by_name_all_vrf(ifname
);
1437 if (ifp
&& ifp
->vrf_id
!= vrf
->vrf_id
) {
1439 "%s: interface %s already exists in another VRF",
1440 __func__
, ifp
->name
);
1441 return NB_ERR_VALIDATION
;
1449 vrf
= vrf_lookup_by_name(vrfname
);
1452 ifp
= if_sunwzebra_get(ifname
, vrf
->vrf_id
);
1454 ifp
= if_get_by_name(ifname
, vrf
->vrf_id
);
1455 #endif /* SUNOS_5 */
1457 ifp
->configured
= true;
1458 nb_running_set_entry(dnode
, ifp
);
1465 static int lib_interface_destroy(enum nb_event event
,
1466 const struct lyd_node
*dnode
)
1468 struct interface
*ifp
;
1472 case NB_EV_VALIDATE
:
1473 ifp
= nb_running_get_entry(dnode
, NULL
, true);
1474 if (CHECK_FLAG(ifp
->status
, ZEBRA_INTERFACE_ACTIVE
)) {
1475 zlog_warn("%s: only inactive interfaces can be deleted",
1477 return NB_ERR_VALIDATION
;
1484 ifp
= nb_running_unset_entry(dnode
);
1486 ifp
->configured
= false;
1495 * XPath: /frr-interface:lib/interface
1497 static const void *lib_interface_get_next(const void *parent_list_entry
,
1498 const void *list_entry
)
1501 struct interface
*pif
= (struct interface
*)list_entry
;
1503 if (list_entry
== NULL
) {
1504 vrf
= RB_MIN(vrf_name_head
, &vrfs_by_name
);
1506 pif
= RB_MIN(if_name_head
, &vrf
->ifaces_by_name
);
1508 vrf
= vrf_lookup_by_id(pif
->vrf_id
);
1509 pif
= RB_NEXT(if_name_head
, pif
);
1510 /* if no more interfaces, switch to next vrf */
1511 while (pif
== NULL
) {
1512 vrf
= RB_NEXT(vrf_name_head
, vrf
);
1515 pif
= RB_MIN(if_name_head
, &vrf
->ifaces_by_name
);
1522 static int lib_interface_get_keys(const void *list_entry
,
1523 struct yang_list_keys
*keys
)
1525 const struct interface
*ifp
= list_entry
;
1527 struct vrf
*vrf
= vrf_lookup_by_id(ifp
->vrf_id
);
1532 strlcpy(keys
->key
[0], ifp
->name
, sizeof(keys
->key
[0]));
1533 strlcpy(keys
->key
[1], vrf
->name
, sizeof(keys
->key
[1]));
1538 static const void *lib_interface_lookup_entry(const void *parent_list_entry
,
1539 const struct yang_list_keys
*keys
)
1541 const char *ifname
= keys
->key
[0];
1542 const char *vrfname
= keys
->key
[1];
1543 struct vrf
*vrf
= vrf_lookup_by_name(vrfname
);
1545 return if_lookup_by_name(ifname
, vrf
->vrf_id
);
1549 * XPath: /frr-interface:lib/interface/description
1551 static int lib_interface_description_modify(enum nb_event event
,
1552 const struct lyd_node
*dnode
,
1553 union nb_resource
*resource
)
1555 struct interface
*ifp
;
1556 const char *description
;
1558 if (event
!= NB_EV_APPLY
)
1561 ifp
= nb_running_get_entry(dnode
, NULL
, true);
1562 XFREE(MTYPE_TMP
, ifp
->desc
);
1563 description
= yang_dnode_get_string(dnode
, NULL
);
1564 ifp
->desc
= XSTRDUP(MTYPE_TMP
, description
);
1569 static int lib_interface_description_destroy(enum nb_event event
,
1570 const struct lyd_node
*dnode
)
1572 struct interface
*ifp
;
1574 if (event
!= NB_EV_APPLY
)
1577 ifp
= nb_running_get_entry(dnode
, NULL
, true);
1578 XFREE(MTYPE_TMP
, ifp
->desc
);
1583 /* clang-format off */
1584 const struct frr_yang_module_info frr_interface_info
= {
1585 .name
= "frr-interface",
1588 .xpath
= "/frr-interface:lib/interface",
1590 .create
= lib_interface_create
,
1591 .destroy
= lib_interface_destroy
,
1592 .cli_show
= cli_show_interface
,
1593 .get_next
= lib_interface_get_next
,
1594 .get_keys
= lib_interface_get_keys
,
1595 .lookup_entry
= lib_interface_lookup_entry
,
1599 .xpath
= "/frr-interface:lib/interface/description",
1601 .modify
= lib_interface_description_modify
,
1602 .destroy
= lib_interface_description_destroy
,
1603 .cli_show
= cli_show_interface_desc
,