3 * Copyright (C) 1997, 1999 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
18 * along with GNU Zebra; see the file COPYING. If not, write to the Free
19 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
27 #include "sockunion.h"
31 #include "zebra_memory.h"
33 #include "connected.h"
38 #include "zebra/rtadv.h"
40 #include "zebra_vrf.h"
41 #include "zebra/interface.h"
42 #include "zebra/rib.h"
44 #include "zebra/zserv.h"
45 #include "zebra/redistribute.h"
46 #include "zebra/debug.h"
47 #include "zebra/irdp.h"
48 #include "zebra/zebra_ptm.h"
49 #include "zebra/rt_netlink.h"
50 #include "zebra/interface.h"
52 #define ZEBRA_PTM_SUPPORT
54 #if defined (HAVE_RTADV)
55 /* Order is intentional. Matches RFC4191. This array is also used for
56 command matching, so only modify with care. */
57 const char *rtadv_pref_strs
[] = { "medium", "high", "INVALID", "low", 0 };
58 #endif /* HAVE_RTADV */
60 static void if_down_del_nbr_connected (struct interface
*ifp
);
62 /* Called when new interface is added. */
64 if_zebra_new_hook (struct interface
*ifp
)
66 struct zebra_if
*zebra_if
;
68 zebra_if
= XCALLOC (MTYPE_TMP
, sizeof (struct zebra_if
));
70 zebra_if
->multicast
= IF_ZEBRA_MULTICAST_UNSPEC
;
71 zebra_if
->shutdown
= IF_ZEBRA_SHUTDOWN_OFF
;
72 zebra_ptm_if_init(zebra_if
);
74 ifp
->ptm_enable
= zebra_ptm_get_enable_state();
75 #if defined (HAVE_RTADV)
77 /* Set default router advertise values. */
78 struct rtadvconf
*rtadv
;
80 rtadv
= &zebra_if
->rtadv
;
82 rtadv
->AdvSendAdvertisements
= 0;
83 rtadv
->MaxRtrAdvInterval
= RTADV_MAX_RTR_ADV_INTERVAL
;
84 rtadv
->MinRtrAdvInterval
= RTADV_MIN_RTR_ADV_INTERVAL
;
85 rtadv
->AdvIntervalTimer
= 0;
86 rtadv
->AdvManagedFlag
= 0;
87 rtadv
->AdvOtherConfigFlag
= 0;
88 rtadv
->AdvHomeAgentFlag
= 0;
89 rtadv
->AdvLinkMTU
= 0;
90 rtadv
->AdvReachableTime
= 0;
91 rtadv
->AdvRetransTimer
= 0;
92 rtadv
->AdvCurHopLimit
= 0;
93 rtadv
->AdvDefaultLifetime
= -1; /* derive from MaxRtrAdvInterval */
94 rtadv
->HomeAgentPreference
= 0;
95 rtadv
->HomeAgentLifetime
= -1; /* derive from AdvDefaultLifetime */
96 rtadv
->AdvIntervalOption
= 0;
97 rtadv
->DefaultPreference
= RTADV_PREF_MEDIUM
;
99 rtadv
->AdvPrefixList
= list_new ();
101 #endif /* HAVE_RTADV */
103 /* Initialize installed address chains tree. */
104 zebra_if
->ipv4_subnets
= route_table_init ();
106 ifp
->info
= zebra_if
;
108 zebra_vrf_static_route_interface_fixup (ifp
);
112 /* Called when interface is deleted. */
114 if_zebra_delete_hook (struct interface
*ifp
)
116 struct zebra_if
*zebra_if
;
120 zebra_if
= ifp
->info
;
122 /* Free installed address chains tree. */
123 if (zebra_if
->ipv4_subnets
)
124 route_table_finish (zebra_if
->ipv4_subnets
);
125 #if defined (HAVE_RTADV)
127 struct rtadvconf
*rtadv
;
129 rtadv
= &zebra_if
->rtadv
;
130 list_free (rtadv
->AdvPrefixList
);
131 #endif /* HAVE_RTADV */
133 XFREE (MTYPE_TMP
, zebra_if
);
139 /* Build the table key */
141 if_build_key (u_int32_t ifindex
, struct prefix
*p
)
144 p
->prefixlen
= IPV4_MAX_BITLEN
;
145 p
->u
.prefix4
.s_addr
= ifindex
;
148 /* Link an interface in a per NS interface tree */
150 if_link_per_ns (struct zebra_ns
*ns
, struct interface
*ifp
)
153 struct route_node
*rn
;
155 if (ifp
->ifindex
== IFINDEX_INTERNAL
)
158 if_build_key (ifp
->ifindex
, &p
);
159 rn
= route_node_get (ns
->if_table
, &p
);
162 ifp
= (struct interface
*)rn
->info
;
163 route_unlock_node (rn
); /* get */
173 /* Delete a VRF. This is called in vrf_terminate(). */
175 if_unlink_per_ns (struct interface
*ifp
)
177 ifp
->node
->info
= NULL
;
178 route_unlock_node(ifp
->node
);
181 /* Look up an interface by identifier within a NS */
183 if_lookup_by_index_per_ns (struct zebra_ns
*ns
, u_int32_t ifindex
)
186 struct route_node
*rn
;
187 struct interface
*ifp
= NULL
;
189 if_build_key (ifindex
, &p
);
190 rn
= route_node_lookup (ns
->if_table
, &p
);
193 ifp
= (struct interface
*)rn
->info
;
194 route_unlock_node (rn
); /* lookup */
200 ifindex2ifname_per_ns (struct zebra_ns
*zns
, unsigned int ifindex
)
202 struct interface
*ifp
;
204 return ((ifp
= if_lookup_by_index_per_ns (zns
, ifindex
)) != NULL
) ?
205 ifp
->name
: "unknown";
208 /* Tie an interface address to its derived subnet list of addresses. */
210 if_subnet_add (struct interface
*ifp
, struct connected
*ifc
)
212 struct route_node
*rn
;
213 struct zebra_if
*zebra_if
;
215 struct list
*addr_list
;
217 assert (ifp
&& ifp
->info
&& ifc
);
218 zebra_if
= ifp
->info
;
220 /* Get address derived subnet node and associated address list, while marking
221 address secondary attribute appropriately. */
224 rn
= route_node_get (zebra_if
->ipv4_subnets
, &cp
);
226 if ((addr_list
= rn
->info
))
227 SET_FLAG (ifc
->flags
, ZEBRA_IFA_SECONDARY
);
230 UNSET_FLAG (ifc
->flags
, ZEBRA_IFA_SECONDARY
);
231 rn
->info
= addr_list
= list_new ();
232 route_lock_node (rn
);
235 /* Tie address at the tail of address list. */
236 listnode_add (addr_list
, ifc
);
238 /* Return list element count. */
239 return (addr_list
->count
);
242 /* Untie an interface address from its derived subnet list of addresses. */
244 if_subnet_delete (struct interface
*ifp
, struct connected
*ifc
)
246 struct route_node
*rn
;
247 struct zebra_if
*zebra_if
;
248 struct list
*addr_list
;
250 assert (ifp
&& ifp
->info
&& ifc
);
251 zebra_if
= ifp
->info
;
253 /* Get address derived subnet node. */
254 rn
= route_node_lookup (zebra_if
->ipv4_subnets
, ifc
->address
);
255 if (! (rn
&& rn
->info
))
257 zlog_warn("Trying to remove an address from an unknown subnet."
258 " (please report this bug)");
261 route_unlock_node (rn
);
263 /* Untie address from subnet's address list. */
264 addr_list
= rn
->info
;
266 /* Deleting an address that is not registered is a bug.
267 * In any case, we shouldn't decrement the lock counter if the address
269 if (!listnode_lookup(addr_list
, ifc
))
271 zlog_warn("Trying to remove an address from a subnet where it is not"
272 " currently registered. (please report this bug)");
276 listnode_delete (addr_list
, ifc
);
277 route_unlock_node (rn
);
279 /* Return list element count, if not empty. */
280 if (addr_list
->count
)
282 /* If deleted address is primary, mark subsequent one as such and distribute. */
283 if (! CHECK_FLAG (ifc
->flags
, ZEBRA_IFA_SECONDARY
))
285 ifc
= listgetdata ((struct listnode
*)listhead (addr_list
));
286 zebra_interface_address_delete_update (ifp
, ifc
);
287 UNSET_FLAG (ifc
->flags
, ZEBRA_IFA_SECONDARY
);
288 /* XXX: Linux kernel removes all the secondary addresses when the primary
289 * address is removed. We could try to work around that, though this is
291 zebra_interface_address_add_update (ifp
, ifc
);
294 return addr_list
->count
;
297 /* Otherwise, free list and route node. */
298 list_free (addr_list
);
300 route_unlock_node (rn
);
305 /* if_flags_mangle: A place for hacks that require mangling
306 * or tweaking the interface flags.
308 * ******************** Solaris flags hacks **************************
310 * Solaris IFF_UP flag reflects only the primary interface as the
311 * routing socket only sends IFINFO for the primary interface. Hence
312 * ~IFF_UP does not per se imply all the logical interfaces are also
313 * down - which we only know of as addresses. Instead we must determine
314 * whether the interface really is up or not according to how many
315 * addresses are still attached. (Solaris always sends RTM_DELADDR if
316 * an interface, logical or not, goes ~IFF_UP).
318 * Ie, we mangle IFF_UP to *additionally* reflect whether or not there
319 * are addresses left in struct connected, not just the actual underlying
322 * We must hence remember the real state of IFF_UP, which we do in
323 * struct zebra_if.primary_state.
325 * Setting IFF_UP within zebra to administratively shutdown the
326 * interface will affect only the primary interface/address on Solaris.
327 ************************End Solaris flags hacks ***********************
330 if_flags_mangle (struct interface
*ifp
, uint64_t *newflags
)
333 struct zebra_if
*zif
= ifp
->info
;
335 zif
->primary_state
= *newflags
& (IFF_UP
& 0xff);
337 if (CHECK_FLAG (zif
->primary_state
, IFF_UP
)
338 || listcount(ifp
->connected
) > 0)
339 SET_FLAG (*newflags
, IFF_UP
);
341 UNSET_FLAG (*newflags
, IFF_UP
);
345 /* Update the flags field of the ifp with the new flag set provided.
346 * Take whatever actions are required for any changes in flags we care
349 * newflags should be the raw value, as obtained from the OS.
352 if_flags_update (struct interface
*ifp
, uint64_t newflags
)
354 if_flags_mangle (ifp
, &newflags
);
356 if (if_is_no_ptm_operative (ifp
))
358 /* operative -> inoperative? */
359 ifp
->flags
= newflags
;
360 if (!if_is_operative (ifp
))
365 /* inoperative -> operative? */
366 ifp
->flags
= newflags
;
367 if (if_is_operative (ifp
))
372 /* Wake up configured address if it is not in current kernel
375 if_addr_wakeup (struct interface
*ifp
)
377 struct listnode
*node
, *nnode
;
378 struct connected
*ifc
;
382 for (ALL_LIST_ELEMENTS (ifp
->connected
, node
, nnode
, ifc
))
386 if (CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
)
387 && ! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
))
390 if (p
->family
== AF_INET
)
392 if (! if_is_up (ifp
))
394 /* Assume zebra is configured like following:
397 * ip addr 192.0.2.1/24
400 * As soon as zebra becomes first aware that gre0 exists in the
401 * kernel, it will set gre0 up and configure its addresses.
403 * (This may happen at startup when the interface already exists
404 * or during runtime when the interface is added to the kernel)
406 * XXX: IRDP code is calling here via if_add_update - this seems
408 * XXX: RUNNING is not a settable flag on any system
409 * I (paulj) am aware of.
411 if_set_flags (ifp
, IFF_UP
| IFF_RUNNING
);
415 ret
= if_set_prefix (ifp
, ifc
);
418 zlog_warn ("Can't set interface's address: %s",
419 safe_strerror(errno
));
423 SET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
424 /* The address will be advertised to zebra clients when the notification
425 * from the kernel has been received.
426 * It will also be added to the interface's subnet list then. */
429 if (p
->family
== AF_INET6
)
431 if (! if_is_up (ifp
))
433 /* See long comment above */
434 if_set_flags (ifp
, IFF_UP
| IFF_RUNNING
);
438 ret
= if_prefix_add_ipv6 (ifp
, ifc
);
441 zlog_warn ("Can't set interface's address: %s",
442 safe_strerror(errno
));
446 SET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
447 /* The address will be advertised to zebra clients when the notification
448 * from the kernel has been received. */
450 #endif /* HAVE_IPV6 */
455 /* Handle interface addition */
457 if_add_update (struct interface
*ifp
)
459 struct zebra_if
*if_data
;
461 if_link_per_ns(zebra_ns_lookup (NS_DEFAULT
), ifp
);
466 if (if_data
->multicast
== IF_ZEBRA_MULTICAST_ON
)
467 if_set_flags (ifp
, IFF_MULTICAST
);
468 else if (if_data
->multicast
== IF_ZEBRA_MULTICAST_OFF
)
469 if_unset_flags (ifp
, IFF_MULTICAST
);
471 zebra_ptm_if_set_ptm_state(ifp
, if_data
);
473 zebra_interface_add_update (ifp
);
475 if (! CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
))
477 SET_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
);
479 if (if_data
&& if_data
->shutdown
== IF_ZEBRA_SHUTDOWN_ON
)
481 if (IS_ZEBRA_DEBUG_KERNEL
)
482 zlog_debug ("interface %s vrf %u index %d is shutdown. "
484 ifp
->name
, ifp
->vrf_id
, ifp
->ifindex
);
488 if_addr_wakeup (ifp
);
490 if (IS_ZEBRA_DEBUG_KERNEL
)
491 zlog_debug ("interface %s vrf %u index %d becomes active.",
492 ifp
->name
, ifp
->vrf_id
, ifp
->ifindex
);
496 if (IS_ZEBRA_DEBUG_KERNEL
)
497 zlog_debug ("interface %s vrf %u index %d is added.",
498 ifp
->name
, ifp
->vrf_id
, ifp
->ifindex
);
502 /* Install connected routes corresponding to an interface. */
504 if_install_connected (struct interface
*ifp
)
506 struct listnode
*node
;
507 struct listnode
*next
;
508 struct connected
*ifc
;
513 for (ALL_LIST_ELEMENTS (ifp
->connected
, node
, next
, ifc
))
516 zebra_interface_address_add_update (ifp
, ifc
);
518 if (p
->family
== AF_INET
)
519 connected_up_ipv4 (ifp
, ifc
);
520 else if (p
->family
== AF_INET6
)
521 connected_up_ipv6 (ifp
, ifc
);
526 /* Uninstall connected routes corresponding to an interface. */
528 if_uninstall_connected (struct interface
*ifp
)
530 struct listnode
*node
;
531 struct listnode
*next
;
532 struct connected
*ifc
;
537 for (ALL_LIST_ELEMENTS (ifp
->connected
, node
, next
, ifc
))
540 zebra_interface_address_delete_update (ifp
, ifc
);
542 if (p
->family
== AF_INET
)
543 connected_down_ipv4 (ifp
, ifc
);
544 else if (p
->family
== AF_INET6
)
545 connected_down_ipv6 (ifp
, ifc
);
550 /* Uninstall and delete connected routes corresponding to an interface. */
551 /* TODO - Check why IPv4 handling here is different from install or if_down */
553 if_delete_connected (struct interface
*ifp
)
555 struct connected
*ifc
;
557 struct route_node
*rn
;
558 struct zebra_if
*zebra_if
;
560 zebra_if
= ifp
->info
;
564 struct listnode
*node
;
565 struct listnode
*last
= NULL
;
567 while ((node
= (last
? last
->next
: listhead (ifp
->connected
))))
569 ifc
= listgetdata (node
);
572 if (p
->family
== AF_INET
573 && (rn
= route_node_lookup (zebra_if
->ipv4_subnets
, p
)))
575 struct listnode
*anode
;
576 struct listnode
*next
;
577 struct listnode
*first
;
578 struct list
*addr_list
;
580 route_unlock_node (rn
);
581 addr_list
= (struct list
*) rn
->info
;
583 /* Remove addresses, secondaries first. */
584 first
= listhead (addr_list
);
585 for (anode
= first
->next
; anode
|| first
; anode
= next
)
594 ifc
= listgetdata (anode
);
595 connected_down_ipv4 (ifp
, ifc
);
597 /* XXX: We have to send notifications here explicitly, because we destroy
598 * the ifc before receiving the notification about the address being deleted.
600 zebra_interface_address_delete_update (ifp
, ifc
);
602 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_REAL
);
603 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
605 /* Remove from subnet chain. */
606 list_delete_node (addr_list
, anode
);
607 route_unlock_node (rn
);
609 /* Remove from interface address list (unconditionally). */
610 if (!CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
))
612 listnode_delete (ifp
->connected
, ifc
);
613 connected_free (ifc
);
619 /* Free chain list and respective route node. */
620 list_delete (addr_list
);
622 route_unlock_node (rn
);
624 else if (p
->family
== AF_INET6
)
626 connected_down_ipv6 (ifp
, ifc
);
628 zebra_interface_address_delete_update (ifp
, ifc
);
630 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_REAL
);
631 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
633 if (CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
))
637 listnode_delete (ifp
->connected
, ifc
);
638 connected_free (ifc
);
649 /* Handle an interface delete event */
651 if_delete_update (struct interface
*ifp
)
655 zlog_err ("interface %s vrf %u index %d is still up while being deleted.",
656 ifp
->name
, ifp
->vrf_id
, ifp
->ifindex
);
660 /* Mark interface as inactive */
661 UNSET_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
);
663 if (IS_ZEBRA_DEBUG_KERNEL
)
664 zlog_debug ("interface %s vrf %u index %d is now inactive.",
665 ifp
->name
, ifp
->vrf_id
, ifp
->ifindex
);
667 /* Delete connected routes from the kernel. */
668 if_delete_connected (ifp
);
670 /* Send out notification on interface delete. */
671 zebra_interface_delete_update (ifp
);
673 if_unlink_per_ns(ifp
);
675 /* Update ifindex after distributing the delete message. This is in
676 case any client needs to have the old value of ifindex available
677 while processing the deletion. Each client daemon is responsible
678 for setting ifindex to IFINDEX_INTERNAL after processing the
679 interface deletion message. */
680 ifp
->ifindex
= IFINDEX_INTERNAL
;
683 /* VRF change for an interface */
685 if_handle_vrf_change (struct interface
*ifp
, vrf_id_t vrf_id
)
689 old_vrf_id
= ifp
->vrf_id
;
691 /* Uninstall connected routes. */
692 if_uninstall_connected (ifp
);
694 /* Delete any IPv4 neighbors created to implement RFC 5549 */
695 if_nbr_ipv6ll_to_ipv4ll_neigh_del_all (ifp
);
697 /* Delete all neighbor addresses learnt through IPv6 RA */
698 if_down_del_nbr_connected (ifp
);
700 /* Send out notification on interface VRF change. */
701 /* This is to issue an UPDATE or a DELETE, as appropriate. */
702 zebra_interface_vrf_update_del (ifp
, vrf_id
);
705 if_update_vrf (ifp
, ifp
->name
, strlen (ifp
->name
), vrf_id
);
707 /* Send out notification on interface VRF change. */
708 /* This is to issue an ADD, if needed. */
709 zebra_interface_vrf_update_add (ifp
, old_vrf_id
);
711 /* Install connected routes (in new VRF). */
712 if_install_connected (ifp
);
714 /* Due to connected route change, schedule RIB processing for both old
717 if (IS_ZEBRA_DEBUG_RIB_DETAILED
)
718 zlog_debug ("%u: IF %s VRF change, scheduling RIB processing",
719 ifp
->vrf_id
, ifp
->name
);
720 rib_update (old_vrf_id
, RIB_UPDATE_IF_CHANGE
);
721 rib_update (ifp
->vrf_id
, RIB_UPDATE_IF_CHANGE
);
723 zebra_vrf_static_route_interface_fixup (ifp
);
727 ipv6_ll_address_to_mac (struct in6_addr
*address
, u_char
*mac
)
729 mac
[0] = address
->s6_addr
[8] ^ 0x02;
730 mac
[1] = address
->s6_addr
[9];
731 mac
[2] = address
->s6_addr
[10];
732 mac
[3] = address
->s6_addr
[13];
733 mac
[4] = address
->s6_addr
[14];
734 mac
[5] = address
->s6_addr
[15];
738 if_nbr_ipv6ll_to_ipv4ll_neigh_update (struct interface
*ifp
,
739 struct in6_addr
*address
,
742 char buf
[16] = "169.254.0.1";
743 struct in_addr ipv4_ll
;
746 inet_pton (AF_INET
, buf
, &ipv4_ll
);
748 ipv6_ll_address_to_mac(address
, (u_char
*)mac
);
749 kernel_neigh_update (add
, ifp
->ifindex
, ipv4_ll
.s_addr
, mac
, 6);
753 if_nbr_ipv6ll_to_ipv4ll_neigh_add_all (struct interface
*ifp
)
755 if (listhead(ifp
->nbr_connected
))
757 struct nbr_connected
*nbr_connected
;
758 struct listnode
*node
;
760 for (ALL_LIST_ELEMENTS_RO (ifp
->nbr_connected
, node
, nbr_connected
))
761 if_nbr_ipv6ll_to_ipv4ll_neigh_update (ifp
,
762 &nbr_connected
->address
->u
.prefix6
,
768 if_nbr_ipv6ll_to_ipv4ll_neigh_del_all (struct interface
*ifp
)
770 if (listhead(ifp
->nbr_connected
))
772 struct nbr_connected
*nbr_connected
;
773 struct listnode
*node
;
775 for (ALL_LIST_ELEMENTS_RO (ifp
->nbr_connected
, node
, nbr_connected
))
776 if_nbr_ipv6ll_to_ipv4ll_neigh_update (ifp
,
777 &nbr_connected
->address
->u
.prefix6
,
783 if_down_del_nbr_connected (struct interface
*ifp
)
785 struct nbr_connected
*nbr_connected
;
786 struct listnode
*node
, *nnode
;
788 for (ALL_LIST_ELEMENTS (ifp
->nbr_connected
, node
, nnode
, nbr_connected
))
790 listnode_delete (ifp
->nbr_connected
, nbr_connected
);
791 nbr_connected_free (nbr_connected
);
795 /* Interface is up. */
797 if_up (struct interface
*ifp
)
799 struct zebra_if
*zif
;
803 quagga_timestamp (2, zif
->up_last
, sizeof (zif
->up_last
));
805 /* Notify the protocol daemons. */
806 if (ifp
->ptm_enable
&& (ifp
->ptm_status
== ZEBRA_PTM_STATUS_DOWN
)) {
807 zlog_warn("%s: interface %s hasn't passed ptm check\n", __func__
,
811 zebra_interface_up_update (ifp
);
813 if_nbr_ipv6ll_to_ipv4ll_neigh_add_all (ifp
);
815 /* Enable fast tx of RA if enabled && RA interval is not in msecs */
816 if (zif
->rtadv
.AdvSendAdvertisements
&&
817 (zif
->rtadv
.MaxRtrAdvInterval
>= 1000))
819 zif
->rtadv
.inFastRexmit
= 1;
820 zif
->rtadv
.NumFastReXmitsRemain
= RTADV_NUM_FAST_REXMITS
;
823 /* Install connected routes to the kernel. */
824 if_install_connected (ifp
);
826 if (IS_ZEBRA_DEBUG_RIB_DETAILED
)
827 zlog_debug ("%u: IF %s up, scheduling RIB processing",
828 ifp
->vrf_id
, ifp
->name
);
829 rib_update (ifp
->vrf_id
, RIB_UPDATE_IF_CHANGE
);
831 zebra_vrf_static_route_interface_fixup (ifp
);
834 /* Interface goes down. We have to manage different behavior of based
837 if_down (struct interface
*ifp
)
839 struct zebra_if
*zif
;
843 quagga_timestamp (2, zif
->down_last
, sizeof (zif
->down_last
));
845 /* Notify to the protocol daemons. */
846 zebra_interface_down_update (ifp
);
848 /* Uninstall connected routes from the kernel. */
849 if_uninstall_connected (ifp
);
851 if (IS_ZEBRA_DEBUG_RIB_DETAILED
)
852 zlog_debug ("%u: IF %s down, scheduling RIB processing",
853 ifp
->vrf_id
, ifp
->name
);
854 rib_update (ifp
->vrf_id
, RIB_UPDATE_IF_CHANGE
);
856 if_nbr_ipv6ll_to_ipv4ll_neigh_del_all (ifp
);
858 /* Delete all neighbor addresses learnt through IPv6 RA */
859 if_down_del_nbr_connected (ifp
);
863 if_refresh (struct interface
*ifp
)
869 /* Output prefix string to vty. */
871 prefix_vty_out (struct vty
*vty
, struct prefix
*p
)
873 char str
[INET6_ADDRSTRLEN
];
875 inet_ntop (p
->family
, &p
->u
.prefix
, str
, sizeof (str
));
876 vty_out (vty
, "%s", str
);
880 /* Dump if address information to vty. */
882 connected_dump_vty (struct vty
*vty
, struct connected
*connected
)
886 /* Print interface address. */
887 p
= connected
->address
;
888 vty_out (vty
, " %s ", prefix_family_str (p
));
889 prefix_vty_out (vty
, p
);
890 vty_out (vty
, "/%d", p
->prefixlen
);
892 /* If there is destination address, print it. */
893 if (connected
->destination
)
895 vty_out (vty
, (CONNECTED_PEER(connected
) ? " peer " : " broadcast "));
896 prefix_vty_out (vty
, connected
->destination
);
899 if (CHECK_FLAG (connected
->flags
, ZEBRA_IFA_SECONDARY
))
900 vty_out (vty
, " secondary");
902 if (CHECK_FLAG (connected
->flags
, ZEBRA_IFA_UNNUMBERED
))
903 vty_out (vty
, " unnumbered");
905 if (connected
->label
)
906 vty_out (vty
, " %s", connected
->label
);
908 vty_out (vty
, "%s", VTY_NEWLINE
);
911 /* Dump interface neighbor address information to vty. */
913 nbr_connected_dump_vty (struct vty
*vty
, struct nbr_connected
*connected
)
917 /* Print interface address. */
918 p
= connected
->address
;
919 vty_out (vty
, " %s ", prefix_family_str (p
));
920 prefix_vty_out (vty
, p
);
921 vty_out (vty
, "/%d", p
->prefixlen
);
923 vty_out (vty
, "%s", VTY_NEWLINE
);
926 #if defined (HAVE_RTADV)
927 /* Dump interface ND information to vty. */
929 nd_dump_vty (struct vty
*vty
, struct interface
*ifp
)
931 struct zebra_if
*zif
;
932 struct rtadvconf
*rtadv
;
935 zif
= (struct zebra_if
*) ifp
->info
;
938 if (rtadv
->AdvSendAdvertisements
)
940 vty_out (vty
, " ND advertised reachable time is %d milliseconds%s",
941 rtadv
->AdvReachableTime
, VTY_NEWLINE
);
942 vty_out (vty
, " ND advertised retransmit interval is %d milliseconds%s",
943 rtadv
->AdvRetransTimer
, VTY_NEWLINE
);
944 vty_out (vty
, " ND router advertisements sent: %d rcvd: %d%s",
945 zif
->ra_sent
, zif
->ra_rcvd
, VTY_NEWLINE
);
946 interval
= rtadv
->MaxRtrAdvInterval
;
948 vty_out (vty
, " ND router advertisements are sent every "
949 "%d milliseconds%s", interval
,
952 vty_out (vty
, " ND router advertisements are sent every "
953 "%d seconds%s", interval
/ 1000,
955 if (rtadv
->AdvDefaultLifetime
!= -1)
956 vty_out (vty
, " ND router advertisements live for %d seconds%s",
957 rtadv
->AdvDefaultLifetime
, VTY_NEWLINE
);
959 vty_out (vty
, " ND router advertisements lifetime tracks ra-interval%s",
961 vty_out (vty
, " ND router advertisement default router preference is "
962 "%s%s", rtadv_pref_strs
[rtadv
->DefaultPreference
],
964 if (rtadv
->AdvManagedFlag
)
965 vty_out (vty
, " Hosts use DHCP to obtain routable addresses.%s",
968 vty_out (vty
, " Hosts use stateless autoconfig for addresses.%s",
970 if (rtadv
->AdvHomeAgentFlag
)
972 vty_out (vty
, " ND router advertisements with "
973 "Home Agent flag bit set.%s",
975 if (rtadv
->HomeAgentLifetime
!= -1)
976 vty_out (vty
, " Home Agent lifetime is %u seconds%s",
977 rtadv
->HomeAgentLifetime
, VTY_NEWLINE
);
979 vty_out (vty
, " Home Agent lifetime tracks ra-lifetime%s",
981 vty_out (vty
, " Home Agent preference is %u%s",
982 rtadv
->HomeAgentPreference
, VTY_NEWLINE
);
984 if (rtadv
->AdvIntervalOption
)
985 vty_out (vty
, " ND router advertisements with Adv. Interval option.%s",
989 #endif /* HAVE_RTADV */
991 /* Interface's information print out to vty interface. */
993 if_dump_vty (struct vty
*vty
, struct interface
*ifp
)
995 struct connected
*connected
;
996 struct nbr_connected
*nbr_connected
;
997 struct listnode
*node
;
998 struct route_node
*rn
;
999 struct zebra_if
*zebra_if
;
1002 zebra_if
= ifp
->info
;
1004 vty_out (vty
, "Interface %s is ", ifp
->name
);
1005 if (if_is_up(ifp
)) {
1006 vty_out (vty
, "up, line protocol ");
1008 if (CHECK_FLAG(ifp
->status
, ZEBRA_INTERFACE_LINKDETECTION
)) {
1009 if (if_is_running(ifp
))
1010 vty_out (vty
, "is up%s", VTY_NEWLINE
);
1012 vty_out (vty
, "is down%s", VTY_NEWLINE
);
1014 vty_out (vty
, "detection is disabled%s", VTY_NEWLINE
);
1017 vty_out (vty
, "down%s", VTY_NEWLINE
);
1020 vty_out (vty
, " Link ups: %5u last: %s%s", zebra_if
->up_count
,
1021 zebra_if
->up_last
[0] ? zebra_if
->up_last
: "(never)", VTY_NEWLINE
);
1022 vty_out (vty
, " Link downs: %5u last: %s%s", zebra_if
->down_count
,
1023 zebra_if
->down_last
[0] ? zebra_if
->down_last
: "(never)", VTY_NEWLINE
);
1025 zebra_ptm_show_status(vty
, ifp
);
1027 vrf
= vrf_lookup(ifp
->vrf_id
);
1028 vty_out (vty
, " vrf: %s%s", vrf
->name
, VTY_NEWLINE
);
1031 vty_out (vty
, " Description: %s%s", ifp
->desc
,
1033 if (ifp
->ifindex
== IFINDEX_INTERNAL
)
1035 vty_out(vty
, " pseudo interface%s", VTY_NEWLINE
);
1038 else if (! CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
))
1040 vty_out(vty
, " index %d inactive interface%s",
1046 vty_out (vty
, " index %d metric %d mtu %d ",
1047 ifp
->ifindex
, ifp
->metric
, ifp
->mtu
);
1049 if (ifp
->mtu6
!= ifp
->mtu
)
1050 vty_out (vty
, "mtu6 %d ", ifp
->mtu6
);
1052 vty_out (vty
, "%s flags: %s%s", VTY_NEWLINE
,
1053 if_flag_dump (ifp
->flags
), VTY_NEWLINE
);
1055 /* Hardware address. */
1056 vty_out (vty
, " Type: %s%s", if_link_type_str (ifp
->ll_type
), VTY_NEWLINE
);
1057 if (ifp
->hw_addr_len
!= 0)
1061 vty_out (vty
, " HWaddr: ");
1062 for (i
= 0; i
< ifp
->hw_addr_len
; i
++)
1063 vty_out (vty
, "%s%02x", i
== 0 ? "" : ":", ifp
->hw_addr
[i
]);
1064 vty_out (vty
, "%s", VTY_NEWLINE
);
1067 /* Bandwidth in Mbps */
1068 if (ifp
->bandwidth
!= 0)
1070 vty_out(vty
, " bandwidth %u Mbps", ifp
->bandwidth
);
1071 vty_out(vty
, "%s", VTY_NEWLINE
);
1074 for (rn
= route_top (zebra_if
->ipv4_subnets
); rn
; rn
= route_next (rn
))
1079 for (ALL_LIST_ELEMENTS_RO ((struct list
*)rn
->info
, node
, connected
))
1080 connected_dump_vty (vty
, connected
);
1083 for (ALL_LIST_ELEMENTS_RO (ifp
->connected
, node
, connected
))
1085 if (CHECK_FLAG (connected
->conf
, ZEBRA_IFC_REAL
) &&
1086 (connected
->address
->family
== AF_INET6
))
1087 connected_dump_vty (vty
, connected
);
1090 if (HAS_LINK_PARAMS(ifp
))
1093 struct if_link_params
*iflp
= ifp
->link_params
;
1094 vty_out(vty
, " Traffic Engineering Link Parameters:%s", VTY_NEWLINE
);
1095 if (IS_PARAM_SET(iflp
, LP_TE
))
1096 vty_out(vty
, " TE metric %u%s",iflp
->te_metric
, VTY_NEWLINE
);
1097 if (IS_PARAM_SET(iflp
, LP_MAX_BW
))
1098 vty_out(vty
, " Maximum Bandwidth %g (Byte/s)%s", iflp
->max_bw
, VTY_NEWLINE
);
1099 if (IS_PARAM_SET(iflp
, LP_MAX_RSV_BW
))
1100 vty_out(vty
, " Maximum Reservable Bandwidth %g (Byte/s)%s", iflp
->max_rsv_bw
, VTY_NEWLINE
);
1101 if (IS_PARAM_SET(iflp
, LP_UNRSV_BW
)) {
1102 vty_out(vty
, " Unreserved Bandwidth per Class Type in Byte/s:%s", VTY_NEWLINE
);
1103 for (i
= 0; i
< MAX_CLASS_TYPE
; i
+=2)
1104 vty_out(vty
, " [%d]: %g (Bytes/sec),\t[%d]: %g (Bytes/sec)%s",
1105 i
, iflp
->unrsv_bw
[i
], i
+1, iflp
->unrsv_bw
[i
+1], VTY_NEWLINE
);
1108 if (IS_PARAM_SET(iflp
, LP_ADM_GRP
))
1109 vty_out(vty
, " Administrative Group:%u%s", iflp
->admin_grp
, VTY_NEWLINE
);
1110 if (IS_PARAM_SET(iflp
, LP_DELAY
))
1112 vty_out(vty
, " Link Delay Average: %u (micro-sec.)", iflp
->av_delay
);
1113 if (IS_PARAM_SET(iflp
, LP_MM_DELAY
))
1115 vty_out(vty
, " Min: %u (micro-sec.)", iflp
->min_delay
);
1116 vty_out(vty
, " Max: %u (micro-sec.)", iflp
->max_delay
);
1118 vty_out(vty
, "%s", VTY_NEWLINE
);
1120 if (IS_PARAM_SET(iflp
, LP_DELAY_VAR
))
1121 vty_out(vty
, " Link Delay Variation %u (micro-sec.)%s", iflp
->delay_var
, VTY_NEWLINE
);
1122 if (IS_PARAM_SET(iflp
, LP_PKT_LOSS
))
1123 vty_out(vty
, " Link Packet Loss %g (in %%)%s", iflp
->pkt_loss
, VTY_NEWLINE
);
1124 if (IS_PARAM_SET(iflp
, LP_AVA_BW
))
1125 vty_out(vty
, " Available Bandwidth %g (Byte/s)%s", iflp
->ava_bw
, VTY_NEWLINE
);
1126 if (IS_PARAM_SET(iflp
, LP_RES_BW
))
1127 vty_out(vty
, " Residual Bandwidth %g (Byte/s)%s", iflp
->res_bw
, VTY_NEWLINE
);
1128 if (IS_PARAM_SET(iflp
, LP_USE_BW
))
1129 vty_out(vty
, " Utilized Bandwidth %g (Byte/s)%s", iflp
->use_bw
, VTY_NEWLINE
);
1130 if (IS_PARAM_SET(iflp
, LP_RMT_AS
))
1131 vty_out(vty
, " Neighbor ASBR IP: %s AS: %u %s", inet_ntoa(iflp
->rmt_ip
), iflp
->rmt_as
, VTY_NEWLINE
);
1135 nd_dump_vty (vty
, ifp
);
1137 #if defined (HAVE_RTADV)
1138 nd_dump_vty (vty
, ifp
);
1139 #endif /* HAVE_RTADV */
1140 if (listhead(ifp
->nbr_connected
))
1141 vty_out (vty
, " Neighbor address(s):%s", VTY_NEWLINE
);
1142 for (ALL_LIST_ELEMENTS_RO (ifp
->nbr_connected
, node
, nbr_connected
))
1143 nbr_connected_dump_vty (vty
, nbr_connected
);
1145 #ifdef HAVE_PROC_NET_DEV
1146 /* Statistics print out using proc file system. */
1147 vty_out (vty
, " %lu input packets (%lu multicast), %lu bytes, "
1149 ifp
->stats
.rx_packets
, ifp
->stats
.rx_multicast
,
1150 ifp
->stats
.rx_bytes
, ifp
->stats
.rx_dropped
, VTY_NEWLINE
);
1152 vty_out (vty
, " %lu input errors, %lu length, %lu overrun,"
1153 " %lu CRC, %lu frame%s",
1154 ifp
->stats
.rx_errors
, ifp
->stats
.rx_length_errors
,
1155 ifp
->stats
.rx_over_errors
, ifp
->stats
.rx_crc_errors
,
1156 ifp
->stats
.rx_frame_errors
, VTY_NEWLINE
);
1158 vty_out (vty
, " %lu fifo, %lu missed%s", ifp
->stats
.rx_fifo_errors
,
1159 ifp
->stats
.rx_missed_errors
, VTY_NEWLINE
);
1161 vty_out (vty
, " %lu output packets, %lu bytes, %lu dropped%s",
1162 ifp
->stats
.tx_packets
, ifp
->stats
.tx_bytes
,
1163 ifp
->stats
.tx_dropped
, VTY_NEWLINE
);
1165 vty_out (vty
, " %lu output errors, %lu aborted, %lu carrier,"
1166 " %lu fifo, %lu heartbeat%s",
1167 ifp
->stats
.tx_errors
, ifp
->stats
.tx_aborted_errors
,
1168 ifp
->stats
.tx_carrier_errors
, ifp
->stats
.tx_fifo_errors
,
1169 ifp
->stats
.tx_heartbeat_errors
, VTY_NEWLINE
);
1171 vty_out (vty
, " %lu window, %lu collisions%s",
1172 ifp
->stats
.tx_window_errors
, ifp
->stats
.collisions
, VTY_NEWLINE
);
1173 #endif /* HAVE_PROC_NET_DEV */
1175 #ifdef HAVE_NET_RT_IFLIST
1176 #if defined (__bsdi__) || defined (__NetBSD__)
1177 /* Statistics print out using sysctl (). */
1178 vty_out (vty
, " input packets %llu, bytes %llu, dropped %llu,"
1179 " multicast packets %llu%s",
1180 (unsigned long long)ifp
->stats
.ifi_ipackets
,
1181 (unsigned long long)ifp
->stats
.ifi_ibytes
,
1182 (unsigned long long)ifp
->stats
.ifi_iqdrops
,
1183 (unsigned long long)ifp
->stats
.ifi_imcasts
,
1186 vty_out (vty
, " input errors %llu%s",
1187 (unsigned long long)ifp
->stats
.ifi_ierrors
, VTY_NEWLINE
);
1189 vty_out (vty
, " output packets %llu, bytes %llu,"
1190 " multicast packets %llu%s",
1191 (unsigned long long)ifp
->stats
.ifi_opackets
,
1192 (unsigned long long)ifp
->stats
.ifi_obytes
,
1193 (unsigned long long)ifp
->stats
.ifi_omcasts
,
1196 vty_out (vty
, " output errors %llu%s",
1197 (unsigned long long)ifp
->stats
.ifi_oerrors
, VTY_NEWLINE
);
1199 vty_out (vty
, " collisions %llu%s",
1200 (unsigned long long)ifp
->stats
.ifi_collisions
, VTY_NEWLINE
);
1202 /* Statistics print out using sysctl (). */
1203 vty_out (vty
, " input packets %lu, bytes %lu, dropped %lu,"
1204 " multicast packets %lu%s",
1205 ifp
->stats
.ifi_ipackets
, ifp
->stats
.ifi_ibytes
,
1206 ifp
->stats
.ifi_iqdrops
, ifp
->stats
.ifi_imcasts
,
1209 vty_out (vty
, " input errors %lu%s",
1210 ifp
->stats
.ifi_ierrors
, VTY_NEWLINE
);
1212 vty_out (vty
, " output packets %lu, bytes %lu, multicast packets %lu%s",
1213 ifp
->stats
.ifi_opackets
, ifp
->stats
.ifi_obytes
,
1214 ifp
->stats
.ifi_omcasts
, VTY_NEWLINE
);
1216 vty_out (vty
, " output errors %lu%s",
1217 ifp
->stats
.ifi_oerrors
, VTY_NEWLINE
);
1219 vty_out (vty
, " collisions %lu%s",
1220 ifp
->stats
.ifi_collisions
, VTY_NEWLINE
);
1221 #endif /* __bsdi__ || __NetBSD__ */
1222 #endif /* HAVE_NET_RT_IFLIST */
1225 /* Wrapper hook point for zebra daemon so that ifindex can be set
1226 * DEFUN macro not used as extract.pl HAS to ignore this
1227 * See also interface_cmd in lib/if.c
1229 DEFUN_NOSH (zebra_interface
,
1230 zebra_interface_cmd
,
1232 "Select an interface to configure\n"
1233 "Interface's name\n")
1236 struct interface
*ifp
;
1238 /* Call lib interface() */
1239 if ((ret
= interface_cmd
.func (self
, vty
, argc
, argv
)) != CMD_SUCCESS
)
1244 if (ifp
->ifindex
== IFINDEX_INTERNAL
)
1245 /* Is this really necessary? Shouldn't status be initialized to 0
1247 UNSET_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
);
1252 ALIAS (zebra_interface
,
1253 zebra_interface_vrf_cmd
,
1254 "interface IFNAME " VRF_CMD_STR
,
1255 "Select an interface to configure\n"
1256 "Interface's name\n"
1260 interface_update_stats (void)
1262 #ifdef HAVE_PROC_NET_DEV
1263 /* If system has interface statistics via proc file system, update
1265 ifstat_update_proc ();
1266 #endif /* HAVE_PROC_NET_DEV */
1267 #ifdef HAVE_NET_RT_IFLIST
1268 ifstat_update_sysctl ();
1269 #endif /* HAVE_NET_RT_IFLIST */
1272 struct cmd_node interface_node
=
1279 /* Wrapper hook point for zebra daemon so that ifindex can be set
1280 * DEFUN macro not used as extract.pl HAS to ignore this
1281 * See also interface_cmd in lib/if.c
1283 DEFUN_NOSH (zebra_vrf
,
1286 "Select a VRF to configure\n"
1291 /* Call lib vrf() */
1292 if ((ret
= vrf_cmd
.func (self
, vty
, argc
, argv
)) != CMD_SUCCESS
)
1295 // vrfp = vty->index;
1300 struct cmd_node vrf_node
=
1307 /* Show all interfaces to vty. */
1308 DEFUN (show_interface
, show_interface_cmd
,
1311 "Interface status and configuration\n")
1313 struct listnode
*node
;
1314 struct interface
*ifp
;
1315 vrf_id_t vrf_id
= VRF_DEFAULT
;
1317 interface_update_stats ();
1320 VRF_GET_ID (vrf_id
, argv
[0]);
1322 /* All interface print. */
1323 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (vrf_id
), node
, ifp
))
1324 if_dump_vty (vty
, ifp
);
1329 ALIAS (show_interface
,
1330 show_interface_vrf_cmd
,
1331 "show interface " VRF_CMD_STR
,
1333 "Interface status and configuration\n"
1336 /* Show all interfaces to vty. */
1337 DEFUN (show_interface_vrf_all
, show_interface_vrf_all_cmd
,
1338 "show interface " VRF_ALL_CMD_STR
,
1340 "Interface status and configuration\n"
1341 VRF_ALL_CMD_HELP_STR
)
1343 struct listnode
*node
;
1344 struct interface
*ifp
;
1347 interface_update_stats ();
1349 /* All interface print. */
1350 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
1351 for (ALL_LIST_ELEMENTS_RO (vrf_iter2iflist (iter
), node
, ifp
))
1352 if_dump_vty (vty
, ifp
);
1357 /* Show specified interface to vty. */
1359 DEFUN (show_interface_name_vrf
,
1360 show_interface_name_vrf_cmd
,
1361 "show interface IFNAME " VRF_CMD_STR
,
1363 "Interface status and configuration\n"
1367 struct interface
*ifp
;
1368 vrf_id_t vrf_id
= VRF_DEFAULT
;
1370 interface_update_stats ();
1373 VRF_GET_ID (vrf_id
, argv
[1]);
1375 /* Specified interface print. */
1376 ifp
= if_lookup_by_name_vrf (argv
[0], vrf_id
);
1379 vty_out (vty
, "%% Can't find interface %s%s", argv
[0],
1383 if_dump_vty (vty
, ifp
);
1388 /* Show specified interface to vty. */
1389 DEFUN (show_interface_name_vrf_all
, show_interface_name_vrf_all_cmd
,
1390 "show interface IFNAME " VRF_ALL_CMD_STR
,
1392 "Interface status and configuration\n"
1394 VRF_ALL_CMD_HELP_STR
)
1396 struct interface
*ifp
;
1400 interface_update_stats ();
1402 /* All interface print. */
1403 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
1405 /* Specified interface print. */
1406 ifp
= if_lookup_by_name_vrf (argv
[0], vrf_iter2id (iter
));
1409 if_dump_vty (vty
, ifp
);
1416 vty_out (vty
, "%% Can't find interface %s%s", argv
[0], VTY_NEWLINE
);
1423 ALIAS (show_interface_name_vrf_all
, show_interface_name_cmd
,
1424 "show interface IFNAME",
1426 "Interface status and configuration\n"
1430 if_show_description (struct vty
*vty
, vrf_id_t vrf_id
)
1432 struct listnode
*node
;
1433 struct interface
*ifp
;
1435 vty_out (vty
, "Interface Status Protocol Description%s", VTY_NEWLINE
);
1436 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (vrf_id
), node
, ifp
))
1440 len
= vty_out (vty
, "%s", ifp
->name
);
1441 vty_out (vty
, "%*s", (16 - len
), " ");
1445 vty_out (vty
, "up ");
1446 if (CHECK_FLAG(ifp
->status
, ZEBRA_INTERFACE_LINKDETECTION
))
1448 if (if_is_running(ifp
))
1449 vty_out (vty
, "up ");
1451 vty_out (vty
, "down ");
1455 vty_out (vty
, "unknown ");
1460 vty_out (vty
, "down down ");
1464 vty_out (vty
, "%s", ifp
->desc
);
1465 vty_out (vty
, "%s", VTY_NEWLINE
);
1469 DEFUN (show_interface_desc
,
1470 show_interface_desc_cmd
,
1471 "show interface description",
1473 "Interface status and configuration\n"
1474 "Interface description\n")
1476 vrf_id_t vrf_id
= VRF_DEFAULT
;
1479 VRF_GET_ID (vrf_id
, argv
[0]);
1481 if_show_description (vty
, vrf_id
);
1486 ALIAS (show_interface_desc
,
1487 show_interface_desc_vrf_cmd
,
1488 "show interface description " VRF_CMD_STR
,
1490 "Interface status and configuration\n"
1491 "Interface description\n"
1494 DEFUN (show_interface_desc_vrf_all
,
1495 show_interface_desc_vrf_all_cmd
,
1496 "show interface description " VRF_ALL_CMD_STR
,
1498 "Interface status and configuration\n"
1499 "Interface description\n"
1500 VRF_ALL_CMD_HELP_STR
)
1504 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
1505 if (!list_isempty (vrf_iter2iflist (iter
)))
1507 vty_out (vty
, "%s\tVRF %u%s%s", VTY_NEWLINE
,
1509 VTY_NEWLINE
, VTY_NEWLINE
);
1510 if_show_description (vty
, vrf_iter2id (iter
));
1519 "Set multicast flag to interface\n")
1522 struct interface
*ifp
;
1523 struct zebra_if
*if_data
;
1525 ifp
= (struct interface
*) vty
->index
;
1526 if (CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
))
1528 ret
= if_set_flags (ifp
, IFF_MULTICAST
);
1531 vty_out (vty
, "Can't set multicast flag%s", VTY_NEWLINE
);
1536 if_data
= ifp
->info
;
1537 if_data
->multicast
= IF_ZEBRA_MULTICAST_ON
;
1542 DEFUN (no_multicast
,
1546 "Unset multicast flag to interface\n")
1549 struct interface
*ifp
;
1550 struct zebra_if
*if_data
;
1552 ifp
= (struct interface
*) vty
->index
;
1553 if (CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
))
1555 ret
= if_unset_flags (ifp
, IFF_MULTICAST
);
1558 vty_out (vty
, "Can't unset multicast flag%s", VTY_NEWLINE
);
1563 if_data
= ifp
->info
;
1564 if_data
->multicast
= IF_ZEBRA_MULTICAST_OFF
;
1572 "Enable link detection on interface\n")
1574 struct interface
*ifp
;
1575 int if_was_operative
;
1577 ifp
= (struct interface
*) vty
->index
;
1578 if_was_operative
= if_is_no_ptm_operative(ifp
);
1579 SET_FLAG(ifp
->status
, ZEBRA_INTERFACE_LINKDETECTION
);
1581 /* When linkdetection is enabled, if might come down */
1582 if (!if_is_no_ptm_operative(ifp
) && if_was_operative
) if_down(ifp
);
1584 /* FIXME: Will defer status change forwarding if interface
1585 does not come down! */
1591 DEFUN (no_linkdetect
,
1595 "Disable link detection on interface\n")
1597 struct interface
*ifp
;
1598 int if_was_operative
;
1600 ifp
= (struct interface
*) vty
->index
;
1601 if_was_operative
= if_is_no_ptm_operative(ifp
);
1602 UNSET_FLAG(ifp
->status
, ZEBRA_INTERFACE_LINKDETECTION
);
1604 /* Interface may come up after disabling link detection */
1605 if (if_is_operative(ifp
) && !if_was_operative
) if_up(ifp
);
1607 /* FIXME: see linkdetect_cmd */
1615 "Shutdown the selected interface\n")
1618 struct interface
*ifp
;
1619 struct zebra_if
*if_data
;
1621 ifp
= (struct interface
*) vty
->index
;
1622 if (ifp
->ifindex
!= IFINDEX_INTERNAL
)
1624 ret
= if_unset_flags (ifp
, IFF_UP
);
1627 vty_out (vty
, "Can't shutdown interface%s", VTY_NEWLINE
);
1632 if_data
= ifp
->info
;
1633 if_data
->shutdown
= IF_ZEBRA_SHUTDOWN_ON
;
1638 DEFUN (no_shutdown_if
,
1642 "Shutdown the selected interface\n")
1645 struct interface
*ifp
;
1646 struct zebra_if
*if_data
;
1648 ifp
= (struct interface
*) vty
->index
;
1650 if (ifp
->ifindex
!= IFINDEX_INTERNAL
)
1652 ret
= if_set_flags (ifp
, IFF_UP
| IFF_RUNNING
);
1655 vty_out (vty
, "Can't up interface%s", VTY_NEWLINE
);
1660 /* Some addresses (in particular, IPv6 addresses on Linux) get
1661 * removed when the interface goes down. They need to be readded.
1663 if_addr_wakeup(ifp
);
1666 if_data
= ifp
->info
;
1667 if_data
->shutdown
= IF_ZEBRA_SHUTDOWN_OFF
;
1672 DEFUN (bandwidth_if
,
1674 "bandwidth <1-100000>",
1675 "Set bandwidth informational parameter\n"
1676 "Bandwidth in megabits\n")
1678 struct interface
*ifp
;
1679 unsigned int bandwidth
;
1681 ifp
= (struct interface
*) vty
->index
;
1682 bandwidth
= strtol(argv
[0], NULL
, 10);
1684 /* bandwidth range is <1-100000> */
1685 if (bandwidth
< 1 || bandwidth
> 100000)
1687 vty_out (vty
, "Bandwidth is invalid%s", VTY_NEWLINE
);
1691 ifp
->bandwidth
= bandwidth
;
1693 /* force protocols to recalculate routes due to cost change */
1694 if (if_is_operative (ifp
))
1695 zebra_interface_up_update (ifp
);
1700 DEFUN (no_bandwidth_if
,
1701 no_bandwidth_if_cmd
,
1704 "Set bandwidth informational parameter\n")
1706 struct interface
*ifp
;
1708 ifp
= (struct interface
*) vty
->index
;
1712 /* force protocols to recalculate routes due to cost change */
1713 if (if_is_operative (ifp
))
1714 zebra_interface_up_update (ifp
);
1719 ALIAS (no_bandwidth_if
,
1720 no_bandwidth_if_val_cmd
,
1721 "no bandwidth <1-100000>",
1723 "Set bandwidth informational parameter\n"
1724 "Bandwidth in megabits\n")
1726 struct cmd_node link_params_node
=
1729 "%s(config-link-params)# ",
1734 link_param_cmd_set_uint32 (struct interface
*ifp
, uint32_t *field
,
1735 uint32_t type
, uint32_t value
)
1737 /* Update field as needed */
1738 if (IS_PARAM_UNSET(ifp
->link_params
, type
) || *field
!= value
)
1741 SET_PARAM(ifp
->link_params
, type
);
1743 /* force protocols to update LINK STATE due to parameters change */
1744 if (if_is_operative (ifp
))
1745 zebra_interface_parameters_update (ifp
);
1749 link_param_cmd_set_float (struct interface
*ifp
, float *field
,
1750 uint32_t type
, float value
)
1753 /* Update field as needed */
1754 if (IS_PARAM_UNSET(ifp
->link_params
, type
) || *field
!= value
)
1757 SET_PARAM(ifp
->link_params
, type
);
1759 /* force protocols to update LINK STATE due to parameters change */
1760 if (if_is_operative (ifp
))
1761 zebra_interface_parameters_update (ifp
);
1766 link_param_cmd_unset (struct interface
*ifp
, uint32_t type
)
1770 UNSET_PARAM(ifp
->link_params
, type
);
1772 /* force protocols to update LINK STATE due to parameters change */
1773 if (if_is_operative (ifp
))
1774 zebra_interface_parameters_update (ifp
);
1782 vty
->node
= LINK_PARAMS_NODE
;
1787 /* Specific Traffic Engineering parameters commands */
1788 DEFUN (link_params_enable
,
1789 link_params_enable_cmd
,
1791 "Activate link parameters on this interface\n")
1793 struct interface
*ifp
= (struct interface
*) vty
->index
;
1795 /* This command could be issue at startup, when activate MPLS TE */
1796 /* on a new interface or after a ON / OFF / ON toggle */
1797 /* In all case, TE parameters are reset to their default factory */
1798 if (IS_ZEBRA_DEBUG_EVENT
)
1799 zlog_debug ("Link-params: enable TE link parameters on interface %s", ifp
->name
);
1801 if (!if_link_params_get (ifp
))
1803 if (IS_ZEBRA_DEBUG_EVENT
)
1804 zlog_debug ("Link-params: failed to init TE link parameters %s", ifp
->name
);
1809 /* force protocols to update LINK STATE due to parameters change */
1810 if (if_is_operative (ifp
))
1811 zebra_interface_parameters_update (ifp
);
1816 DEFUN (no_link_params_enable
,
1817 no_link_params_enable_cmd
,
1820 "Disable link parameters on this interface\n")
1822 struct interface
*ifp
= (struct interface
*) vty
->index
;
1824 zlog_debug ("MPLS-TE: disable TE link parameters on interface %s", ifp
->name
);
1826 if_link_params_free (ifp
);
1828 /* force protocols to update LINK STATE due to parameters change */
1829 if (if_is_operative (ifp
))
1830 zebra_interface_parameters_update (ifp
);
1835 /* STANDARD TE metrics */
1836 DEFUN (link_params_metric
,
1837 link_params_metric_cmd
,
1838 "metric <0-4294967295>",
1839 "Link metric for MPLS-TE purpose\n"
1840 "Metric value in decimal\n")
1842 struct interface
*ifp
= (struct interface
*) vty
->index
;
1843 struct if_link_params
*iflp
= if_link_params_get (ifp
);
1846 VTY_GET_ULONG("metric", metric
, argv
[0]);
1848 /* Update TE metric if needed */
1849 link_param_cmd_set_uint32 (ifp
, &iflp
->te_metric
, LP_TE
, metric
);
1854 DEFUN (no_link_params_metric
,
1855 no_link_params_metric_cmd
,
1858 "Disbale Link Metric on this interface\n")
1860 struct interface
*ifp
= (struct interface
*) vty
->index
;
1862 /* Unset TE Metric */
1863 link_param_cmd_unset(ifp
, LP_TE
);
1868 DEFUN (link_params_maxbw
,
1869 link_params_maxbw_cmd
,
1871 "Maximum bandwidth that can be used\n"
1872 "Bytes/second (IEEE floating point format)\n")
1874 struct interface
*ifp
= (struct interface
*) vty
->index
;
1875 struct if_link_params
*iflp
= if_link_params_get (ifp
);
1879 if (sscanf (argv
[0], "%g", &bw
) != 1)
1881 vty_out (vty
, "link_params_maxbw: fscanf: %s%s", safe_strerror (errno
),
1886 /* Check that Maximum bandwidth is not lower than other bandwidth parameters */
1887 if ((bw
<= iflp
->max_rsv_bw
)
1888 || (bw
<= iflp
->unrsv_bw
[0])
1889 || (bw
<= iflp
->unrsv_bw
[1])
1890 || (bw
<= iflp
->unrsv_bw
[2])
1891 || (bw
<= iflp
->unrsv_bw
[3])
1892 || (bw
<= iflp
->unrsv_bw
[4])
1893 || (bw
<= iflp
->unrsv_bw
[5])
1894 || (bw
<= iflp
->unrsv_bw
[6])
1895 || (bw
<= iflp
->unrsv_bw
[7])
1896 || (bw
<= iflp
->ava_bw
)
1897 || (bw
<= iflp
->res_bw
)
1898 || (bw
<= iflp
->use_bw
))
1901 "Maximum Bandwidth could not be lower than others bandwidth%s",
1906 /* Update Maximum Bandwidth if needed */
1907 link_param_cmd_set_float (ifp
, &iflp
->max_bw
, LP_MAX_BW
, bw
);
1912 DEFUN (link_params_max_rsv_bw
,
1913 link_params_max_rsv_bw_cmd
,
1914 "max-rsv-bw BANDWIDTH",
1915 "Maximum bandwidth that may be reserved\n"
1916 "Bytes/second (IEEE floating point format)\n")
1918 struct interface
*ifp
= (struct interface
*) vty
->index
;
1919 struct if_link_params
*iflp
= if_link_params_get (ifp
);
1922 if (sscanf (argv
[0], "%g", &bw
) != 1)
1924 vty_out (vty
, "link_params_max_rsv_bw: fscanf: %s%s", safe_strerror (errno
),
1929 /* Check that bandwidth is not greater than maximum bandwidth parameter */
1930 if (bw
> iflp
->max_bw
)
1933 "Maximum Reservable Bandwidth could not be greater than Maximum Bandwidth (%g)%s",
1934 iflp
->max_bw
, VTY_NEWLINE
);
1938 /* Update Maximum Reservable Bandwidth if needed */
1939 link_param_cmd_set_float (ifp
, &iflp
->max_rsv_bw
, LP_MAX_RSV_BW
, bw
);
1944 DEFUN (link_params_unrsv_bw
,
1945 link_params_unrsv_bw_cmd
,
1946 "unrsv-bw <0-7> BANDWIDTH",
1947 "Unreserved bandwidth at each priority level\n"
1949 "Bytes/second (IEEE floating point format)\n")
1951 struct interface
*ifp
= (struct interface
*) vty
->index
;
1952 struct if_link_params
*iflp
= if_link_params_get (ifp
);
1956 /* We don't have to consider about range check here. */
1957 if (sscanf (argv
[0], "%d", &priority
) != 1)
1959 vty_out (vty
, "link_params_unrsv_bw: fscanf: %s%s", safe_strerror (errno
),
1964 if (sscanf (argv
[1], "%g", &bw
) != 1)
1966 vty_out (vty
, "link_params_unrsv_bw: fscanf: %s%s", safe_strerror (errno
),
1971 /* Check that bandwidth is not greater than maximum bandwidth parameter */
1972 if (bw
> iflp
->max_bw
)
1975 "UnReserved Bandwidth could not be greater than Maximum Bandwidth (%g)%s",
1976 iflp
->max_bw
, VTY_NEWLINE
);
1980 /* Update Unreserved Bandwidth if needed */
1981 link_param_cmd_set_float (ifp
, &iflp
->unrsv_bw
[priority
], LP_UNRSV_BW
, bw
);
1986 DEFUN (link_params_admin_grp
,
1987 link_params_admin_grp_cmd
,
1988 "admin-grp BITPATTERN",
1989 "Administrative group membership\n"
1990 "32-bit Hexadecimal value (e.g. 0xa1)\n")
1992 struct interface
*ifp
= (struct interface
*) vty
->index
;
1993 struct if_link_params
*iflp
= if_link_params_get (ifp
);
1994 unsigned long value
;
1996 if (sscanf (argv
[0], "0x%lx", &value
) != 1)
1998 vty_out (vty
, "link_params_admin_grp: fscanf: %s%s",
1999 safe_strerror (errno
), VTY_NEWLINE
);
2003 /* Update Administrative Group if needed */
2004 link_param_cmd_set_uint32 (ifp
, &iflp
->admin_grp
, LP_ADM_GRP
, value
);
2009 DEFUN (no_link_params_admin_grp
,
2010 no_link_params_admin_grp_cmd
,
2013 "Disbale Administrative group membership on this interface\n")
2015 struct interface
*ifp
= (struct interface
*) vty
->index
;
2017 /* Unset Admin Group */
2018 link_param_cmd_unset(ifp
, LP_ADM_GRP
);
2023 /* RFC5392 & RFC5316: INTER-AS */
2024 DEFUN (link_params_inter_as
,
2025 link_params_inter_as_cmd
,
2026 "neighbor A.B.C.D as <1-4294967295>",
2027 "Configure remote ASBR information (Neighbor IP address and AS number)\n"
2028 "Remote IP address in dot decimal A.B.C.D\n"
2029 "Remote AS number\n"
2030 "AS number in the range <1-4294967295>\n")
2033 struct interface
*ifp
= (struct interface
*) vty
->index
;
2034 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2035 struct in_addr addr
;
2038 if (!inet_aton (argv
[0], &addr
))
2040 vty_out (vty
, "Please specify Router-Addr by A.B.C.D%s", VTY_NEWLINE
);
2044 VTY_GET_ULONG("AS number", as
, argv
[1]);
2046 /* Update Remote IP and Remote AS fields if needed */
2047 if (IS_PARAM_UNSET(iflp
, LP_RMT_AS
)
2048 || iflp
->rmt_as
!= as
2049 || iflp
->rmt_ip
.s_addr
!= addr
.s_addr
)
2053 iflp
->rmt_ip
.s_addr
= addr
.s_addr
;
2054 SET_PARAM(iflp
, LP_RMT_AS
);
2056 /* force protocols to update LINK STATE due to parameters change */
2057 if (if_is_operative (ifp
))
2058 zebra_interface_parameters_update (ifp
);
2063 DEFUN (no_link_params_inter_as
,
2064 no_link_params_inter_as_cmd
,
2067 "Remove Neighbor IP address and AS number for Inter-AS TE\n")
2070 struct interface
*ifp
= (struct interface
*) vty
->index
;
2071 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2073 /* Reset Remote IP and AS neighbor */
2075 iflp
->rmt_ip
.s_addr
= 0;
2076 UNSET_PARAM(iflp
, LP_RMT_AS
);
2078 /* force protocols to update LINK STATE due to parameters change */
2079 if (if_is_operative (ifp
))
2080 zebra_interface_parameters_update (ifp
);
2085 /* RFC7471: OSPF Traffic Engineering (TE) Metric extensions & draft-ietf-isis-metric-extensions-07.txt */
2086 DEFUN (link_params_delay
,
2087 link_params_delay_cmd
,
2088 "delay <0-16777215>",
2089 "Unidirectional Average Link Delay\n"
2090 "Average delay in micro-second as decimal (0...16777215)\n")
2093 struct interface
*ifp
= (struct interface
*) vty
->index
;
2094 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2095 u_int32_t delay
= 0, low
= 0, high
= 0;
2096 u_int8_t update
= 0;
2098 /* Get and Check new delay values */
2099 VTY_GET_ULONG("delay", delay
, argv
[0]);
2103 /* Check new delay value against old Min and Max delays if set */
2104 if (IS_PARAM_SET(iflp
, LP_MM_DELAY
)
2105 && (delay
<= iflp
->min_delay
|| delay
>= iflp
->max_delay
))
2107 vty_out (vty
, "Average delay should be comprise between Min (%d) and Max (%d) delay%s",
2108 iflp
->min_delay
, iflp
->max_delay
, VTY_NEWLINE
);
2111 /* Update delay if value is not set or change */
2112 if (IS_PARAM_UNSET(iflp
, LP_DELAY
)|| iflp
->av_delay
!= delay
)
2114 iflp
->av_delay
= delay
;
2115 SET_PARAM(iflp
, LP_DELAY
);
2118 /* Unset Min and Max delays if already set */
2119 if (IS_PARAM_SET(iflp
, LP_MM_DELAY
))
2121 iflp
->min_delay
= 0;
2122 iflp
->max_delay
= 0;
2123 UNSET_PARAM(iflp
, LP_MM_DELAY
);
2128 vty_out (vty
, "You should specify both Minimum and Maximum delay with Average delay%s",
2133 VTY_GET_ULONG("minimum delay", low
, argv
[1]);
2134 VTY_GET_ULONG("maximum delay", high
, argv
[2]);
2135 /* Check new delays value coherency */
2136 if (delay
<= low
|| delay
>= high
)
2138 vty_out (vty
, "Average delay should be comprise between Min (%d) and Max (%d) delay%s",
2139 low
, high
, VTY_NEWLINE
);
2142 /* Update Delays if needed */
2143 if (IS_PARAM_UNSET(iflp
, LP_DELAY
)
2144 || IS_PARAM_UNSET(iflp
, LP_MM_DELAY
)
2145 || iflp
->av_delay
!= delay
2146 || iflp
->min_delay
!= low
2147 || iflp
->max_delay
!= high
)
2149 iflp
->av_delay
= delay
;
2150 SET_PARAM(iflp
, LP_DELAY
);
2151 iflp
->min_delay
= low
;
2152 iflp
->max_delay
= high
;
2153 SET_PARAM(iflp
, LP_MM_DELAY
);
2162 /* force protocols to update LINK STATE due to parameters change */
2163 if (update
== 1 && if_is_operative (ifp
))
2164 zebra_interface_parameters_update (ifp
);
2169 ALIAS (link_params_delay
,
2170 link_params_delay_mm_cmd
,
2171 "delay <0-16777215> min <0-16777215> max <0-16777215>",
2172 "Unidirectional Average Link Delay (optionally Minimum and Maximum delays)\n"
2173 "Average delay in micro-second as decimal (0...16777215)\n"
2175 "Minimum delay in micro-second as decimal (0...16777215)\n"
2177 "Maximum delay in micro-second as decimal (0...16777215)\n")
2179 DEFUN (no_link_params_delay
,
2180 no_link_params_delay_cmd
,
2183 "Disbale Unidirectional Average, Min & Max Link Delay on this interface\n")
2185 struct interface
*ifp
= (struct interface
*) vty
->index
;
2186 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2190 UNSET_PARAM(iflp
, LP_DELAY
);
2191 iflp
->min_delay
= 0;
2192 iflp
->max_delay
= 0;
2193 UNSET_PARAM(iflp
, LP_MM_DELAY
);
2195 /* force protocols to update LINK STATE due to parameters change */
2196 if (if_is_operative (ifp
))
2197 zebra_interface_parameters_update (ifp
);
2202 DEFUN (link_params_delay_var
,
2203 link_params_delay_var_cmd
,
2204 "delay-variation <0-16777215>",
2205 "Unidirectional Link Delay Variation\n"
2206 "delay variation in micro-second as decimal (0...16777215)\n")
2208 struct interface
*ifp
= (struct interface
*) vty
->index
;
2209 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2212 VTY_GET_ULONG("delay variation", value
, argv
[0]);
2214 /* Update Delay Variation if needed */
2215 link_param_cmd_set_uint32 (ifp
, &iflp
->delay_var
, LP_DELAY_VAR
, value
);
2220 DEFUN (no_link_params_delay_var
,
2221 no_link_params_delay_var_cmd
,
2222 "no delay-variation",
2224 "Disbale Unidirectional Delay Variation on this interface\n")
2226 struct interface
*ifp
= (struct interface
*) vty
->index
;
2228 /* Unset Delay Variation */
2229 link_param_cmd_unset(ifp
, LP_DELAY_VAR
);
2234 DEFUN (link_params_pkt_loss
,
2235 link_params_pkt_loss_cmd
,
2236 "packet-loss PERCENTAGE",
2237 "Unidirectional Link Packet Loss\n"
2238 "percentage of total traffic by 0.000003% step and less than 50.331642%\n")
2240 struct interface
*ifp
= (struct interface
*) vty
->index
;
2241 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2244 if (sscanf (argv
[0], "%g", &fval
) != 1)
2246 vty_out (vty
, "link_params_pkt_loss: fscanf: %s%s", safe_strerror (errno
),
2251 if (fval
> MAX_PKT_LOSS
)
2252 fval
= MAX_PKT_LOSS
;
2254 /* Update Packet Loss if needed */
2255 link_param_cmd_set_float (ifp
, &iflp
->pkt_loss
, LP_PKT_LOSS
, fval
);
2260 DEFUN (no_link_params_pkt_loss
,
2261 no_link_params_pkt_loss_cmd
,
2264 "Disbale Unidirectional Link Packet Loss on this interface\n")
2266 struct interface
*ifp
= (struct interface
*) vty
->index
;
2268 /* Unset Packet Loss */
2269 link_param_cmd_unset(ifp
, LP_PKT_LOSS
);
2274 DEFUN (link_params_res_bw
,
2275 link_params_res_bw_cmd
,
2277 "Unidirectional Residual Bandwidth\n"
2278 "Bytes/second (IEEE floating point format)\n")
2280 struct interface
*ifp
= (struct interface
*) vty
->index
;
2281 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2284 if (sscanf (argv
[0], "%g", &bw
) != 1)
2286 vty_out (vty
, "link_params_res_bw: fscanf: %s%s", safe_strerror (errno
),
2291 /* Check that bandwidth is not greater than maximum bandwidth parameter */
2292 if (bw
> iflp
->max_bw
)
2295 "Residual Bandwidth could not be greater than Maximum Bandwidth (%g)%s",
2296 iflp
->max_bw
, VTY_NEWLINE
);
2300 /* Update Residual Bandwidth if needed */
2301 link_param_cmd_set_float (ifp
, &iflp
->res_bw
, LP_RES_BW
, bw
);
2306 DEFUN (no_link_params_res_bw
,
2307 no_link_params_res_bw_cmd
,
2310 "Disbale Unidirectional Residual Bandwidth on this interface\n")
2312 struct interface
*ifp
= (struct interface
*) vty
->index
;
2314 /* Unset Residual Bandwidth */
2315 link_param_cmd_unset(ifp
, LP_RES_BW
);
2320 DEFUN (link_params_ava_bw
,
2321 link_params_ava_bw_cmd
,
2323 "Unidirectional Available Bandwidth\n"
2324 "Bytes/second (IEEE floating point format)\n")
2326 struct interface
*ifp
= (struct interface
*) vty
->index
;
2327 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2330 if (sscanf (argv
[0], "%g", &bw
) != 1)
2332 vty_out (vty
, "link_params_ava_bw: fscanf: %s%s", safe_strerror (errno
),
2337 /* Check that bandwidth is not greater than maximum bandwidth parameter */
2338 if (bw
> iflp
->max_bw
)
2341 "Available Bandwidth could not be greater than Maximum Bandwidth (%g)%s",
2342 iflp
->max_bw
, VTY_NEWLINE
);
2346 /* Update Residual Bandwidth if needed */
2347 link_param_cmd_set_float (ifp
, &iflp
->ava_bw
, LP_AVA_BW
, bw
);
2352 DEFUN (no_link_params_ava_bw
,
2353 no_link_params_ava_bw_cmd
,
2356 "Disbale Unidirectional Available Bandwidth on this interface\n")
2358 struct interface
*ifp
= (struct interface
*) vty
->index
;
2360 /* Unset Available Bandwidth */
2361 link_param_cmd_unset(ifp
, LP_AVA_BW
);
2366 DEFUN (link_params_use_bw
,
2367 link_params_use_bw_cmd
,
2369 "Unidirectional Utilised Bandwidth\n"
2370 "Bytes/second (IEEE floating point format)\n")
2372 struct interface
*ifp
= (struct interface
*) vty
->index
;
2373 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2376 if (sscanf (argv
[0], "%g", &bw
) != 1)
2378 vty_out (vty
, "link_params_use_bw: fscanf: %s%s", safe_strerror (errno
),
2383 /* Check that bandwidth is not greater than maximum bandwidth parameter */
2384 if (bw
> iflp
->max_bw
)
2387 "Utilised Bandwidth could not be greater than Maximum Bandwidth (%g)%s",
2388 iflp
->max_bw
, VTY_NEWLINE
);
2392 /* Update Utilized Bandwidth if needed */
2393 link_param_cmd_set_float (ifp
, &iflp
->use_bw
, LP_USE_BW
, bw
);
2398 DEFUN (no_link_params_use_bw
,
2399 no_link_params_use_bw_cmd
,
2402 "Disbale Unidirectional Utilised Bandwidth on this interface\n")
2404 struct interface
*ifp
= (struct interface
*) vty
->index
;
2406 /* Unset Utilised Bandwidth */
2407 link_param_cmd_unset(ifp
, LP_USE_BW
);
2413 ip_address_install (struct vty
*vty
, struct interface
*ifp
,
2414 const char *addr_str
, const char *peer_str
,
2417 struct zebra_if
*if_data
;
2418 struct prefix_ipv4 cp
;
2419 struct connected
*ifc
;
2420 struct prefix_ipv4
*p
;
2423 if_data
= ifp
->info
;
2425 ret
= str2prefix_ipv4 (addr_str
, &cp
);
2428 vty_out (vty
, "%% Malformed address %s", VTY_NEWLINE
);
2432 if (ipv4_martian(&cp
.prefix
))
2434 vty_out (vty
, "%% Invalid address%s", VTY_NEWLINE
);
2438 ifc
= connected_check (ifp
, (struct prefix
*) &cp
);
2441 ifc
= connected_new ();
2445 p
= prefix_ipv4_new ();
2447 ifc
->address
= (struct prefix
*) p
;
2450 if (p
->prefixlen
<= IPV4_MAX_PREFIXLEN
-2)
2452 p
= prefix_ipv4_new ();
2454 p
->prefix
.s_addr
= ipv4_broadcast_addr(p
->prefix
.s_addr
,p
->prefixlen
);
2455 ifc
->destination
= (struct prefix
*) p
;
2460 ifc
->label
= XSTRDUP (MTYPE_CONNECTED_LABEL
, label
);
2462 /* Add to linked list. */
2463 listnode_add (ifp
->connected
, ifc
);
2466 /* This address is configured from zebra. */
2467 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
))
2468 SET_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
);
2470 /* In case of this route need to install kernel. */
2471 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
)
2472 && CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
)
2473 && !(if_data
&& if_data
->shutdown
== IF_ZEBRA_SHUTDOWN_ON
))
2475 /* Some system need to up the interface to set IP address. */
2476 if (! if_is_up (ifp
))
2478 if_set_flags (ifp
, IFF_UP
| IFF_RUNNING
);
2482 ret
= if_set_prefix (ifp
, ifc
);
2485 vty_out (vty
, "%% Can't set interface IP address: %s.%s",
2486 safe_strerror(errno
), VTY_NEWLINE
);
2490 SET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
2491 /* The address will be advertised to zebra clients when the notification
2492 * from the kernel has been received.
2493 * It will also be added to the subnet chain list, then. */
2500 ip_address_uninstall (struct vty
*vty
, struct interface
*ifp
,
2501 const char *addr_str
, const char *peer_str
,
2504 struct prefix_ipv4 cp
;
2505 struct connected
*ifc
;
2508 /* Convert to prefix structure. */
2509 ret
= str2prefix_ipv4 (addr_str
, &cp
);
2512 vty_out (vty
, "%% Malformed address %s", VTY_NEWLINE
);
2516 /* Check current interface address. */
2517 ifc
= connected_check (ifp
, (struct prefix
*) &cp
);
2520 vty_out (vty
, "%% Can't find address%s", VTY_NEWLINE
);
2524 /* This is not configured address. */
2525 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
))
2528 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
);
2530 /* This is not real address or interface is not active. */
2531 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
)
2532 || ! CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
))
2534 listnode_delete (ifp
->connected
, ifc
);
2535 connected_free (ifc
);
2539 /* This is real route. */
2540 ret
= if_unset_prefix (ifp
, ifc
);
2543 vty_out (vty
, "%% Can't unset interface IP address: %s.%s",
2544 safe_strerror(errno
), VTY_NEWLINE
);
2547 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
2548 /* we will receive a kernel notification about this route being removed.
2549 * this will trigger its removal from the connected list. */
2555 "ip address A.B.C.D/M",
2556 "Interface Internet Protocol config commands\n"
2557 "Set the IP address of an interface\n"
2558 "IP address (e.g. 10.0.0.1/8)\n")
2560 return ip_address_install (vty
, vty
->index
, argv
[0], NULL
, NULL
);
2563 DEFUN (no_ip_address
,
2565 "no ip address A.B.C.D/M",
2567 "Interface Internet Protocol config commands\n"
2568 "Set the IP address of an interface\n"
2569 "IP Address (e.g. 10.0.0.1/8)")
2571 return ip_address_uninstall (vty
, vty
->index
, argv
[0], NULL
, NULL
);
2576 DEFUN (ip_address_label
,
2577 ip_address_label_cmd
,
2578 "ip address A.B.C.D/M label LINE",
2579 "Interface Internet Protocol config commands\n"
2580 "Set the IP address of an interface\n"
2581 "IP address (e.g. 10.0.0.1/8)\n"
2582 "Label of this address\n"
2585 return ip_address_install (vty
, vty
->index
, argv
[0], NULL
, argv
[1]);
2588 DEFUN (no_ip_address_label
,
2589 no_ip_address_label_cmd
,
2590 "no ip address A.B.C.D/M label LINE",
2592 "Interface Internet Protocol config commands\n"
2593 "Set the IP address of an interface\n"
2594 "IP address (e.g. 10.0.0.1/8)\n"
2595 "Label of this address\n"
2598 return ip_address_uninstall (vty
, vty
->index
, argv
[0], NULL
, argv
[1]);
2600 #endif /* HAVE_NETLINK */
2604 ipv6_address_install (struct vty
*vty
, struct interface
*ifp
,
2605 const char *addr_str
, const char *peer_str
,
2606 const char *label
, int secondary
)
2608 struct zebra_if
*if_data
;
2609 struct prefix_ipv6 cp
;
2610 struct connected
*ifc
;
2611 struct prefix_ipv6
*p
;
2614 if_data
= ifp
->info
;
2616 ret
= str2prefix_ipv6 (addr_str
, &cp
);
2619 vty_out (vty
, "%% Malformed address %s", VTY_NEWLINE
);
2623 if (ipv6_martian(&cp
.prefix
))
2625 vty_out (vty
, "%% Invalid address%s", VTY_NEWLINE
);
2629 ifc
= connected_check (ifp
, (struct prefix
*) &cp
);
2632 ifc
= connected_new ();
2636 p
= prefix_ipv6_new ();
2638 ifc
->address
= (struct prefix
*) p
;
2642 SET_FLAG (ifc
->flags
, ZEBRA_IFA_SECONDARY
);
2646 ifc
->label
= XSTRDUP (MTYPE_CONNECTED_LABEL
, label
);
2648 /* Add to linked list. */
2649 listnode_add (ifp
->connected
, ifc
);
2652 /* This address is configured from zebra. */
2653 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
))
2654 SET_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
);
2656 /* In case of this route need to install kernel. */
2657 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
)
2658 && CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
)
2659 && !(if_data
&& if_data
->shutdown
== IF_ZEBRA_SHUTDOWN_ON
))
2661 /* Some system need to up the interface to set IP address. */
2662 if (! if_is_up (ifp
))
2664 if_set_flags (ifp
, IFF_UP
| IFF_RUNNING
);
2668 ret
= if_prefix_add_ipv6 (ifp
, ifc
);
2672 vty_out (vty
, "%% Can't set interface IP address: %s.%s",
2673 safe_strerror(errno
), VTY_NEWLINE
);
2677 SET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
2678 /* The address will be advertised to zebra clients when the notification
2679 * from the kernel has been received. */
2685 /* Return true if an ipv6 address is configured on ifp */
2687 ipv6_address_configured (struct interface
*ifp
)
2689 struct connected
*connected
;
2690 struct listnode
*node
;
2692 for (ALL_LIST_ELEMENTS_RO (ifp
->connected
, node
, connected
))
2693 if (CHECK_FLAG (connected
->conf
, ZEBRA_IFC_REAL
) && (connected
->address
->family
== AF_INET6
))
2700 ipv6_address_uninstall (struct vty
*vty
, struct interface
*ifp
,
2701 const char *addr_str
, const char *peer_str
,
2702 const char *label
, int secondry
)
2704 struct prefix_ipv6 cp
;
2705 struct connected
*ifc
;
2708 /* Convert to prefix structure. */
2709 ret
= str2prefix_ipv6 (addr_str
, &cp
);
2712 vty_out (vty
, "%% Malformed address %s", VTY_NEWLINE
);
2716 /* Check current interface address. */
2717 ifc
= connected_check (ifp
, (struct prefix
*) &cp
);
2720 vty_out (vty
, "%% Can't find address%s", VTY_NEWLINE
);
2724 /* This is not configured address. */
2725 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
))
2728 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
);
2730 /* This is not real address or interface is not active. */
2731 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
)
2732 || ! CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
))
2734 listnode_delete (ifp
->connected
, ifc
);
2735 connected_free (ifc
);
2739 /* This is real route. */
2740 ret
= if_prefix_delete_ipv6 (ifp
, ifc
);
2743 vty_out (vty
, "%% Can't unset interface IP address: %s.%s",
2744 safe_strerror(errno
), VTY_NEWLINE
);
2748 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
2749 /* This information will be propagated to the zclients when the
2750 * kernel notification is received. */
2754 DEFUN (ipv6_address
,
2756 "ipv6 address X:X::X:X/M",
2757 "Interface IPv6 config commands\n"
2758 "Set the IP address of an interface\n"
2759 "IPv6 address (e.g. 3ffe:506::1/48)\n")
2761 return ipv6_address_install (vty
, vty
->index
, argv
[0], NULL
, NULL
, 0);
2764 DEFUN (no_ipv6_address
,
2765 no_ipv6_address_cmd
,
2766 "no ipv6 address X:X::X:X/M",
2768 "Interface IPv6 config commands\n"
2769 "Set the IP address of an interface\n"
2770 "IPv6 address (e.g. 3ffe:506::1/48)\n")
2772 return ipv6_address_uninstall (vty
, vty
->index
, argv
[0], NULL
, NULL
, 0);
2774 #endif /* HAVE_IPV6 */
2777 link_params_config_write (struct vty
*vty
, struct interface
*ifp
)
2781 if ((ifp
== NULL
) || !HAS_LINK_PARAMS(ifp
))
2784 struct if_link_params
*iflp
= ifp
->link_params
;
2786 vty_out (vty
, " link-params%s", VTY_NEWLINE
);
2787 vty_out(vty
, " enable%s", VTY_NEWLINE
);
2788 if (IS_PARAM_SET(iflp
, LP_TE
))
2789 vty_out(vty
, " metric %u%s",iflp
->te_metric
, VTY_NEWLINE
);
2790 if (IS_PARAM_SET(iflp
, LP_MAX_BW
))
2791 vty_out(vty
, " max-bw %g%s", iflp
->max_bw
, VTY_NEWLINE
);
2792 if (IS_PARAM_SET(iflp
, LP_MAX_RSV_BW
))
2793 vty_out(vty
, " max-rsv-bw %g%s", iflp
->max_rsv_bw
, VTY_NEWLINE
);
2794 if (IS_PARAM_SET(iflp
, LP_UNRSV_BW
))
2796 for (i
= 0; i
< 8; i
++)
2797 vty_out(vty
, " unrsv-bw %d %g%s",
2798 i
, iflp
->unrsv_bw
[i
], VTY_NEWLINE
);
2800 if (IS_PARAM_SET(iflp
, LP_ADM_GRP
))
2801 vty_out(vty
, " admin-grp %u%s", iflp
->admin_grp
, VTY_NEWLINE
);
2802 if (IS_PARAM_SET(iflp
, LP_DELAY
))
2804 vty_out(vty
, " delay %u", iflp
->av_delay
);
2805 if (IS_PARAM_SET(iflp
, LP_MM_DELAY
))
2807 vty_out(vty
, " min %u", iflp
->min_delay
);
2808 vty_out(vty
, " max %u", iflp
->max_delay
);
2810 vty_out(vty
, "%s", VTY_NEWLINE
);
2812 if (IS_PARAM_SET(iflp
, LP_DELAY_VAR
))
2813 vty_out(vty
, " delay-variation %u%s", iflp
->delay_var
, VTY_NEWLINE
);
2814 if (IS_PARAM_SET(iflp
, LP_PKT_LOSS
))
2815 vty_out(vty
, " packet-loss %g%s", iflp
->pkt_loss
, VTY_NEWLINE
);
2816 if (IS_PARAM_SET(iflp
, LP_AVA_BW
))
2817 vty_out(vty
, " ava-bw %g%s", iflp
->ava_bw
, VTY_NEWLINE
);
2818 if (IS_PARAM_SET(iflp
, LP_RES_BW
))
2819 vty_out(vty
, " res-bw %g%s", iflp
->res_bw
, VTY_NEWLINE
);
2820 if (IS_PARAM_SET(iflp
, LP_USE_BW
))
2821 vty_out(vty
, " use-bw %g%s", iflp
->use_bw
, VTY_NEWLINE
);
2822 if (IS_PARAM_SET(iflp
, LP_RMT_AS
))
2823 vty_out(vty
, " neighbor %s as %u%s", inet_ntoa(iflp
->rmt_ip
),
2824 iflp
->rmt_as
, VTY_NEWLINE
);
2829 if_config_write (struct vty
*vty
)
2831 struct listnode
*node
;
2832 struct interface
*ifp
;
2835 zebra_ptm_write (vty
);
2837 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
2838 for (ALL_LIST_ELEMENTS_RO (vrf_iter2iflist (iter
), node
, ifp
))
2840 struct zebra_if
*if_data
;
2841 struct listnode
*addrnode
;
2842 struct connected
*ifc
;
2846 if_data
= ifp
->info
;
2847 vrf
= vrf_lookup(ifp
->vrf_id
);
2849 if (ifp
->vrf_id
== VRF_DEFAULT
)
2850 vty_out (vty
, "interface %s%s", ifp
->name
, VTY_NEWLINE
);
2852 vty_out (vty
, "interface %s vrf %s%s", ifp
->name
, vrf
->name
,
2857 if (if_data
->shutdown
== IF_ZEBRA_SHUTDOWN_ON
)
2858 vty_out (vty
, " shutdown%s", VTY_NEWLINE
);
2860 zebra_ptm_if_write(vty
, if_data
);
2864 vty_out (vty
, " description %s%s", ifp
->desc
,
2867 /* Assign bandwidth here to avoid unnecessary interface flap
2868 while processing config script */
2869 if (ifp
->bandwidth
!= 0)
2870 vty_out(vty
, " bandwidth %u%s", ifp
->bandwidth
, VTY_NEWLINE
);
2872 if (!CHECK_FLAG(ifp
->status
, ZEBRA_INTERFACE_LINKDETECTION
))
2873 vty_out(vty
, " no link-detect%s", VTY_NEWLINE
);
2875 for (ALL_LIST_ELEMENTS_RO (ifp
->connected
, addrnode
, ifc
))
2877 if (CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
))
2879 char buf
[INET6_ADDRSTRLEN
];
2881 vty_out (vty
, " ip%s address %s",
2882 p
->family
== AF_INET
? "" : "v6",
2883 prefix2str (p
, buf
, sizeof(buf
)));
2886 vty_out (vty
, " label %s", ifc
->label
);
2888 vty_out (vty
, "%s", VTY_NEWLINE
);
2894 if (if_data
->multicast
!= IF_ZEBRA_MULTICAST_UNSPEC
)
2895 vty_out (vty
, " %smulticast%s",
2896 if_data
->multicast
== IF_ZEBRA_MULTICAST_ON
? "" : "no ",
2900 #if defined (HAVE_RTADV)
2901 rtadv_config_write (vty
, ifp
);
2902 #endif /* HAVE_RTADV */
2905 irdp_config_write (vty
, ifp
);
2908 link_params_config_write (vty
, ifp
);
2910 vty_out (vty
, "!%s", VTY_NEWLINE
);
2916 vrf_config_write (struct vty
*vty
)
2918 struct listnode
*node
;
2919 struct zebra_vrf
*zvrf
;
2921 for (ALL_LIST_ELEMENTS_RO (zvrf_list
, node
, zvrf
))
2923 if (strcmp(zvrf
->name
, VRF_DEFAULT_NAME
))
2925 vty_out (vty
, "vrf %s%s", zvrf
->name
, VTY_NEWLINE
);
2926 vty_out (vty
, "!%s", VTY_NEWLINE
);
2932 /* Allocate and initialize interface vector. */
2934 zebra_if_init (void)
2936 /* Initialize interface and new hook. */
2937 if_add_hook (IF_NEW_HOOK
, if_zebra_new_hook
);
2938 if_add_hook (IF_DELETE_HOOK
, if_zebra_delete_hook
);
2940 /* Install configuration write function. */
2941 install_node (&interface_node
, if_config_write
);
2942 install_node (&link_params_node
, NULL
);
2943 install_node (&vrf_node
, vrf_config_write
);
2945 install_element (VIEW_NODE
, &show_interface_cmd
);
2946 install_element (VIEW_NODE
, &show_interface_vrf_cmd
);
2947 install_element (VIEW_NODE
, &show_interface_vrf_all_cmd
);
2948 install_element (VIEW_NODE
, &show_interface_name_cmd
);
2949 install_element (VIEW_NODE
, &show_interface_name_vrf_cmd
);
2950 install_element (VIEW_NODE
, &show_interface_name_vrf_all_cmd
);
2951 install_element (ENABLE_NODE
, &show_interface_cmd
);
2952 install_element (ENABLE_NODE
, &show_interface_vrf_cmd
);
2953 install_element (ENABLE_NODE
, &show_interface_vrf_all_cmd
);
2954 install_element (ENABLE_NODE
, &show_interface_name_cmd
);
2955 install_element (ENABLE_NODE
, &show_interface_name_vrf_cmd
);
2956 install_element (ENABLE_NODE
, &show_interface_name_vrf_all_cmd
);
2957 install_element (ENABLE_NODE
, &show_interface_desc_cmd
);
2958 install_element (ENABLE_NODE
, &show_interface_desc_vrf_cmd
);
2959 install_element (ENABLE_NODE
, &show_interface_desc_vrf_all_cmd
);
2960 install_element (CONFIG_NODE
, &zebra_interface_cmd
);
2961 install_element (CONFIG_NODE
, &zebra_interface_vrf_cmd
);
2962 install_element (CONFIG_NODE
, &no_interface_cmd
);
2963 install_element (CONFIG_NODE
, &no_interface_vrf_cmd
);
2964 install_default (INTERFACE_NODE
);
2965 install_element (INTERFACE_NODE
, &interface_desc_cmd
);
2966 install_element (INTERFACE_NODE
, &no_interface_desc_cmd
);
2967 install_element (INTERFACE_NODE
, &multicast_cmd
);
2968 install_element (INTERFACE_NODE
, &no_multicast_cmd
);
2969 install_element (INTERFACE_NODE
, &linkdetect_cmd
);
2970 install_element (INTERFACE_NODE
, &no_linkdetect_cmd
);
2971 install_element (INTERFACE_NODE
, &shutdown_if_cmd
);
2972 install_element (INTERFACE_NODE
, &no_shutdown_if_cmd
);
2973 install_element (INTERFACE_NODE
, &bandwidth_if_cmd
);
2974 install_element (INTERFACE_NODE
, &no_bandwidth_if_cmd
);
2975 install_element (INTERFACE_NODE
, &no_bandwidth_if_val_cmd
);
2976 install_element (INTERFACE_NODE
, &ip_address_cmd
);
2977 install_element (INTERFACE_NODE
, &no_ip_address_cmd
);
2979 install_element (INTERFACE_NODE
, &ipv6_address_cmd
);
2980 install_element (INTERFACE_NODE
, &no_ipv6_address_cmd
);
2981 #endif /* HAVE_IPV6 */
2983 install_element (INTERFACE_NODE
, &ip_address_label_cmd
);
2984 install_element (INTERFACE_NODE
, &no_ip_address_label_cmd
);
2985 #endif /* HAVE_NETLINK */
2986 install_element(INTERFACE_NODE
, &link_params_cmd
);
2987 install_default(LINK_PARAMS_NODE
);
2988 install_element(LINK_PARAMS_NODE
, &link_params_enable_cmd
);
2989 install_element(LINK_PARAMS_NODE
, &no_link_params_enable_cmd
);
2990 install_element(LINK_PARAMS_NODE
, &link_params_metric_cmd
);
2991 install_element(LINK_PARAMS_NODE
, &link_params_maxbw_cmd
);
2992 install_element(LINK_PARAMS_NODE
, &link_params_max_rsv_bw_cmd
);
2993 install_element(LINK_PARAMS_NODE
, &link_params_unrsv_bw_cmd
);
2994 install_element(LINK_PARAMS_NODE
, &link_params_admin_grp_cmd
);
2995 install_element(LINK_PARAMS_NODE
, &link_params_inter_as_cmd
);
2996 install_element(LINK_PARAMS_NODE
, &no_link_params_inter_as_cmd
);
2997 install_element(LINK_PARAMS_NODE
, &link_params_delay_cmd
);
2998 install_element(LINK_PARAMS_NODE
, &link_params_delay_mm_cmd
);
2999 install_element(LINK_PARAMS_NODE
, &link_params_delay_var_cmd
);
3000 install_element(LINK_PARAMS_NODE
, &link_params_pkt_loss_cmd
);
3001 install_element(LINK_PARAMS_NODE
, &link_params_ava_bw_cmd
);
3002 install_element(LINK_PARAMS_NODE
, &link_params_res_bw_cmd
);
3003 install_element(LINK_PARAMS_NODE
, &link_params_use_bw_cmd
);
3005 install_element (CONFIG_NODE
, &zebra_vrf_cmd
);
3006 install_element (CONFIG_NODE
, &no_vrf_cmd
);
3007 install_default (VRF_NODE
);