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
);
63 zebra_if_node_destroy (route_table_delegate_t
*delegate
,
64 struct route_table
*table
, struct route_node
*node
)
67 list_delete (node
->info
);
68 route_node_destroy (delegate
, table
, node
);
71 route_table_delegate_t zebra_if_table_delegate
= {
72 .create_node
= route_node_create
,
73 .destroy_node
= zebra_if_node_destroy
76 /* Called when new interface is added. */
78 if_zebra_new_hook (struct interface
*ifp
)
80 struct zebra_if
*zebra_if
;
82 zebra_if
= XCALLOC (MTYPE_TMP
, sizeof (struct zebra_if
));
84 zebra_if
->multicast
= IF_ZEBRA_MULTICAST_UNSPEC
;
85 zebra_if
->shutdown
= IF_ZEBRA_SHUTDOWN_OFF
;
86 zebra_ptm_if_init(zebra_if
);
88 ifp
->ptm_enable
= zebra_ptm_get_enable_state();
89 #if defined (HAVE_RTADV)
91 /* Set default router advertise values. */
92 struct rtadvconf
*rtadv
;
94 rtadv
= &zebra_if
->rtadv
;
96 rtadv
->AdvSendAdvertisements
= 0;
97 rtadv
->MaxRtrAdvInterval
= RTADV_MAX_RTR_ADV_INTERVAL
;
98 rtadv
->MinRtrAdvInterval
= RTADV_MIN_RTR_ADV_INTERVAL
;
99 rtadv
->AdvIntervalTimer
= 0;
100 rtadv
->AdvManagedFlag
= 0;
101 rtadv
->AdvOtherConfigFlag
= 0;
102 rtadv
->AdvHomeAgentFlag
= 0;
103 rtadv
->AdvLinkMTU
= 0;
104 rtadv
->AdvReachableTime
= 0;
105 rtadv
->AdvRetransTimer
= 0;
106 rtadv
->AdvCurHopLimit
= 0;
107 rtadv
->AdvDefaultLifetime
= -1; /* derive from MaxRtrAdvInterval */
108 rtadv
->HomeAgentPreference
= 0;
109 rtadv
->HomeAgentLifetime
= -1; /* derive from AdvDefaultLifetime */
110 rtadv
->AdvIntervalOption
= 0;
111 rtadv
->DefaultPreference
= RTADV_PREF_MEDIUM
;
113 rtadv
->AdvPrefixList
= list_new ();
115 #endif /* HAVE_RTADV */
117 /* Initialize installed address chains tree. */
118 zebra_if
->ipv4_subnets
= route_table_init_with_delegate (&zebra_if_table_delegate
);
120 ifp
->info
= zebra_if
;
122 zebra_vrf_static_route_interface_fixup (ifp
);
126 /* Called when interface is deleted. */
128 if_zebra_delete_hook (struct interface
*ifp
)
130 struct zebra_if
*zebra_if
;
134 zebra_if
= ifp
->info
;
136 /* Free installed address chains tree. */
137 if (zebra_if
->ipv4_subnets
)
138 route_table_finish (zebra_if
->ipv4_subnets
);
139 #if defined (HAVE_RTADV)
141 struct rtadvconf
*rtadv
;
143 rtadv
= &zebra_if
->rtadv
;
144 list_free (rtadv
->AdvPrefixList
);
145 #endif /* HAVE_RTADV */
147 XFREE (MTYPE_TMP
, zebra_if
);
153 /* Build the table key */
155 if_build_key (u_int32_t ifindex
, struct prefix
*p
)
158 p
->prefixlen
= IPV4_MAX_BITLEN
;
159 p
->u
.prefix4
.s_addr
= ifindex
;
162 /* Link an interface in a per NS interface tree */
164 if_link_per_ns (struct zebra_ns
*ns
, struct interface
*ifp
)
167 struct route_node
*rn
;
169 if (ifp
->ifindex
== IFINDEX_INTERNAL
)
172 if_build_key (ifp
->ifindex
, &p
);
173 rn
= route_node_get (ns
->if_table
, &p
);
176 ifp
= (struct interface
*)rn
->info
;
177 route_unlock_node (rn
); /* get */
187 /* Delete a VRF. This is called in vrf_terminate(). */
189 if_unlink_per_ns (struct interface
*ifp
)
191 ifp
->node
->info
= NULL
;
192 route_unlock_node(ifp
->node
);
196 /* Look up an interface by identifier within a NS */
198 if_lookup_by_index_per_ns (struct zebra_ns
*ns
, u_int32_t ifindex
)
201 struct route_node
*rn
;
202 struct interface
*ifp
= NULL
;
204 if_build_key (ifindex
, &p
);
205 rn
= route_node_lookup (ns
->if_table
, &p
);
208 ifp
= (struct interface
*)rn
->info
;
209 route_unlock_node (rn
); /* lookup */
214 /* Look up an interface by name within a NS */
216 if_lookup_by_name_per_ns (struct zebra_ns
*ns
, const char *ifname
)
218 struct route_node
*rn
;
219 struct interface
*ifp
;
221 for (rn
= route_top (ns
->if_table
); rn
; rn
= route_next (rn
))
223 ifp
= (struct interface
*)rn
->info
;
224 if (ifp
&& strcmp (ifp
->name
, ifname
) == 0)
232 ifindex2ifname_per_ns (struct zebra_ns
*zns
, unsigned int ifindex
)
234 struct interface
*ifp
;
236 return ((ifp
= if_lookup_by_index_per_ns (zns
, ifindex
)) != NULL
) ?
237 ifp
->name
: "unknown";
240 /* Tie an interface address to its derived subnet list of addresses. */
242 if_subnet_add (struct interface
*ifp
, struct connected
*ifc
)
244 struct route_node
*rn
;
245 struct zebra_if
*zebra_if
;
247 struct list
*addr_list
;
249 assert (ifp
&& ifp
->info
&& ifc
);
250 zebra_if
= ifp
->info
;
252 /* Get address derived subnet node and associated address list, while marking
253 address secondary attribute appropriately. */
256 rn
= route_node_get (zebra_if
->ipv4_subnets
, &cp
);
258 if ((addr_list
= rn
->info
))
259 SET_FLAG (ifc
->flags
, ZEBRA_IFA_SECONDARY
);
262 UNSET_FLAG (ifc
->flags
, ZEBRA_IFA_SECONDARY
);
263 rn
->info
= addr_list
= list_new ();
264 route_lock_node (rn
);
267 /* Tie address at the tail of address list. */
268 listnode_add (addr_list
, ifc
);
270 /* Return list element count. */
271 return (addr_list
->count
);
274 /* Untie an interface address from its derived subnet list of addresses. */
276 if_subnet_delete (struct interface
*ifp
, struct connected
*ifc
)
278 struct route_node
*rn
;
279 struct zebra_if
*zebra_if
;
280 struct list
*addr_list
;
282 assert (ifp
&& ifp
->info
&& ifc
);
283 zebra_if
= ifp
->info
;
285 /* Get address derived subnet node. */
286 rn
= route_node_lookup (zebra_if
->ipv4_subnets
, ifc
->address
);
287 if (! (rn
&& rn
->info
))
289 zlog_warn("Trying to remove an address from an unknown subnet."
290 " (please report this bug)");
293 route_unlock_node (rn
);
295 /* Untie address from subnet's address list. */
296 addr_list
= rn
->info
;
298 /* Deleting an address that is not registered is a bug.
299 * In any case, we shouldn't decrement the lock counter if the address
301 if (!listnode_lookup(addr_list
, ifc
))
303 zlog_warn("Trying to remove an address from a subnet where it is not"
304 " currently registered. (please report this bug)");
308 listnode_delete (addr_list
, ifc
);
309 route_unlock_node (rn
);
311 /* Return list element count, if not empty. */
312 if (addr_list
->count
)
314 /* If deleted address is primary, mark subsequent one as such and distribute. */
315 if (! CHECK_FLAG (ifc
->flags
, ZEBRA_IFA_SECONDARY
))
317 ifc
= listgetdata ((struct listnode
*)listhead (addr_list
));
318 zebra_interface_address_delete_update (ifp
, ifc
);
319 UNSET_FLAG (ifc
->flags
, ZEBRA_IFA_SECONDARY
);
320 /* XXX: Linux kernel removes all the secondary addresses when the primary
321 * address is removed. We could try to work around that, though this is
323 zebra_interface_address_add_update (ifp
, ifc
);
326 return addr_list
->count
;
329 /* Otherwise, free list and route node. */
330 list_free (addr_list
);
332 route_unlock_node (rn
);
337 /* if_flags_mangle: A place for hacks that require mangling
338 * or tweaking the interface flags.
340 * ******************** Solaris flags hacks **************************
342 * Solaris IFF_UP flag reflects only the primary interface as the
343 * routing socket only sends IFINFO for the primary interface. Hence
344 * ~IFF_UP does not per se imply all the logical interfaces are also
345 * down - which we only know of as addresses. Instead we must determine
346 * whether the interface really is up or not according to how many
347 * addresses are still attached. (Solaris always sends RTM_DELADDR if
348 * an interface, logical or not, goes ~IFF_UP).
350 * Ie, we mangle IFF_UP to *additionally* reflect whether or not there
351 * are addresses left in struct connected, not just the actual underlying
354 * We must hence remember the real state of IFF_UP, which we do in
355 * struct zebra_if.primary_state.
357 * Setting IFF_UP within zebra to administratively shutdown the
358 * interface will affect only the primary interface/address on Solaris.
359 ************************End Solaris flags hacks ***********************
362 if_flags_mangle (struct interface
*ifp
, uint64_t *newflags
)
365 struct zebra_if
*zif
= ifp
->info
;
367 zif
->primary_state
= *newflags
& (IFF_UP
& 0xff);
369 if (CHECK_FLAG (zif
->primary_state
, IFF_UP
)
370 || listcount(ifp
->connected
) > 0)
371 SET_FLAG (*newflags
, IFF_UP
);
373 UNSET_FLAG (*newflags
, IFF_UP
);
377 /* Update the flags field of the ifp with the new flag set provided.
378 * Take whatever actions are required for any changes in flags we care
381 * newflags should be the raw value, as obtained from the OS.
384 if_flags_update (struct interface
*ifp
, uint64_t newflags
)
386 if_flags_mangle (ifp
, &newflags
);
388 if (if_is_no_ptm_operative (ifp
))
390 /* operative -> inoperative? */
391 ifp
->flags
= newflags
;
392 if (!if_is_operative (ifp
))
397 /* inoperative -> operative? */
398 ifp
->flags
= newflags
;
399 if (if_is_operative (ifp
))
404 /* Wake up configured address if it is not in current kernel
407 if_addr_wakeup (struct interface
*ifp
)
409 struct listnode
*node
, *nnode
;
410 struct connected
*ifc
;
414 for (ALL_LIST_ELEMENTS (ifp
->connected
, node
, nnode
, ifc
))
418 if (CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
)
419 && ! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
))
422 if (p
->family
== AF_INET
)
424 if (! if_is_up (ifp
))
426 /* Assume zebra is configured like following:
429 * ip addr 192.0.2.1/24
432 * As soon as zebra becomes first aware that gre0 exists in the
433 * kernel, it will set gre0 up and configure its addresses.
435 * (This may happen at startup when the interface already exists
436 * or during runtime when the interface is added to the kernel)
438 * XXX: IRDP code is calling here via if_add_update - this seems
440 * XXX: RUNNING is not a settable flag on any system
441 * I (paulj) am aware of.
443 if_set_flags (ifp
, IFF_UP
| IFF_RUNNING
);
447 ret
= if_set_prefix (ifp
, ifc
);
450 zlog_warn ("Can't set interface's address: %s",
451 safe_strerror(errno
));
455 SET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
456 /* The address will be advertised to zebra clients when the notification
457 * from the kernel has been received.
458 * It will also be added to the interface's subnet list then. */
460 if (p
->family
== AF_INET6
)
462 if (! if_is_up (ifp
))
464 /* See long comment above */
465 if_set_flags (ifp
, IFF_UP
| IFF_RUNNING
);
469 ret
= if_prefix_add_ipv6 (ifp
, ifc
);
472 zlog_warn ("Can't set interface's address: %s",
473 safe_strerror(errno
));
477 SET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
478 /* The address will be advertised to zebra clients when the notification
479 * from the kernel has been received. */
485 /* Handle interface addition */
487 if_add_update (struct interface
*ifp
)
489 struct zebra_if
*if_data
;
491 if_link_per_ns(zebra_ns_lookup (NS_DEFAULT
), ifp
);
496 if (if_data
->multicast
== IF_ZEBRA_MULTICAST_ON
)
497 if_set_flags (ifp
, IFF_MULTICAST
);
498 else if (if_data
->multicast
== IF_ZEBRA_MULTICAST_OFF
)
499 if_unset_flags (ifp
, IFF_MULTICAST
);
501 zebra_ptm_if_set_ptm_state(ifp
, if_data
);
503 zebra_interface_add_update (ifp
);
505 if (! CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
))
507 SET_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
);
509 if (if_data
&& if_data
->shutdown
== IF_ZEBRA_SHUTDOWN_ON
)
511 if (IS_ZEBRA_DEBUG_KERNEL
)
512 zlog_debug ("interface %s vrf %u index %d is shutdown. "
514 ifp
->name
, ifp
->vrf_id
, ifp
->ifindex
);
518 if_addr_wakeup (ifp
);
520 if (IS_ZEBRA_DEBUG_KERNEL
)
521 zlog_debug ("interface %s vrf %u index %d becomes active.",
522 ifp
->name
, ifp
->vrf_id
, ifp
->ifindex
);
526 if (IS_ZEBRA_DEBUG_KERNEL
)
527 zlog_debug ("interface %s vrf %u index %d is added.",
528 ifp
->name
, ifp
->vrf_id
, ifp
->ifindex
);
532 /* Install connected routes corresponding to an interface. */
534 if_install_connected (struct interface
*ifp
)
536 struct listnode
*node
;
537 struct listnode
*next
;
538 struct connected
*ifc
;
543 for (ALL_LIST_ELEMENTS (ifp
->connected
, node
, next
, ifc
))
545 if (CHECK_FLAG(ifc
->conf
, ZEBRA_IFC_REAL
))
546 zebra_interface_address_add_update (ifp
, ifc
);
549 if (p
->family
== AF_INET
)
550 connected_up_ipv4 (ifp
, ifc
);
551 else if (p
->family
== AF_INET6
)
552 connected_up_ipv6 (ifp
, ifc
);
557 /* Uninstall connected routes corresponding to an interface. */
559 if_uninstall_connected (struct interface
*ifp
)
561 struct listnode
*node
;
562 struct listnode
*next
;
563 struct connected
*ifc
;
568 for (ALL_LIST_ELEMENTS (ifp
->connected
, node
, next
, ifc
))
571 zebra_interface_address_delete_update (ifp
, ifc
);
573 if (p
->family
== AF_INET
)
574 connected_down_ipv4 (ifp
, ifc
);
575 else if (p
->family
== AF_INET6
)
576 connected_down_ipv6 (ifp
, ifc
);
581 /* Uninstall and delete connected routes corresponding to an interface. */
582 /* TODO - Check why IPv4 handling here is different from install or if_down */
584 if_delete_connected (struct interface
*ifp
)
586 struct connected
*ifc
;
588 struct route_node
*rn
;
589 struct zebra_if
*zebra_if
;
591 zebra_if
= ifp
->info
;
595 struct listnode
*node
;
596 struct listnode
*last
= NULL
;
598 while ((node
= (last
? last
->next
: listhead (ifp
->connected
))))
600 ifc
= listgetdata (node
);
603 if (p
->family
== AF_INET
604 && (rn
= route_node_lookup (zebra_if
->ipv4_subnets
, p
)))
606 struct listnode
*anode
;
607 struct listnode
*next
;
608 struct listnode
*first
;
609 struct list
*addr_list
;
611 route_unlock_node (rn
);
612 addr_list
= (struct list
*) rn
->info
;
614 /* Remove addresses, secondaries first. */
615 first
= listhead (addr_list
);
616 for (anode
= first
->next
; anode
|| first
; anode
= next
)
625 ifc
= listgetdata (anode
);
626 connected_down_ipv4 (ifp
, ifc
);
628 /* XXX: We have to send notifications here explicitly, because we destroy
629 * the ifc before receiving the notification about the address being deleted.
631 zebra_interface_address_delete_update (ifp
, ifc
);
633 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_REAL
);
634 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
636 /* Remove from subnet chain. */
637 list_delete_node (addr_list
, anode
);
638 route_unlock_node (rn
);
640 /* Remove from interface address list (unconditionally). */
641 if (!CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
))
643 listnode_delete (ifp
->connected
, ifc
);
644 connected_free (ifc
);
650 /* Free chain list and respective route node. */
651 list_delete (addr_list
);
653 route_unlock_node (rn
);
655 else if (p
->family
== AF_INET6
)
657 connected_down_ipv6 (ifp
, ifc
);
659 zebra_interface_address_delete_update (ifp
, ifc
);
661 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_REAL
);
662 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
664 if (CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
))
668 listnode_delete (ifp
->connected
, ifc
);
669 connected_free (ifc
);
680 /* Handle an interface delete event */
682 if_delete_update (struct interface
*ifp
)
686 zlog_err ("interface %s vrf %u index %d is still up while being deleted.",
687 ifp
->name
, ifp
->vrf_id
, ifp
->ifindex
);
691 /* Mark interface as inactive */
692 UNSET_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
);
694 if (IS_ZEBRA_DEBUG_KERNEL
)
695 zlog_debug ("interface %s vrf %u index %d is now inactive.",
696 ifp
->name
, ifp
->vrf_id
, ifp
->ifindex
);
698 /* Delete connected routes from the kernel. */
699 if_delete_connected (ifp
);
701 /* Send out notification on interface delete. */
702 zebra_interface_delete_update (ifp
);
704 if_unlink_per_ns(ifp
);
706 /* Update ifindex after distributing the delete message. This is in
707 case any client needs to have the old value of ifindex available
708 while processing the deletion. Each client daemon is responsible
709 for setting ifindex to IFINDEX_INTERNAL after processing the
710 interface deletion message. */
711 ifp
->ifindex
= IFINDEX_INTERNAL
;
715 /* VRF change for an interface */
717 if_handle_vrf_change (struct interface
*ifp
, vrf_id_t vrf_id
)
721 old_vrf_id
= ifp
->vrf_id
;
723 /* Uninstall connected routes. */
724 if_uninstall_connected (ifp
);
726 /* Delete any IPv4 neighbors created to implement RFC 5549 */
727 if_nbr_ipv6ll_to_ipv4ll_neigh_del_all (ifp
);
729 /* Delete all neighbor addresses learnt through IPv6 RA */
730 if_down_del_nbr_connected (ifp
);
732 /* Send out notification on interface VRF change. */
733 /* This is to issue an UPDATE or a DELETE, as appropriate. */
734 zebra_interface_vrf_update_del (ifp
, vrf_id
);
737 if_update (ifp
, ifp
->name
, strlen (ifp
->name
), vrf_id
);
739 /* Send out notification on interface VRF change. */
740 /* This is to issue an ADD, if needed. */
741 zebra_interface_vrf_update_add (ifp
, old_vrf_id
);
743 /* Install connected routes (in new VRF). */
744 if_install_connected (ifp
);
746 /* Due to connected route change, schedule RIB processing for both old
749 if (IS_ZEBRA_DEBUG_RIB_DETAILED
)
750 zlog_debug ("%u: IF %s VRF change, scheduling RIB processing",
751 ifp
->vrf_id
, ifp
->name
);
752 rib_update (old_vrf_id
, RIB_UPDATE_IF_CHANGE
);
753 rib_update (ifp
->vrf_id
, RIB_UPDATE_IF_CHANGE
);
755 zebra_vrf_static_route_interface_fixup (ifp
);
759 ipv6_ll_address_to_mac (struct in6_addr
*address
, u_char
*mac
)
761 mac
[0] = address
->s6_addr
[8] ^ 0x02;
762 mac
[1] = address
->s6_addr
[9];
763 mac
[2] = address
->s6_addr
[10];
764 mac
[3] = address
->s6_addr
[13];
765 mac
[4] = address
->s6_addr
[14];
766 mac
[5] = address
->s6_addr
[15];
770 if_nbr_ipv6ll_to_ipv4ll_neigh_update (struct interface
*ifp
,
771 struct in6_addr
*address
,
774 char buf
[16] = "169.254.0.1";
775 struct in_addr ipv4_ll
;
778 inet_pton (AF_INET
, buf
, &ipv4_ll
);
780 ipv6_ll_address_to_mac(address
, (u_char
*)mac
);
781 kernel_neigh_update (add
, ifp
->ifindex
, ipv4_ll
.s_addr
, mac
, 6);
785 if_nbr_ipv6ll_to_ipv4ll_neigh_add_all (struct interface
*ifp
)
787 if (listhead(ifp
->nbr_connected
))
789 struct nbr_connected
*nbr_connected
;
790 struct listnode
*node
;
792 for (ALL_LIST_ELEMENTS_RO (ifp
->nbr_connected
, node
, nbr_connected
))
793 if_nbr_ipv6ll_to_ipv4ll_neigh_update (ifp
,
794 &nbr_connected
->address
->u
.prefix6
,
800 if_nbr_ipv6ll_to_ipv4ll_neigh_del_all (struct interface
*ifp
)
802 if (listhead(ifp
->nbr_connected
))
804 struct nbr_connected
*nbr_connected
;
805 struct listnode
*node
;
807 for (ALL_LIST_ELEMENTS_RO (ifp
->nbr_connected
, node
, nbr_connected
))
808 if_nbr_ipv6ll_to_ipv4ll_neigh_update (ifp
,
809 &nbr_connected
->address
->u
.prefix6
,
815 if_down_del_nbr_connected (struct interface
*ifp
)
817 struct nbr_connected
*nbr_connected
;
818 struct listnode
*node
, *nnode
;
820 for (ALL_LIST_ELEMENTS (ifp
->nbr_connected
, node
, nnode
, nbr_connected
))
822 listnode_delete (ifp
->nbr_connected
, nbr_connected
);
823 nbr_connected_free (nbr_connected
);
827 /* Interface is up. */
829 if_up (struct interface
*ifp
)
831 struct zebra_if
*zif
;
835 quagga_timestamp (2, zif
->up_last
, sizeof (zif
->up_last
));
837 /* Notify the protocol daemons. */
838 if (ifp
->ptm_enable
&& (ifp
->ptm_status
== ZEBRA_PTM_STATUS_DOWN
)) {
839 zlog_warn("%s: interface %s hasn't passed ptm check\n", __func__
,
843 zebra_interface_up_update (ifp
);
845 if_nbr_ipv6ll_to_ipv4ll_neigh_add_all (ifp
);
847 /* Enable fast tx of RA if enabled && RA interval is not in msecs */
848 if (zif
->rtadv
.AdvSendAdvertisements
&&
849 (zif
->rtadv
.MaxRtrAdvInterval
>= 1000))
851 zif
->rtadv
.inFastRexmit
= 1;
852 zif
->rtadv
.NumFastReXmitsRemain
= RTADV_NUM_FAST_REXMITS
;
855 /* Install connected routes to the kernel. */
856 if_install_connected (ifp
);
858 if (IS_ZEBRA_DEBUG_RIB_DETAILED
)
859 zlog_debug ("%u: IF %s up, scheduling RIB processing",
860 ifp
->vrf_id
, ifp
->name
);
861 rib_update (ifp
->vrf_id
, RIB_UPDATE_IF_CHANGE
);
863 zebra_vrf_static_route_interface_fixup (ifp
);
866 /* Interface goes down. We have to manage different behavior of based
869 if_down (struct interface
*ifp
)
871 struct zebra_if
*zif
;
875 quagga_timestamp (2, zif
->down_last
, sizeof (zif
->down_last
));
877 /* Notify to the protocol daemons. */
878 zebra_interface_down_update (ifp
);
880 /* Uninstall connected routes from the kernel. */
881 if_uninstall_connected (ifp
);
883 if (IS_ZEBRA_DEBUG_RIB_DETAILED
)
884 zlog_debug ("%u: IF %s down, scheduling RIB processing",
885 ifp
->vrf_id
, ifp
->name
);
886 rib_update (ifp
->vrf_id
, RIB_UPDATE_IF_CHANGE
);
888 if_nbr_ipv6ll_to_ipv4ll_neigh_del_all (ifp
);
890 /* Delete all neighbor addresses learnt through IPv6 RA */
891 if_down_del_nbr_connected (ifp
);
895 if_refresh (struct interface
*ifp
)
901 /* Output prefix string to vty. */
903 prefix_vty_out (struct vty
*vty
, struct prefix
*p
)
905 char str
[INET6_ADDRSTRLEN
];
907 inet_ntop (p
->family
, &p
->u
.prefix
, str
, sizeof (str
));
908 vty_out (vty
, "%s", str
);
912 /* Dump if address information to vty. */
914 connected_dump_vty (struct vty
*vty
, struct connected
*connected
)
918 /* Print interface address. */
919 p
= connected
->address
;
920 vty_out (vty
, " %s ", prefix_family_str (p
));
921 prefix_vty_out (vty
, p
);
922 vty_out (vty
, "/%d", p
->prefixlen
);
924 /* If there is destination address, print it. */
925 if (connected
->destination
)
927 vty_out (vty
, (CONNECTED_PEER(connected
) ? " peer " : " broadcast "));
928 prefix_vty_out (vty
, connected
->destination
);
931 if (CHECK_FLAG (connected
->flags
, ZEBRA_IFA_SECONDARY
))
932 vty_out (vty
, " secondary");
934 if (CHECK_FLAG (connected
->flags
, ZEBRA_IFA_UNNUMBERED
))
935 vty_out (vty
, " unnumbered");
937 if (connected
->label
)
938 vty_out (vty
, " %s", connected
->label
);
940 vty_out (vty
, "%s", VTY_NEWLINE
);
943 /* Dump interface neighbor address information to vty. */
945 nbr_connected_dump_vty (struct vty
*vty
, struct nbr_connected
*connected
)
949 /* Print interface address. */
950 p
= connected
->address
;
951 vty_out (vty
, " %s ", prefix_family_str (p
));
952 prefix_vty_out (vty
, p
);
953 vty_out (vty
, "/%d", p
->prefixlen
);
955 vty_out (vty
, "%s", VTY_NEWLINE
);
958 #if defined (HAVE_RTADV)
959 /* Dump interface ND information to vty. */
961 nd_dump_vty (struct vty
*vty
, struct interface
*ifp
)
963 struct zebra_if
*zif
;
964 struct rtadvconf
*rtadv
;
967 zif
= (struct zebra_if
*) ifp
->info
;
970 if (rtadv
->AdvSendAdvertisements
)
972 vty_out (vty
, " ND advertised reachable time is %d milliseconds%s",
973 rtadv
->AdvReachableTime
, VTY_NEWLINE
);
974 vty_out (vty
, " ND advertised retransmit interval is %d milliseconds%s",
975 rtadv
->AdvRetransTimer
, VTY_NEWLINE
);
976 vty_out (vty
, " ND router advertisements sent: %d rcvd: %d%s",
977 zif
->ra_sent
, zif
->ra_rcvd
, VTY_NEWLINE
);
978 interval
= rtadv
->MaxRtrAdvInterval
;
980 vty_out (vty
, " ND router advertisements are sent every "
981 "%d milliseconds%s", interval
,
984 vty_out (vty
, " ND router advertisements are sent every "
985 "%d seconds%s", interval
/ 1000,
987 if (rtadv
->AdvDefaultLifetime
!= -1)
988 vty_out (vty
, " ND router advertisements live for %d seconds%s",
989 rtadv
->AdvDefaultLifetime
, VTY_NEWLINE
);
991 vty_out (vty
, " ND router advertisements lifetime tracks ra-interval%s",
993 vty_out (vty
, " ND router advertisement default router preference is "
994 "%s%s", rtadv_pref_strs
[rtadv
->DefaultPreference
],
996 if (rtadv
->AdvManagedFlag
)
997 vty_out (vty
, " Hosts use DHCP to obtain routable addresses.%s",
1000 vty_out (vty
, " Hosts use stateless autoconfig for addresses.%s",
1002 if (rtadv
->AdvHomeAgentFlag
)
1004 vty_out (vty
, " ND router advertisements with "
1005 "Home Agent flag bit set.%s",
1007 if (rtadv
->HomeAgentLifetime
!= -1)
1008 vty_out (vty
, " Home Agent lifetime is %u seconds%s",
1009 rtadv
->HomeAgentLifetime
, VTY_NEWLINE
);
1011 vty_out (vty
, " Home Agent lifetime tracks ra-lifetime%s",
1013 vty_out (vty
, " Home Agent preference is %u%s",
1014 rtadv
->HomeAgentPreference
, VTY_NEWLINE
);
1016 if (rtadv
->AdvIntervalOption
)
1017 vty_out (vty
, " ND router advertisements with Adv. Interval option.%s",
1021 #endif /* HAVE_RTADV */
1023 /* Interface's information print out to vty interface. */
1025 if_dump_vty (struct vty
*vty
, struct interface
*ifp
)
1027 struct connected
*connected
;
1028 struct nbr_connected
*nbr_connected
;
1029 struct listnode
*node
;
1030 struct route_node
*rn
;
1031 struct zebra_if
*zebra_if
;
1034 zebra_if
= ifp
->info
;
1036 vty_out (vty
, "Interface %s is ", ifp
->name
);
1037 if (if_is_up(ifp
)) {
1038 vty_out (vty
, "up, line protocol ");
1040 if (CHECK_FLAG(ifp
->status
, ZEBRA_INTERFACE_LINKDETECTION
)) {
1041 if (if_is_running(ifp
))
1042 vty_out (vty
, "is up%s", VTY_NEWLINE
);
1044 vty_out (vty
, "is down%s", VTY_NEWLINE
);
1046 vty_out (vty
, "detection is disabled%s", VTY_NEWLINE
);
1049 vty_out (vty
, "down%s", VTY_NEWLINE
);
1052 vty_out (vty
, " Link ups: %5u last: %s%s", zebra_if
->up_count
,
1053 zebra_if
->up_last
[0] ? zebra_if
->up_last
: "(never)", VTY_NEWLINE
);
1054 vty_out (vty
, " Link downs: %5u last: %s%s", zebra_if
->down_count
,
1055 zebra_if
->down_last
[0] ? zebra_if
->down_last
: "(never)", VTY_NEWLINE
);
1057 zebra_ptm_show_status(vty
, ifp
);
1059 vrf
= vrf_lookup_by_id (ifp
->vrf_id
);
1060 vty_out (vty
, " vrf: %s%s", vrf
->name
, VTY_NEWLINE
);
1063 vty_out (vty
, " Description: %s%s", ifp
->desc
,
1065 if (ifp
->ifindex
== IFINDEX_INTERNAL
)
1067 vty_out(vty
, " pseudo interface%s", VTY_NEWLINE
);
1070 else if (! CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
))
1072 vty_out(vty
, " index %d inactive interface%s",
1078 vty_out (vty
, " index %d metric %d mtu %d speed %u ",
1079 ifp
->ifindex
, ifp
->metric
, ifp
->mtu
, ifp
->speed
);
1080 if (ifp
->mtu6
!= ifp
->mtu
)
1081 vty_out (vty
, "mtu6 %d ", ifp
->mtu6
);
1082 vty_out (vty
, "%s flags: %s%s", VTY_NEWLINE
,
1083 if_flag_dump (ifp
->flags
), VTY_NEWLINE
);
1085 /* Hardware address. */
1086 vty_out (vty
, " Type: %s%s", if_link_type_str (ifp
->ll_type
), VTY_NEWLINE
);
1087 if (ifp
->hw_addr_len
!= 0)
1091 vty_out (vty
, " HWaddr: ");
1092 for (i
= 0; i
< ifp
->hw_addr_len
; i
++)
1093 vty_out (vty
, "%s%02x", i
== 0 ? "" : ":", ifp
->hw_addr
[i
]);
1094 vty_out (vty
, "%s", VTY_NEWLINE
);
1097 /* Bandwidth in Mbps */
1098 if (ifp
->bandwidth
!= 0)
1100 vty_out(vty
, " bandwidth %u Mbps", ifp
->bandwidth
);
1101 vty_out(vty
, "%s", VTY_NEWLINE
);
1104 for (rn
= route_top (zebra_if
->ipv4_subnets
); rn
; rn
= route_next (rn
))
1109 for (ALL_LIST_ELEMENTS_RO ((struct list
*)rn
->info
, node
, connected
))
1110 connected_dump_vty (vty
, connected
);
1113 for (ALL_LIST_ELEMENTS_RO (ifp
->connected
, node
, connected
))
1115 if (CHECK_FLAG (connected
->conf
, ZEBRA_IFC_REAL
) &&
1116 (connected
->address
->family
== AF_INET6
))
1117 connected_dump_vty (vty
, connected
);
1120 if (HAS_LINK_PARAMS(ifp
))
1123 struct if_link_params
*iflp
= ifp
->link_params
;
1124 vty_out(vty
, " Traffic Engineering Link Parameters:%s", VTY_NEWLINE
);
1125 if (IS_PARAM_SET(iflp
, LP_TE_METRIC
))
1126 vty_out(vty
, " TE metric %u%s",iflp
->te_metric
, VTY_NEWLINE
);
1127 if (IS_PARAM_SET(iflp
, LP_MAX_BW
))
1128 vty_out(vty
, " Maximum Bandwidth %g (Byte/s)%s", iflp
->max_bw
, VTY_NEWLINE
);
1129 if (IS_PARAM_SET(iflp
, LP_MAX_RSV_BW
))
1130 vty_out(vty
, " Maximum Reservable Bandwidth %g (Byte/s)%s", iflp
->max_rsv_bw
, VTY_NEWLINE
);
1131 if (IS_PARAM_SET(iflp
, LP_UNRSV_BW
)) {
1132 vty_out(vty
, " Unreserved Bandwidth per Class Type in Byte/s:%s", VTY_NEWLINE
);
1133 for (i
= 0; i
< MAX_CLASS_TYPE
; i
+=2)
1134 vty_out(vty
, " [%d]: %g (Bytes/sec),\t[%d]: %g (Bytes/sec)%s",
1135 i
, iflp
->unrsv_bw
[i
], i
+1, iflp
->unrsv_bw
[i
+1], VTY_NEWLINE
);
1138 if (IS_PARAM_SET(iflp
, LP_ADM_GRP
))
1139 vty_out(vty
, " Administrative Group:%u%s", iflp
->admin_grp
, VTY_NEWLINE
);
1140 if (IS_PARAM_SET(iflp
, LP_DELAY
))
1142 vty_out(vty
, " Link Delay Average: %u (micro-sec.)", iflp
->av_delay
);
1143 if (IS_PARAM_SET(iflp
, LP_MM_DELAY
))
1145 vty_out(vty
, " Min: %u (micro-sec.)", iflp
->min_delay
);
1146 vty_out(vty
, " Max: %u (micro-sec.)", iflp
->max_delay
);
1148 vty_out(vty
, "%s", VTY_NEWLINE
);
1150 if (IS_PARAM_SET(iflp
, LP_DELAY_VAR
))
1151 vty_out(vty
, " Link Delay Variation %u (micro-sec.)%s", iflp
->delay_var
, VTY_NEWLINE
);
1152 if (IS_PARAM_SET(iflp
, LP_PKT_LOSS
))
1153 vty_out(vty
, " Link Packet Loss %g (in %%)%s", iflp
->pkt_loss
, VTY_NEWLINE
);
1154 if (IS_PARAM_SET(iflp
, LP_AVA_BW
))
1155 vty_out(vty
, " Available Bandwidth %g (Byte/s)%s", iflp
->ava_bw
, VTY_NEWLINE
);
1156 if (IS_PARAM_SET(iflp
, LP_RES_BW
))
1157 vty_out(vty
, " Residual Bandwidth %g (Byte/s)%s", iflp
->res_bw
, VTY_NEWLINE
);
1158 if (IS_PARAM_SET(iflp
, LP_USE_BW
))
1159 vty_out(vty
, " Utilized Bandwidth %g (Byte/s)%s", iflp
->use_bw
, VTY_NEWLINE
);
1160 if (IS_PARAM_SET(iflp
, LP_RMT_AS
))
1161 vty_out(vty
, " Neighbor ASBR IP: %s AS: %u %s", inet_ntoa(iflp
->rmt_ip
), iflp
->rmt_as
, VTY_NEWLINE
);
1165 nd_dump_vty (vty
, ifp
);
1167 #if defined (HAVE_RTADV)
1168 nd_dump_vty (vty
, ifp
);
1169 #endif /* HAVE_RTADV */
1170 if (listhead(ifp
->nbr_connected
))
1171 vty_out (vty
, " Neighbor address(s):%s", VTY_NEWLINE
);
1172 for (ALL_LIST_ELEMENTS_RO (ifp
->nbr_connected
, node
, nbr_connected
))
1173 nbr_connected_dump_vty (vty
, nbr_connected
);
1175 #ifdef HAVE_PROC_NET_DEV
1176 /* Statistics print out using proc file system. */
1177 vty_out (vty
, " %lu input packets (%lu multicast), %lu bytes, "
1179 ifp
->stats
.rx_packets
, ifp
->stats
.rx_multicast
,
1180 ifp
->stats
.rx_bytes
, ifp
->stats
.rx_dropped
, VTY_NEWLINE
);
1182 vty_out (vty
, " %lu input errors, %lu length, %lu overrun,"
1183 " %lu CRC, %lu frame%s",
1184 ifp
->stats
.rx_errors
, ifp
->stats
.rx_length_errors
,
1185 ifp
->stats
.rx_over_errors
, ifp
->stats
.rx_crc_errors
,
1186 ifp
->stats
.rx_frame_errors
, VTY_NEWLINE
);
1188 vty_out (vty
, " %lu fifo, %lu missed%s", ifp
->stats
.rx_fifo_errors
,
1189 ifp
->stats
.rx_missed_errors
, VTY_NEWLINE
);
1191 vty_out (vty
, " %lu output packets, %lu bytes, %lu dropped%s",
1192 ifp
->stats
.tx_packets
, ifp
->stats
.tx_bytes
,
1193 ifp
->stats
.tx_dropped
, VTY_NEWLINE
);
1195 vty_out (vty
, " %lu output errors, %lu aborted, %lu carrier,"
1196 " %lu fifo, %lu heartbeat%s",
1197 ifp
->stats
.tx_errors
, ifp
->stats
.tx_aborted_errors
,
1198 ifp
->stats
.tx_carrier_errors
, ifp
->stats
.tx_fifo_errors
,
1199 ifp
->stats
.tx_heartbeat_errors
, VTY_NEWLINE
);
1201 vty_out (vty
, " %lu window, %lu collisions%s",
1202 ifp
->stats
.tx_window_errors
, ifp
->stats
.collisions
, VTY_NEWLINE
);
1203 #endif /* HAVE_PROC_NET_DEV */
1205 #ifdef HAVE_NET_RT_IFLIST
1206 #if defined (__bsdi__) || defined (__NetBSD__)
1207 /* Statistics print out using sysctl (). */
1208 vty_out (vty
, " input packets %llu, bytes %llu, dropped %llu,"
1209 " multicast packets %llu%s",
1210 (unsigned long long)ifp
->stats
.ifi_ipackets
,
1211 (unsigned long long)ifp
->stats
.ifi_ibytes
,
1212 (unsigned long long)ifp
->stats
.ifi_iqdrops
,
1213 (unsigned long long)ifp
->stats
.ifi_imcasts
,
1216 vty_out (vty
, " input errors %llu%s",
1217 (unsigned long long)ifp
->stats
.ifi_ierrors
, VTY_NEWLINE
);
1219 vty_out (vty
, " output packets %llu, bytes %llu,"
1220 " multicast packets %llu%s",
1221 (unsigned long long)ifp
->stats
.ifi_opackets
,
1222 (unsigned long long)ifp
->stats
.ifi_obytes
,
1223 (unsigned long long)ifp
->stats
.ifi_omcasts
,
1226 vty_out (vty
, " output errors %llu%s",
1227 (unsigned long long)ifp
->stats
.ifi_oerrors
, VTY_NEWLINE
);
1229 vty_out (vty
, " collisions %llu%s",
1230 (unsigned long long)ifp
->stats
.ifi_collisions
, VTY_NEWLINE
);
1232 /* Statistics print out using sysctl (). */
1233 vty_out (vty
, " input packets %lu, bytes %lu, dropped %lu,"
1234 " multicast packets %lu%s",
1235 ifp
->stats
.ifi_ipackets
, ifp
->stats
.ifi_ibytes
,
1236 ifp
->stats
.ifi_iqdrops
, ifp
->stats
.ifi_imcasts
,
1239 vty_out (vty
, " input errors %lu%s",
1240 ifp
->stats
.ifi_ierrors
, VTY_NEWLINE
);
1242 vty_out (vty
, " output packets %lu, bytes %lu, multicast packets %lu%s",
1243 ifp
->stats
.ifi_opackets
, ifp
->stats
.ifi_obytes
,
1244 ifp
->stats
.ifi_omcasts
, VTY_NEWLINE
);
1246 vty_out (vty
, " output errors %lu%s",
1247 ifp
->stats
.ifi_oerrors
, VTY_NEWLINE
);
1249 vty_out (vty
, " collisions %lu%s",
1250 ifp
->stats
.ifi_collisions
, VTY_NEWLINE
);
1251 #endif /* __bsdi__ || __NetBSD__ */
1252 #endif /* HAVE_NET_RT_IFLIST */
1256 interface_update_stats (void)
1258 #ifdef HAVE_PROC_NET_DEV
1259 /* If system has interface statistics via proc file system, update
1261 ifstat_update_proc ();
1262 #endif /* HAVE_PROC_NET_DEV */
1263 #ifdef HAVE_NET_RT_IFLIST
1264 ifstat_update_sysctl ();
1265 #endif /* HAVE_NET_RT_IFLIST */
1268 struct cmd_node interface_node
=
1275 /* Show all interfaces to vty. */
1276 DEFUN (show_interface
,
1278 "show interface [vrf NAME]",
1280 "Interface status and configuration\n"
1283 struct listnode
*node
;
1284 struct interface
*ifp
;
1285 vrf_id_t vrf_id
= VRF_DEFAULT
;
1287 interface_update_stats ();
1290 VRF_GET_ID (vrf_id
, argv
[3]->arg
);
1292 /* All interface print. */
1293 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (vrf_id
), node
, ifp
))
1294 if_dump_vty (vty
, ifp
);
1300 /* Show all interfaces to vty. */
1301 DEFUN (show_interface_vrf_all
,
1302 show_interface_vrf_all_cmd
,
1303 "show interface vrf all",
1305 "Interface status and configuration\n"
1306 VRF_ALL_CMD_HELP_STR
)
1309 struct listnode
*node
;
1310 struct interface
*ifp
;
1312 interface_update_stats ();
1314 /* All interface print. */
1315 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
)
1316 for (ALL_LIST_ELEMENTS_RO (vrf
->iflist
, node
, ifp
))
1317 if_dump_vty (vty
, ifp
);
1322 /* Show specified interface to vty. */
1324 DEFUN (show_interface_name_vrf
,
1325 show_interface_name_vrf_cmd
,
1326 "show interface IFNAME vrf NAME",
1328 "Interface status and configuration\n"
1334 struct interface
*ifp
;
1335 vrf_id_t vrf_id
= VRF_DEFAULT
;
1337 interface_update_stats ();
1339 VRF_GET_ID (vrf_id
, argv
[idx_name
]->arg
);
1341 /* Specified interface print. */
1342 ifp
= if_lookup_by_name (argv
[idx_ifname
]->arg
, vrf_id
);
1345 vty_out (vty
, "%% Can't find interface %s%s", argv
[idx_ifname
]->arg
,
1349 if_dump_vty (vty
, ifp
);
1354 /* Show specified interface to vty. */
1355 DEFUN (show_interface_name_vrf_all
,
1356 show_interface_name_vrf_all_cmd
,
1357 "show interface IFNAME [vrf all]",
1359 "Interface status and configuration\n"
1361 VRF_ALL_CMD_HELP_STR
)
1365 struct interface
*ifp
;
1368 interface_update_stats ();
1370 /* All interface print. */
1371 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
)
1373 /* Specified interface print. */
1374 ifp
= if_lookup_by_name (argv
[idx_ifname
]->arg
, vrf
->vrf_id
);
1377 if_dump_vty (vty
, ifp
);
1384 vty_out (vty
, "%% Can't find interface %s%s", argv
[idx_ifname
]->arg
, VTY_NEWLINE
);
1393 if_show_description (struct vty
*vty
, vrf_id_t vrf_id
)
1395 struct listnode
*node
;
1396 struct interface
*ifp
;
1398 vty_out (vty
, "Interface Status Protocol Description%s", VTY_NEWLINE
);
1399 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (vrf_id
), node
, ifp
))
1403 len
= vty_out (vty
, "%s", ifp
->name
);
1404 vty_out (vty
, "%*s", (16 - len
), " ");
1408 vty_out (vty
, "up ");
1409 if (CHECK_FLAG(ifp
->status
, ZEBRA_INTERFACE_LINKDETECTION
))
1411 if (if_is_running(ifp
))
1412 vty_out (vty
, "up ");
1414 vty_out (vty
, "down ");
1418 vty_out (vty
, "unknown ");
1423 vty_out (vty
, "down down ");
1427 vty_out (vty
, "%s", ifp
->desc
);
1428 vty_out (vty
, "%s", VTY_NEWLINE
);
1432 DEFUN (show_interface_desc
,
1433 show_interface_desc_cmd
,
1434 "show interface description [vrf NAME]",
1436 "Interface status and configuration\n"
1437 "Interface description\n"
1440 vrf_id_t vrf_id
= VRF_DEFAULT
;
1443 VRF_GET_ID (vrf_id
, argv
[4]->arg
);
1445 if_show_description (vty
, vrf_id
);
1451 DEFUN (show_interface_desc_vrf_all
,
1452 show_interface_desc_vrf_all_cmd
,
1453 "show interface description vrf all",
1455 "Interface status and configuration\n"
1456 "Interface description\n"
1457 VRF_ALL_CMD_HELP_STR
)
1461 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
)
1462 if (!list_isempty (vrf
->iflist
))
1464 vty_out (vty
, "%s\tVRF %u%s%s", VTY_NEWLINE
, vrf
->vrf_id
,
1465 VTY_NEWLINE
, VTY_NEWLINE
);
1466 if_show_description (vty
, vrf
->vrf_id
);
1475 "Set multicast flag to interface\n")
1477 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1479 struct zebra_if
*if_data
;
1481 if (CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
))
1483 ret
= if_set_flags (ifp
, IFF_MULTICAST
);
1486 vty_out (vty
, "Can't set multicast flag%s", VTY_NEWLINE
);
1491 if_data
= ifp
->info
;
1492 if_data
->multicast
= IF_ZEBRA_MULTICAST_ON
;
1497 DEFUN (no_multicast
,
1501 "Unset multicast flag to interface\n")
1503 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1505 struct zebra_if
*if_data
;
1507 if (CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
))
1509 ret
= if_unset_flags (ifp
, IFF_MULTICAST
);
1512 vty_out (vty
, "Can't unset multicast flag%s", VTY_NEWLINE
);
1517 if_data
= ifp
->info
;
1518 if_data
->multicast
= IF_ZEBRA_MULTICAST_OFF
;
1526 "Enable link detection on interface\n")
1528 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1529 int if_was_operative
;
1531 if_was_operative
= if_is_no_ptm_operative(ifp
);
1532 SET_FLAG(ifp
->status
, ZEBRA_INTERFACE_LINKDETECTION
);
1534 /* When linkdetection is enabled, if might come down */
1535 if (!if_is_no_ptm_operative(ifp
) && if_was_operative
) if_down(ifp
);
1537 /* FIXME: Will defer status change forwarding if interface
1538 does not come down! */
1544 DEFUN (no_linkdetect
,
1548 "Disable link detection on interface\n")
1550 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1551 int if_was_operative
;
1553 if_was_operative
= if_is_no_ptm_operative(ifp
);
1554 UNSET_FLAG(ifp
->status
, ZEBRA_INTERFACE_LINKDETECTION
);
1556 /* Interface may come up after disabling link detection */
1557 if (if_is_operative(ifp
) && !if_was_operative
) if_up(ifp
);
1559 /* FIXME: see linkdetect_cmd */
1567 "Shutdown the selected interface\n")
1569 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1571 struct zebra_if
*if_data
;
1573 if (ifp
->ifindex
!= IFINDEX_INTERNAL
)
1575 ret
= if_unset_flags (ifp
, IFF_UP
);
1578 vty_out (vty
, "Can't shutdown interface%s", VTY_NEWLINE
);
1583 if_data
= ifp
->info
;
1584 if_data
->shutdown
= IF_ZEBRA_SHUTDOWN_ON
;
1589 DEFUN (no_shutdown_if
,
1593 "Shutdown the selected interface\n")
1595 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1597 struct zebra_if
*if_data
;
1599 if (ifp
->ifindex
!= IFINDEX_INTERNAL
)
1601 ret
= if_set_flags (ifp
, IFF_UP
| IFF_RUNNING
);
1604 vty_out (vty
, "Can't up interface%s", VTY_NEWLINE
);
1609 /* Some addresses (in particular, IPv6 addresses on Linux) get
1610 * removed when the interface goes down. They need to be readded.
1612 if_addr_wakeup(ifp
);
1615 if_data
= ifp
->info
;
1616 if_data
->shutdown
= IF_ZEBRA_SHUTDOWN_OFF
;
1621 DEFUN (bandwidth_if
,
1623 "bandwidth (1-100000)",
1624 "Set bandwidth informational parameter\n"
1625 "Bandwidth in megabits\n")
1628 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1629 unsigned int bandwidth
;
1631 bandwidth
= strtol(argv
[idx_number
]->arg
, NULL
, 10);
1633 /* bandwidth range is <1-100000> */
1634 if (bandwidth
< 1 || bandwidth
> 100000)
1636 vty_out (vty
, "Bandwidth is invalid%s", VTY_NEWLINE
);
1640 ifp
->bandwidth
= bandwidth
;
1642 /* force protocols to recalculate routes due to cost change */
1643 if (if_is_operative (ifp
))
1644 zebra_interface_up_update (ifp
);
1649 DEFUN (no_bandwidth_if
,
1650 no_bandwidth_if_cmd
,
1651 "no bandwidth [(1-100000)]",
1653 "Set bandwidth informational parameter\n"
1654 "Bandwidth in megabits\n")
1656 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1660 /* force protocols to recalculate routes due to cost change */
1661 if (if_is_operative (ifp
))
1662 zebra_interface_up_update (ifp
);
1668 struct cmd_node link_params_node
=
1671 "%s(config-link-params)# ",
1676 link_param_cmd_set_uint32 (struct interface
*ifp
, uint32_t *field
,
1677 uint32_t type
, uint32_t value
)
1679 /* Update field as needed */
1680 if (IS_PARAM_UNSET(ifp
->link_params
, type
) || *field
!= value
)
1683 SET_PARAM(ifp
->link_params
, type
);
1685 /* force protocols to update LINK STATE due to parameters change */
1686 if (if_is_operative (ifp
))
1687 zebra_interface_parameters_update (ifp
);
1691 link_param_cmd_set_float (struct interface
*ifp
, float *field
,
1692 uint32_t type
, float value
)
1695 /* Update field as needed */
1696 if (IS_PARAM_UNSET(ifp
->link_params
, type
) || *field
!= value
)
1699 SET_PARAM(ifp
->link_params
, type
);
1701 /* force protocols to update LINK STATE due to parameters change */
1702 if (if_is_operative (ifp
))
1703 zebra_interface_parameters_update (ifp
);
1708 link_param_cmd_unset (struct interface
*ifp
, uint32_t type
)
1710 if (ifp
->link_params
== NULL
)
1714 UNSET_PARAM(ifp
->link_params
, type
);
1716 /* force protocols to update LINK STATE due to parameters change */
1717 if (if_is_operative (ifp
))
1718 zebra_interface_parameters_update (ifp
);
1721 DEFUN_NOSH (link_params
,
1726 /* vty->qobj_index stays the same @ interface pointer */
1727 vty
->node
= LINK_PARAMS_NODE
;
1732 DEFUN_NOSH (exit_link_params
,
1733 exit_link_params_cmd
,
1735 "Exit from Link Params configuration mode\n")
1737 if (vty
->node
== LINK_PARAMS_NODE
)
1738 vty
->node
= INTERFACE_NODE
;
1742 /* Specific Traffic Engineering parameters commands */
1743 DEFUN (link_params_enable
,
1744 link_params_enable_cmd
,
1746 "Activate link parameters on this interface\n")
1748 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1750 /* This command could be issue at startup, when activate MPLS TE */
1751 /* on a new interface or after a ON / OFF / ON toggle */
1752 /* In all case, TE parameters are reset to their default factory */
1753 if (IS_ZEBRA_DEBUG_EVENT
)
1754 zlog_debug ("Link-params: enable TE link parameters on interface %s", ifp
->name
);
1756 if (!if_link_params_get (ifp
))
1758 if (IS_ZEBRA_DEBUG_EVENT
)
1759 zlog_debug ("Link-params: failed to init TE link parameters %s", ifp
->name
);
1764 /* force protocols to update LINK STATE due to parameters change */
1765 if (if_is_operative (ifp
))
1766 zebra_interface_parameters_update (ifp
);
1771 DEFUN (no_link_params_enable
,
1772 no_link_params_enable_cmd
,
1775 "Disable link parameters on this interface\n")
1777 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1779 zlog_debug ("MPLS-TE: disable TE link parameters on interface %s", ifp
->name
);
1781 if_link_params_free (ifp
);
1783 /* force protocols to update LINK STATE due to parameters change */
1784 if (if_is_operative (ifp
))
1785 zebra_interface_parameters_update (ifp
);
1790 /* STANDARD TE metrics */
1791 DEFUN (link_params_metric
,
1792 link_params_metric_cmd
,
1793 "metric (0-4294967295)",
1794 "Link metric for MPLS-TE purpose\n"
1795 "Metric value in decimal\n")
1798 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1799 struct if_link_params
*iflp
= if_link_params_get (ifp
);
1802 VTY_GET_ULONG("metric", metric
, argv
[idx_number
]->arg
);
1804 /* Update TE metric if needed */
1805 link_param_cmd_set_uint32 (ifp
, &iflp
->te_metric
, LP_TE_METRIC
, metric
);
1810 DEFUN (no_link_params_metric
,
1811 no_link_params_metric_cmd
,
1814 "Disable Link Metric on this interface\n")
1816 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1818 /* Unset TE Metric */
1819 link_param_cmd_unset(ifp
, LP_TE_METRIC
);
1824 DEFUN (link_params_maxbw
,
1825 link_params_maxbw_cmd
,
1827 "Maximum bandwidth that can be used\n"
1828 "Bytes/second (IEEE floating point format)\n")
1830 int idx_bandwidth
= 1;
1831 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1832 struct if_link_params
*iflp
= if_link_params_get (ifp
);
1836 if (sscanf (argv
[idx_bandwidth
]->arg
, "%g", &bw
) != 1)
1838 vty_out (vty
, "link_params_maxbw: fscanf: %s%s", safe_strerror (errno
),
1843 /* Check that Maximum bandwidth is not lower than other bandwidth parameters */
1844 if ((bw
<= iflp
->max_rsv_bw
)
1845 || (bw
<= iflp
->unrsv_bw
[0])
1846 || (bw
<= iflp
->unrsv_bw
[1])
1847 || (bw
<= iflp
->unrsv_bw
[2])
1848 || (bw
<= iflp
->unrsv_bw
[3])
1849 || (bw
<= iflp
->unrsv_bw
[4])
1850 || (bw
<= iflp
->unrsv_bw
[5])
1851 || (bw
<= iflp
->unrsv_bw
[6])
1852 || (bw
<= iflp
->unrsv_bw
[7])
1853 || (bw
<= iflp
->ava_bw
)
1854 || (bw
<= iflp
->res_bw
)
1855 || (bw
<= iflp
->use_bw
))
1858 "Maximum Bandwidth could not be lower than others bandwidth%s",
1863 /* Update Maximum Bandwidth if needed */
1864 link_param_cmd_set_float (ifp
, &iflp
->max_bw
, LP_MAX_BW
, bw
);
1869 DEFUN (link_params_max_rsv_bw
,
1870 link_params_max_rsv_bw_cmd
,
1871 "max-rsv-bw BANDWIDTH",
1872 "Maximum bandwidth that may be reserved\n"
1873 "Bytes/second (IEEE floating point format)\n")
1875 int idx_bandwidth
= 1;
1876 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1877 struct if_link_params
*iflp
= if_link_params_get (ifp
);
1880 if (sscanf (argv
[idx_bandwidth
]->arg
, "%g", &bw
) != 1)
1882 vty_out (vty
, "link_params_max_rsv_bw: fscanf: %s%s", safe_strerror (errno
),
1887 /* Check that bandwidth is not greater than maximum bandwidth parameter */
1888 if (bw
> iflp
->max_bw
)
1891 "Maximum Reservable Bandwidth could not be greater than Maximum Bandwidth (%g)%s",
1892 iflp
->max_bw
, VTY_NEWLINE
);
1896 /* Update Maximum Reservable Bandwidth if needed */
1897 link_param_cmd_set_float (ifp
, &iflp
->max_rsv_bw
, LP_MAX_RSV_BW
, bw
);
1902 DEFUN (link_params_unrsv_bw
,
1903 link_params_unrsv_bw_cmd
,
1904 "unrsv-bw (0-7) BANDWIDTH",
1905 "Unreserved bandwidth at each priority level\n"
1907 "Bytes/second (IEEE floating point format)\n")
1910 int idx_bandwidth
= 2;
1911 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1912 struct if_link_params
*iflp
= if_link_params_get (ifp
);
1916 /* We don't have to consider about range check here. */
1917 if (sscanf (argv
[idx_number
]->arg
, "%d", &priority
) != 1)
1919 vty_out (vty
, "link_params_unrsv_bw: fscanf: %s%s", safe_strerror (errno
),
1924 if (sscanf (argv
[idx_bandwidth
]->arg
, "%g", &bw
) != 1)
1926 vty_out (vty
, "link_params_unrsv_bw: fscanf: %s%s", safe_strerror (errno
),
1931 /* Check that bandwidth is not greater than maximum bandwidth parameter */
1932 if (bw
> iflp
->max_bw
)
1935 "UnReserved Bandwidth could not be greater than Maximum Bandwidth (%g)%s",
1936 iflp
->max_bw
, VTY_NEWLINE
);
1940 /* Update Unreserved Bandwidth if needed */
1941 link_param_cmd_set_float (ifp
, &iflp
->unrsv_bw
[priority
], LP_UNRSV_BW
, bw
);
1946 DEFUN (link_params_admin_grp
,
1947 link_params_admin_grp_cmd
,
1948 "admin-grp BITPATTERN",
1949 "Administrative group membership\n"
1950 "32-bit Hexadecimal value (e.g. 0xa1)\n")
1952 int idx_bitpattern
= 1;
1953 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1954 struct if_link_params
*iflp
= if_link_params_get (ifp
);
1955 unsigned long value
;
1957 if (sscanf (argv
[idx_bitpattern
]->arg
, "0x%lx", &value
) != 1)
1959 vty_out (vty
, "link_params_admin_grp: fscanf: %s%s",
1960 safe_strerror (errno
), VTY_NEWLINE
);
1964 /* Update Administrative Group if needed */
1965 link_param_cmd_set_uint32 (ifp
, &iflp
->admin_grp
, LP_ADM_GRP
, value
);
1970 DEFUN (no_link_params_admin_grp
,
1971 no_link_params_admin_grp_cmd
,
1974 "Disable Administrative group membership on this interface\n")
1976 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1978 /* Unset Admin Group */
1979 link_param_cmd_unset(ifp
, LP_ADM_GRP
);
1984 /* RFC5392 & RFC5316: INTER-AS */
1985 DEFUN (link_params_inter_as
,
1986 link_params_inter_as_cmd
,
1987 "neighbor A.B.C.D as (1-4294967295)",
1988 "Configure remote ASBR information (Neighbor IP address and AS number)\n"
1989 "Remote IP address in dot decimal A.B.C.D\n"
1990 "Remote AS number\n"
1991 "AS number in the range <1-4294967295>\n")
1996 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1997 struct if_link_params
*iflp
= if_link_params_get (ifp
);
1998 struct in_addr addr
;
2001 if (!inet_aton (argv
[idx_ipv4
]->arg
, &addr
))
2003 vty_out (vty
, "Please specify Router-Addr by A.B.C.D%s", VTY_NEWLINE
);
2007 VTY_GET_ULONG("AS number", as
, argv
[idx_number
]->arg
);
2009 /* Update Remote IP and Remote AS fields if needed */
2010 if (IS_PARAM_UNSET(iflp
, LP_RMT_AS
)
2011 || iflp
->rmt_as
!= as
2012 || iflp
->rmt_ip
.s_addr
!= addr
.s_addr
)
2016 iflp
->rmt_ip
.s_addr
= addr
.s_addr
;
2017 SET_PARAM(iflp
, LP_RMT_AS
);
2019 /* force protocols to update LINK STATE due to parameters change */
2020 if (if_is_operative (ifp
))
2021 zebra_interface_parameters_update (ifp
);
2026 DEFUN (no_link_params_inter_as
,
2027 no_link_params_inter_as_cmd
,
2030 "Remove Neighbor IP address and AS number for Inter-AS TE\n")
2032 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2033 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2035 /* Reset Remote IP and AS neighbor */
2037 iflp
->rmt_ip
.s_addr
= 0;
2038 UNSET_PARAM(iflp
, LP_RMT_AS
);
2040 /* force protocols to update LINK STATE due to parameters change */
2041 if (if_is_operative (ifp
))
2042 zebra_interface_parameters_update (ifp
);
2047 /* RFC7471: OSPF Traffic Engineering (TE) Metric extensions & draft-ietf-isis-metric-extensions-07.txt */
2048 DEFUN (link_params_delay
,
2049 link_params_delay_cmd
,
2050 "delay (0-16777215) [min (0-16777215) max (0-16777215)]",
2051 "Unidirectional Average Link Delay\n"
2052 "Average delay in micro-second as decimal (0...16777215)\n"
2054 "Minimum delay in micro-second as decimal (0...16777215)\n"
2056 "Maximum delay in micro-second as decimal (0...16777215)\n")
2058 /* Get and Check new delay values */
2059 u_int32_t delay
= 0, low
= 0, high
= 0;
2060 VTY_GET_ULONG("delay", delay
, argv
[1]->arg
);
2063 VTY_GET_ULONG("minimum delay", low
, argv
[3]->arg
);
2064 VTY_GET_ULONG("maximum delay", high
, argv
[5]->arg
);
2067 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2068 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2069 u_int8_t update
= 0;
2073 /* Check new delay value against old Min and Max delays if set */
2074 if (IS_PARAM_SET(iflp
, LP_MM_DELAY
)
2075 && (delay
<= iflp
->min_delay
|| delay
>= iflp
->max_delay
))
2077 vty_out (vty
, "Average delay should be comprise between Min (%d) and Max (%d) delay%s",
2078 iflp
->min_delay
, iflp
->max_delay
, VTY_NEWLINE
);
2081 /* Update delay if value is not set or change */
2082 if (IS_PARAM_UNSET(iflp
, LP_DELAY
)|| iflp
->av_delay
!= delay
)
2084 iflp
->av_delay
= delay
;
2085 SET_PARAM(iflp
, LP_DELAY
);
2088 /* Unset Min and Max delays if already set */
2089 if (IS_PARAM_SET(iflp
, LP_MM_DELAY
))
2091 iflp
->min_delay
= 0;
2092 iflp
->max_delay
= 0;
2093 UNSET_PARAM(iflp
, LP_MM_DELAY
);
2099 /* Check new delays value coherency */
2100 if (delay
<= low
|| delay
>= high
)
2102 vty_out (vty
, "Average delay should be comprise between Min (%d) and Max (%d) delay%s",
2103 low
, high
, VTY_NEWLINE
);
2106 /* Update Delays if needed */
2107 if (IS_PARAM_UNSET(iflp
, LP_DELAY
)
2108 || IS_PARAM_UNSET(iflp
, LP_MM_DELAY
)
2109 || iflp
->av_delay
!= delay
2110 || iflp
->min_delay
!= low
2111 || iflp
->max_delay
!= high
)
2113 iflp
->av_delay
= delay
;
2114 SET_PARAM(iflp
, LP_DELAY
);
2115 iflp
->min_delay
= low
;
2116 iflp
->max_delay
= high
;
2117 SET_PARAM(iflp
, LP_MM_DELAY
);
2122 /* force protocols to update LINK STATE due to parameters change */
2123 if (update
== 1 && if_is_operative (ifp
))
2124 zebra_interface_parameters_update (ifp
);
2129 DEFUN (no_link_params_delay
,
2130 no_link_params_delay_cmd
,
2133 "Disable Unidirectional Average, Min & Max Link Delay on this interface\n")
2135 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2136 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2140 UNSET_PARAM(iflp
, LP_DELAY
);
2141 iflp
->min_delay
= 0;
2142 iflp
->max_delay
= 0;
2143 UNSET_PARAM(iflp
, LP_MM_DELAY
);
2145 /* force protocols to update LINK STATE due to parameters change */
2146 if (if_is_operative (ifp
))
2147 zebra_interface_parameters_update (ifp
);
2152 DEFUN (link_params_delay_var
,
2153 link_params_delay_var_cmd
,
2154 "delay-variation (0-16777215)",
2155 "Unidirectional Link Delay Variation\n"
2156 "delay variation in micro-second as decimal (0...16777215)\n")
2159 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2160 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2163 VTY_GET_ULONG("delay variation", value
, argv
[idx_number
]->arg
);
2165 /* Update Delay Variation if needed */
2166 link_param_cmd_set_uint32 (ifp
, &iflp
->delay_var
, LP_DELAY_VAR
, value
);
2171 DEFUN (no_link_params_delay_var
,
2172 no_link_params_delay_var_cmd
,
2173 "no delay-variation",
2175 "Disable Unidirectional Delay Variation on this interface\n")
2177 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2179 /* Unset Delay Variation */
2180 link_param_cmd_unset(ifp
, LP_DELAY_VAR
);
2185 DEFUN (link_params_pkt_loss
,
2186 link_params_pkt_loss_cmd
,
2187 "packet-loss PERCENTAGE",
2188 "Unidirectional Link Packet Loss\n"
2189 "percentage of total traffic by 0.000003% step and less than 50.331642%\n")
2191 int idx_percentage
= 1;
2192 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2193 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2196 if (sscanf (argv
[idx_percentage
]->arg
, "%g", &fval
) != 1)
2198 vty_out (vty
, "link_params_pkt_loss: fscanf: %s%s", safe_strerror (errno
),
2203 if (fval
> MAX_PKT_LOSS
)
2204 fval
= MAX_PKT_LOSS
;
2206 /* Update Packet Loss if needed */
2207 link_param_cmd_set_float (ifp
, &iflp
->pkt_loss
, LP_PKT_LOSS
, fval
);
2212 DEFUN (no_link_params_pkt_loss
,
2213 no_link_params_pkt_loss_cmd
,
2216 "Disable Unidirectional Link Packet Loss on this interface\n")
2218 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2220 /* Unset Packet Loss */
2221 link_param_cmd_unset(ifp
, LP_PKT_LOSS
);
2226 DEFUN (link_params_res_bw
,
2227 link_params_res_bw_cmd
,
2229 "Unidirectional Residual Bandwidth\n"
2230 "Bytes/second (IEEE floating point format)\n")
2232 int idx_bandwidth
= 1;
2233 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2234 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2237 if (sscanf (argv
[idx_bandwidth
]->arg
, "%g", &bw
) != 1)
2239 vty_out (vty
, "link_params_res_bw: fscanf: %s%s", safe_strerror (errno
),
2244 /* Check that bandwidth is not greater than maximum bandwidth parameter */
2245 if (bw
> iflp
->max_bw
)
2248 "Residual Bandwidth could not be greater than Maximum Bandwidth (%g)%s",
2249 iflp
->max_bw
, VTY_NEWLINE
);
2253 /* Update Residual Bandwidth if needed */
2254 link_param_cmd_set_float (ifp
, &iflp
->res_bw
, LP_RES_BW
, bw
);
2259 DEFUN (no_link_params_res_bw
,
2260 no_link_params_res_bw_cmd
,
2263 "Disable Unidirectional Residual Bandwidth on this interface\n")
2265 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2267 /* Unset Residual Bandwidth */
2268 link_param_cmd_unset(ifp
, LP_RES_BW
);
2273 DEFUN (link_params_ava_bw
,
2274 link_params_ava_bw_cmd
,
2276 "Unidirectional Available Bandwidth\n"
2277 "Bytes/second (IEEE floating point format)\n")
2279 int idx_bandwidth
= 1;
2280 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2281 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2284 if (sscanf (argv
[idx_bandwidth
]->arg
, "%g", &bw
) != 1)
2286 vty_out (vty
, "link_params_ava_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 "Available 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
->ava_bw
, LP_AVA_BW
, bw
);
2306 DEFUN (no_link_params_ava_bw
,
2307 no_link_params_ava_bw_cmd
,
2310 "Disable Unidirectional Available Bandwidth on this interface\n")
2312 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2314 /* Unset Available Bandwidth */
2315 link_param_cmd_unset(ifp
, LP_AVA_BW
);
2320 DEFUN (link_params_use_bw
,
2321 link_params_use_bw_cmd
,
2323 "Unidirectional Utilised Bandwidth\n"
2324 "Bytes/second (IEEE floating point format)\n")
2326 int idx_bandwidth
= 1;
2327 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2328 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2331 if (sscanf (argv
[idx_bandwidth
]->arg
, "%g", &bw
) != 1)
2333 vty_out (vty
, "link_params_use_bw: fscanf: %s%s", safe_strerror (errno
),
2338 /* Check that bandwidth is not greater than maximum bandwidth parameter */
2339 if (bw
> iflp
->max_bw
)
2342 "Utilised Bandwidth could not be greater than Maximum Bandwidth (%g)%s",
2343 iflp
->max_bw
, VTY_NEWLINE
);
2347 /* Update Utilized Bandwidth if needed */
2348 link_param_cmd_set_float (ifp
, &iflp
->use_bw
, LP_USE_BW
, bw
);
2353 DEFUN (no_link_params_use_bw
,
2354 no_link_params_use_bw_cmd
,
2357 "Disable Unidirectional Utilised Bandwidth on this interface\n")
2359 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2361 /* Unset Utilised Bandwidth */
2362 link_param_cmd_unset(ifp
, LP_USE_BW
);
2368 ip_address_install (struct vty
*vty
, struct interface
*ifp
,
2369 const char *addr_str
, const char *peer_str
,
2372 struct zebra_if
*if_data
;
2373 struct prefix_ipv4 cp
;
2374 struct connected
*ifc
;
2375 struct prefix_ipv4
*p
;
2378 if_data
= ifp
->info
;
2380 ret
= str2prefix_ipv4 (addr_str
, &cp
);
2383 vty_out (vty
, "%% Malformed address %s", VTY_NEWLINE
);
2387 if (ipv4_martian(&cp
.prefix
))
2389 vty_out (vty
, "%% Invalid address%s", VTY_NEWLINE
);
2393 ifc
= connected_check (ifp
, (struct prefix
*) &cp
);
2396 ifc
= connected_new ();
2400 p
= prefix_ipv4_new ();
2402 ifc
->address
= (struct prefix
*) p
;
2405 if (p
->prefixlen
<= IPV4_MAX_PREFIXLEN
-2)
2407 p
= prefix_ipv4_new ();
2409 p
->prefix
.s_addr
= ipv4_broadcast_addr(p
->prefix
.s_addr
,p
->prefixlen
);
2410 ifc
->destination
= (struct prefix
*) p
;
2415 ifc
->label
= XSTRDUP (MTYPE_CONNECTED_LABEL
, label
);
2417 /* Add to linked list. */
2418 listnode_add (ifp
->connected
, ifc
);
2421 /* This address is configured from zebra. */
2422 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
))
2423 SET_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
);
2425 /* In case of this route need to install kernel. */
2426 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
)
2427 && CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
)
2428 && !(if_data
&& if_data
->shutdown
== IF_ZEBRA_SHUTDOWN_ON
))
2430 /* Some system need to up the interface to set IP address. */
2431 if (! if_is_up (ifp
))
2433 if_set_flags (ifp
, IFF_UP
| IFF_RUNNING
);
2437 ret
= if_set_prefix (ifp
, ifc
);
2440 vty_out (vty
, "%% Can't set interface IP address: %s.%s",
2441 safe_strerror(errno
), VTY_NEWLINE
);
2445 SET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
2446 /* The address will be advertised to zebra clients when the notification
2447 * from the kernel has been received.
2448 * It will also be added to the subnet chain list, then. */
2455 ip_address_uninstall (struct vty
*vty
, struct interface
*ifp
,
2456 const char *addr_str
, const char *peer_str
,
2459 struct prefix_ipv4 cp
;
2460 struct connected
*ifc
;
2463 /* Convert to prefix structure. */
2464 ret
= str2prefix_ipv4 (addr_str
, &cp
);
2467 vty_out (vty
, "%% Malformed address %s", VTY_NEWLINE
);
2471 /* Check current interface address. */
2472 ifc
= connected_check (ifp
, (struct prefix
*) &cp
);
2475 vty_out (vty
, "%% Can't find address%s", VTY_NEWLINE
);
2479 /* This is not configured address. */
2480 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
))
2483 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
);
2485 /* This is not real address or interface is not active. */
2486 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
)
2487 || ! CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
))
2489 listnode_delete (ifp
->connected
, ifc
);
2490 connected_free (ifc
);
2494 /* This is real route. */
2495 ret
= if_unset_prefix (ifp
, ifc
);
2498 vty_out (vty
, "%% Can't unset interface IP address: %s.%s",
2499 safe_strerror(errno
), VTY_NEWLINE
);
2502 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
2503 /* we will receive a kernel notification about this route being removed.
2504 * this will trigger its removal from the connected list. */
2510 "ip address A.B.C.D/M",
2511 "Interface Internet Protocol config commands\n"
2512 "Set the IP address of an interface\n"
2513 "IP address (e.g. 10.0.0.1/8)\n")
2515 int idx_ipv4_prefixlen
= 2;
2516 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2517 return ip_address_install (vty
, ifp
, argv
[idx_ipv4_prefixlen
]->arg
, NULL
, NULL
);
2520 DEFUN (no_ip_address
,
2522 "no ip address A.B.C.D/M",
2524 "Interface Internet Protocol config commands\n"
2525 "Set the IP address of an interface\n"
2526 "IP Address (e.g. 10.0.0.1/8)")
2528 int idx_ipv4_prefixlen
= 3;
2529 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2530 return ip_address_uninstall (vty
, ifp
, argv
[idx_ipv4_prefixlen
]->arg
, NULL
, NULL
);
2535 DEFUN (ip_address_label
,
2536 ip_address_label_cmd
,
2537 "ip address A.B.C.D/M label LINE",
2538 "Interface Internet Protocol config commands\n"
2539 "Set the IP address of an interface\n"
2540 "IP address (e.g. 10.0.0.1/8)\n"
2541 "Label of this address\n"
2544 int idx_ipv4_prefixlen
= 2;
2546 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2547 return ip_address_install (vty
, ifp
, argv
[idx_ipv4_prefixlen
]->arg
, NULL
, argv
[idx_line
]->arg
);
2550 DEFUN (no_ip_address_label
,
2551 no_ip_address_label_cmd
,
2552 "no ip address A.B.C.D/M label LINE",
2554 "Interface Internet Protocol config commands\n"
2555 "Set the IP address of an interface\n"
2556 "IP address (e.g. 10.0.0.1/8)\n"
2557 "Label of this address\n"
2560 int idx_ipv4_prefixlen
= 3;
2562 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2563 return ip_address_uninstall (vty
, ifp
, argv
[idx_ipv4_prefixlen
]->arg
, NULL
, argv
[idx_line
]->arg
);
2565 #endif /* HAVE_NETLINK */
2568 ipv6_address_install (struct vty
*vty
, struct interface
*ifp
,
2569 const char *addr_str
, const char *peer_str
,
2570 const char *label
, int secondary
)
2572 struct zebra_if
*if_data
;
2573 struct prefix_ipv6 cp
;
2574 struct connected
*ifc
;
2575 struct prefix_ipv6
*p
;
2578 if_data
= ifp
->info
;
2580 ret
= str2prefix_ipv6 (addr_str
, &cp
);
2583 vty_out (vty
, "%% Malformed address %s", VTY_NEWLINE
);
2587 if (ipv6_martian(&cp
.prefix
))
2589 vty_out (vty
, "%% Invalid address%s", VTY_NEWLINE
);
2593 ifc
= connected_check (ifp
, (struct prefix
*) &cp
);
2596 ifc
= connected_new ();
2600 p
= prefix_ipv6_new ();
2602 ifc
->address
= (struct prefix
*) p
;
2606 SET_FLAG (ifc
->flags
, ZEBRA_IFA_SECONDARY
);
2610 ifc
->label
= XSTRDUP (MTYPE_CONNECTED_LABEL
, label
);
2612 /* Add to linked list. */
2613 listnode_add (ifp
->connected
, ifc
);
2616 /* This address is configured from zebra. */
2617 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
))
2618 SET_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
);
2620 /* In case of this route need to install kernel. */
2621 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
)
2622 && CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
)
2623 && !(if_data
&& if_data
->shutdown
== IF_ZEBRA_SHUTDOWN_ON
))
2625 /* Some system need to up the interface to set IP address. */
2626 if (! if_is_up (ifp
))
2628 if_set_flags (ifp
, IFF_UP
| IFF_RUNNING
);
2632 ret
= if_prefix_add_ipv6 (ifp
, ifc
);
2636 vty_out (vty
, "%% Can't set interface IP address: %s.%s",
2637 safe_strerror(errno
), VTY_NEWLINE
);
2641 SET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
2642 /* The address will be advertised to zebra clients when the notification
2643 * from the kernel has been received. */
2649 /* Return true if an ipv6 address is configured on ifp */
2651 ipv6_address_configured (struct interface
*ifp
)
2653 struct connected
*connected
;
2654 struct listnode
*node
;
2656 for (ALL_LIST_ELEMENTS_RO (ifp
->connected
, node
, connected
))
2657 if (CHECK_FLAG (connected
->conf
, ZEBRA_IFC_REAL
) && (connected
->address
->family
== AF_INET6
))
2664 ipv6_address_uninstall (struct vty
*vty
, struct interface
*ifp
,
2665 const char *addr_str
, const char *peer_str
,
2666 const char *label
, int secondry
)
2668 struct prefix_ipv6 cp
;
2669 struct connected
*ifc
;
2672 /* Convert to prefix structure. */
2673 ret
= str2prefix_ipv6 (addr_str
, &cp
);
2676 vty_out (vty
, "%% Malformed address %s", VTY_NEWLINE
);
2680 /* Check current interface address. */
2681 ifc
= connected_check (ifp
, (struct prefix
*) &cp
);
2684 vty_out (vty
, "%% Can't find address%s", VTY_NEWLINE
);
2688 /* This is not configured address. */
2689 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
))
2692 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
);
2694 /* This is not real address or interface is not active. */
2695 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
)
2696 || ! CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
))
2698 listnode_delete (ifp
->connected
, ifc
);
2699 connected_free (ifc
);
2703 /* This is real route. */
2704 ret
= if_prefix_delete_ipv6 (ifp
, ifc
);
2707 vty_out (vty
, "%% Can't unset interface IP address: %s.%s",
2708 safe_strerror(errno
), VTY_NEWLINE
);
2712 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
2713 /* This information will be propagated to the zclients when the
2714 * kernel notification is received. */
2718 DEFUN (ipv6_address
,
2720 "ipv6 address X:X::X:X/M",
2721 "Interface IPv6 config commands\n"
2722 "Set the IP address of an interface\n"
2723 "IPv6 address (e.g. 3ffe:506::1/48)\n")
2725 int idx_ipv6_prefixlen
= 2;
2726 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2727 return ipv6_address_install (vty
, ifp
, argv
[idx_ipv6_prefixlen
]->arg
, NULL
, NULL
, 0);
2730 DEFUN (no_ipv6_address
,
2731 no_ipv6_address_cmd
,
2732 "no 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
= 3;
2739 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2740 return ipv6_address_uninstall (vty
, ifp
, argv
[idx_ipv6_prefixlen
]->arg
, NULL
, NULL
, 0);
2744 link_params_config_write (struct vty
*vty
, struct interface
*ifp
)
2748 if ((ifp
== NULL
) || !HAS_LINK_PARAMS(ifp
))
2751 struct if_link_params
*iflp
= ifp
->link_params
;
2753 vty_out (vty
, " link-params%s", VTY_NEWLINE
);
2754 vty_out(vty
, " enable%s", VTY_NEWLINE
);
2755 if (IS_PARAM_SET(iflp
, LP_TE_METRIC
) && iflp
->te_metric
!= ifp
->metric
)
2756 vty_out(vty
, " metric %u%s",iflp
->te_metric
, VTY_NEWLINE
);
2757 if (IS_PARAM_SET(iflp
, LP_MAX_BW
) && iflp
->max_bw
!= iflp
->default_bw
)
2758 vty_out(vty
, " max-bw %g%s", iflp
->max_bw
, VTY_NEWLINE
);
2759 if (IS_PARAM_SET(iflp
, LP_MAX_RSV_BW
) && iflp
->max_rsv_bw
!= iflp
->default_bw
)
2760 vty_out(vty
, " max-rsv-bw %g%s", iflp
->max_rsv_bw
, VTY_NEWLINE
);
2761 if (IS_PARAM_SET(iflp
, LP_UNRSV_BW
))
2763 for (i
= 0; i
< 8; i
++)
2764 if (iflp
->unrsv_bw
[i
] != iflp
->default_bw
)
2765 vty_out(vty
, " unrsv-bw %d %g%s",
2766 i
, iflp
->unrsv_bw
[i
], VTY_NEWLINE
);
2768 if (IS_PARAM_SET(iflp
, LP_ADM_GRP
))
2769 vty_out(vty
, " admin-grp 0x%x%s", iflp
->admin_grp
, VTY_NEWLINE
);
2770 if (IS_PARAM_SET(iflp
, LP_DELAY
))
2772 vty_out(vty
, " delay %u", iflp
->av_delay
);
2773 if (IS_PARAM_SET(iflp
, LP_MM_DELAY
))
2775 vty_out(vty
, " min %u", iflp
->min_delay
);
2776 vty_out(vty
, " max %u", iflp
->max_delay
);
2778 vty_out(vty
, "%s", VTY_NEWLINE
);
2780 if (IS_PARAM_SET(iflp
, LP_DELAY_VAR
))
2781 vty_out(vty
, " delay-variation %u%s", iflp
->delay_var
, VTY_NEWLINE
);
2782 if (IS_PARAM_SET(iflp
, LP_PKT_LOSS
))
2783 vty_out(vty
, " packet-loss %g%s", iflp
->pkt_loss
, VTY_NEWLINE
);
2784 if (IS_PARAM_SET(iflp
, LP_AVA_BW
))
2785 vty_out(vty
, " ava-bw %g%s", iflp
->ava_bw
, VTY_NEWLINE
);
2786 if (IS_PARAM_SET(iflp
, LP_RES_BW
))
2787 vty_out(vty
, " res-bw %g%s", iflp
->res_bw
, VTY_NEWLINE
);
2788 if (IS_PARAM_SET(iflp
, LP_USE_BW
))
2789 vty_out(vty
, " use-bw %g%s", iflp
->use_bw
, VTY_NEWLINE
);
2790 if (IS_PARAM_SET(iflp
, LP_RMT_AS
))
2791 vty_out(vty
, " neighbor %s as %u%s", inet_ntoa(iflp
->rmt_ip
),
2792 iflp
->rmt_as
, VTY_NEWLINE
);
2793 vty_out(vty
, " exit-link-params%s", VTY_NEWLINE
);
2798 if_config_write (struct vty
*vty
)
2801 struct listnode
*node
;
2802 struct interface
*ifp
;
2804 zebra_ptm_write (vty
);
2806 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
)
2807 for (ALL_LIST_ELEMENTS_RO (vrf
->iflist
, node
, ifp
))
2809 struct zebra_if
*if_data
;
2810 struct listnode
*addrnode
;
2811 struct connected
*ifc
;
2815 if_data
= ifp
->info
;
2816 vrf
= vrf_lookup_by_id (ifp
->vrf_id
);
2818 if (ifp
->vrf_id
== VRF_DEFAULT
)
2819 vty_out (vty
, "interface %s%s", ifp
->name
, VTY_NEWLINE
);
2821 vty_out (vty
, "interface %s vrf %s%s", ifp
->name
, vrf
->name
,
2826 if (if_data
->shutdown
== IF_ZEBRA_SHUTDOWN_ON
)
2827 vty_out (vty
, " shutdown%s", VTY_NEWLINE
);
2829 zebra_ptm_if_write(vty
, if_data
);
2833 vty_out (vty
, " description %s%s", ifp
->desc
,
2836 /* Assign bandwidth here to avoid unnecessary interface flap
2837 while processing config script */
2838 if (ifp
->bandwidth
!= 0)
2839 vty_out(vty
, " bandwidth %u%s", ifp
->bandwidth
, VTY_NEWLINE
);
2841 if (!CHECK_FLAG(ifp
->status
, ZEBRA_INTERFACE_LINKDETECTION
))
2842 vty_out(vty
, " no link-detect%s", VTY_NEWLINE
);
2844 for (ALL_LIST_ELEMENTS_RO (ifp
->connected
, addrnode
, ifc
))
2846 if (CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
))
2848 char buf
[INET6_ADDRSTRLEN
];
2850 vty_out (vty
, " ip%s address %s",
2851 p
->family
== AF_INET
? "" : "v6",
2852 prefix2str (p
, buf
, sizeof(buf
)));
2855 vty_out (vty
, " label %s", ifc
->label
);
2857 vty_out (vty
, "%s", VTY_NEWLINE
);
2863 if (if_data
->multicast
!= IF_ZEBRA_MULTICAST_UNSPEC
)
2864 vty_out (vty
, " %smulticast%s",
2865 if_data
->multicast
== IF_ZEBRA_MULTICAST_ON
? "" : "no ",
2869 #if defined (HAVE_RTADV)
2870 rtadv_config_write (vty
, ifp
);
2871 #endif /* HAVE_RTADV */
2874 irdp_config_write (vty
, ifp
);
2877 link_params_config_write (vty
, ifp
);
2879 vty_out (vty
, "!%s", VTY_NEWLINE
);
2884 /* Allocate and initialize interface vector. */
2886 zebra_if_init (void)
2888 /* Initialize interface and new hook. */
2889 if_add_hook (IF_NEW_HOOK
, if_zebra_new_hook
);
2890 if_add_hook (IF_DELETE_HOOK
, if_zebra_delete_hook
);
2892 /* Install configuration write function. */
2893 install_node (&interface_node
, if_config_write
);
2894 install_node (&link_params_node
, NULL
);
2897 install_element (VIEW_NODE
, &show_interface_cmd
);
2898 install_element (VIEW_NODE
, &show_interface_vrf_all_cmd
);
2899 install_element (VIEW_NODE
, &show_interface_name_vrf_cmd
);
2900 install_element (VIEW_NODE
, &show_interface_name_vrf_all_cmd
);
2902 install_element (ENABLE_NODE
, &show_interface_desc_cmd
);
2903 install_element (ENABLE_NODE
, &show_interface_desc_vrf_all_cmd
);
2904 install_element (INTERFACE_NODE
, &multicast_cmd
);
2905 install_element (INTERFACE_NODE
, &no_multicast_cmd
);
2906 install_element (INTERFACE_NODE
, &linkdetect_cmd
);
2907 install_element (INTERFACE_NODE
, &no_linkdetect_cmd
);
2908 install_element (INTERFACE_NODE
, &shutdown_if_cmd
);
2909 install_element (INTERFACE_NODE
, &no_shutdown_if_cmd
);
2910 install_element (INTERFACE_NODE
, &bandwidth_if_cmd
);
2911 install_element (INTERFACE_NODE
, &no_bandwidth_if_cmd
);
2912 install_element (INTERFACE_NODE
, &ip_address_cmd
);
2913 install_element (INTERFACE_NODE
, &no_ip_address_cmd
);
2914 install_element (INTERFACE_NODE
, &ipv6_address_cmd
);
2915 install_element (INTERFACE_NODE
, &no_ipv6_address_cmd
);
2917 install_element (INTERFACE_NODE
, &ip_address_label_cmd
);
2918 install_element (INTERFACE_NODE
, &no_ip_address_label_cmd
);
2919 #endif /* HAVE_NETLINK */
2920 install_element(INTERFACE_NODE
, &link_params_cmd
);
2921 install_default(LINK_PARAMS_NODE
);
2922 install_element(LINK_PARAMS_NODE
, &link_params_enable_cmd
);
2923 install_element(LINK_PARAMS_NODE
, &no_link_params_enable_cmd
);
2924 install_element(LINK_PARAMS_NODE
, &link_params_metric_cmd
);
2925 install_element(LINK_PARAMS_NODE
, &no_link_params_metric_cmd
);
2926 install_element(LINK_PARAMS_NODE
, &link_params_maxbw_cmd
);
2927 install_element(LINK_PARAMS_NODE
, &link_params_max_rsv_bw_cmd
);
2928 install_element(LINK_PARAMS_NODE
, &link_params_unrsv_bw_cmd
);
2929 install_element(LINK_PARAMS_NODE
, &link_params_admin_grp_cmd
);
2930 install_element(LINK_PARAMS_NODE
, &no_link_params_admin_grp_cmd
);
2931 install_element(LINK_PARAMS_NODE
, &link_params_inter_as_cmd
);
2932 install_element(LINK_PARAMS_NODE
, &no_link_params_inter_as_cmd
);
2933 install_element(LINK_PARAMS_NODE
, &link_params_delay_cmd
);
2934 install_element(LINK_PARAMS_NODE
, &no_link_params_delay_cmd
);
2935 install_element(LINK_PARAMS_NODE
, &link_params_delay_var_cmd
);
2936 install_element(LINK_PARAMS_NODE
, &no_link_params_delay_var_cmd
);
2937 install_element(LINK_PARAMS_NODE
, &link_params_pkt_loss_cmd
);
2938 install_element(LINK_PARAMS_NODE
, &no_link_params_pkt_loss_cmd
);
2939 install_element(LINK_PARAMS_NODE
, &link_params_ava_bw_cmd
);
2940 install_element(LINK_PARAMS_NODE
, &no_link_params_ava_bw_cmd
);
2941 install_element(LINK_PARAMS_NODE
, &link_params_res_bw_cmd
);
2942 install_element(LINK_PARAMS_NODE
, &no_link_params_res_bw_cmd
);
2943 install_element(LINK_PARAMS_NODE
, &link_params_use_bw_cmd
);
2944 install_element(LINK_PARAMS_NODE
, &no_link_params_use_bw_cmd
);
2945 install_element(LINK_PARAMS_NODE
, &exit_link_params_cmd
);