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
);
195 /* Look up an interface by identifier within a NS */
197 if_lookup_by_index_per_ns (struct zebra_ns
*ns
, u_int32_t ifindex
)
200 struct route_node
*rn
;
201 struct interface
*ifp
= NULL
;
203 if_build_key (ifindex
, &p
);
204 rn
= route_node_lookup (ns
->if_table
, &p
);
207 ifp
= (struct interface
*)rn
->info
;
208 route_unlock_node (rn
); /* lookup */
214 ifindex2ifname_per_ns (struct zebra_ns
*zns
, unsigned int ifindex
)
216 struct interface
*ifp
;
218 return ((ifp
= if_lookup_by_index_per_ns (zns
, ifindex
)) != NULL
) ?
219 ifp
->name
: "unknown";
222 /* Tie an interface address to its derived subnet list of addresses. */
224 if_subnet_add (struct interface
*ifp
, struct connected
*ifc
)
226 struct route_node
*rn
;
227 struct zebra_if
*zebra_if
;
229 struct list
*addr_list
;
231 assert (ifp
&& ifp
->info
&& ifc
);
232 zebra_if
= ifp
->info
;
234 /* Get address derived subnet node and associated address list, while marking
235 address secondary attribute appropriately. */
238 rn
= route_node_get (zebra_if
->ipv4_subnets
, &cp
);
240 if ((addr_list
= rn
->info
))
241 SET_FLAG (ifc
->flags
, ZEBRA_IFA_SECONDARY
);
244 UNSET_FLAG (ifc
->flags
, ZEBRA_IFA_SECONDARY
);
245 rn
->info
= addr_list
= list_new ();
246 route_lock_node (rn
);
249 /* Tie address at the tail of address list. */
250 listnode_add (addr_list
, ifc
);
252 /* Return list element count. */
253 return (addr_list
->count
);
256 /* Untie an interface address from its derived subnet list of addresses. */
258 if_subnet_delete (struct interface
*ifp
, struct connected
*ifc
)
260 struct route_node
*rn
;
261 struct zebra_if
*zebra_if
;
262 struct list
*addr_list
;
264 assert (ifp
&& ifp
->info
&& ifc
);
265 zebra_if
= ifp
->info
;
267 /* Get address derived subnet node. */
268 rn
= route_node_lookup (zebra_if
->ipv4_subnets
, ifc
->address
);
269 if (! (rn
&& rn
->info
))
271 zlog_warn("Trying to remove an address from an unknown subnet."
272 " (please report this bug)");
275 route_unlock_node (rn
);
277 /* Untie address from subnet's address list. */
278 addr_list
= rn
->info
;
280 /* Deleting an address that is not registered is a bug.
281 * In any case, we shouldn't decrement the lock counter if the address
283 if (!listnode_lookup(addr_list
, ifc
))
285 zlog_warn("Trying to remove an address from a subnet where it is not"
286 " currently registered. (please report this bug)");
290 listnode_delete (addr_list
, ifc
);
291 route_unlock_node (rn
);
293 /* Return list element count, if not empty. */
294 if (addr_list
->count
)
296 /* If deleted address is primary, mark subsequent one as such and distribute. */
297 if (! CHECK_FLAG (ifc
->flags
, ZEBRA_IFA_SECONDARY
))
299 ifc
= listgetdata ((struct listnode
*)listhead (addr_list
));
300 zebra_interface_address_delete_update (ifp
, ifc
);
301 UNSET_FLAG (ifc
->flags
, ZEBRA_IFA_SECONDARY
);
302 /* XXX: Linux kernel removes all the secondary addresses when the primary
303 * address is removed. We could try to work around that, though this is
305 zebra_interface_address_add_update (ifp
, ifc
);
308 return addr_list
->count
;
311 /* Otherwise, free list and route node. */
312 list_free (addr_list
);
314 route_unlock_node (rn
);
319 /* if_flags_mangle: A place for hacks that require mangling
320 * or tweaking the interface flags.
322 * ******************** Solaris flags hacks **************************
324 * Solaris IFF_UP flag reflects only the primary interface as the
325 * routing socket only sends IFINFO for the primary interface. Hence
326 * ~IFF_UP does not per se imply all the logical interfaces are also
327 * down - which we only know of as addresses. Instead we must determine
328 * whether the interface really is up or not according to how many
329 * addresses are still attached. (Solaris always sends RTM_DELADDR if
330 * an interface, logical or not, goes ~IFF_UP).
332 * Ie, we mangle IFF_UP to *additionally* reflect whether or not there
333 * are addresses left in struct connected, not just the actual underlying
336 * We must hence remember the real state of IFF_UP, which we do in
337 * struct zebra_if.primary_state.
339 * Setting IFF_UP within zebra to administratively shutdown the
340 * interface will affect only the primary interface/address on Solaris.
341 ************************End Solaris flags hacks ***********************
344 if_flags_mangle (struct interface
*ifp
, uint64_t *newflags
)
347 struct zebra_if
*zif
= ifp
->info
;
349 zif
->primary_state
= *newflags
& (IFF_UP
& 0xff);
351 if (CHECK_FLAG (zif
->primary_state
, IFF_UP
)
352 || listcount(ifp
->connected
) > 0)
353 SET_FLAG (*newflags
, IFF_UP
);
355 UNSET_FLAG (*newflags
, IFF_UP
);
359 /* Update the flags field of the ifp with the new flag set provided.
360 * Take whatever actions are required for any changes in flags we care
363 * newflags should be the raw value, as obtained from the OS.
366 if_flags_update (struct interface
*ifp
, uint64_t newflags
)
368 if_flags_mangle (ifp
, &newflags
);
370 if (if_is_no_ptm_operative (ifp
))
372 /* operative -> inoperative? */
373 ifp
->flags
= newflags
;
374 if (!if_is_operative (ifp
))
379 /* inoperative -> operative? */
380 ifp
->flags
= newflags
;
381 if (if_is_operative (ifp
))
386 /* Wake up configured address if it is not in current kernel
389 if_addr_wakeup (struct interface
*ifp
)
391 struct listnode
*node
, *nnode
;
392 struct connected
*ifc
;
396 for (ALL_LIST_ELEMENTS (ifp
->connected
, node
, nnode
, ifc
))
400 if (CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
)
401 && ! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
))
404 if (p
->family
== AF_INET
)
406 if (! if_is_up (ifp
))
408 /* Assume zebra is configured like following:
411 * ip addr 192.0.2.1/24
414 * As soon as zebra becomes first aware that gre0 exists in the
415 * kernel, it will set gre0 up and configure its addresses.
417 * (This may happen at startup when the interface already exists
418 * or during runtime when the interface is added to the kernel)
420 * XXX: IRDP code is calling here via if_add_update - this seems
422 * XXX: RUNNING is not a settable flag on any system
423 * I (paulj) am aware of.
425 if_set_flags (ifp
, IFF_UP
| IFF_RUNNING
);
429 ret
= if_set_prefix (ifp
, ifc
);
432 zlog_warn ("Can't set interface's address: %s",
433 safe_strerror(errno
));
437 SET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
438 /* The address will be advertised to zebra clients when the notification
439 * from the kernel has been received.
440 * It will also be added to the interface's subnet list then. */
442 if (p
->family
== AF_INET6
)
444 if (! if_is_up (ifp
))
446 /* See long comment above */
447 if_set_flags (ifp
, IFF_UP
| IFF_RUNNING
);
451 ret
= if_prefix_add_ipv6 (ifp
, ifc
);
454 zlog_warn ("Can't set interface's address: %s",
455 safe_strerror(errno
));
459 SET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
460 /* The address will be advertised to zebra clients when the notification
461 * from the kernel has been received. */
467 /* Handle interface addition */
469 if_add_update (struct interface
*ifp
)
471 struct zebra_if
*if_data
;
473 if_link_per_ns(zebra_ns_lookup (NS_DEFAULT
), ifp
);
478 if (if_data
->multicast
== IF_ZEBRA_MULTICAST_ON
)
479 if_set_flags (ifp
, IFF_MULTICAST
);
480 else if (if_data
->multicast
== IF_ZEBRA_MULTICAST_OFF
)
481 if_unset_flags (ifp
, IFF_MULTICAST
);
483 zebra_ptm_if_set_ptm_state(ifp
, if_data
);
485 zebra_interface_add_update (ifp
);
487 if (! CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
))
489 SET_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
);
491 if (if_data
&& if_data
->shutdown
== IF_ZEBRA_SHUTDOWN_ON
)
493 if (IS_ZEBRA_DEBUG_KERNEL
)
494 zlog_debug ("interface %s vrf %u index %d is shutdown. "
496 ifp
->name
, ifp
->vrf_id
, ifp
->ifindex
);
500 if_addr_wakeup (ifp
);
502 if (IS_ZEBRA_DEBUG_KERNEL
)
503 zlog_debug ("interface %s vrf %u index %d becomes active.",
504 ifp
->name
, ifp
->vrf_id
, ifp
->ifindex
);
508 if (IS_ZEBRA_DEBUG_KERNEL
)
509 zlog_debug ("interface %s vrf %u index %d is added.",
510 ifp
->name
, ifp
->vrf_id
, ifp
->ifindex
);
514 /* Install connected routes corresponding to an interface. */
516 if_install_connected (struct interface
*ifp
)
518 struct listnode
*node
;
519 struct listnode
*next
;
520 struct connected
*ifc
;
525 for (ALL_LIST_ELEMENTS (ifp
->connected
, node
, next
, ifc
))
527 if (CHECK_FLAG(ifc
->conf
, ZEBRA_IFC_REAL
))
528 zebra_interface_address_add_update (ifp
, ifc
);
531 if (p
->family
== AF_INET
)
532 connected_up_ipv4 (ifp
, ifc
);
533 else if (p
->family
== AF_INET6
)
534 connected_up_ipv6 (ifp
, ifc
);
539 /* Uninstall connected routes corresponding to an interface. */
541 if_uninstall_connected (struct interface
*ifp
)
543 struct listnode
*node
;
544 struct listnode
*next
;
545 struct connected
*ifc
;
550 for (ALL_LIST_ELEMENTS (ifp
->connected
, node
, next
, ifc
))
553 zebra_interface_address_delete_update (ifp
, ifc
);
555 if (p
->family
== AF_INET
)
556 connected_down_ipv4 (ifp
, ifc
);
557 else if (p
->family
== AF_INET6
)
558 connected_down_ipv6 (ifp
, ifc
);
563 /* Uninstall and delete connected routes corresponding to an interface. */
564 /* TODO - Check why IPv4 handling here is different from install or if_down */
566 if_delete_connected (struct interface
*ifp
)
568 struct connected
*ifc
;
570 struct route_node
*rn
;
571 struct zebra_if
*zebra_if
;
573 zebra_if
= ifp
->info
;
577 struct listnode
*node
;
578 struct listnode
*last
= NULL
;
580 while ((node
= (last
? last
->next
: listhead (ifp
->connected
))))
582 ifc
= listgetdata (node
);
585 if (p
->family
== AF_INET
586 && (rn
= route_node_lookup (zebra_if
->ipv4_subnets
, p
)))
588 struct listnode
*anode
;
589 struct listnode
*next
;
590 struct listnode
*first
;
591 struct list
*addr_list
;
593 route_unlock_node (rn
);
594 addr_list
= (struct list
*) rn
->info
;
596 /* Remove addresses, secondaries first. */
597 first
= listhead (addr_list
);
598 for (anode
= first
->next
; anode
|| first
; anode
= next
)
607 ifc
= listgetdata (anode
);
608 connected_down_ipv4 (ifp
, ifc
);
610 /* XXX: We have to send notifications here explicitly, because we destroy
611 * the ifc before receiving the notification about the address being deleted.
613 zebra_interface_address_delete_update (ifp
, ifc
);
615 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_REAL
);
616 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
618 /* Remove from subnet chain. */
619 list_delete_node (addr_list
, anode
);
620 route_unlock_node (rn
);
622 /* Remove from interface address list (unconditionally). */
623 if (!CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
))
625 listnode_delete (ifp
->connected
, ifc
);
626 connected_free (ifc
);
632 /* Free chain list and respective route node. */
633 list_delete (addr_list
);
635 route_unlock_node (rn
);
637 else if (p
->family
== AF_INET6
)
639 connected_down_ipv6 (ifp
, ifc
);
641 zebra_interface_address_delete_update (ifp
, ifc
);
643 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_REAL
);
644 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
646 if (CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
))
650 listnode_delete (ifp
->connected
, ifc
);
651 connected_free (ifc
);
662 /* Handle an interface delete event */
664 if_delete_update (struct interface
*ifp
)
668 zlog_err ("interface %s vrf %u index %d is still up while being deleted.",
669 ifp
->name
, ifp
->vrf_id
, ifp
->ifindex
);
673 /* Mark interface as inactive */
674 UNSET_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
);
676 if (IS_ZEBRA_DEBUG_KERNEL
)
677 zlog_debug ("interface %s vrf %u index %d is now inactive.",
678 ifp
->name
, ifp
->vrf_id
, ifp
->ifindex
);
680 /* Delete connected routes from the kernel. */
681 if_delete_connected (ifp
);
683 /* Send out notification on interface delete. */
684 zebra_interface_delete_update (ifp
);
686 if_unlink_per_ns(ifp
);
688 /* Update ifindex after distributing the delete message. This is in
689 case any client needs to have the old value of ifindex available
690 while processing the deletion. Each client daemon is responsible
691 for setting ifindex to IFINDEX_INTERNAL after processing the
692 interface deletion message. */
693 ifp
->ifindex
= IFINDEX_INTERNAL
;
696 /* VRF change for an interface */
698 if_handle_vrf_change (struct interface
*ifp
, vrf_id_t vrf_id
)
702 old_vrf_id
= ifp
->vrf_id
;
704 /* Uninstall connected routes. */
705 if_uninstall_connected (ifp
);
707 /* Delete any IPv4 neighbors created to implement RFC 5549 */
708 if_nbr_ipv6ll_to_ipv4ll_neigh_del_all (ifp
);
710 /* Delete all neighbor addresses learnt through IPv6 RA */
711 if_down_del_nbr_connected (ifp
);
713 /* Send out notification on interface VRF change. */
714 /* This is to issue an UPDATE or a DELETE, as appropriate. */
715 zebra_interface_vrf_update_del (ifp
, vrf_id
);
718 if_update_vrf (ifp
, ifp
->name
, strlen (ifp
->name
), vrf_id
);
720 /* Send out notification on interface VRF change. */
721 /* This is to issue an ADD, if needed. */
722 zebra_interface_vrf_update_add (ifp
, old_vrf_id
);
724 /* Install connected routes (in new VRF). */
725 if_install_connected (ifp
);
727 /* Due to connected route change, schedule RIB processing for both old
730 if (IS_ZEBRA_DEBUG_RIB_DETAILED
)
731 zlog_debug ("%u: IF %s VRF change, scheduling RIB processing",
732 ifp
->vrf_id
, ifp
->name
);
733 rib_update (old_vrf_id
, RIB_UPDATE_IF_CHANGE
);
734 rib_update (ifp
->vrf_id
, RIB_UPDATE_IF_CHANGE
);
736 zebra_vrf_static_route_interface_fixup (ifp
);
740 ipv6_ll_address_to_mac (struct in6_addr
*address
, u_char
*mac
)
742 mac
[0] = address
->s6_addr
[8] ^ 0x02;
743 mac
[1] = address
->s6_addr
[9];
744 mac
[2] = address
->s6_addr
[10];
745 mac
[3] = address
->s6_addr
[13];
746 mac
[4] = address
->s6_addr
[14];
747 mac
[5] = address
->s6_addr
[15];
751 if_nbr_ipv6ll_to_ipv4ll_neigh_update (struct interface
*ifp
,
752 struct in6_addr
*address
,
755 char buf
[16] = "169.254.0.1";
756 struct in_addr ipv4_ll
;
759 inet_pton (AF_INET
, buf
, &ipv4_ll
);
761 ipv6_ll_address_to_mac(address
, (u_char
*)mac
);
762 kernel_neigh_update (add
, ifp
->ifindex
, ipv4_ll
.s_addr
, mac
, 6);
766 if_nbr_ipv6ll_to_ipv4ll_neigh_add_all (struct interface
*ifp
)
768 if (listhead(ifp
->nbr_connected
))
770 struct nbr_connected
*nbr_connected
;
771 struct listnode
*node
;
773 for (ALL_LIST_ELEMENTS_RO (ifp
->nbr_connected
, node
, nbr_connected
))
774 if_nbr_ipv6ll_to_ipv4ll_neigh_update (ifp
,
775 &nbr_connected
->address
->u
.prefix6
,
781 if_nbr_ipv6ll_to_ipv4ll_neigh_del_all (struct interface
*ifp
)
783 if (listhead(ifp
->nbr_connected
))
785 struct nbr_connected
*nbr_connected
;
786 struct listnode
*node
;
788 for (ALL_LIST_ELEMENTS_RO (ifp
->nbr_connected
, node
, nbr_connected
))
789 if_nbr_ipv6ll_to_ipv4ll_neigh_update (ifp
,
790 &nbr_connected
->address
->u
.prefix6
,
796 if_down_del_nbr_connected (struct interface
*ifp
)
798 struct nbr_connected
*nbr_connected
;
799 struct listnode
*node
, *nnode
;
801 for (ALL_LIST_ELEMENTS (ifp
->nbr_connected
, node
, nnode
, nbr_connected
))
803 listnode_delete (ifp
->nbr_connected
, nbr_connected
);
804 nbr_connected_free (nbr_connected
);
808 /* Interface is up. */
810 if_up (struct interface
*ifp
)
812 struct zebra_if
*zif
;
816 quagga_timestamp (2, zif
->up_last
, sizeof (zif
->up_last
));
818 /* Notify the protocol daemons. */
819 if (ifp
->ptm_enable
&& (ifp
->ptm_status
== ZEBRA_PTM_STATUS_DOWN
)) {
820 zlog_warn("%s: interface %s hasn't passed ptm check\n", __func__
,
824 zebra_interface_up_update (ifp
);
826 if_nbr_ipv6ll_to_ipv4ll_neigh_add_all (ifp
);
828 /* Enable fast tx of RA if enabled && RA interval is not in msecs */
829 if (zif
->rtadv
.AdvSendAdvertisements
&&
830 (zif
->rtadv
.MaxRtrAdvInterval
>= 1000))
832 zif
->rtadv
.inFastRexmit
= 1;
833 zif
->rtadv
.NumFastReXmitsRemain
= RTADV_NUM_FAST_REXMITS
;
836 /* Install connected routes to the kernel. */
837 if_install_connected (ifp
);
839 if (IS_ZEBRA_DEBUG_RIB_DETAILED
)
840 zlog_debug ("%u: IF %s up, scheduling RIB processing",
841 ifp
->vrf_id
, ifp
->name
);
842 rib_update (ifp
->vrf_id
, RIB_UPDATE_IF_CHANGE
);
844 zebra_vrf_static_route_interface_fixup (ifp
);
847 /* Interface goes down. We have to manage different behavior of based
850 if_down (struct interface
*ifp
)
852 struct zebra_if
*zif
;
856 quagga_timestamp (2, zif
->down_last
, sizeof (zif
->down_last
));
858 /* Notify to the protocol daemons. */
859 zebra_interface_down_update (ifp
);
861 /* Uninstall connected routes from the kernel. */
862 if_uninstall_connected (ifp
);
864 if (IS_ZEBRA_DEBUG_RIB_DETAILED
)
865 zlog_debug ("%u: IF %s down, scheduling RIB processing",
866 ifp
->vrf_id
, ifp
->name
);
867 rib_update (ifp
->vrf_id
, RIB_UPDATE_IF_CHANGE
);
869 if_nbr_ipv6ll_to_ipv4ll_neigh_del_all (ifp
);
871 /* Delete all neighbor addresses learnt through IPv6 RA */
872 if_down_del_nbr_connected (ifp
);
876 if_refresh (struct interface
*ifp
)
882 /* Output prefix string to vty. */
884 prefix_vty_out (struct vty
*vty
, struct prefix
*p
)
886 char str
[INET6_ADDRSTRLEN
];
888 inet_ntop (p
->family
, &p
->u
.prefix
, str
, sizeof (str
));
889 vty_out (vty
, "%s", str
);
893 /* Dump if address information to vty. */
895 connected_dump_vty (struct vty
*vty
, struct connected
*connected
)
899 /* Print interface address. */
900 p
= connected
->address
;
901 vty_out (vty
, " %s ", prefix_family_str (p
));
902 prefix_vty_out (vty
, p
);
903 vty_out (vty
, "/%d", p
->prefixlen
);
905 /* If there is destination address, print it. */
906 if (connected
->destination
)
908 vty_out (vty
, (CONNECTED_PEER(connected
) ? " peer " : " broadcast "));
909 prefix_vty_out (vty
, connected
->destination
);
912 if (CHECK_FLAG (connected
->flags
, ZEBRA_IFA_SECONDARY
))
913 vty_out (vty
, " secondary");
915 if (CHECK_FLAG (connected
->flags
, ZEBRA_IFA_UNNUMBERED
))
916 vty_out (vty
, " unnumbered");
918 if (connected
->label
)
919 vty_out (vty
, " %s", connected
->label
);
921 vty_out (vty
, "%s", VTY_NEWLINE
);
924 /* Dump interface neighbor address information to vty. */
926 nbr_connected_dump_vty (struct vty
*vty
, struct nbr_connected
*connected
)
930 /* Print interface address. */
931 p
= connected
->address
;
932 vty_out (vty
, " %s ", prefix_family_str (p
));
933 prefix_vty_out (vty
, p
);
934 vty_out (vty
, "/%d", p
->prefixlen
);
936 vty_out (vty
, "%s", VTY_NEWLINE
);
939 #if defined (HAVE_RTADV)
940 /* Dump interface ND information to vty. */
942 nd_dump_vty (struct vty
*vty
, struct interface
*ifp
)
944 struct zebra_if
*zif
;
945 struct rtadvconf
*rtadv
;
948 zif
= (struct zebra_if
*) ifp
->info
;
951 if (rtadv
->AdvSendAdvertisements
)
953 vty_out (vty
, " ND advertised reachable time is %d milliseconds%s",
954 rtadv
->AdvReachableTime
, VTY_NEWLINE
);
955 vty_out (vty
, " ND advertised retransmit interval is %d milliseconds%s",
956 rtadv
->AdvRetransTimer
, VTY_NEWLINE
);
957 vty_out (vty
, " ND router advertisements sent: %d rcvd: %d%s",
958 zif
->ra_sent
, zif
->ra_rcvd
, VTY_NEWLINE
);
959 interval
= rtadv
->MaxRtrAdvInterval
;
961 vty_out (vty
, " ND router advertisements are sent every "
962 "%d milliseconds%s", interval
,
965 vty_out (vty
, " ND router advertisements are sent every "
966 "%d seconds%s", interval
/ 1000,
968 if (rtadv
->AdvDefaultLifetime
!= -1)
969 vty_out (vty
, " ND router advertisements live for %d seconds%s",
970 rtadv
->AdvDefaultLifetime
, VTY_NEWLINE
);
972 vty_out (vty
, " ND router advertisements lifetime tracks ra-interval%s",
974 vty_out (vty
, " ND router advertisement default router preference is "
975 "%s%s", rtadv_pref_strs
[rtadv
->DefaultPreference
],
977 if (rtadv
->AdvManagedFlag
)
978 vty_out (vty
, " Hosts use DHCP to obtain routable addresses.%s",
981 vty_out (vty
, " Hosts use stateless autoconfig for addresses.%s",
983 if (rtadv
->AdvHomeAgentFlag
)
985 vty_out (vty
, " ND router advertisements with "
986 "Home Agent flag bit set.%s",
988 if (rtadv
->HomeAgentLifetime
!= -1)
989 vty_out (vty
, " Home Agent lifetime is %u seconds%s",
990 rtadv
->HomeAgentLifetime
, VTY_NEWLINE
);
992 vty_out (vty
, " Home Agent lifetime tracks ra-lifetime%s",
994 vty_out (vty
, " Home Agent preference is %u%s",
995 rtadv
->HomeAgentPreference
, VTY_NEWLINE
);
997 if (rtadv
->AdvIntervalOption
)
998 vty_out (vty
, " ND router advertisements with Adv. Interval option.%s",
1002 #endif /* HAVE_RTADV */
1004 /* Interface's information print out to vty interface. */
1006 if_dump_vty (struct vty
*vty
, struct interface
*ifp
)
1008 struct connected
*connected
;
1009 struct nbr_connected
*nbr_connected
;
1010 struct listnode
*node
;
1011 struct route_node
*rn
;
1012 struct zebra_if
*zebra_if
;
1015 zebra_if
= ifp
->info
;
1017 vty_out (vty
, "Interface %s is ", ifp
->name
);
1018 if (if_is_up(ifp
)) {
1019 vty_out (vty
, "up, line protocol ");
1021 if (CHECK_FLAG(ifp
->status
, ZEBRA_INTERFACE_LINKDETECTION
)) {
1022 if (if_is_running(ifp
))
1023 vty_out (vty
, "is up%s", VTY_NEWLINE
);
1025 vty_out (vty
, "is down%s", VTY_NEWLINE
);
1027 vty_out (vty
, "detection is disabled%s", VTY_NEWLINE
);
1030 vty_out (vty
, "down%s", VTY_NEWLINE
);
1033 vty_out (vty
, " Link ups: %5u last: %s%s", zebra_if
->up_count
,
1034 zebra_if
->up_last
[0] ? zebra_if
->up_last
: "(never)", VTY_NEWLINE
);
1035 vty_out (vty
, " Link downs: %5u last: %s%s", zebra_if
->down_count
,
1036 zebra_if
->down_last
[0] ? zebra_if
->down_last
: "(never)", VTY_NEWLINE
);
1038 zebra_ptm_show_status(vty
, ifp
);
1040 vrf
= vrf_lookup_by_id (ifp
->vrf_id
);
1041 vty_out (vty
, " vrf: %s%s", vrf
->name
, VTY_NEWLINE
);
1044 vty_out (vty
, " Description: %s%s", ifp
->desc
,
1046 if (ifp
->ifindex
== IFINDEX_INTERNAL
)
1048 vty_out(vty
, " pseudo interface%s", VTY_NEWLINE
);
1051 else if (! CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
))
1053 vty_out(vty
, " index %d inactive interface%s",
1059 vty_out (vty
, " index %d metric %d mtu %d ",
1060 ifp
->ifindex
, ifp
->metric
, ifp
->mtu
);
1061 if (ifp
->mtu6
!= ifp
->mtu
)
1062 vty_out (vty
, "mtu6 %d ", ifp
->mtu6
);
1063 vty_out (vty
, "%s flags: %s%s", VTY_NEWLINE
,
1064 if_flag_dump (ifp
->flags
), VTY_NEWLINE
);
1066 /* Hardware address. */
1067 vty_out (vty
, " Type: %s%s", if_link_type_str (ifp
->ll_type
), VTY_NEWLINE
);
1068 if (ifp
->hw_addr_len
!= 0)
1072 vty_out (vty
, " HWaddr: ");
1073 for (i
= 0; i
< ifp
->hw_addr_len
; i
++)
1074 vty_out (vty
, "%s%02x", i
== 0 ? "" : ":", ifp
->hw_addr
[i
]);
1075 vty_out (vty
, "%s", VTY_NEWLINE
);
1078 /* Bandwidth in Mbps */
1079 if (ifp
->bandwidth
!= 0)
1081 vty_out(vty
, " bandwidth %u Mbps", ifp
->bandwidth
);
1082 vty_out(vty
, "%s", VTY_NEWLINE
);
1085 for (rn
= route_top (zebra_if
->ipv4_subnets
); rn
; rn
= route_next (rn
))
1090 for (ALL_LIST_ELEMENTS_RO ((struct list
*)rn
->info
, node
, connected
))
1091 connected_dump_vty (vty
, connected
);
1094 for (ALL_LIST_ELEMENTS_RO (ifp
->connected
, node
, connected
))
1096 if (CHECK_FLAG (connected
->conf
, ZEBRA_IFC_REAL
) &&
1097 (connected
->address
->family
== AF_INET6
))
1098 connected_dump_vty (vty
, connected
);
1101 if (HAS_LINK_PARAMS(ifp
))
1104 struct if_link_params
*iflp
= ifp
->link_params
;
1105 vty_out(vty
, " Traffic Engineering Link Parameters:%s", VTY_NEWLINE
);
1106 if (IS_PARAM_SET(iflp
, LP_TE_METRIC
))
1107 vty_out(vty
, " TE metric %u%s",iflp
->te_metric
, VTY_NEWLINE
);
1108 if (IS_PARAM_SET(iflp
, LP_MAX_BW
))
1109 vty_out(vty
, " Maximum Bandwidth %g (Byte/s)%s", iflp
->max_bw
, VTY_NEWLINE
);
1110 if (IS_PARAM_SET(iflp
, LP_MAX_RSV_BW
))
1111 vty_out(vty
, " Maximum Reservable Bandwidth %g (Byte/s)%s", iflp
->max_rsv_bw
, VTY_NEWLINE
);
1112 if (IS_PARAM_SET(iflp
, LP_UNRSV_BW
)) {
1113 vty_out(vty
, " Unreserved Bandwidth per Class Type in Byte/s:%s", VTY_NEWLINE
);
1114 for (i
= 0; i
< MAX_CLASS_TYPE
; i
+=2)
1115 vty_out(vty
, " [%d]: %g (Bytes/sec),\t[%d]: %g (Bytes/sec)%s",
1116 i
, iflp
->unrsv_bw
[i
], i
+1, iflp
->unrsv_bw
[i
+1], VTY_NEWLINE
);
1119 if (IS_PARAM_SET(iflp
, LP_ADM_GRP
))
1120 vty_out(vty
, " Administrative Group:%u%s", iflp
->admin_grp
, VTY_NEWLINE
);
1121 if (IS_PARAM_SET(iflp
, LP_DELAY
))
1123 vty_out(vty
, " Link Delay Average: %u (micro-sec.)", iflp
->av_delay
);
1124 if (IS_PARAM_SET(iflp
, LP_MM_DELAY
))
1126 vty_out(vty
, " Min: %u (micro-sec.)", iflp
->min_delay
);
1127 vty_out(vty
, " Max: %u (micro-sec.)", iflp
->max_delay
);
1129 vty_out(vty
, "%s", VTY_NEWLINE
);
1131 if (IS_PARAM_SET(iflp
, LP_DELAY_VAR
))
1132 vty_out(vty
, " Link Delay Variation %u (micro-sec.)%s", iflp
->delay_var
, VTY_NEWLINE
);
1133 if (IS_PARAM_SET(iflp
, LP_PKT_LOSS
))
1134 vty_out(vty
, " Link Packet Loss %g (in %%)%s", iflp
->pkt_loss
, VTY_NEWLINE
);
1135 if (IS_PARAM_SET(iflp
, LP_AVA_BW
))
1136 vty_out(vty
, " Available Bandwidth %g (Byte/s)%s", iflp
->ava_bw
, VTY_NEWLINE
);
1137 if (IS_PARAM_SET(iflp
, LP_RES_BW
))
1138 vty_out(vty
, " Residual Bandwidth %g (Byte/s)%s", iflp
->res_bw
, VTY_NEWLINE
);
1139 if (IS_PARAM_SET(iflp
, LP_USE_BW
))
1140 vty_out(vty
, " Utilized Bandwidth %g (Byte/s)%s", iflp
->use_bw
, VTY_NEWLINE
);
1141 if (IS_PARAM_SET(iflp
, LP_RMT_AS
))
1142 vty_out(vty
, " Neighbor ASBR IP: %s AS: %u %s", inet_ntoa(iflp
->rmt_ip
), iflp
->rmt_as
, VTY_NEWLINE
);
1146 nd_dump_vty (vty
, ifp
);
1148 #if defined (HAVE_RTADV)
1149 nd_dump_vty (vty
, ifp
);
1150 #endif /* HAVE_RTADV */
1151 if (listhead(ifp
->nbr_connected
))
1152 vty_out (vty
, " Neighbor address(s):%s", VTY_NEWLINE
);
1153 for (ALL_LIST_ELEMENTS_RO (ifp
->nbr_connected
, node
, nbr_connected
))
1154 nbr_connected_dump_vty (vty
, nbr_connected
);
1156 #ifdef HAVE_PROC_NET_DEV
1157 /* Statistics print out using proc file system. */
1158 vty_out (vty
, " %lu input packets (%lu multicast), %lu bytes, "
1160 ifp
->stats
.rx_packets
, ifp
->stats
.rx_multicast
,
1161 ifp
->stats
.rx_bytes
, ifp
->stats
.rx_dropped
, VTY_NEWLINE
);
1163 vty_out (vty
, " %lu input errors, %lu length, %lu overrun,"
1164 " %lu CRC, %lu frame%s",
1165 ifp
->stats
.rx_errors
, ifp
->stats
.rx_length_errors
,
1166 ifp
->stats
.rx_over_errors
, ifp
->stats
.rx_crc_errors
,
1167 ifp
->stats
.rx_frame_errors
, VTY_NEWLINE
);
1169 vty_out (vty
, " %lu fifo, %lu missed%s", ifp
->stats
.rx_fifo_errors
,
1170 ifp
->stats
.rx_missed_errors
, VTY_NEWLINE
);
1172 vty_out (vty
, " %lu output packets, %lu bytes, %lu dropped%s",
1173 ifp
->stats
.tx_packets
, ifp
->stats
.tx_bytes
,
1174 ifp
->stats
.tx_dropped
, VTY_NEWLINE
);
1176 vty_out (vty
, " %lu output errors, %lu aborted, %lu carrier,"
1177 " %lu fifo, %lu heartbeat%s",
1178 ifp
->stats
.tx_errors
, ifp
->stats
.tx_aborted_errors
,
1179 ifp
->stats
.tx_carrier_errors
, ifp
->stats
.tx_fifo_errors
,
1180 ifp
->stats
.tx_heartbeat_errors
, VTY_NEWLINE
);
1182 vty_out (vty
, " %lu window, %lu collisions%s",
1183 ifp
->stats
.tx_window_errors
, ifp
->stats
.collisions
, VTY_NEWLINE
);
1184 #endif /* HAVE_PROC_NET_DEV */
1186 #ifdef HAVE_NET_RT_IFLIST
1187 #if defined (__bsdi__) || defined (__NetBSD__)
1188 /* Statistics print out using sysctl (). */
1189 vty_out (vty
, " input packets %llu, bytes %llu, dropped %llu,"
1190 " multicast packets %llu%s",
1191 (unsigned long long)ifp
->stats
.ifi_ipackets
,
1192 (unsigned long long)ifp
->stats
.ifi_ibytes
,
1193 (unsigned long long)ifp
->stats
.ifi_iqdrops
,
1194 (unsigned long long)ifp
->stats
.ifi_imcasts
,
1197 vty_out (vty
, " input errors %llu%s",
1198 (unsigned long long)ifp
->stats
.ifi_ierrors
, VTY_NEWLINE
);
1200 vty_out (vty
, " output packets %llu, bytes %llu,"
1201 " multicast packets %llu%s",
1202 (unsigned long long)ifp
->stats
.ifi_opackets
,
1203 (unsigned long long)ifp
->stats
.ifi_obytes
,
1204 (unsigned long long)ifp
->stats
.ifi_omcasts
,
1207 vty_out (vty
, " output errors %llu%s",
1208 (unsigned long long)ifp
->stats
.ifi_oerrors
, VTY_NEWLINE
);
1210 vty_out (vty
, " collisions %llu%s",
1211 (unsigned long long)ifp
->stats
.ifi_collisions
, VTY_NEWLINE
);
1213 /* Statistics print out using sysctl (). */
1214 vty_out (vty
, " input packets %lu, bytes %lu, dropped %lu,"
1215 " multicast packets %lu%s",
1216 ifp
->stats
.ifi_ipackets
, ifp
->stats
.ifi_ibytes
,
1217 ifp
->stats
.ifi_iqdrops
, ifp
->stats
.ifi_imcasts
,
1220 vty_out (vty
, " input errors %lu%s",
1221 ifp
->stats
.ifi_ierrors
, VTY_NEWLINE
);
1223 vty_out (vty
, " output packets %lu, bytes %lu, multicast packets %lu%s",
1224 ifp
->stats
.ifi_opackets
, ifp
->stats
.ifi_obytes
,
1225 ifp
->stats
.ifi_omcasts
, VTY_NEWLINE
);
1227 vty_out (vty
, " output errors %lu%s",
1228 ifp
->stats
.ifi_oerrors
, VTY_NEWLINE
);
1230 vty_out (vty
, " collisions %lu%s",
1231 ifp
->stats
.ifi_collisions
, VTY_NEWLINE
);
1232 #endif /* __bsdi__ || __NetBSD__ */
1233 #endif /* HAVE_NET_RT_IFLIST */
1237 interface_update_stats (void)
1239 #ifdef HAVE_PROC_NET_DEV
1240 /* If system has interface statistics via proc file system, update
1242 ifstat_update_proc ();
1243 #endif /* HAVE_PROC_NET_DEV */
1244 #ifdef HAVE_NET_RT_IFLIST
1245 ifstat_update_sysctl ();
1246 #endif /* HAVE_NET_RT_IFLIST */
1249 struct cmd_node interface_node
=
1256 /* Show all interfaces to vty. */
1257 DEFUN (show_interface
,
1259 "show interface [vrf NAME]",
1261 "Interface status and configuration\n"
1264 struct listnode
*node
;
1265 struct interface
*ifp
;
1266 vrf_id_t vrf_id
= VRF_DEFAULT
;
1268 interface_update_stats ();
1271 VRF_GET_ID (vrf_id
, argv
[3]->arg
);
1273 /* All interface print. */
1274 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (vrf_id
), node
, ifp
))
1275 if_dump_vty (vty
, ifp
);
1281 /* Show all interfaces to vty. */
1282 DEFUN (show_interface_vrf_all
,
1283 show_interface_vrf_all_cmd
,
1284 "show interface vrf all",
1286 "Interface status and configuration\n"
1287 VRF_ALL_CMD_HELP_STR
)
1290 struct listnode
*node
;
1291 struct interface
*ifp
;
1293 interface_update_stats ();
1295 /* All interface print. */
1296 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
)
1297 for (ALL_LIST_ELEMENTS_RO (vrf
->iflist
, node
, ifp
))
1298 if_dump_vty (vty
, ifp
);
1303 /* Show specified interface to vty. */
1305 DEFUN (show_interface_name_vrf
,
1306 show_interface_name_vrf_cmd
,
1307 "show interface IFNAME vrf NAME",
1309 "Interface status and configuration\n"
1315 struct interface
*ifp
;
1316 vrf_id_t vrf_id
= VRF_DEFAULT
;
1318 interface_update_stats ();
1320 VRF_GET_ID (vrf_id
, argv
[idx_name
]->arg
);
1322 /* Specified interface print. */
1323 ifp
= if_lookup_by_name_vrf (argv
[idx_ifname
]->arg
, vrf_id
);
1326 vty_out (vty
, "%% Can't find interface %s%s", argv
[idx_ifname
]->arg
,
1330 if_dump_vty (vty
, ifp
);
1335 /* Show specified interface to vty. */
1336 DEFUN (show_interface_name_vrf_all
,
1337 show_interface_name_vrf_all_cmd
,
1338 "show interface IFNAME [vrf all]",
1340 "Interface status and configuration\n"
1342 VRF_ALL_CMD_HELP_STR
)
1346 struct interface
*ifp
;
1349 interface_update_stats ();
1351 /* All interface print. */
1352 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
)
1354 /* Specified interface print. */
1355 ifp
= if_lookup_by_name_vrf (argv
[idx_ifname
]->arg
, vrf
->vrf_id
);
1358 if_dump_vty (vty
, ifp
);
1365 vty_out (vty
, "%% Can't find interface %s%s", argv
[idx_ifname
]->arg
, VTY_NEWLINE
);
1374 if_show_description (struct vty
*vty
, vrf_id_t vrf_id
)
1376 struct listnode
*node
;
1377 struct interface
*ifp
;
1379 vty_out (vty
, "Interface Status Protocol Description%s", VTY_NEWLINE
);
1380 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (vrf_id
), node
, ifp
))
1384 len
= vty_out (vty
, "%s", ifp
->name
);
1385 vty_out (vty
, "%*s", (16 - len
), " ");
1389 vty_out (vty
, "up ");
1390 if (CHECK_FLAG(ifp
->status
, ZEBRA_INTERFACE_LINKDETECTION
))
1392 if (if_is_running(ifp
))
1393 vty_out (vty
, "up ");
1395 vty_out (vty
, "down ");
1399 vty_out (vty
, "unknown ");
1404 vty_out (vty
, "down down ");
1408 vty_out (vty
, "%s", ifp
->desc
);
1409 vty_out (vty
, "%s", VTY_NEWLINE
);
1413 DEFUN (show_interface_desc
,
1414 show_interface_desc_cmd
,
1415 "show interface description [vrf NAME]",
1417 "Interface status and configuration\n"
1418 "Interface description\n"
1421 vrf_id_t vrf_id
= VRF_DEFAULT
;
1424 VRF_GET_ID (vrf_id
, argv
[4]->arg
);
1426 if_show_description (vty
, vrf_id
);
1432 DEFUN (show_interface_desc_vrf_all
,
1433 show_interface_desc_vrf_all_cmd
,
1434 "show interface description vrf all",
1436 "Interface status and configuration\n"
1437 "Interface description\n"
1438 VRF_ALL_CMD_HELP_STR
)
1442 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
)
1443 if (!list_isempty (vrf
->iflist
))
1445 vty_out (vty
, "%s\tVRF %u%s%s", VTY_NEWLINE
, vrf
->vrf_id
,
1446 VTY_NEWLINE
, VTY_NEWLINE
);
1447 if_show_description (vty
, vrf
->vrf_id
);
1456 "Set multicast flag to interface\n")
1458 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1460 struct zebra_if
*if_data
;
1462 if (CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
))
1464 ret
= if_set_flags (ifp
, IFF_MULTICAST
);
1467 vty_out (vty
, "Can't set multicast flag%s", VTY_NEWLINE
);
1472 if_data
= ifp
->info
;
1473 if_data
->multicast
= IF_ZEBRA_MULTICAST_ON
;
1478 DEFUN (no_multicast
,
1482 "Unset multicast flag to interface\n")
1484 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1486 struct zebra_if
*if_data
;
1488 if (CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
))
1490 ret
= if_unset_flags (ifp
, IFF_MULTICAST
);
1493 vty_out (vty
, "Can't unset multicast flag%s", VTY_NEWLINE
);
1498 if_data
= ifp
->info
;
1499 if_data
->multicast
= IF_ZEBRA_MULTICAST_OFF
;
1507 "Enable link detection on interface\n")
1509 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1510 int if_was_operative
;
1512 if_was_operative
= if_is_no_ptm_operative(ifp
);
1513 SET_FLAG(ifp
->status
, ZEBRA_INTERFACE_LINKDETECTION
);
1515 /* When linkdetection is enabled, if might come down */
1516 if (!if_is_no_ptm_operative(ifp
) && if_was_operative
) if_down(ifp
);
1518 /* FIXME: Will defer status change forwarding if interface
1519 does not come down! */
1525 DEFUN (no_linkdetect
,
1529 "Disable link detection on interface\n")
1531 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1532 int if_was_operative
;
1534 if_was_operative
= if_is_no_ptm_operative(ifp
);
1535 UNSET_FLAG(ifp
->status
, ZEBRA_INTERFACE_LINKDETECTION
);
1537 /* Interface may come up after disabling link detection */
1538 if (if_is_operative(ifp
) && !if_was_operative
) if_up(ifp
);
1540 /* FIXME: see linkdetect_cmd */
1548 "Shutdown the selected interface\n")
1550 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1552 struct zebra_if
*if_data
;
1554 if (ifp
->ifindex
!= IFINDEX_INTERNAL
)
1556 ret
= if_unset_flags (ifp
, IFF_UP
);
1559 vty_out (vty
, "Can't shutdown interface%s", VTY_NEWLINE
);
1564 if_data
= ifp
->info
;
1565 if_data
->shutdown
= IF_ZEBRA_SHUTDOWN_ON
;
1570 DEFUN (no_shutdown_if
,
1574 "Shutdown the selected interface\n")
1576 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1578 struct zebra_if
*if_data
;
1580 if (ifp
->ifindex
!= IFINDEX_INTERNAL
)
1582 ret
= if_set_flags (ifp
, IFF_UP
| IFF_RUNNING
);
1585 vty_out (vty
, "Can't up interface%s", VTY_NEWLINE
);
1590 /* Some addresses (in particular, IPv6 addresses on Linux) get
1591 * removed when the interface goes down. They need to be readded.
1593 if_addr_wakeup(ifp
);
1596 if_data
= ifp
->info
;
1597 if_data
->shutdown
= IF_ZEBRA_SHUTDOWN_OFF
;
1602 DEFUN (bandwidth_if
,
1604 "bandwidth (1-100000)",
1605 "Set bandwidth informational parameter\n"
1606 "Bandwidth in megabits\n")
1609 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1610 unsigned int bandwidth
;
1612 bandwidth
= strtol(argv
[idx_number
]->arg
, NULL
, 10);
1614 /* bandwidth range is <1-100000> */
1615 if (bandwidth
< 1 || bandwidth
> 100000)
1617 vty_out (vty
, "Bandwidth is invalid%s", VTY_NEWLINE
);
1621 ifp
->bandwidth
= bandwidth
;
1623 /* force protocols to recalculate routes due to cost change */
1624 if (if_is_operative (ifp
))
1625 zebra_interface_up_update (ifp
);
1630 DEFUN (no_bandwidth_if
,
1631 no_bandwidth_if_cmd
,
1632 "no bandwidth [(1-100000)]",
1634 "Set bandwidth informational parameter\n"
1635 "Bandwidth in megabits\n")
1637 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1641 /* force protocols to recalculate routes due to cost change */
1642 if (if_is_operative (ifp
))
1643 zebra_interface_up_update (ifp
);
1649 struct cmd_node link_params_node
=
1652 "%s(config-link-params)# ",
1657 link_param_cmd_set_uint32 (struct interface
*ifp
, uint32_t *field
,
1658 uint32_t type
, uint32_t value
)
1660 /* Update field as needed */
1661 if (IS_PARAM_UNSET(ifp
->link_params
, type
) || *field
!= value
)
1664 SET_PARAM(ifp
->link_params
, type
);
1666 /* force protocols to update LINK STATE due to parameters change */
1667 if (if_is_operative (ifp
))
1668 zebra_interface_parameters_update (ifp
);
1672 link_param_cmd_set_float (struct interface
*ifp
, float *field
,
1673 uint32_t type
, float value
)
1676 /* Update field as needed */
1677 if (IS_PARAM_UNSET(ifp
->link_params
, type
) || *field
!= value
)
1680 SET_PARAM(ifp
->link_params
, type
);
1682 /* force protocols to update LINK STATE due to parameters change */
1683 if (if_is_operative (ifp
))
1684 zebra_interface_parameters_update (ifp
);
1689 link_param_cmd_unset (struct interface
*ifp
, uint32_t type
)
1693 UNSET_PARAM(ifp
->link_params
, type
);
1695 /* force protocols to update LINK STATE due to parameters change */
1696 if (if_is_operative (ifp
))
1697 zebra_interface_parameters_update (ifp
);
1705 /* vty->qobj_index stays the same @ interface pointer */
1706 vty
->node
= LINK_PARAMS_NODE
;
1711 DEFUN (exit_link_params
,
1712 exit_link_params_cmd
,
1714 "Exit from Link Params configuration mode\n")
1716 if (vty
->node
== LINK_PARAMS_NODE
)
1717 vty
->node
= INTERFACE_NODE
;
1721 /* Specific Traffic Engineering parameters commands */
1722 DEFUN (link_params_enable
,
1723 link_params_enable_cmd
,
1725 "Activate link parameters on this interface\n")
1727 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1729 /* This command could be issue at startup, when activate MPLS TE */
1730 /* on a new interface or after a ON / OFF / ON toggle */
1731 /* In all case, TE parameters are reset to their default factory */
1732 if (IS_ZEBRA_DEBUG_EVENT
)
1733 zlog_debug ("Link-params: enable TE link parameters on interface %s", ifp
->name
);
1735 if (!if_link_params_get (ifp
))
1737 if (IS_ZEBRA_DEBUG_EVENT
)
1738 zlog_debug ("Link-params: failed to init TE link parameters %s", ifp
->name
);
1743 /* force protocols to update LINK STATE due to parameters change */
1744 if (if_is_operative (ifp
))
1745 zebra_interface_parameters_update (ifp
);
1750 DEFUN (no_link_params_enable
,
1751 no_link_params_enable_cmd
,
1754 "Disable link parameters on this interface\n")
1756 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1758 zlog_debug ("MPLS-TE: disable TE link parameters on interface %s", ifp
->name
);
1760 if_link_params_free (ifp
);
1762 /* force protocols to update LINK STATE due to parameters change */
1763 if (if_is_operative (ifp
))
1764 zebra_interface_parameters_update (ifp
);
1769 /* STANDARD TE metrics */
1770 DEFUN (link_params_metric
,
1771 link_params_metric_cmd
,
1772 "metric (0-4294967295)",
1773 "Link metric for MPLS-TE purpose\n"
1774 "Metric value in decimal\n")
1777 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1778 struct if_link_params
*iflp
= if_link_params_get (ifp
);
1781 VTY_GET_ULONG("metric", metric
, argv
[idx_number
]->arg
);
1783 /* Update TE metric if needed */
1784 link_param_cmd_set_uint32 (ifp
, &iflp
->te_metric
, LP_TE_METRIC
, metric
);
1789 DEFUN (no_link_params_metric
,
1790 no_link_params_metric_cmd
,
1793 "Disable Link Metric on this interface\n")
1795 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1797 /* Unset TE Metric */
1798 link_param_cmd_unset(ifp
, LP_TE_METRIC
);
1803 DEFUN (link_params_maxbw
,
1804 link_params_maxbw_cmd
,
1806 "Maximum bandwidth that can be used\n"
1807 "Bytes/second (IEEE floating point format)\n")
1809 int idx_bandwidth
= 1;
1810 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1811 struct if_link_params
*iflp
= if_link_params_get (ifp
);
1815 if (sscanf (argv
[idx_bandwidth
]->arg
, "%g", &bw
) != 1)
1817 vty_out (vty
, "link_params_maxbw: fscanf: %s%s", safe_strerror (errno
),
1822 /* Check that Maximum bandwidth is not lower than other bandwidth parameters */
1823 if ((bw
<= iflp
->max_rsv_bw
)
1824 || (bw
<= iflp
->unrsv_bw
[0])
1825 || (bw
<= iflp
->unrsv_bw
[1])
1826 || (bw
<= iflp
->unrsv_bw
[2])
1827 || (bw
<= iflp
->unrsv_bw
[3])
1828 || (bw
<= iflp
->unrsv_bw
[4])
1829 || (bw
<= iflp
->unrsv_bw
[5])
1830 || (bw
<= iflp
->unrsv_bw
[6])
1831 || (bw
<= iflp
->unrsv_bw
[7])
1832 || (bw
<= iflp
->ava_bw
)
1833 || (bw
<= iflp
->res_bw
)
1834 || (bw
<= iflp
->use_bw
))
1837 "Maximum Bandwidth could not be lower than others bandwidth%s",
1842 /* Update Maximum Bandwidth if needed */
1843 link_param_cmd_set_float (ifp
, &iflp
->max_bw
, LP_MAX_BW
, bw
);
1848 DEFUN (link_params_max_rsv_bw
,
1849 link_params_max_rsv_bw_cmd
,
1850 "max-rsv-bw BANDWIDTH",
1851 "Maximum bandwidth that may be reserved\n"
1852 "Bytes/second (IEEE floating point format)\n")
1854 int idx_bandwidth
= 1;
1855 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1856 struct if_link_params
*iflp
= if_link_params_get (ifp
);
1859 if (sscanf (argv
[idx_bandwidth
]->arg
, "%g", &bw
) != 1)
1861 vty_out (vty
, "link_params_max_rsv_bw: fscanf: %s%s", safe_strerror (errno
),
1866 /* Check that bandwidth is not greater than maximum bandwidth parameter */
1867 if (bw
> iflp
->max_bw
)
1870 "Maximum Reservable Bandwidth could not be greater than Maximum Bandwidth (%g)%s",
1871 iflp
->max_bw
, VTY_NEWLINE
);
1875 /* Update Maximum Reservable Bandwidth if needed */
1876 link_param_cmd_set_float (ifp
, &iflp
->max_rsv_bw
, LP_MAX_RSV_BW
, bw
);
1881 DEFUN (link_params_unrsv_bw
,
1882 link_params_unrsv_bw_cmd
,
1883 "unrsv-bw (0-7) BANDWIDTH",
1884 "Unreserved bandwidth at each priority level\n"
1886 "Bytes/second (IEEE floating point format)\n")
1889 int idx_bandwidth
= 2;
1890 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1891 struct if_link_params
*iflp
= if_link_params_get (ifp
);
1895 /* We don't have to consider about range check here. */
1896 if (sscanf (argv
[idx_number
]->arg
, "%d", &priority
) != 1)
1898 vty_out (vty
, "link_params_unrsv_bw: fscanf: %s%s", safe_strerror (errno
),
1903 if (sscanf (argv
[idx_bandwidth
]->arg
, "%g", &bw
) != 1)
1905 vty_out (vty
, "link_params_unrsv_bw: fscanf: %s%s", safe_strerror (errno
),
1910 /* Check that bandwidth is not greater than maximum bandwidth parameter */
1911 if (bw
> iflp
->max_bw
)
1914 "UnReserved Bandwidth could not be greater than Maximum Bandwidth (%g)%s",
1915 iflp
->max_bw
, VTY_NEWLINE
);
1919 /* Update Unreserved Bandwidth if needed */
1920 link_param_cmd_set_float (ifp
, &iflp
->unrsv_bw
[priority
], LP_UNRSV_BW
, bw
);
1925 DEFUN (link_params_admin_grp
,
1926 link_params_admin_grp_cmd
,
1927 "admin-grp BITPATTERN",
1928 "Administrative group membership\n"
1929 "32-bit Hexadecimal value (e.g. 0xa1)\n")
1931 int idx_bitpattern
= 1;
1932 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1933 struct if_link_params
*iflp
= if_link_params_get (ifp
);
1934 unsigned long value
;
1936 if (sscanf (argv
[idx_bitpattern
]->arg
, "0x%lx", &value
) != 1)
1938 vty_out (vty
, "link_params_admin_grp: fscanf: %s%s",
1939 safe_strerror (errno
), VTY_NEWLINE
);
1943 /* Update Administrative Group if needed */
1944 link_param_cmd_set_uint32 (ifp
, &iflp
->admin_grp
, LP_ADM_GRP
, value
);
1949 DEFUN (no_link_params_admin_grp
,
1950 no_link_params_admin_grp_cmd
,
1953 "Disable Administrative group membership on this interface\n")
1955 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1957 /* Unset Admin Group */
1958 link_param_cmd_unset(ifp
, LP_ADM_GRP
);
1963 /* RFC5392 & RFC5316: INTER-AS */
1964 DEFUN (link_params_inter_as
,
1965 link_params_inter_as_cmd
,
1966 "neighbor A.B.C.D as (1-4294967295)",
1967 "Configure remote ASBR information (Neighbor IP address and AS number)\n"
1968 "Remote IP address in dot decimal A.B.C.D\n"
1969 "Remote AS number\n"
1970 "AS number in the range <1-4294967295>\n")
1975 VTY_DECLVAR_CONTEXT (interface
, ifp
);
1976 struct if_link_params
*iflp
= if_link_params_get (ifp
);
1977 struct in_addr addr
;
1980 if (!inet_aton (argv
[idx_ipv4
]->arg
, &addr
))
1982 vty_out (vty
, "Please specify Router-Addr by A.B.C.D%s", VTY_NEWLINE
);
1986 VTY_GET_ULONG("AS number", as
, argv
[idx_number
]->arg
);
1988 /* Update Remote IP and Remote AS fields if needed */
1989 if (IS_PARAM_UNSET(iflp
, LP_RMT_AS
)
1990 || iflp
->rmt_as
!= as
1991 || iflp
->rmt_ip
.s_addr
!= addr
.s_addr
)
1995 iflp
->rmt_ip
.s_addr
= addr
.s_addr
;
1996 SET_PARAM(iflp
, LP_RMT_AS
);
1998 /* force protocols to update LINK STATE due to parameters change */
1999 if (if_is_operative (ifp
))
2000 zebra_interface_parameters_update (ifp
);
2005 DEFUN (no_link_params_inter_as
,
2006 no_link_params_inter_as_cmd
,
2009 "Remove Neighbor IP address and AS number for Inter-AS TE\n")
2011 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2012 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2014 /* Reset Remote IP and AS neighbor */
2016 iflp
->rmt_ip
.s_addr
= 0;
2017 UNSET_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 /* RFC7471: OSPF Traffic Engineering (TE) Metric extensions & draft-ietf-isis-metric-extensions-07.txt */
2027 DEFUN (link_params_delay
,
2028 link_params_delay_cmd
,
2029 "delay (0-16777215) [min (0-16777215) max (0-16777215)]",
2030 "Unidirectional Average Link Delay\n"
2031 "Average delay in micro-second as decimal (0...16777215)\n"
2033 "Minimum delay in micro-second as decimal (0...16777215)\n"
2035 "Maximum delay in micro-second as decimal (0...16777215)\n")
2037 /* Get and Check new delay values */
2038 u_int32_t delay
= 0, low
= 0, high
= 0;
2039 VTY_GET_ULONG("delay", delay
, argv
[1]->arg
);
2042 VTY_GET_ULONG("minimum delay", low
, argv
[3]->arg
);
2043 VTY_GET_ULONG("maximum delay", high
, argv
[5]->arg
);
2046 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2047 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2048 u_int8_t update
= 0;
2052 /* Check new delay value against old Min and Max delays if set */
2053 if (IS_PARAM_SET(iflp
, LP_MM_DELAY
)
2054 && (delay
<= iflp
->min_delay
|| delay
>= iflp
->max_delay
))
2056 vty_out (vty
, "Average delay should be comprise between Min (%d) and Max (%d) delay%s",
2057 iflp
->min_delay
, iflp
->max_delay
, VTY_NEWLINE
);
2060 /* Update delay if value is not set or change */
2061 if (IS_PARAM_UNSET(iflp
, LP_DELAY
)|| iflp
->av_delay
!= delay
)
2063 iflp
->av_delay
= delay
;
2064 SET_PARAM(iflp
, LP_DELAY
);
2067 /* Unset Min and Max delays if already set */
2068 if (IS_PARAM_SET(iflp
, LP_MM_DELAY
))
2070 iflp
->min_delay
= 0;
2071 iflp
->max_delay
= 0;
2072 UNSET_PARAM(iflp
, LP_MM_DELAY
);
2078 /* Check new delays value coherency */
2079 if (delay
<= low
|| delay
>= high
)
2081 vty_out (vty
, "Average delay should be comprise between Min (%d) and Max (%d) delay%s",
2082 low
, high
, VTY_NEWLINE
);
2085 /* Update Delays if needed */
2086 if (IS_PARAM_UNSET(iflp
, LP_DELAY
)
2087 || IS_PARAM_UNSET(iflp
, LP_MM_DELAY
)
2088 || iflp
->av_delay
!= delay
2089 || iflp
->min_delay
!= low
2090 || iflp
->max_delay
!= high
)
2092 iflp
->av_delay
= delay
;
2093 SET_PARAM(iflp
, LP_DELAY
);
2094 iflp
->min_delay
= low
;
2095 iflp
->max_delay
= high
;
2096 SET_PARAM(iflp
, LP_MM_DELAY
);
2101 /* force protocols to update LINK STATE due to parameters change */
2102 if (update
== 1 && if_is_operative (ifp
))
2103 zebra_interface_parameters_update (ifp
);
2108 DEFUN (no_link_params_delay
,
2109 no_link_params_delay_cmd
,
2112 "Disable Unidirectional Average, Min & Max Link Delay on this interface\n")
2114 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2115 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2119 UNSET_PARAM(iflp
, LP_DELAY
);
2120 iflp
->min_delay
= 0;
2121 iflp
->max_delay
= 0;
2122 UNSET_PARAM(iflp
, LP_MM_DELAY
);
2124 /* force protocols to update LINK STATE due to parameters change */
2125 if (if_is_operative (ifp
))
2126 zebra_interface_parameters_update (ifp
);
2131 DEFUN (link_params_delay_var
,
2132 link_params_delay_var_cmd
,
2133 "delay-variation (0-16777215)",
2134 "Unidirectional Link Delay Variation\n"
2135 "delay variation in micro-second as decimal (0...16777215)\n")
2138 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2139 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2142 VTY_GET_ULONG("delay variation", value
, argv
[idx_number
]->arg
);
2144 /* Update Delay Variation if needed */
2145 link_param_cmd_set_uint32 (ifp
, &iflp
->delay_var
, LP_DELAY_VAR
, value
);
2150 DEFUN (no_link_params_delay_var
,
2151 no_link_params_delay_var_cmd
,
2152 "no delay-variation",
2154 "Disable Unidirectional Delay Variation on this interface\n")
2156 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2158 /* Unset Delay Variation */
2159 link_param_cmd_unset(ifp
, LP_DELAY_VAR
);
2164 DEFUN (link_params_pkt_loss
,
2165 link_params_pkt_loss_cmd
,
2166 "packet-loss PERCENTAGE",
2167 "Unidirectional Link Packet Loss\n"
2168 "percentage of total traffic by 0.000003% step and less than 50.331642%\n")
2170 int idx_percentage
= 1;
2171 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2172 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2175 if (sscanf (argv
[idx_percentage
]->arg
, "%g", &fval
) != 1)
2177 vty_out (vty
, "link_params_pkt_loss: fscanf: %s%s", safe_strerror (errno
),
2182 if (fval
> MAX_PKT_LOSS
)
2183 fval
= MAX_PKT_LOSS
;
2185 /* Update Packet Loss if needed */
2186 link_param_cmd_set_float (ifp
, &iflp
->pkt_loss
, LP_PKT_LOSS
, fval
);
2191 DEFUN (no_link_params_pkt_loss
,
2192 no_link_params_pkt_loss_cmd
,
2195 "Disable Unidirectional Link Packet Loss on this interface\n")
2197 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2199 /* Unset Packet Loss */
2200 link_param_cmd_unset(ifp
, LP_PKT_LOSS
);
2205 DEFUN (link_params_res_bw
,
2206 link_params_res_bw_cmd
,
2208 "Unidirectional Residual Bandwidth\n"
2209 "Bytes/second (IEEE floating point format)\n")
2211 int idx_bandwidth
= 1;
2212 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2213 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2216 if (sscanf (argv
[idx_bandwidth
]->arg
, "%g", &bw
) != 1)
2218 vty_out (vty
, "link_params_res_bw: fscanf: %s%s", safe_strerror (errno
),
2223 /* Check that bandwidth is not greater than maximum bandwidth parameter */
2224 if (bw
> iflp
->max_bw
)
2227 "Residual Bandwidth could not be greater than Maximum Bandwidth (%g)%s",
2228 iflp
->max_bw
, VTY_NEWLINE
);
2232 /* Update Residual Bandwidth if needed */
2233 link_param_cmd_set_float (ifp
, &iflp
->res_bw
, LP_RES_BW
, bw
);
2238 DEFUN (no_link_params_res_bw
,
2239 no_link_params_res_bw_cmd
,
2242 "Disable Unidirectional Residual Bandwidth on this interface\n")
2244 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2246 /* Unset Residual Bandwidth */
2247 link_param_cmd_unset(ifp
, LP_RES_BW
);
2252 DEFUN (link_params_ava_bw
,
2253 link_params_ava_bw_cmd
,
2255 "Unidirectional Available Bandwidth\n"
2256 "Bytes/second (IEEE floating point format)\n")
2258 int idx_bandwidth
= 1;
2259 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2260 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2263 if (sscanf (argv
[idx_bandwidth
]->arg
, "%g", &bw
) != 1)
2265 vty_out (vty
, "link_params_ava_bw: fscanf: %s%s", safe_strerror (errno
),
2270 /* Check that bandwidth is not greater than maximum bandwidth parameter */
2271 if (bw
> iflp
->max_bw
)
2274 "Available Bandwidth could not be greater than Maximum Bandwidth (%g)%s",
2275 iflp
->max_bw
, VTY_NEWLINE
);
2279 /* Update Residual Bandwidth if needed */
2280 link_param_cmd_set_float (ifp
, &iflp
->ava_bw
, LP_AVA_BW
, bw
);
2285 DEFUN (no_link_params_ava_bw
,
2286 no_link_params_ava_bw_cmd
,
2289 "Disable Unidirectional Available Bandwidth on this interface\n")
2291 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2293 /* Unset Available Bandwidth */
2294 link_param_cmd_unset(ifp
, LP_AVA_BW
);
2299 DEFUN (link_params_use_bw
,
2300 link_params_use_bw_cmd
,
2302 "Unidirectional Utilised Bandwidth\n"
2303 "Bytes/second (IEEE floating point format)\n")
2305 int idx_bandwidth
= 1;
2306 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2307 struct if_link_params
*iflp
= if_link_params_get (ifp
);
2310 if (sscanf (argv
[idx_bandwidth
]->arg
, "%g", &bw
) != 1)
2312 vty_out (vty
, "link_params_use_bw: fscanf: %s%s", safe_strerror (errno
),
2317 /* Check that bandwidth is not greater than maximum bandwidth parameter */
2318 if (bw
> iflp
->max_bw
)
2321 "Utilised Bandwidth could not be greater than Maximum Bandwidth (%g)%s",
2322 iflp
->max_bw
, VTY_NEWLINE
);
2326 /* Update Utilized Bandwidth if needed */
2327 link_param_cmd_set_float (ifp
, &iflp
->use_bw
, LP_USE_BW
, bw
);
2332 DEFUN (no_link_params_use_bw
,
2333 no_link_params_use_bw_cmd
,
2336 "Disable Unidirectional Utilised Bandwidth on this interface\n")
2338 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2340 /* Unset Utilised Bandwidth */
2341 link_param_cmd_unset(ifp
, LP_USE_BW
);
2347 ip_address_install (struct vty
*vty
, struct interface
*ifp
,
2348 const char *addr_str
, const char *peer_str
,
2351 struct zebra_if
*if_data
;
2352 struct prefix_ipv4 cp
;
2353 struct connected
*ifc
;
2354 struct prefix_ipv4
*p
;
2357 if_data
= ifp
->info
;
2359 ret
= str2prefix_ipv4 (addr_str
, &cp
);
2362 vty_out (vty
, "%% Malformed address %s", VTY_NEWLINE
);
2366 if (ipv4_martian(&cp
.prefix
))
2368 vty_out (vty
, "%% Invalid address%s", VTY_NEWLINE
);
2372 ifc
= connected_check (ifp
, (struct prefix
*) &cp
);
2375 ifc
= connected_new ();
2379 p
= prefix_ipv4_new ();
2381 ifc
->address
= (struct prefix
*) p
;
2384 if (p
->prefixlen
<= IPV4_MAX_PREFIXLEN
-2)
2386 p
= prefix_ipv4_new ();
2388 p
->prefix
.s_addr
= ipv4_broadcast_addr(p
->prefix
.s_addr
,p
->prefixlen
);
2389 ifc
->destination
= (struct prefix
*) p
;
2394 ifc
->label
= XSTRDUP (MTYPE_CONNECTED_LABEL
, label
);
2396 /* Add to linked list. */
2397 listnode_add (ifp
->connected
, ifc
);
2400 /* This address is configured from zebra. */
2401 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
))
2402 SET_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
);
2404 /* In case of this route need to install kernel. */
2405 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
)
2406 && CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
)
2407 && !(if_data
&& if_data
->shutdown
== IF_ZEBRA_SHUTDOWN_ON
))
2409 /* Some system need to up the interface to set IP address. */
2410 if (! if_is_up (ifp
))
2412 if_set_flags (ifp
, IFF_UP
| IFF_RUNNING
);
2416 ret
= if_set_prefix (ifp
, ifc
);
2419 vty_out (vty
, "%% Can't set interface IP address: %s.%s",
2420 safe_strerror(errno
), VTY_NEWLINE
);
2424 SET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
2425 /* The address will be advertised to zebra clients when the notification
2426 * from the kernel has been received.
2427 * It will also be added to the subnet chain list, then. */
2434 ip_address_uninstall (struct vty
*vty
, struct interface
*ifp
,
2435 const char *addr_str
, const char *peer_str
,
2438 struct prefix_ipv4 cp
;
2439 struct connected
*ifc
;
2442 /* Convert to prefix structure. */
2443 ret
= str2prefix_ipv4 (addr_str
, &cp
);
2446 vty_out (vty
, "%% Malformed address %s", VTY_NEWLINE
);
2450 /* Check current interface address. */
2451 ifc
= connected_check (ifp
, (struct prefix
*) &cp
);
2454 vty_out (vty
, "%% Can't find address%s", VTY_NEWLINE
);
2458 /* This is not configured address. */
2459 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
))
2462 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
);
2464 /* This is not real address or interface is not active. */
2465 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
)
2466 || ! CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
))
2468 listnode_delete (ifp
->connected
, ifc
);
2469 connected_free (ifc
);
2473 /* This is real route. */
2474 ret
= if_unset_prefix (ifp
, ifc
);
2477 vty_out (vty
, "%% Can't unset interface IP address: %s.%s",
2478 safe_strerror(errno
), VTY_NEWLINE
);
2481 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
2482 /* we will receive a kernel notification about this route being removed.
2483 * this will trigger its removal from the connected list. */
2489 "ip address A.B.C.D/M",
2490 "Interface Internet Protocol config commands\n"
2491 "Set the IP address of an interface\n"
2492 "IP address (e.g. 10.0.0.1/8)\n")
2494 int idx_ipv4_prefixlen
= 2;
2495 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2496 return ip_address_install (vty
, ifp
, argv
[idx_ipv4_prefixlen
]->arg
, NULL
, NULL
);
2499 DEFUN (no_ip_address
,
2501 "no ip address A.B.C.D/M",
2503 "Interface Internet Protocol config commands\n"
2504 "Set the IP address of an interface\n"
2505 "IP Address (e.g. 10.0.0.1/8)")
2507 int idx_ipv4_prefixlen
= 3;
2508 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2509 return ip_address_uninstall (vty
, ifp
, argv
[idx_ipv4_prefixlen
]->arg
, NULL
, NULL
);
2514 DEFUN (ip_address_label
,
2515 ip_address_label_cmd
,
2516 "ip address A.B.C.D/M label LINE",
2517 "Interface Internet Protocol config commands\n"
2518 "Set the IP address of an interface\n"
2519 "IP address (e.g. 10.0.0.1/8)\n"
2520 "Label of this address\n"
2523 int idx_ipv4_prefixlen
= 2;
2525 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2526 return ip_address_install (vty
, ifp
, argv
[idx_ipv4_prefixlen
]->arg
, NULL
, argv
[idx_line
]->arg
);
2529 DEFUN (no_ip_address_label
,
2530 no_ip_address_label_cmd
,
2531 "no ip address A.B.C.D/M label LINE",
2533 "Interface Internet Protocol config commands\n"
2534 "Set the IP address of an interface\n"
2535 "IP address (e.g. 10.0.0.1/8)\n"
2536 "Label of this address\n"
2539 int idx_ipv4_prefixlen
= 3;
2541 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2542 return ip_address_uninstall (vty
, ifp
, argv
[idx_ipv4_prefixlen
]->arg
, NULL
, argv
[idx_line
]->arg
);
2544 #endif /* HAVE_NETLINK */
2547 ipv6_address_install (struct vty
*vty
, struct interface
*ifp
,
2548 const char *addr_str
, const char *peer_str
,
2549 const char *label
, int secondary
)
2551 struct zebra_if
*if_data
;
2552 struct prefix_ipv6 cp
;
2553 struct connected
*ifc
;
2554 struct prefix_ipv6
*p
;
2557 if_data
= ifp
->info
;
2559 ret
= str2prefix_ipv6 (addr_str
, &cp
);
2562 vty_out (vty
, "%% Malformed address %s", VTY_NEWLINE
);
2566 if (ipv6_martian(&cp
.prefix
))
2568 vty_out (vty
, "%% Invalid address%s", VTY_NEWLINE
);
2572 ifc
= connected_check (ifp
, (struct prefix
*) &cp
);
2575 ifc
= connected_new ();
2579 p
= prefix_ipv6_new ();
2581 ifc
->address
= (struct prefix
*) p
;
2585 SET_FLAG (ifc
->flags
, ZEBRA_IFA_SECONDARY
);
2589 ifc
->label
= XSTRDUP (MTYPE_CONNECTED_LABEL
, label
);
2591 /* Add to linked list. */
2592 listnode_add (ifp
->connected
, ifc
);
2595 /* This address is configured from zebra. */
2596 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
))
2597 SET_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
);
2599 /* In case of this route need to install kernel. */
2600 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
)
2601 && CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
)
2602 && !(if_data
&& if_data
->shutdown
== IF_ZEBRA_SHUTDOWN_ON
))
2604 /* Some system need to up the interface to set IP address. */
2605 if (! if_is_up (ifp
))
2607 if_set_flags (ifp
, IFF_UP
| IFF_RUNNING
);
2611 ret
= if_prefix_add_ipv6 (ifp
, ifc
);
2615 vty_out (vty
, "%% Can't set interface IP address: %s.%s",
2616 safe_strerror(errno
), VTY_NEWLINE
);
2620 SET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
2621 /* The address will be advertised to zebra clients when the notification
2622 * from the kernel has been received. */
2628 /* Return true if an ipv6 address is configured on ifp */
2630 ipv6_address_configured (struct interface
*ifp
)
2632 struct connected
*connected
;
2633 struct listnode
*node
;
2635 for (ALL_LIST_ELEMENTS_RO (ifp
->connected
, node
, connected
))
2636 if (CHECK_FLAG (connected
->conf
, ZEBRA_IFC_REAL
) && (connected
->address
->family
== AF_INET6
))
2643 ipv6_address_uninstall (struct vty
*vty
, struct interface
*ifp
,
2644 const char *addr_str
, const char *peer_str
,
2645 const char *label
, int secondry
)
2647 struct prefix_ipv6 cp
;
2648 struct connected
*ifc
;
2651 /* Convert to prefix structure. */
2652 ret
= str2prefix_ipv6 (addr_str
, &cp
);
2655 vty_out (vty
, "%% Malformed address %s", VTY_NEWLINE
);
2659 /* Check current interface address. */
2660 ifc
= connected_check (ifp
, (struct prefix
*) &cp
);
2663 vty_out (vty
, "%% Can't find address%s", VTY_NEWLINE
);
2667 /* This is not configured address. */
2668 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
))
2671 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
);
2673 /* This is not real address or interface is not active. */
2674 if (! CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
)
2675 || ! CHECK_FLAG (ifp
->status
, ZEBRA_INTERFACE_ACTIVE
))
2677 listnode_delete (ifp
->connected
, ifc
);
2678 connected_free (ifc
);
2682 /* This is real route. */
2683 ret
= if_prefix_delete_ipv6 (ifp
, ifc
);
2686 vty_out (vty
, "%% Can't unset interface IP address: %s.%s",
2687 safe_strerror(errno
), VTY_NEWLINE
);
2691 UNSET_FLAG (ifc
->conf
, ZEBRA_IFC_QUEUED
);
2692 /* This information will be propagated to the zclients when the
2693 * kernel notification is received. */
2697 DEFUN (ipv6_address
,
2699 "ipv6 address X:X::X:X/M",
2700 "Interface IPv6 config commands\n"
2701 "Set the IP address of an interface\n"
2702 "IPv6 address (e.g. 3ffe:506::1/48)\n")
2704 int idx_ipv6_prefixlen
= 2;
2705 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2706 return ipv6_address_install (vty
, ifp
, argv
[idx_ipv6_prefixlen
]->arg
, NULL
, NULL
, 0);
2709 DEFUN (no_ipv6_address
,
2710 no_ipv6_address_cmd
,
2711 "no ipv6 address X:X::X:X/M",
2713 "Interface IPv6 config commands\n"
2714 "Set the IP address of an interface\n"
2715 "IPv6 address (e.g. 3ffe:506::1/48)\n")
2717 int idx_ipv6_prefixlen
= 3;
2718 VTY_DECLVAR_CONTEXT (interface
, ifp
);
2719 return ipv6_address_uninstall (vty
, ifp
, argv
[idx_ipv6_prefixlen
]->arg
, NULL
, NULL
, 0);
2723 link_params_config_write (struct vty
*vty
, struct interface
*ifp
)
2727 if ((ifp
== NULL
) || !HAS_LINK_PARAMS(ifp
))
2730 struct if_link_params
*iflp
= ifp
->link_params
;
2732 vty_out (vty
, " link-params%s", VTY_NEWLINE
);
2733 vty_out(vty
, " enable%s", VTY_NEWLINE
);
2734 if (IS_PARAM_SET(iflp
, LP_TE_METRIC
) && iflp
->te_metric
!= ifp
->metric
)
2735 vty_out(vty
, " metric %u%s",iflp
->te_metric
, VTY_NEWLINE
);
2736 if (IS_PARAM_SET(iflp
, LP_MAX_BW
) && iflp
->max_bw
!= iflp
->default_bw
)
2737 vty_out(vty
, " max-bw %g%s", iflp
->max_bw
, VTY_NEWLINE
);
2738 if (IS_PARAM_SET(iflp
, LP_MAX_RSV_BW
) && iflp
->max_rsv_bw
!= iflp
->default_bw
)
2739 vty_out(vty
, " max-rsv-bw %g%s", iflp
->max_rsv_bw
, VTY_NEWLINE
);
2740 if (IS_PARAM_SET(iflp
, LP_UNRSV_BW
))
2742 for (i
= 0; i
< 8; i
++)
2743 if (iflp
->unrsv_bw
[i
] != iflp
->default_bw
)
2744 vty_out(vty
, " unrsv-bw %d %g%s",
2745 i
, iflp
->unrsv_bw
[i
], VTY_NEWLINE
);
2747 if (IS_PARAM_SET(iflp
, LP_ADM_GRP
))
2748 vty_out(vty
, " admin-grp 0x%x%s", iflp
->admin_grp
, VTY_NEWLINE
);
2749 if (IS_PARAM_SET(iflp
, LP_DELAY
))
2751 vty_out(vty
, " delay %u", iflp
->av_delay
);
2752 if (IS_PARAM_SET(iflp
, LP_MM_DELAY
))
2754 vty_out(vty
, " min %u", iflp
->min_delay
);
2755 vty_out(vty
, " max %u", iflp
->max_delay
);
2757 vty_out(vty
, "%s", VTY_NEWLINE
);
2759 if (IS_PARAM_SET(iflp
, LP_DELAY_VAR
))
2760 vty_out(vty
, " delay-variation %u%s", iflp
->delay_var
, VTY_NEWLINE
);
2761 if (IS_PARAM_SET(iflp
, LP_PKT_LOSS
))
2762 vty_out(vty
, " packet-loss %g%s", iflp
->pkt_loss
, VTY_NEWLINE
);
2763 if (IS_PARAM_SET(iflp
, LP_AVA_BW
))
2764 vty_out(vty
, " ava-bw %g%s", iflp
->ava_bw
, VTY_NEWLINE
);
2765 if (IS_PARAM_SET(iflp
, LP_RES_BW
))
2766 vty_out(vty
, " res-bw %g%s", iflp
->res_bw
, VTY_NEWLINE
);
2767 if (IS_PARAM_SET(iflp
, LP_USE_BW
))
2768 vty_out(vty
, " use-bw %g%s", iflp
->use_bw
, VTY_NEWLINE
);
2769 if (IS_PARAM_SET(iflp
, LP_RMT_AS
))
2770 vty_out(vty
, " neighbor %s as %u%s", inet_ntoa(iflp
->rmt_ip
),
2771 iflp
->rmt_as
, VTY_NEWLINE
);
2772 vty_out(vty
, " exit-link-params%s", VTY_NEWLINE
);
2777 if_config_write (struct vty
*vty
)
2780 struct listnode
*node
;
2781 struct interface
*ifp
;
2783 zebra_ptm_write (vty
);
2785 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
)
2786 for (ALL_LIST_ELEMENTS_RO (vrf
->iflist
, node
, ifp
))
2788 struct zebra_if
*if_data
;
2789 struct listnode
*addrnode
;
2790 struct connected
*ifc
;
2794 if_data
= ifp
->info
;
2795 vrf
= vrf_lookup_by_id (ifp
->vrf_id
);
2797 if (ifp
->vrf_id
== VRF_DEFAULT
)
2798 vty_out (vty
, "interface %s%s", ifp
->name
, VTY_NEWLINE
);
2800 vty_out (vty
, "interface %s vrf %s%s", ifp
->name
, vrf
->name
,
2805 if (if_data
->shutdown
== IF_ZEBRA_SHUTDOWN_ON
)
2806 vty_out (vty
, " shutdown%s", VTY_NEWLINE
);
2808 zebra_ptm_if_write(vty
, if_data
);
2812 vty_out (vty
, " description %s%s", ifp
->desc
,
2815 /* Assign bandwidth here to avoid unnecessary interface flap
2816 while processing config script */
2817 if (ifp
->bandwidth
!= 0)
2818 vty_out(vty
, " bandwidth %u%s", ifp
->bandwidth
, VTY_NEWLINE
);
2820 if (!CHECK_FLAG(ifp
->status
, ZEBRA_INTERFACE_LINKDETECTION
))
2821 vty_out(vty
, " no link-detect%s", VTY_NEWLINE
);
2823 for (ALL_LIST_ELEMENTS_RO (ifp
->connected
, addrnode
, ifc
))
2825 if (CHECK_FLAG (ifc
->conf
, ZEBRA_IFC_CONFIGURED
))
2827 char buf
[INET6_ADDRSTRLEN
];
2829 vty_out (vty
, " ip%s address %s",
2830 p
->family
== AF_INET
? "" : "v6",
2831 prefix2str (p
, buf
, sizeof(buf
)));
2834 vty_out (vty
, " label %s", ifc
->label
);
2836 vty_out (vty
, "%s", VTY_NEWLINE
);
2842 if (if_data
->multicast
!= IF_ZEBRA_MULTICAST_UNSPEC
)
2843 vty_out (vty
, " %smulticast%s",
2844 if_data
->multicast
== IF_ZEBRA_MULTICAST_ON
? "" : "no ",
2848 #if defined (HAVE_RTADV)
2849 rtadv_config_write (vty
, ifp
);
2850 #endif /* HAVE_RTADV */
2853 irdp_config_write (vty
, ifp
);
2856 link_params_config_write (vty
, ifp
);
2858 vty_out (vty
, "!%s", VTY_NEWLINE
);
2863 /* Allocate and initialize interface vector. */
2865 zebra_if_init (void)
2867 /* Initialize interface and new hook. */
2868 if_add_hook (IF_NEW_HOOK
, if_zebra_new_hook
);
2869 if_add_hook (IF_DELETE_HOOK
, if_zebra_delete_hook
);
2871 /* Install configuration write function. */
2872 install_node (&interface_node
, if_config_write
);
2873 install_node (&link_params_node
, NULL
);
2876 install_element (VIEW_NODE
, &show_interface_cmd
);
2877 install_element (VIEW_NODE
, &show_interface_vrf_all_cmd
);
2878 install_element (VIEW_NODE
, &show_interface_name_vrf_cmd
);
2879 install_element (VIEW_NODE
, &show_interface_name_vrf_all_cmd
);
2881 install_element (ENABLE_NODE
, &show_interface_desc_cmd
);
2882 install_element (ENABLE_NODE
, &show_interface_desc_vrf_all_cmd
);
2883 install_element (INTERFACE_NODE
, &multicast_cmd
);
2884 install_element (INTERFACE_NODE
, &no_multicast_cmd
);
2885 install_element (INTERFACE_NODE
, &linkdetect_cmd
);
2886 install_element (INTERFACE_NODE
, &no_linkdetect_cmd
);
2887 install_element (INTERFACE_NODE
, &shutdown_if_cmd
);
2888 install_element (INTERFACE_NODE
, &no_shutdown_if_cmd
);
2889 install_element (INTERFACE_NODE
, &bandwidth_if_cmd
);
2890 install_element (INTERFACE_NODE
, &no_bandwidth_if_cmd
);
2891 install_element (INTERFACE_NODE
, &ip_address_cmd
);
2892 install_element (INTERFACE_NODE
, &no_ip_address_cmd
);
2893 install_element (INTERFACE_NODE
, &ipv6_address_cmd
);
2894 install_element (INTERFACE_NODE
, &no_ipv6_address_cmd
);
2896 install_element (INTERFACE_NODE
, &ip_address_label_cmd
);
2897 install_element (INTERFACE_NODE
, &no_ip_address_label_cmd
);
2898 #endif /* HAVE_NETLINK */
2899 install_element(INTERFACE_NODE
, &link_params_cmd
);
2900 install_default(LINK_PARAMS_NODE
);
2901 install_element(LINK_PARAMS_NODE
, &link_params_enable_cmd
);
2902 install_element(LINK_PARAMS_NODE
, &no_link_params_enable_cmd
);
2903 install_element(LINK_PARAMS_NODE
, &link_params_metric_cmd
);
2904 install_element(LINK_PARAMS_NODE
, &no_link_params_metric_cmd
);
2905 install_element(LINK_PARAMS_NODE
, &link_params_maxbw_cmd
);
2906 install_element(LINK_PARAMS_NODE
, &link_params_max_rsv_bw_cmd
);
2907 install_element(LINK_PARAMS_NODE
, &link_params_unrsv_bw_cmd
);
2908 install_element(LINK_PARAMS_NODE
, &link_params_admin_grp_cmd
);
2909 install_element(LINK_PARAMS_NODE
, &no_link_params_admin_grp_cmd
);
2910 install_element(LINK_PARAMS_NODE
, &link_params_inter_as_cmd
);
2911 install_element(LINK_PARAMS_NODE
, &no_link_params_inter_as_cmd
);
2912 install_element(LINK_PARAMS_NODE
, &link_params_delay_cmd
);
2913 install_element(LINK_PARAMS_NODE
, &no_link_params_delay_cmd
);
2914 install_element(LINK_PARAMS_NODE
, &link_params_delay_var_cmd
);
2915 install_element(LINK_PARAMS_NODE
, &no_link_params_delay_var_cmd
);
2916 install_element(LINK_PARAMS_NODE
, &link_params_pkt_loss_cmd
);
2917 install_element(LINK_PARAMS_NODE
, &no_link_params_pkt_loss_cmd
);
2918 install_element(LINK_PARAMS_NODE
, &link_params_ava_bw_cmd
);
2919 install_element(LINK_PARAMS_NODE
, &no_link_params_ava_bw_cmd
);
2920 install_element(LINK_PARAMS_NODE
, &link_params_res_bw_cmd
);
2921 install_element(LINK_PARAMS_NODE
, &no_link_params_res_bw_cmd
);
2922 install_element(LINK_PARAMS_NODE
, &link_params_use_bw_cmd
);
2923 install_element(LINK_PARAMS_NODE
, &no_link_params_use_bw_cmd
);
2924 install_element(LINK_PARAMS_NODE
, &exit_link_params_cmd
);