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")
1237 /* Call lib interface() */
1238 if ((ret
= interface_cmd
.func (self
, vty
, argc
, argv
)) != CMD_SUCCESS
)
1241 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1243 if (ifp
->ifindex
== IFINDEX_INTERNAL
)
1244 /* Is this really necessary? Shouldn't status be initialized to 0
1246 UNSET_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
);
1252 interface_update_stats (void)
1254 #ifdef HAVE_PROC_NET_DEV
1255 /* If system has interface statistics via proc file system, update
1257 ifstat_update_proc ();
1258 #endif /* HAVE_PROC_NET_DEV */
1259 #ifdef HAVE_NET_RT_IFLIST
1260 ifstat_update_sysctl ();
1261 #endif /* HAVE_NET_RT_IFLIST */
1264 struct cmd_node interface_node
=
1271 /* Wrapper hook point for zebra daemon so that ifindex can be set
1272 * DEFUN macro not used as extract.pl HAS to ignore this
1273 * See also interface_cmd in lib/if.c
1275 DEFUN_NOSH (zebra_vrf
,
1278 "Select a VRF to configure\n"
1281 // VTY_DECLVAR_CONTEXT (vrf, vrfp);
1284 /* Call lib vrf() */
1285 if ((ret
= vrf_cmd
.func (self
, vty
, argc
, argv
)) != CMD_SUCCESS
)
1291 struct cmd_node vrf_node
=
1298 /* Show all interfaces to vty. */
1299 DEFUN (show_interface
,
1301 "show interface [vrf NAME]",
1303 "Interface status and configuration\n"
1306 struct listnode
*node
;
1307 struct interface
*ifp
;
1308 vrf_id_t vrf_id
= VRF_DEFAULT
;
1310 interface_update_stats ();
1313 VRF_GET_ID (vrf_id
, argv
[3]->arg
);
1315 /* All interface print. */
1316 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (vrf_id
), node
, ifp
))
1317 if_dump_vty (vty
, ifp
);
1323 /* Show all interfaces to vty. */
1324 DEFUN (show_interface_vrf_all
,
1325 show_interface_vrf_all_cmd
,
1326 "show interface vrf all",
1328 "Interface status and configuration\n"
1329 VRF_ALL_CMD_HELP_STR
)
1331 struct listnode
*node
;
1332 struct interface
*ifp
;
1335 interface_update_stats ();
1337 /* All interface print. */
1338 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
1339 for (ALL_LIST_ELEMENTS_RO (vrf_iter2iflist (iter
), node
, ifp
))
1340 if_dump_vty (vty
, ifp
);
1345 /* Show specified interface to vty. */
1347 DEFUN (show_interface_name_vrf
,
1348 show_interface_name_vrf_cmd
,
1349 "show interface IFNAME vrf NAME",
1351 "Interface status and configuration\n"
1357 struct interface
*ifp
;
1358 vrf_id_t vrf_id
= VRF_DEFAULT
;
1360 interface_update_stats ();
1362 VRF_GET_ID (vrf_id
, argv
[idx_name
]->arg
);
1364 /* Specified interface print. */
1365 ifp
= if_lookup_by_name_vrf (argv
[idx_ifname
]->arg
, vrf_id
);
1368 vty_out (vty
, "%% Can't find interface %s%s", argv
[idx_ifname
]->arg
,
1372 if_dump_vty (vty
, ifp
);
1377 /* Show specified interface to vty. */
1378 DEFUN (show_interface_name_vrf_all
,
1379 show_interface_name_vrf_all_cmd
,
1380 "show interface IFNAME [vrf all]",
1382 "Interface status and configuration\n"
1384 VRF_ALL_CMD_HELP_STR
)
1387 struct interface
*ifp
;
1391 interface_update_stats ();
1393 /* All interface print. */
1394 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
1396 /* Specified interface print. */
1397 ifp
= if_lookup_by_name_vrf (argv
[idx_ifname
]->arg
, vrf_iter2id (iter
));
1400 if_dump_vty (vty
, ifp
);
1407 vty_out (vty
, "%% Can't find interface %s%s", argv
[idx_ifname
]->arg
, VTY_NEWLINE
);
1416 if_show_description (struct vty
*vty
, vrf_id_t vrf_id
)
1418 struct listnode
*node
;
1419 struct interface
*ifp
;
1421 vty_out (vty
, "Interface Status Protocol Description%s", VTY_NEWLINE
);
1422 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (vrf_id
), node
, ifp
))
1426 len
= vty_out (vty
, "%s", ifp
->name
);
1427 vty_out (vty
, "%*s", (16 - len
), " ");
1431 vty_out (vty
, "up ");
1432 if (CHECK_FLAG(ifp
->status
, ZEBRA_INTERFACE_LINKDETECTION
))
1434 if (if_is_running(ifp
))
1435 vty_out (vty
, "up ");
1437 vty_out (vty
, "down ");
1441 vty_out (vty
, "unknown ");
1446 vty_out (vty
, "down down ");
1450 vty_out (vty
, "%s", ifp
->desc
);
1451 vty_out (vty
, "%s", VTY_NEWLINE
);
1455 DEFUN (show_interface_desc
,
1456 show_interface_desc_cmd
,
1457 "show interface description [vrf NAME]",
1459 "Interface status and configuration\n"
1460 "Interface description\n"
1463 vrf_id_t vrf_id
= VRF_DEFAULT
;
1466 VRF_GET_ID (vrf_id
, argv
[4]->arg
);
1468 if_show_description (vty
, vrf_id
);
1474 DEFUN (show_interface_desc_vrf_all
,
1475 show_interface_desc_vrf_all_cmd
,
1476 "show interface description vrf all",
1478 "Interface status and configuration\n"
1479 "Interface description\n"
1480 VRF_ALL_CMD_HELP_STR
)
1484 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
1485 if (!list_isempty (vrf_iter2iflist (iter
)))
1487 vty_out (vty
, "%s\tVRF %u%s%s", VTY_NEWLINE
,
1489 VTY_NEWLINE
, VTY_NEWLINE
);
1490 if_show_description (vty
, vrf_iter2id (iter
));
1499 "Set multicast flag to interface\n")
1501 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1503 struct zebra_if
*if_data
;
1505 if (CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
))
1507 ret
= if_set_flags (ifp
, IFF_MULTICAST
);
1510 vty_out (vty
, "Can't set multicast flag%s", VTY_NEWLINE
);
1515 if_data
= ifp
->info
;
1516 if_data
->multicast
= IF_ZEBRA_MULTICAST_ON
;
1521 DEFUN (no_multicast
,
1525 "Unset multicast flag to interface\n")
1527 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1529 struct zebra_if
*if_data
;
1531 if (CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
))
1533 ret
= if_unset_flags (ifp
, IFF_MULTICAST
);
1536 vty_out (vty
, "Can't unset multicast flag%s", VTY_NEWLINE
);
1541 if_data
= ifp
->info
;
1542 if_data
->multicast
= IF_ZEBRA_MULTICAST_OFF
;
1550 "Enable link detection on interface\n")
1552 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1553 int if_was_operative
;
1555 if_was_operative
= if_is_no_ptm_operative(ifp
);
1556 SET_FLAG(ifp
->status
, ZEBRA_INTERFACE_LINKDETECTION
);
1558 /* When linkdetection is enabled, if might come down */
1559 if (!if_is_no_ptm_operative(ifp
) && if_was_operative
) if_down(ifp
);
1561 /* FIXME: Will defer status change forwarding if interface
1562 does not come down! */
1568 DEFUN (no_linkdetect
,
1572 "Disable link detection on interface\n")
1574 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1575 int if_was_operative
;
1577 if_was_operative
= if_is_no_ptm_operative(ifp
);
1578 UNSET_FLAG(ifp
->status
, ZEBRA_INTERFACE_LINKDETECTION
);
1580 /* Interface may come up after disabling link detection */
1581 if (if_is_operative(ifp
) && !if_was_operative
) if_up(ifp
);
1583 /* FIXME: see linkdetect_cmd */
1591 "Shutdown the selected interface\n")
1593 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1595 struct zebra_if
*if_data
;
1597 if (ifp
->ifindex
!= IFINDEX_INTERNAL
)
1599 ret
= if_unset_flags (ifp
, IFF_UP
);
1602 vty_out (vty
, "Can't shutdown interface%s", VTY_NEWLINE
);
1607 if_data
= ifp
->info
;
1608 if_data
->shutdown
= IF_ZEBRA_SHUTDOWN_ON
;
1613 DEFUN (no_shutdown_if
,
1617 "Shutdown the selected interface\n")
1619 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1621 struct zebra_if
*if_data
;
1623 if (ifp
->ifindex
!= IFINDEX_INTERNAL
)
1625 ret
= if_set_flags (ifp
, IFF_UP
| IFF_RUNNING
);
1628 vty_out (vty
, "Can't up interface%s", VTY_NEWLINE
);
1633 /* Some addresses (in particular, IPv6 addresses on Linux) get
1634 * removed when the interface goes down. They need to be readded.
1636 if_addr_wakeup(ifp
);
1639 if_data
= ifp
->info
;
1640 if_data
->shutdown
= IF_ZEBRA_SHUTDOWN_OFF
;
1645 DEFUN (bandwidth_if
,
1647 "bandwidth (1-100000)",
1648 "Set bandwidth informational parameter\n"
1649 "Bandwidth in megabits\n")
1652 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1653 unsigned int bandwidth
;
1655 bandwidth
= strtol(argv
[idx_number
]->arg
, NULL
, 10);
1657 /* bandwidth range is <1-100000> */
1658 if (bandwidth
< 1 || bandwidth
> 100000)
1660 vty_out (vty
, "Bandwidth is invalid%s", VTY_NEWLINE
);
1664 ifp
->bandwidth
= bandwidth
;
1666 /* force protocols to recalculate routes due to cost change */
1667 if (if_is_operative (ifp
))
1668 zebra_interface_up_update (ifp
);
1673 DEFUN (no_bandwidth_if
,
1674 no_bandwidth_if_cmd
,
1675 "no bandwidth [(1-100000)]",
1677 "Set bandwidth informational parameter\n"
1678 "Bandwidth in megabits\n")
1680 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1684 /* force protocols to recalculate routes due to cost change */
1685 if (if_is_operative (ifp
))
1686 zebra_interface_up_update (ifp
);
1692 struct cmd_node link_params_node
=
1695 "%s(config-link-params)# ",
1700 link_param_cmd_set_uint32 (struct interface
*ifp
, uint32_t *field
,
1701 uint32_t type
, uint32_t value
)
1703 /* Update field as needed */
1704 if (IS_PARAM_UNSET(ifp
->link_params
, type
) || *field
!= value
)
1707 SET_PARAM(ifp
->link_params
, type
);
1709 /* force protocols to update LINK STATE due to parameters change */
1710 if (if_is_operative (ifp
))
1711 zebra_interface_parameters_update (ifp
);
1715 link_param_cmd_set_float (struct interface
*ifp
, float *field
,
1716 uint32_t type
, float value
)
1719 /* Update field as needed */
1720 if (IS_PARAM_UNSET(ifp
->link_params
, type
) || *field
!= value
)
1723 SET_PARAM(ifp
->link_params
, type
);
1725 /* force protocols to update LINK STATE due to parameters change */
1726 if (if_is_operative (ifp
))
1727 zebra_interface_parameters_update (ifp
);
1732 link_param_cmd_unset (struct interface
*ifp
, uint32_t type
)
1736 UNSET_PARAM(ifp
->link_params
, type
);
1738 /* force protocols to update LINK STATE due to parameters change */
1739 if (if_is_operative (ifp
))
1740 zebra_interface_parameters_update (ifp
);
1748 /* vty->qobj_index stays the same @ interface pointer */
1749 vty
->node
= LINK_PARAMS_NODE
;
1754 /* Specific Traffic Engineering parameters commands */
1755 DEFUN (link_params_enable
,
1756 link_params_enable_cmd
,
1758 "Activate link parameters on this interface\n")
1760 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1762 /* This command could be issue at startup, when activate MPLS TE */
1763 /* on a new interface or after a ON / OFF / ON toggle */
1764 /* In all case, TE parameters are reset to their default factory */
1765 if (IS_ZEBRA_DEBUG_EVENT
)
1766 zlog_debug ("Link-params: enable TE link parameters on interface %s", ifp
->name
);
1768 if (!if_link_params_get (ifp
))
1770 if (IS_ZEBRA_DEBUG_EVENT
)
1771 zlog_debug ("Link-params: failed to init TE link parameters %s", ifp
->name
);
1776 /* force protocols to update LINK STATE due to parameters change */
1777 if (if_is_operative (ifp
))
1778 zebra_interface_parameters_update (ifp
);
1783 DEFUN (no_link_params_enable
,
1784 no_link_params_enable_cmd
,
1787 "Disable link parameters on this interface\n")
1789 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1791 zlog_debug ("MPLS-TE: disable TE link parameters on interface %s", ifp
->name
);
1793 if_link_params_free (ifp
);
1795 /* force protocols to update LINK STATE due to parameters change */
1796 if (if_is_operative (ifp
))
1797 zebra_interface_parameters_update (ifp
);
1802 /* STANDARD TE metrics */
1803 DEFUN (link_params_metric
,
1804 link_params_metric_cmd
,
1805 "metric (0-4294967295)",
1806 "Link metric for MPLS-TE purpose\n"
1807 "Metric value in decimal\n")
1810 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1811 struct if_link_params
*iflp
= if_link_params_get (ifp
);
1814 VTY_GET_ULONG("metric", metric
, argv
[idx_number
]->arg
);
1816 /* Update TE metric if needed */
1817 link_param_cmd_set_uint32 (ifp
, &iflp
->te_metric
, LP_TE
, metric
);
1822 DEFUN (no_link_params_metric
,
1823 no_link_params_metric_cmd
,
1826 "Disable Link Metric on this interface\n")
1828 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1830 /* Unset TE Metric */
1831 link_param_cmd_unset(ifp
, LP_TE
);
1836 DEFUN (link_params_maxbw
,
1837 link_params_maxbw_cmd
,
1839 "Maximum bandwidth that can be used\n"
1840 "Bytes/second (IEEE floating point format)\n")
1842 int idx_bandwidth
= 1;
1843 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1844 struct if_link_params
*iflp
= if_link_params_get (ifp
);
1848 if (sscanf (argv
[idx_bandwidth
]->arg
, "%g", &bw
) != 1)
1850 vty_out (vty
, "link_params_maxbw: fscanf: %s%s", safe_strerror (errno
),
1855 /* Check that Maximum bandwidth is not lower than other bandwidth parameters */
1856 if ((bw
<= iflp
->max_rsv_bw
)
1857 || (bw
<= iflp
->unrsv_bw
[0])
1858 || (bw
<= iflp
->unrsv_bw
[1])
1859 || (bw
<= iflp
->unrsv_bw
[2])
1860 || (bw
<= iflp
->unrsv_bw
[3])
1861 || (bw
<= iflp
->unrsv_bw
[4])
1862 || (bw
<= iflp
->unrsv_bw
[5])
1863 || (bw
<= iflp
->unrsv_bw
[6])
1864 || (bw
<= iflp
->unrsv_bw
[7])
1865 || (bw
<= iflp
->ava_bw
)
1866 || (bw
<= iflp
->res_bw
)
1867 || (bw
<= iflp
->use_bw
))
1870 "Maximum Bandwidth could not be lower than others bandwidth%s",
1875 /* Update Maximum Bandwidth if needed */
1876 link_param_cmd_set_float (ifp
, &iflp
->max_bw
, LP_MAX_BW
, bw
);
1881 DEFUN (link_params_max_rsv_bw
,
1882 link_params_max_rsv_bw_cmd
,
1883 "max-rsv-bw BANDWIDTH",
1884 "Maximum bandwidth that may be reserved\n"
1885 "Bytes/second (IEEE floating point format)\n")
1887 int idx_bandwidth
= 1;
1888 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1889 struct if_link_params
*iflp
= if_link_params_get (ifp
);
1892 if (sscanf (argv
[idx_bandwidth
]->arg
, "%g", &bw
) != 1)
1894 vty_out (vty
, "link_params_max_rsv_bw: fscanf: %s%s", safe_strerror (errno
),
1899 /* Check that bandwidth is not greater than maximum bandwidth parameter */
1900 if (bw
> iflp
->max_bw
)
1903 "Maximum Reservable Bandwidth could not be greater than Maximum Bandwidth (%g)%s",
1904 iflp
->max_bw
, VTY_NEWLINE
);
1908 /* Update Maximum Reservable Bandwidth if needed */
1909 link_param_cmd_set_float (ifp
, &iflp
->max_rsv_bw
, LP_MAX_RSV_BW
, bw
);
1914 DEFUN (link_params_unrsv_bw
,
1915 link_params_unrsv_bw_cmd
,
1916 "unrsv-bw (0-7) BANDWIDTH",
1917 "Unreserved bandwidth at each priority level\n"
1919 "Bytes/second (IEEE floating point format)\n")
1922 int idx_bandwidth
= 2;
1923 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1924 struct if_link_params
*iflp
= if_link_params_get (ifp
);
1928 /* We don't have to consider about range check here. */
1929 if (sscanf (argv
[idx_number
]->arg
, "%d", &priority
) != 1)
1931 vty_out (vty
, "link_params_unrsv_bw: fscanf: %s%s", safe_strerror (errno
),
1936 if (sscanf (argv
[idx_bandwidth
]->arg
, "%g", &bw
) != 1)
1938 vty_out (vty
, "link_params_unrsv_bw: fscanf: %s%s", safe_strerror (errno
),
1943 /* Check that bandwidth is not greater than maximum bandwidth parameter */
1944 if (bw
> iflp
->max_bw
)
1947 "UnReserved Bandwidth could not be greater than Maximum Bandwidth (%g)%s",
1948 iflp
->max_bw
, VTY_NEWLINE
);
1952 /* Update Unreserved Bandwidth if needed */
1953 link_param_cmd_set_float (ifp
, &iflp
->unrsv_bw
[priority
], LP_UNRSV_BW
, bw
);
1958 DEFUN (link_params_admin_grp
,
1959 link_params_admin_grp_cmd
,
1960 "admin-grp BITPATTERN",
1961 "Administrative group membership\n"
1962 "32-bit Hexadecimal value (e.g. 0xa1)\n")
1964 int idx_bitpattern
= 1;
1965 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1966 struct if_link_params
*iflp
= if_link_params_get (ifp
);
1967 unsigned long value
;
1969 if (sscanf (argv
[idx_bitpattern
]->arg
, "0x%lx", &value
) != 1)
1971 vty_out (vty
, "link_params_admin_grp: fscanf: %s%s",
1972 safe_strerror (errno
), VTY_NEWLINE
);
1976 /* Update Administrative Group if needed */
1977 link_param_cmd_set_uint32 (ifp
, &iflp
->admin_grp
, LP_ADM_GRP
, value
);
1982 DEFUN (no_link_params_admin_grp
,
1983 no_link_params_admin_grp_cmd
,
1986 "Disable Administrative group membership on this interface\n")
1988 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1990 /* Unset Admin Group */
1991 link_param_cmd_unset(ifp
, LP_ADM_GRP
);
1996 /* RFC5392 & RFC5316: INTER-AS */
1997 DEFUN (link_params_inter_as
,
1998 link_params_inter_as_cmd
,
1999 "neighbor A.B.C.D as (1-4294967295)",
2000 "Configure remote ASBR information (Neighbor IP address and AS number)\n"
2001 "Remote IP address in dot decimal A.B.C.D\n"
2002 "Remote AS number\n"
2003 "AS number in the range <1-4294967295>\n")
2008 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2009 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2010 struct in_addr addr
;
2013 if (!inet_aton (argv
[idx_ipv4
]->arg
, &addr
))
2015 vty_out (vty
, "Please specify Router-Addr by A.B.C.D%s", VTY_NEWLINE
);
2019 VTY_GET_ULONG("AS number", as
, argv
[idx_number
]->arg
);
2021 /* Update Remote IP and Remote AS fields if needed */
2022 if (IS_PARAM_UNSET(iflp
, LP_RMT_AS
)
2023 || iflp
->rmt_as
!= as
2024 || iflp
->rmt_ip
.s_addr
!= addr
.s_addr
)
2028 iflp
->rmt_ip
.s_addr
= addr
.s_addr
;
2029 SET_PARAM(iflp
, LP_RMT_AS
);
2031 /* force protocols to update LINK STATE due to parameters change */
2032 if (if_is_operative (ifp
))
2033 zebra_interface_parameters_update (ifp
);
2038 DEFUN (no_link_params_inter_as
,
2039 no_link_params_inter_as_cmd
,
2042 "Remove Neighbor IP address and AS number for Inter-AS TE\n")
2044 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2045 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2047 /* Reset Remote IP and AS neighbor */
2049 iflp
->rmt_ip
.s_addr
= 0;
2050 UNSET_PARAM(iflp
, LP_RMT_AS
);
2052 /* force protocols to update LINK STATE due to parameters change */
2053 if (if_is_operative (ifp
))
2054 zebra_interface_parameters_update (ifp
);
2059 /* RFC7471: OSPF Traffic Engineering (TE) Metric extensions & draft-ietf-isis-metric-extensions-07.txt */
2060 DEFUN (link_params_delay
,
2061 link_params_delay_cmd
,
2062 "delay (0-16777215) [min (0-16777215) max (0-16777215)]",
2063 "Unidirectional Average Link Delay\n"
2064 "Average delay in micro-second as decimal (0...16777215)\n"
2066 "Minimum delay in micro-second as decimal (0...16777215)\n"
2068 "Maximum delay in micro-second as decimal (0...16777215)\n")
2070 /* Get and Check new delay values */
2071 u_int32_t delay
= 0, low
= 0, high
= 0;
2072 VTY_GET_ULONG("delay", delay
, argv
[1]->arg
);
2075 VTY_GET_ULONG("minimum delay", low
, argv
[3]->arg
);
2076 VTY_GET_ULONG("maximum delay", high
, argv
[5]->arg
);
2079 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2080 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2081 u_int8_t update
= 0;
2085 /* Check new delay value against old Min and Max delays if set */
2086 if (IS_PARAM_SET(iflp
, LP_MM_DELAY
)
2087 && (delay
<= iflp
->min_delay
|| delay
>= iflp
->max_delay
))
2089 vty_out (vty
, "Average delay should be comprise between Min (%d) and Max (%d) delay%s",
2090 iflp
->min_delay
, iflp
->max_delay
, VTY_NEWLINE
);
2093 /* Update delay if value is not set or change */
2094 if (IS_PARAM_UNSET(iflp
, LP_DELAY
)|| iflp
->av_delay
!= delay
)
2096 iflp
->av_delay
= delay
;
2097 SET_PARAM(iflp
, LP_DELAY
);
2100 /* Unset Min and Max delays if already set */
2101 if (IS_PARAM_SET(iflp
, LP_MM_DELAY
))
2103 iflp
->min_delay
= 0;
2104 iflp
->max_delay
= 0;
2105 UNSET_PARAM(iflp
, LP_MM_DELAY
);
2111 /* Check new delays value coherency */
2112 if (delay
<= low
|| delay
>= high
)
2114 vty_out (vty
, "Average delay should be comprise between Min (%d) and Max (%d) delay%s",
2115 low
, high
, VTY_NEWLINE
);
2118 /* Update Delays if needed */
2119 if (IS_PARAM_UNSET(iflp
, LP_DELAY
)
2120 || IS_PARAM_UNSET(iflp
, LP_MM_DELAY
)
2121 || iflp
->av_delay
!= delay
2122 || iflp
->min_delay
!= low
2123 || iflp
->max_delay
!= high
)
2125 iflp
->av_delay
= delay
;
2126 SET_PARAM(iflp
, LP_DELAY
);
2127 iflp
->min_delay
= low
;
2128 iflp
->max_delay
= high
;
2129 SET_PARAM(iflp
, LP_MM_DELAY
);
2134 /* force protocols to update LINK STATE due to parameters change */
2135 if (update
== 1 && if_is_operative (ifp
))
2136 zebra_interface_parameters_update (ifp
);
2141 DEFUN (no_link_params_delay
,
2142 no_link_params_delay_cmd
,
2145 "Disable Unidirectional Average, Min & Max Link Delay on this interface\n")
2147 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2148 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2152 UNSET_PARAM(iflp
, LP_DELAY
);
2153 iflp
->min_delay
= 0;
2154 iflp
->max_delay
= 0;
2155 UNSET_PARAM(iflp
, LP_MM_DELAY
);
2157 /* force protocols to update LINK STATE due to parameters change */
2158 if (if_is_operative (ifp
))
2159 zebra_interface_parameters_update (ifp
);
2164 DEFUN (link_params_delay_var
,
2165 link_params_delay_var_cmd
,
2166 "delay-variation (0-16777215)",
2167 "Unidirectional Link Delay Variation\n"
2168 "delay variation in micro-second as decimal (0...16777215)\n")
2171 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2172 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2175 VTY_GET_ULONG("delay variation", value
, argv
[idx_number
]->arg
);
2177 /* Update Delay Variation if needed */
2178 link_param_cmd_set_uint32 (ifp
, &iflp
->delay_var
, LP_DELAY_VAR
, value
);
2183 DEFUN (no_link_params_delay_var
,
2184 no_link_params_delay_var_cmd
,
2185 "no delay-variation",
2187 "Disable Unidirectional Delay Variation on this interface\n")
2189 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2191 /* Unset Delay Variation */
2192 link_param_cmd_unset(ifp
, LP_DELAY_VAR
);
2197 DEFUN (link_params_pkt_loss
,
2198 link_params_pkt_loss_cmd
,
2199 "packet-loss PERCENTAGE",
2200 "Unidirectional Link Packet Loss\n"
2201 "percentage of total traffic by 0.000003% step and less than 50.331642%\n")
2203 int idx_percentage
= 1;
2204 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2205 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2208 if (sscanf (argv
[idx_percentage
]->arg
, "%g", &fval
) != 1)
2210 vty_out (vty
, "link_params_pkt_loss: fscanf: %s%s", safe_strerror (errno
),
2215 if (fval
> MAX_PKT_LOSS
)
2216 fval
= MAX_PKT_LOSS
;
2218 /* Update Packet Loss if needed */
2219 link_param_cmd_set_float (ifp
, &iflp
->pkt_loss
, LP_PKT_LOSS
, fval
);
2224 DEFUN (no_link_params_pkt_loss
,
2225 no_link_params_pkt_loss_cmd
,
2228 "Disable Unidirectional Link Packet Loss on this interface\n")
2230 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2232 /* Unset Packet Loss */
2233 link_param_cmd_unset(ifp
, LP_PKT_LOSS
);
2238 DEFUN (link_params_res_bw
,
2239 link_params_res_bw_cmd
,
2241 "Unidirectional Residual Bandwidth\n"
2242 "Bytes/second (IEEE floating point format)\n")
2244 int idx_bandwidth
= 1;
2245 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2246 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2249 if (sscanf (argv
[idx_bandwidth
]->arg
, "%g", &bw
) != 1)
2251 vty_out (vty
, "link_params_res_bw: fscanf: %s%s", safe_strerror (errno
),
2256 /* Check that bandwidth is not greater than maximum bandwidth parameter */
2257 if (bw
> iflp
->max_bw
)
2260 "Residual Bandwidth could not be greater than Maximum Bandwidth (%g)%s",
2261 iflp
->max_bw
, VTY_NEWLINE
);
2265 /* Update Residual Bandwidth if needed */
2266 link_param_cmd_set_float (ifp
, &iflp
->res_bw
, LP_RES_BW
, bw
);
2271 DEFUN (no_link_params_res_bw
,
2272 no_link_params_res_bw_cmd
,
2275 "Disable Unidirectional Residual Bandwidth on this interface\n")
2277 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2279 /* Unset Residual Bandwidth */
2280 link_param_cmd_unset(ifp
, LP_RES_BW
);
2285 DEFUN (link_params_ava_bw
,
2286 link_params_ava_bw_cmd
,
2288 "Unidirectional Available Bandwidth\n"
2289 "Bytes/second (IEEE floating point format)\n")
2291 int idx_bandwidth
= 1;
2292 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2293 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2296 if (sscanf (argv
[idx_bandwidth
]->arg
, "%g", &bw
) != 1)
2298 vty_out (vty
, "link_params_ava_bw: fscanf: %s%s", safe_strerror (errno
),
2303 /* Check that bandwidth is not greater than maximum bandwidth parameter */
2304 if (bw
> iflp
->max_bw
)
2307 "Available Bandwidth could not be greater than Maximum Bandwidth (%g)%s",
2308 iflp
->max_bw
, VTY_NEWLINE
);
2312 /* Update Residual Bandwidth if needed */
2313 link_param_cmd_set_float (ifp
, &iflp
->ava_bw
, LP_AVA_BW
, bw
);
2318 DEFUN (no_link_params_ava_bw
,
2319 no_link_params_ava_bw_cmd
,
2322 "Disable Unidirectional Available Bandwidth on this interface\n")
2324 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2326 /* Unset Available Bandwidth */
2327 link_param_cmd_unset(ifp
, LP_AVA_BW
);
2332 DEFUN (link_params_use_bw
,
2333 link_params_use_bw_cmd
,
2335 "Unidirectional Utilised Bandwidth\n"
2336 "Bytes/second (IEEE floating point format)\n")
2338 int idx_bandwidth
= 1;
2339 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2340 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2343 if (sscanf (argv
[idx_bandwidth
]->arg
, "%g", &bw
) != 1)
2345 vty_out (vty
, "link_params_use_bw: fscanf: %s%s", safe_strerror (errno
),
2350 /* Check that bandwidth is not greater than maximum bandwidth parameter */
2351 if (bw
> iflp
->max_bw
)
2354 "Utilised Bandwidth could not be greater than Maximum Bandwidth (%g)%s",
2355 iflp
->max_bw
, VTY_NEWLINE
);
2359 /* Update Utilized Bandwidth if needed */
2360 link_param_cmd_set_float (ifp
, &iflp
->use_bw
, LP_USE_BW
, bw
);
2365 DEFUN (no_link_params_use_bw
,
2366 no_link_params_use_bw_cmd
,
2369 "Disable Unidirectional Utilised Bandwidth on this interface\n")
2371 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2373 /* Unset Utilised Bandwidth */
2374 link_param_cmd_unset(ifp
, LP_USE_BW
);
2380 ip_address_install (struct vty
*vty
, struct interface
*ifp
,
2381 const char *addr_str
, const char *peer_str
,
2384 struct zebra_if
*if_data
;
2385 struct prefix_ipv4 cp
;
2386 struct connected
*ifc
;
2387 struct prefix_ipv4
*p
;
2390 if_data
= ifp
->info
;
2392 ret
= str2prefix_ipv4 (addr_str
, &cp
);
2395 vty_out (vty
, "%% Malformed address %s", VTY_NEWLINE
);
2399 if (ipv4_martian(&cp
.prefix
))
2401 vty_out (vty
, "%% Invalid address%s", VTY_NEWLINE
);
2405 ifc
= connected_check (ifp
, (struct prefix
*) &cp
);
2408 ifc
= connected_new ();
2412 p
= prefix_ipv4_new ();
2414 ifc
->address
= (struct prefix
*) p
;
2417 if (p
->prefixlen
<= IPV4_MAX_PREFIXLEN
-2)
2419 p
= prefix_ipv4_new ();
2421 p
->prefix
.s_addr
= ipv4_broadcast_addr(p
->prefix
.s_addr
,p
->prefixlen
);
2422 ifc
->destination
= (struct prefix
*) p
;
2427 ifc
->label
= XSTRDUP (MTYPE_CONNECTED_LABEL
, label
);
2429 /* Add to linked list. */
2430 listnode_add (ifp
->connected
, ifc
);
2433 /* This address is configured from zebra. */
2434 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
))
2435 SET_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
);
2437 /* In case of this route need to install kernel. */
2438 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
)
2439 && CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
)
2440 && !(if_data
&& if_data
->shutdown
== IF_ZEBRA_SHUTDOWN_ON
))
2442 /* Some system need to up the interface to set IP address. */
2443 if (! if_is_up (ifp
))
2445 if_set_flags (ifp
, IFF_UP
| IFF_RUNNING
);
2449 ret
= if_set_prefix (ifp
, ifc
);
2452 vty_out (vty
, "%% Can't set interface IP address: %s.%s",
2453 safe_strerror(errno
), VTY_NEWLINE
);
2457 SET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
2458 /* The address will be advertised to zebra clients when the notification
2459 * from the kernel has been received.
2460 * It will also be added to the subnet chain list, then. */
2467 ip_address_uninstall (struct vty
*vty
, struct interface
*ifp
,
2468 const char *addr_str
, const char *peer_str
,
2471 struct prefix_ipv4 cp
;
2472 struct connected
*ifc
;
2475 /* Convert to prefix structure. */
2476 ret
= str2prefix_ipv4 (addr_str
, &cp
);
2479 vty_out (vty
, "%% Malformed address %s", VTY_NEWLINE
);
2483 /* Check current interface address. */
2484 ifc
= connected_check (ifp
, (struct prefix
*) &cp
);
2487 vty_out (vty
, "%% Can't find address%s", VTY_NEWLINE
);
2491 /* This is not configured address. */
2492 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
))
2495 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
);
2497 /* This is not real address or interface is not active. */
2498 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
)
2499 || ! CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
))
2501 listnode_delete (ifp
->connected
, ifc
);
2502 connected_free (ifc
);
2506 /* This is real route. */
2507 ret
= if_unset_prefix (ifp
, ifc
);
2510 vty_out (vty
, "%% Can't unset interface IP address: %s.%s",
2511 safe_strerror(errno
), VTY_NEWLINE
);
2514 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
2515 /* we will receive a kernel notification about this route being removed.
2516 * this will trigger its removal from the connected list. */
2522 "ip address A.B.C.D/M",
2523 "Interface Internet Protocol config commands\n"
2524 "Set the IP address of an interface\n"
2525 "IP address (e.g. 10.0.0.1/8)\n")
2527 int idx_ipv4_prefixlen
= 2;
2528 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2529 return ip_address_install (vty
, ifp
, argv
[idx_ipv4_prefixlen
]->arg
, NULL
, NULL
);
2532 DEFUN (no_ip_address
,
2534 "no ip address A.B.C.D/M",
2536 "Interface Internet Protocol config commands\n"
2537 "Set the IP address of an interface\n"
2538 "IP Address (e.g. 10.0.0.1/8)")
2540 int idx_ipv4_prefixlen
= 3;
2541 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2542 return ip_address_uninstall (vty
, ifp
, argv
[idx_ipv4_prefixlen
]->arg
, NULL
, NULL
);
2547 DEFUN (ip_address_label
,
2548 ip_address_label_cmd
,
2549 "ip address A.B.C.D/M label LINE",
2550 "Interface Internet Protocol config commands\n"
2551 "Set the IP address of an interface\n"
2552 "IP address (e.g. 10.0.0.1/8)\n"
2553 "Label of this address\n"
2556 int idx_ipv4_prefixlen
= 2;
2558 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2559 return ip_address_install (vty
, ifp
, argv
[idx_ipv4_prefixlen
]->arg
, NULL
, argv
[idx_line
]->arg
);
2562 DEFUN (no_ip_address_label
,
2563 no_ip_address_label_cmd
,
2564 "no ip address A.B.C.D/M label LINE",
2566 "Interface Internet Protocol config commands\n"
2567 "Set the IP address of an interface\n"
2568 "IP address (e.g. 10.0.0.1/8)\n"
2569 "Label of this address\n"
2572 int idx_ipv4_prefixlen
= 3;
2574 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2575 return ip_address_uninstall (vty
, ifp
, argv
[idx_ipv4_prefixlen
]->arg
, NULL
, argv
[idx_line
]->arg
);
2577 #endif /* HAVE_NETLINK */
2581 ipv6_address_install (struct vty
*vty
, struct interface
*ifp
,
2582 const char *addr_str
, const char *peer_str
,
2583 const char *label
, int secondary
)
2585 struct zebra_if
*if_data
;
2586 struct prefix_ipv6 cp
;
2587 struct connected
*ifc
;
2588 struct prefix_ipv6
*p
;
2591 if_data
= ifp
->info
;
2593 ret
= str2prefix_ipv6 (addr_str
, &cp
);
2596 vty_out (vty
, "%% Malformed address %s", VTY_NEWLINE
);
2600 if (ipv6_martian(&cp
.prefix
))
2602 vty_out (vty
, "%% Invalid address%s", VTY_NEWLINE
);
2606 ifc
= connected_check (ifp
, (struct prefix
*) &cp
);
2609 ifc
= connected_new ();
2613 p
= prefix_ipv6_new ();
2615 ifc
->address
= (struct prefix
*) p
;
2619 SET_FLAG (ifc
->flags
, ZEBRA_IFA_SECONDARY
);
2623 ifc
->label
= XSTRDUP (MTYPE_CONNECTED_LABEL
, label
);
2625 /* Add to linked list. */
2626 listnode_add (ifp
->connected
, ifc
);
2629 /* This address is configured from zebra. */
2630 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
))
2631 SET_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
);
2633 /* In case of this route need to install kernel. */
2634 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
)
2635 && CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
)
2636 && !(if_data
&& if_data
->shutdown
== IF_ZEBRA_SHUTDOWN_ON
))
2638 /* Some system need to up the interface to set IP address. */
2639 if (! if_is_up (ifp
))
2641 if_set_flags (ifp
, IFF_UP
| IFF_RUNNING
);
2645 ret
= if_prefix_add_ipv6 (ifp
, ifc
);
2649 vty_out (vty
, "%% Can't set interface IP address: %s.%s",
2650 safe_strerror(errno
), VTY_NEWLINE
);
2654 SET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
2655 /* The address will be advertised to zebra clients when the notification
2656 * from the kernel has been received. */
2662 /* Return true if an ipv6 address is configured on ifp */
2664 ipv6_address_configured (struct interface
*ifp
)
2666 struct connected
*connected
;
2667 struct listnode
*node
;
2669 for (ALL_LIST_ELEMENTS_RO (ifp
->connected
, node
, connected
))
2670 if (CHECK_FLAG (connected
->conf
, ZEBRA_IFC_REAL
) && (connected
->address
->family
== AF_INET6
))
2677 ipv6_address_uninstall (struct vty
*vty
, struct interface
*ifp
,
2678 const char *addr_str
, const char *peer_str
,
2679 const char *label
, int secondry
)
2681 struct prefix_ipv6 cp
;
2682 struct connected
*ifc
;
2685 /* Convert to prefix structure. */
2686 ret
= str2prefix_ipv6 (addr_str
, &cp
);
2689 vty_out (vty
, "%% Malformed address %s", VTY_NEWLINE
);
2693 /* Check current interface address. */
2694 ifc
= connected_check (ifp
, (struct prefix
*) &cp
);
2697 vty_out (vty
, "%% Can't find address%s", VTY_NEWLINE
);
2701 /* This is not configured address. */
2702 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
))
2705 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
);
2707 /* This is not real address or interface is not active. */
2708 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
)
2709 || ! CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
))
2711 listnode_delete (ifp
->connected
, ifc
);
2712 connected_free (ifc
);
2716 /* This is real route. */
2717 ret
= if_prefix_delete_ipv6 (ifp
, ifc
);
2720 vty_out (vty
, "%% Can't unset interface IP address: %s.%s",
2721 safe_strerror(errno
), VTY_NEWLINE
);
2725 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
2726 /* This information will be propagated to the zclients when the
2727 * kernel notification is received. */
2731 DEFUN (ipv6_address
,
2733 "ipv6 address X:X::X:X/M",
2734 "Interface IPv6 config commands\n"
2735 "Set the IP address of an interface\n"
2736 "IPv6 address (e.g. 3ffe:506::1/48)\n")
2738 int idx_ipv6_prefixlen
= 2;
2739 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2740 return ipv6_address_install (vty
, ifp
, argv
[idx_ipv6_prefixlen
]->arg
, NULL
, NULL
, 0);
2743 DEFUN (no_ipv6_address
,
2744 no_ipv6_address_cmd
,
2745 "no ipv6 address X:X::X:X/M",
2747 "Interface IPv6 config commands\n"
2748 "Set the IP address of an interface\n"
2749 "IPv6 address (e.g. 3ffe:506::1/48)\n")
2751 int idx_ipv6_prefixlen
= 3;
2752 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2753 return ipv6_address_uninstall (vty
, ifp
, argv
[idx_ipv6_prefixlen
]->arg
, NULL
, NULL
, 0);
2755 #endif /* HAVE_IPV6 */
2758 link_params_config_write (struct vty
*vty
, struct interface
*ifp
)
2762 if ((ifp
== NULL
) || !HAS_LINK_PARAMS(ifp
))
2765 struct if_link_params
*iflp
= ifp
->link_params
;
2767 vty_out (vty
, " link-params%s", VTY_NEWLINE
);
2768 vty_out(vty
, " enable%s", VTY_NEWLINE
);
2769 if (IS_PARAM_SET(iflp
, LP_TE
))
2770 vty_out(vty
, " metric %u%s",iflp
->te_metric
, VTY_NEWLINE
);
2771 if (IS_PARAM_SET(iflp
, LP_MAX_BW
))
2772 vty_out(vty
, " max-bw %g%s", iflp
->max_bw
, VTY_NEWLINE
);
2773 if (IS_PARAM_SET(iflp
, LP_MAX_RSV_BW
))
2774 vty_out(vty
, " max-rsv-bw %g%s", iflp
->max_rsv_bw
, VTY_NEWLINE
);
2775 if (IS_PARAM_SET(iflp
, LP_UNRSV_BW
))
2777 for (i
= 0; i
< 8; i
++)
2778 vty_out(vty
, " unrsv-bw %d %g%s",
2779 i
, iflp
->unrsv_bw
[i
], VTY_NEWLINE
);
2781 if (IS_PARAM_SET(iflp
, LP_ADM_GRP
))
2782 vty_out(vty
, " admin-grp %u%s", iflp
->admin_grp
, VTY_NEWLINE
);
2783 if (IS_PARAM_SET(iflp
, LP_DELAY
))
2785 vty_out(vty
, " delay %u", iflp
->av_delay
);
2786 if (IS_PARAM_SET(iflp
, LP_MM_DELAY
))
2788 vty_out(vty
, " min %u", iflp
->min_delay
);
2789 vty_out(vty
, " max %u", iflp
->max_delay
);
2791 vty_out(vty
, "%s", VTY_NEWLINE
);
2793 if (IS_PARAM_SET(iflp
, LP_DELAY_VAR
))
2794 vty_out(vty
, " delay-variation %u%s", iflp
->delay_var
, VTY_NEWLINE
);
2795 if (IS_PARAM_SET(iflp
, LP_PKT_LOSS
))
2796 vty_out(vty
, " packet-loss %g%s", iflp
->pkt_loss
, VTY_NEWLINE
);
2797 if (IS_PARAM_SET(iflp
, LP_AVA_BW
))
2798 vty_out(vty
, " ava-bw %g%s", iflp
->ava_bw
, VTY_NEWLINE
);
2799 if (IS_PARAM_SET(iflp
, LP_RES_BW
))
2800 vty_out(vty
, " res-bw %g%s", iflp
->res_bw
, VTY_NEWLINE
);
2801 if (IS_PARAM_SET(iflp
, LP_USE_BW
))
2802 vty_out(vty
, " use-bw %g%s", iflp
->use_bw
, VTY_NEWLINE
);
2803 if (IS_PARAM_SET(iflp
, LP_RMT_AS
))
2804 vty_out(vty
, " neighbor %s as %u%s", inet_ntoa(iflp
->rmt_ip
),
2805 iflp
->rmt_as
, VTY_NEWLINE
);
2810 if_config_write (struct vty
*vty
)
2812 struct listnode
*node
;
2813 struct interface
*ifp
;
2816 zebra_ptm_write (vty
);
2818 for (iter
= vrf_first (); iter
!= VRF_ITER_INVALID
; iter
= vrf_next (iter
))
2819 for (ALL_LIST_ELEMENTS_RO (vrf_iter2iflist (iter
), node
, ifp
))
2821 struct zebra_if
*if_data
;
2822 struct listnode
*addrnode
;
2823 struct connected
*ifc
;
2827 if_data
= ifp
->info
;
2828 vrf
= vrf_lookup(ifp
->vrf_id
);
2830 if (ifp
->vrf_id
== VRF_DEFAULT
)
2831 vty_out (vty
, "interface %s%s", ifp
->name
, VTY_NEWLINE
);
2833 vty_out (vty
, "interface %s vrf %s%s", ifp
->name
, vrf
->name
,
2838 if (if_data
->shutdown
== IF_ZEBRA_SHUTDOWN_ON
)
2839 vty_out (vty
, " shutdown%s", VTY_NEWLINE
);
2841 zebra_ptm_if_write(vty
, if_data
);
2845 vty_out (vty
, " description %s%s", ifp
->desc
,
2848 /* Assign bandwidth here to avoid unnecessary interface flap
2849 while processing config script */
2850 if (ifp
->bandwidth
!= 0)
2851 vty_out(vty
, " bandwidth %u%s", ifp
->bandwidth
, VTY_NEWLINE
);
2853 if (!CHECK_FLAG(ifp
->status
, ZEBRA_INTERFACE_LINKDETECTION
))
2854 vty_out(vty
, " no link-detect%s", VTY_NEWLINE
);
2856 for (ALL_LIST_ELEMENTS_RO (ifp
->connected
, addrnode
, ifc
))
2858 if (CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
))
2860 char buf
[INET6_ADDRSTRLEN
];
2862 vty_out (vty
, " ip%s address %s",
2863 p
->family
== AF_INET
? "" : "v6",
2864 prefix2str (p
, buf
, sizeof(buf
)));
2867 vty_out (vty
, " label %s", ifc
->label
);
2869 vty_out (vty
, "%s", VTY_NEWLINE
);
2875 if (if_data
->multicast
!= IF_ZEBRA_MULTICAST_UNSPEC
)
2876 vty_out (vty
, " %smulticast%s",
2877 if_data
->multicast
== IF_ZEBRA_MULTICAST_ON
? "" : "no ",
2881 #if defined (HAVE_RTADV)
2882 rtadv_config_write (vty
, ifp
);
2883 #endif /* HAVE_RTADV */
2886 irdp_config_write (vty
, ifp
);
2889 link_params_config_write (vty
, ifp
);
2891 vty_out (vty
, "!%s", VTY_NEWLINE
);
2897 vrf_config_write (struct vty
*vty
)
2899 struct listnode
*node
;
2900 struct zebra_vrf
*zvrf
;
2902 for (ALL_LIST_ELEMENTS_RO (zvrf_list
, node
, zvrf
))
2904 if (strcmp(zvrf
->name
, VRF_DEFAULT_NAME
))
2906 vty_out (vty
, "vrf %s%s", zvrf
->name
, VTY_NEWLINE
);
2907 vty_out (vty
, "!%s", VTY_NEWLINE
);
2913 /* Allocate and initialize interface vector. */
2915 zebra_if_init (void)
2917 /* Initialize interface and new hook. */
2918 if_add_hook (IF_NEW_HOOK
, if_zebra_new_hook
);
2919 if_add_hook (IF_DELETE_HOOK
, if_zebra_delete_hook
);
2921 /* Install configuration write function. */
2922 install_node (&interface_node
, if_config_write
);
2923 install_node (&link_params_node
, NULL
);
2924 install_node (&vrf_node
, vrf_config_write
);
2926 install_element (VIEW_NODE
, &show_interface_cmd
);
2927 install_element (VIEW_NODE
, &show_interface_vrf_all_cmd
);
2928 install_element (VIEW_NODE
, &show_interface_name_vrf_cmd
);
2929 install_element (VIEW_NODE
, &show_interface_name_vrf_all_cmd
);
2931 install_element (ENABLE_NODE
, &show_interface_desc_cmd
);
2932 install_element (ENABLE_NODE
, &show_interface_desc_vrf_all_cmd
);
2933 install_element (CONFIG_NODE
, &zebra_interface_cmd
);
2934 install_element (CONFIG_NODE
, &no_interface_cmd
);
2935 install_default (INTERFACE_NODE
);
2936 install_element (INTERFACE_NODE
, &interface_desc_cmd
);
2937 install_element (INTERFACE_NODE
, &no_interface_desc_cmd
);
2938 install_element (INTERFACE_NODE
, &multicast_cmd
);
2939 install_element (INTERFACE_NODE
, &no_multicast_cmd
);
2940 install_element (INTERFACE_NODE
, &linkdetect_cmd
);
2941 install_element (INTERFACE_NODE
, &no_linkdetect_cmd
);
2942 install_element (INTERFACE_NODE
, &shutdown_if_cmd
);
2943 install_element (INTERFACE_NODE
, &no_shutdown_if_cmd
);
2944 install_element (INTERFACE_NODE
, &bandwidth_if_cmd
);
2945 install_element (INTERFACE_NODE
, &no_bandwidth_if_cmd
);
2946 install_element (INTERFACE_NODE
, &ip_address_cmd
);
2947 install_element (INTERFACE_NODE
, &no_ip_address_cmd
);
2949 install_element (INTERFACE_NODE
, &ipv6_address_cmd
);
2950 install_element (INTERFACE_NODE
, &no_ipv6_address_cmd
);
2951 #endif /* HAVE_IPV6 */
2953 install_element (INTERFACE_NODE
, &ip_address_label_cmd
);
2954 install_element (INTERFACE_NODE
, &no_ip_address_label_cmd
);
2955 #endif /* HAVE_NETLINK */
2956 install_element(INTERFACE_NODE
, &link_params_cmd
);
2957 install_default(LINK_PARAMS_NODE
);
2958 install_element(LINK_PARAMS_NODE
, &link_params_enable_cmd
);
2959 install_element(LINK_PARAMS_NODE
, &no_link_params_enable_cmd
);
2960 install_element(LINK_PARAMS_NODE
, &link_params_metric_cmd
);
2961 install_element(LINK_PARAMS_NODE
, &link_params_maxbw_cmd
);
2962 install_element(LINK_PARAMS_NODE
, &link_params_max_rsv_bw_cmd
);
2963 install_element(LINK_PARAMS_NODE
, &link_params_unrsv_bw_cmd
);
2964 install_element(LINK_PARAMS_NODE
, &link_params_admin_grp_cmd
);
2965 install_element(LINK_PARAMS_NODE
, &link_params_inter_as_cmd
);
2966 install_element(LINK_PARAMS_NODE
, &no_link_params_inter_as_cmd
);
2967 install_element(LINK_PARAMS_NODE
, &link_params_delay_cmd
);
2968 install_element(LINK_PARAMS_NODE
, &link_params_delay_var_cmd
);
2969 install_element(LINK_PARAMS_NODE
, &link_params_pkt_loss_cmd
);
2970 install_element(LINK_PARAMS_NODE
, &link_params_ava_bw_cmd
);
2971 install_element(LINK_PARAMS_NODE
, &link_params_res_bw_cmd
);
2972 install_element(LINK_PARAMS_NODE
, &link_params_use_bw_cmd
);
2974 install_element (CONFIG_NODE
, &zebra_vrf_cmd
);
2975 install_element (CONFIG_NODE
, &no_vrf_cmd
);
2976 install_default (VRF_NODE
);