version 1.1.1.3, 2013/07/21 23:54:41
|
version 1.1.1.4, 2016/11/02 10:09:10
|
Line 32
|
Line 32
|
#include "connected.h" |
#include "connected.h" |
#include "log.h" |
#include "log.h" |
#include "zclient.h" |
#include "zclient.h" |
|
#include "vrf.h" |
|
|
#include "zebra/interface.h" |
#include "zebra/interface.h" |
#include "zebra/rtadv.h" |
#include "zebra/rtadv.h" |
Line 41
|
Line 42
|
#include "zebra/debug.h" |
#include "zebra/debug.h" |
#include "zebra/irdp.h" |
#include "zebra/irdp.h" |
|
|
#ifdef RTADV | #if defined (HAVE_RTADV) |
/* Order is intentional. Matches RFC4191. This array is also used for |
/* Order is intentional. Matches RFC4191. This array is also used for |
command matching, so only modify with care. */ |
command matching, so only modify with care. */ |
const char *rtadv_pref_strs[] = { "medium", "high", "INVALID", "low", 0 }; |
const char *rtadv_pref_strs[] = { "medium", "high", "INVALID", "low", 0 }; |
#endif /* RTADV */ | #endif /* HAVE_RTADV */ |
|
|
/* Called when new interface is added. */ |
/* Called when new interface is added. */ |
static int |
static int |
Line 56 if_zebra_new_hook (struct interface *ifp)
|
Line 57 if_zebra_new_hook (struct interface *ifp)
|
zebra_if = XCALLOC (MTYPE_TMP, sizeof (struct zebra_if)); |
zebra_if = XCALLOC (MTYPE_TMP, sizeof (struct zebra_if)); |
|
|
zebra_if->multicast = IF_ZEBRA_MULTICAST_UNSPEC; |
zebra_if->multicast = IF_ZEBRA_MULTICAST_UNSPEC; |
zebra_if->shutdown = IF_ZEBRA_SHUTDOWN_UNSPEC; | zebra_if->shutdown = IF_ZEBRA_SHUTDOWN_OFF; |
|
|
#ifdef RTADV | #if defined (HAVE_RTADV) |
{ |
{ |
/* Set default router advertise values. */ |
/* Set default router advertise values. */ |
struct rtadvconf *rtadv; |
struct rtadvconf *rtadv; |
Line 84 if_zebra_new_hook (struct interface *ifp)
|
Line 85 if_zebra_new_hook (struct interface *ifp)
|
|
|
rtadv->AdvPrefixList = list_new (); |
rtadv->AdvPrefixList = list_new (); |
} |
} |
#endif /* RTADV */ | #endif /* HAVE_RTADV */ |
|
|
/* Initialize installed address chains tree. */ |
/* Initialize installed address chains tree. */ |
zebra_if->ipv4_subnets = route_table_init (); |
zebra_if->ipv4_subnets = route_table_init (); |
Line 161 if_subnet_delete (struct interface *ifp, struct connec
|
Line 162 if_subnet_delete (struct interface *ifp, struct connec
|
/* Get address derived subnet node. */ |
/* Get address derived subnet node. */ |
rn = route_node_lookup (zebra_if->ipv4_subnets, ifc->address); |
rn = route_node_lookup (zebra_if->ipv4_subnets, ifc->address); |
if (! (rn && rn->info)) |
if (! (rn && rn->info)) |
return -1; | { |
| zlog_warn("Trying to remove an address from an unknown subnet." |
| " (please report this bug)"); |
| return -1; |
| } |
route_unlock_node (rn); |
route_unlock_node (rn); |
|
|
/* Untie address from subnet's address list. */ |
/* Untie address from subnet's address list. */ |
addr_list = rn->info; |
addr_list = rn->info; |
|
|
|
/* Deleting an address that is not registered is a bug. |
|
* In any case, we shouldn't decrement the lock counter if the address |
|
* is unknown. */ |
|
if (!listnode_lookup(addr_list, ifc)) |
|
{ |
|
zlog_warn("Trying to remove an address from a subnet where it is not" |
|
" currently registered. (please report this bug)"); |
|
return -1; |
|
} |
|
|
listnode_delete (addr_list, ifc); |
listnode_delete (addr_list, ifc); |
route_unlock_node (rn); |
route_unlock_node (rn); |
|
|
Line 178 if_subnet_delete (struct interface *ifp, struct connec
|
Line 194 if_subnet_delete (struct interface *ifp, struct connec
|
ifc = listgetdata (listhead (addr_list)); |
ifc = listgetdata (listhead (addr_list)); |
zebra_interface_address_delete_update (ifp, ifc); |
zebra_interface_address_delete_update (ifp, ifc); |
UNSET_FLAG (ifc->flags, ZEBRA_IFA_SECONDARY); |
UNSET_FLAG (ifc->flags, ZEBRA_IFA_SECONDARY); |
|
/* XXX: Linux kernel removes all the secondary addresses when the primary |
|
* address is removed. We could try to work around that, though this is |
|
* non-trivial. */ |
zebra_interface_address_add_update (ifp, ifc); |
zebra_interface_address_add_update (ifp, ifc); |
} |
} |
|
|
Line 274 if_addr_wakeup (struct interface *ifp)
|
Line 293 if_addr_wakeup (struct interface *ifp)
|
p = ifc->address; |
p = ifc->address; |
|
|
if (CHECK_FLAG (ifc->conf, ZEBRA_IFC_CONFIGURED) |
if (CHECK_FLAG (ifc->conf, ZEBRA_IFC_CONFIGURED) |
&& ! CHECK_FLAG (ifc->conf, ZEBRA_IFC_REAL)) | && ! CHECK_FLAG (ifc->conf, ZEBRA_IFC_QUEUED)) |
{ |
{ |
/* Address check. */ |
/* Address check. */ |
if (p->family == AF_INET) |
if (p->family == AF_INET) |
{ |
{ |
if (! if_is_up (ifp)) |
if (! if_is_up (ifp)) |
{ |
{ |
/* XXX: WTF is it trying to set flags here? | /* Assume zebra is configured like following: |
* caller has just gotten a new interface, has been | * |
* handed the flags already. This code has no business | * interface gre0 |
* trying to override administrative status of the interface. | * ip addr 192.0.2.1/24 |
* The only call path to here which doesn't originate from | * ! |
* kernel event is irdp - what on earth is it trying to do? | * |
* | * As soon as zebra becomes first aware that gre0 exists in the |
* further RUNNING is not a settable flag on any system | * kernel, it will set gre0 up and configure its addresses. |
* I (paulj) am aware of. | * |
*/ | * (This may happen at startup when the interface already exists |
| * or during runtime when the interface is added to the kernel) |
| * |
| * XXX: IRDP code is calling here via if_add_update - this seems |
| * somewhat weird. |
| * XXX: RUNNING is not a settable flag on any system |
| * I (paulj) am aware of. |
| */ |
if_set_flags (ifp, IFF_UP | IFF_RUNNING); |
if_set_flags (ifp, IFF_UP | IFF_RUNNING); |
if_refresh (ifp); |
if_refresh (ifp); |
} |
} |
Line 303 if_addr_wakeup (struct interface *ifp)
|
Line 329 if_addr_wakeup (struct interface *ifp)
|
continue; |
continue; |
} |
} |
|
|
/* Add to subnet chain list. */ | SET_FLAG (ifc->conf, ZEBRA_IFC_QUEUED); |
if_subnet_add (ifp, ifc); | /* The address will be advertised to zebra clients when the notification |
| * from the kernel has been received. |
SET_FLAG (ifc->conf, ZEBRA_IFC_REAL); | * It will also be added to the interface's subnet list then. */ |
| |
zebra_interface_address_add_update (ifp, ifc); | |
| |
if (if_is_operative(ifp)) | |
connected_up_ipv4 (ifp, ifc); | |
} |
} |
#ifdef HAVE_IPV6 |
#ifdef HAVE_IPV6 |
if (p->family == AF_INET6) |
if (p->family == AF_INET6) |
{ |
{ |
if (! if_is_up (ifp)) |
if (! if_is_up (ifp)) |
{ |
{ |
/* XXX: See long comment above */ | /* See long comment above */ |
if_set_flags (ifp, IFF_UP | IFF_RUNNING); |
if_set_flags (ifp, IFF_UP | IFF_RUNNING); |
if_refresh (ifp); |
if_refresh (ifp); |
} |
} |
Line 330 if_addr_wakeup (struct interface *ifp)
|
Line 351 if_addr_wakeup (struct interface *ifp)
|
safe_strerror(errno)); |
safe_strerror(errno)); |
continue; |
continue; |
} |
} |
SET_FLAG (ifc->conf, ZEBRA_IFC_REAL); |
|
|
|
zebra_interface_address_add_update (ifp, ifc); | SET_FLAG (ifc->conf, ZEBRA_IFC_QUEUED); |
| /* The address will be advertised to zebra clients when the notification |
if (if_is_operative(ifp)) | * from the kernel has been received. */ |
connected_up_ipv6 (ifp, ifc); | |
} |
} |
#endif /* HAVE_IPV6 */ |
#endif /* HAVE_IPV6 */ |
} |
} |
Line 349 if_add_update (struct interface *ifp)
|
Line 368 if_add_update (struct interface *ifp)
|
struct zebra_if *if_data; |
struct zebra_if *if_data; |
|
|
if_data = ifp->info; |
if_data = ifp->info; |
|
assert(if_data); |
|
|
if (if_data->multicast == IF_ZEBRA_MULTICAST_ON) |
if (if_data->multicast == IF_ZEBRA_MULTICAST_ON) |
if_set_flags (ifp, IFF_MULTICAST); |
if_set_flags (ifp, IFF_MULTICAST); |
else if (if_data->multicast == IF_ZEBRA_MULTICAST_OFF) |
else if (if_data->multicast == IF_ZEBRA_MULTICAST_OFF) |
Line 360 if_add_update (struct interface *ifp)
|
Line 381 if_add_update (struct interface *ifp)
|
{ |
{ |
SET_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE); |
SET_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE); |
|
|
|
if (if_data && if_data->shutdown == IF_ZEBRA_SHUTDOWN_ON) |
|
{ |
|
if (IS_ZEBRA_DEBUG_KERNEL) |
|
zlog_debug ("interface %s vrf %u index %d is shutdown. " |
|
"Won't wake it up.", |
|
ifp->name, ifp->vrf_id, ifp->ifindex); |
|
return; |
|
} |
|
|
if_addr_wakeup (ifp); |
if_addr_wakeup (ifp); |
|
|
if (IS_ZEBRA_DEBUG_KERNEL) |
if (IS_ZEBRA_DEBUG_KERNEL) |
zlog_debug ("interface %s index %d becomes active.", | zlog_debug ("interface %s vrf %u index %d becomes active.", |
ifp->name, ifp->ifindex); | ifp->name, ifp->vrf_id, ifp->ifindex); |
} |
} |
else |
else |
{ |
{ |
if (IS_ZEBRA_DEBUG_KERNEL) |
if (IS_ZEBRA_DEBUG_KERNEL) |
zlog_debug ("interface %s index %d is added.", ifp->name, ifp->ifindex); | zlog_debug ("interface %s vrf %u index %d is added.", |
| ifp->name, ifp->vrf_id, ifp->ifindex); |
} |
} |
} |
} |
|
|
Line 386 if_delete_update (struct interface *ifp)
|
Line 417 if_delete_update (struct interface *ifp)
|
|
|
if (if_is_up(ifp)) |
if (if_is_up(ifp)) |
{ |
{ |
zlog_err ("interface %s index %d is still up while being deleted.", | zlog_err ("interface %s vrf %u index %d is still up while being deleted.", |
ifp->name, ifp->ifindex); | ifp->name, ifp->vrf_id, ifp->ifindex); |
return; |
return; |
} |
} |
|
|
Line 395 if_delete_update (struct interface *ifp)
|
Line 426 if_delete_update (struct interface *ifp)
|
UNSET_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE); |
UNSET_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE); |
|
|
if (IS_ZEBRA_DEBUG_KERNEL) |
if (IS_ZEBRA_DEBUG_KERNEL) |
zlog_debug ("interface %s index %d is now inactive.", | zlog_debug ("interface %s vrf %u index %d is now inactive.", |
ifp->name, ifp->ifindex); | ifp->name, ifp->vrf_id, ifp->ifindex); |
|
|
/* Delete connected routes from the kernel. */ |
/* Delete connected routes from the kernel. */ |
if (ifp->connected) |
if (ifp->connected) |
Line 433 if_delete_update (struct interface *ifp)
|
Line 464 if_delete_update (struct interface *ifp)
|
|
|
ifc = listgetdata (anode); |
ifc = listgetdata (anode); |
p = ifc->address; |
p = ifc->address; |
|
|
connected_down_ipv4 (ifp, ifc); |
connected_down_ipv4 (ifp, ifc); |
|
|
|
/* XXX: We have to send notifications here explicitly, because we destroy |
|
* the ifc before receiving the notification about the address being deleted. |
|
*/ |
zebra_interface_address_delete_update (ifp, ifc); |
zebra_interface_address_delete_update (ifp, ifc); |
|
|
UNSET_FLAG (ifc->conf, ZEBRA_IFC_REAL); |
UNSET_FLAG (ifc->conf, ZEBRA_IFC_REAL); |
|
UNSET_FLAG (ifc->conf, ZEBRA_IFC_QUEUED); |
|
|
/* Remove from subnet chain. */ |
/* Remove from subnet chain. */ |
list_delete_node (addr_list, anode); |
list_delete_node (addr_list, anode); |
Line 467 if_delete_update (struct interface *ifp)
|
Line 501 if_delete_update (struct interface *ifp)
|
zebra_interface_address_delete_update (ifp, ifc); |
zebra_interface_address_delete_update (ifp, ifc); |
|
|
UNSET_FLAG (ifc->conf, ZEBRA_IFC_REAL); |
UNSET_FLAG (ifc->conf, ZEBRA_IFC_REAL); |
|
UNSET_FLAG (ifc->conf, ZEBRA_IFC_QUEUED); |
|
|
if (CHECK_FLAG (ifc->conf, ZEBRA_IFC_CONFIGURED)) |
if (CHECK_FLAG (ifc->conf, ZEBRA_IFC_CONFIGURED)) |
last = node; |
last = node; |
Line 522 if_up (struct interface *ifp)
|
Line 557 if_up (struct interface *ifp)
|
} |
} |
|
|
/* Examine all static routes. */ |
/* Examine all static routes. */ |
rib_update (); | rib_update (ifp->vrf_id); |
} |
} |
|
|
/* Interface goes down. We have to manage different behavior of based |
/* Interface goes down. We have to manage different behavior of based |
Line 555 if_down (struct interface *ifp)
|
Line 590 if_down (struct interface *ifp)
|
} |
} |
|
|
/* Examine all static routes which direct to the interface. */ |
/* Examine all static routes which direct to the interface. */ |
rib_update (); | rib_update (ifp->vrf_id); |
} |
} |
|
|
void |
void |
Line 603 connected_dump_vty (struct vty *vty, struct connected
|
Line 638 connected_dump_vty (struct vty *vty, struct connected
|
vty_out (vty, "%s", VTY_NEWLINE); |
vty_out (vty, "%s", VTY_NEWLINE); |
} |
} |
|
|
#ifdef RTADV | #if defined (HAVE_RTADV) |
/* Dump interface ND information to vty. */ |
/* Dump interface ND information to vty. */ |
static void |
static void |
nd_dump_vty (struct vty *vty, struct interface *ifp) |
nd_dump_vty (struct vty *vty, struct interface *ifp) |
Line 664 nd_dump_vty (struct vty *vty, struct interface *ifp)
|
Line 699 nd_dump_vty (struct vty *vty, struct interface *ifp)
|
VTY_NEWLINE); |
VTY_NEWLINE); |
} |
} |
} |
} |
#endif /* RTADV */ | #endif /* HAVE_RTADV */ |
|
|
/* Interface's information print out to vty interface. */ |
/* Interface's information print out to vty interface. */ |
static void |
static void |
if_dump_vty (struct vty *vty, struct interface *ifp) |
if_dump_vty (struct vty *vty, struct interface *ifp) |
{ |
{ |
#ifdef HAVE_STRUCT_SOCKADDR_DL |
|
struct sockaddr_dl *sdl; |
|
#endif /* HAVE_STRUCT_SOCKADDR_DL */ |
|
struct connected *connected; |
struct connected *connected; |
struct listnode *node; |
struct listnode *node; |
struct route_node *rn; |
struct route_node *rn; |
Line 696 if_dump_vty (struct vty *vty, struct interface *ifp)
|
Line 728 if_dump_vty (struct vty *vty, struct interface *ifp)
|
vty_out (vty, "down%s", VTY_NEWLINE); |
vty_out (vty, "down%s", VTY_NEWLINE); |
} |
} |
|
|
|
vty_out (vty, " vrf: %u%s", ifp->vrf_id, VTY_NEWLINE); |
|
|
if (ifp->desc) |
if (ifp->desc) |
vty_out (vty, " Description: %s%s", ifp->desc, |
vty_out (vty, " Description: %s%s", ifp->desc, |
VTY_NEWLINE); |
VTY_NEWLINE); |
Line 722 if_dump_vty (struct vty *vty, struct interface *ifp)
|
Line 756 if_dump_vty (struct vty *vty, struct interface *ifp)
|
if_flag_dump (ifp->flags), VTY_NEWLINE); |
if_flag_dump (ifp->flags), VTY_NEWLINE); |
|
|
/* Hardware address. */ |
/* Hardware address. */ |
#ifdef HAVE_STRUCT_SOCKADDR_DL | vty_out (vty, " Type: %s%s", if_link_type_str (ifp->ll_type), VTY_NEWLINE); |
sdl = &ifp->sdl; | |
if (sdl != NULL && sdl->sdl_alen != 0) | |
{ | |
int i; | |
u_char *ptr; | |
| |
vty_out (vty, " HWaddr: "); | |
for (i = 0, ptr = (u_char *)LLADDR (sdl); i < sdl->sdl_alen; i++, ptr++) | |
vty_out (vty, "%s%02x", i == 0 ? "" : ":", *ptr); | |
vty_out (vty, "%s", VTY_NEWLINE); | |
} | |
#else | |
if (ifp->hw_addr_len != 0) |
if (ifp->hw_addr_len != 0) |
{ |
{ |
int i; |
int i; |
Line 744 if_dump_vty (struct vty *vty, struct interface *ifp)
|
Line 766 if_dump_vty (struct vty *vty, struct interface *ifp)
|
vty_out (vty, "%s%02x", i == 0 ? "" : ":", ifp->hw_addr[i]); |
vty_out (vty, "%s%02x", i == 0 ? "" : ":", ifp->hw_addr[i]); |
vty_out (vty, "%s", VTY_NEWLINE); |
vty_out (vty, "%s", VTY_NEWLINE); |
} |
} |
#endif /* HAVE_STRUCT_SOCKADDR_DL */ |
|
|
|
/* Bandwidth in kbps */ |
/* Bandwidth in kbps */ |
if (ifp->bandwidth != 0) |
if (ifp->bandwidth != 0) |
Line 769 if_dump_vty (struct vty *vty, struct interface *ifp)
|
Line 790 if_dump_vty (struct vty *vty, struct interface *ifp)
|
connected_dump_vty (vty, connected); |
connected_dump_vty (vty, connected); |
} |
} |
|
|
#ifdef RTADV | #if defined (HAVE_RTADV) |
nd_dump_vty (vty, ifp); |
nd_dump_vty (vty, ifp); |
#endif /* RTADV */ | #endif /* HAVE_RTADV */ |
|
|
#ifdef HAVE_PROC_NET_DEV |
#ifdef HAVE_PROC_NET_DEV |
/* Statistics print out using proc file system. */ |
/* Statistics print out using proc file system. */ |
Line 806 if_dump_vty (struct vty *vty, struct interface *ifp)
|
Line 827 if_dump_vty (struct vty *vty, struct interface *ifp)
|
#ifdef HAVE_NET_RT_IFLIST |
#ifdef HAVE_NET_RT_IFLIST |
#if defined (__bsdi__) || defined (__NetBSD__) |
#if defined (__bsdi__) || defined (__NetBSD__) |
/* Statistics print out using sysctl (). */ |
/* Statistics print out using sysctl (). */ |
vty_out (vty, " input packets %qu, bytes %qu, dropped %qu," | vty_out (vty, " input packets %llu, bytes %llu, dropped %llu," |
" multicast packets %qu%s", | " multicast packets %llu%s", |
ifp->stats.ifi_ipackets, ifp->stats.ifi_ibytes, | (unsigned long long)ifp->stats.ifi_ipackets, |
ifp->stats.ifi_iqdrops, ifp->stats.ifi_imcasts, | (unsigned long long)ifp->stats.ifi_ibytes, |
VTY_NEWLINE); | (unsigned long long)ifp->stats.ifi_iqdrops, |
| (unsigned long long)ifp->stats.ifi_imcasts, |
| VTY_NEWLINE); |
|
|
vty_out (vty, " input errors %qu%s", | vty_out (vty, " input errors %llu%s", |
ifp->stats.ifi_ierrors, VTY_NEWLINE); | (unsigned long long)ifp->stats.ifi_ierrors, VTY_NEWLINE); |
|
|
vty_out (vty, " output packets %qu, bytes %qu, multicast packets %qu%s", | vty_out (vty, " output packets %llu, bytes %llu," |
ifp->stats.ifi_opackets, ifp->stats.ifi_obytes, | " multicast packets %llu%s", |
ifp->stats.ifi_omcasts, VTY_NEWLINE); | (unsigned long long)ifp->stats.ifi_opackets, |
| (unsigned long long)ifp->stats.ifi_obytes, |
| (unsigned long long)ifp->stats.ifi_omcasts, |
| VTY_NEWLINE); |
|
|
vty_out (vty, " output errors %qu%s", | vty_out (vty, " output errors %llu%s", |
ifp->stats.ifi_oerrors, VTY_NEWLINE); | (unsigned long long)ifp->stats.ifi_oerrors, VTY_NEWLINE); |
|
|
vty_out (vty, " collisions %qu%s", | vty_out (vty, " collisions %llu%s", |
ifp->stats.ifi_collisions, VTY_NEWLINE); | (unsigned long long)ifp->stats.ifi_collisions, VTY_NEWLINE); |
#else |
#else |
/* Statistics print out using sysctl (). */ |
/* Statistics print out using sysctl (). */ |
vty_out (vty, " input packets %lu, bytes %lu, dropped %lu," |
vty_out (vty, " input packets %lu, bytes %lu, dropped %lu," |
Line 875 DEFUN_NOSH (zebra_interface,
|
Line 901 DEFUN_NOSH (zebra_interface,
|
return ret; |
return ret; |
} |
} |
|
|
|
ALIAS (zebra_interface, |
|
zebra_interface_vrf_cmd, |
|
"interface IFNAME " VRF_CMD_STR, |
|
"Select an interface to configure\n" |
|
"Interface's name\n" |
|
VRF_CMD_HELP_STR) |
|
|
struct cmd_node interface_node = |
struct cmd_node interface_node = |
{ |
{ |
INTERFACE_NODE, |
INTERFACE_NODE, |
Line 882 struct cmd_node interface_node =
|
Line 915 struct cmd_node interface_node =
|
1 |
1 |
}; |
}; |
|
|
/* Show all or specified interface to vty. */ | /* Show all interfaces to vty. */ |
DEFUN (show_interface, show_interface_cmd, |
DEFUN (show_interface, show_interface_cmd, |
"show interface [IFNAME]", | "show interface", |
SHOW_STR |
SHOW_STR |
|
"Interface status and configuration\n") |
|
{ |
|
struct listnode *node; |
|
struct interface *ifp; |
|
vrf_id_t vrf_id = VRF_DEFAULT; |
|
|
|
#ifdef HAVE_PROC_NET_DEV |
|
/* If system has interface statistics via proc file system, update |
|
statistics. */ |
|
ifstat_update_proc (); |
|
#endif /* HAVE_PROC_NET_DEV */ |
|
#ifdef HAVE_NET_RT_IFLIST |
|
ifstat_update_sysctl (); |
|
#endif /* HAVE_NET_RT_IFLIST */ |
|
|
|
if (argc > 0) |
|
VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
|
|
|
/* All interface print. */ |
|
for (ALL_LIST_ELEMENTS_RO (vrf_iflist (vrf_id), node, ifp)) |
|
if_dump_vty (vty, ifp); |
|
|
|
return CMD_SUCCESS; |
|
} |
|
|
|
ALIAS (show_interface, |
|
show_interface_vrf_cmd, |
|
"show interface " VRF_CMD_STR, |
|
SHOW_STR |
"Interface status and configuration\n" |
"Interface status and configuration\n" |
"Inteface name\n") | VRF_CMD_HELP_STR) |
| |
| /* Show all interfaces to vty. */ |
| DEFUN (show_interface_vrf_all, show_interface_vrf_all_cmd, |
| "show interface " VRF_ALL_CMD_STR, |
| SHOW_STR |
| "Interface status and configuration\n" |
| VRF_ALL_CMD_HELP_STR) |
{ |
{ |
struct listnode *node; |
struct listnode *node; |
struct interface *ifp; |
struct interface *ifp; |
| vrf_iter_t iter; |
| |
#ifdef HAVE_PROC_NET_DEV |
#ifdef HAVE_PROC_NET_DEV |
/* If system has interface statistics via proc file system, update |
/* If system has interface statistics via proc file system, update |
statistics. */ |
statistics. */ |
Line 901 DEFUN (show_interface, show_interface_cmd,
|
Line 971 DEFUN (show_interface, show_interface_cmd,
|
ifstat_update_sysctl (); |
ifstat_update_sysctl (); |
#endif /* HAVE_NET_RT_IFLIST */ |
#endif /* HAVE_NET_RT_IFLIST */ |
|
|
|
/* All interface print. */ |
|
for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
|
for (ALL_LIST_ELEMENTS_RO (vrf_iter2iflist (iter), node, ifp)) |
|
if_dump_vty (vty, ifp); |
|
|
|
return CMD_SUCCESS; |
|
} |
|
|
|
/* Show specified interface to vty. */ |
|
DEFUN (show_interface_name, show_interface_name_cmd, |
|
"show interface IFNAME", |
|
SHOW_STR |
|
"Interface status and configuration\n" |
|
"Inteface name\n") |
|
{ |
|
struct interface *ifp; |
|
vrf_id_t vrf_id = VRF_DEFAULT; |
|
|
|
#ifdef HAVE_PROC_NET_DEV |
|
/* If system has interface statistics via proc file system, update |
|
statistics. */ |
|
ifstat_update_proc (); |
|
#endif /* HAVE_PROC_NET_DEV */ |
|
#ifdef HAVE_NET_RT_IFLIST |
|
ifstat_update_sysctl (); |
|
#endif /* HAVE_NET_RT_IFLIST */ |
|
|
|
if (argc > 1) |
|
VTY_GET_INTEGER ("VRF ID", vrf_id, argv[1]); |
|
|
/* Specified interface print. */ |
/* Specified interface print. */ |
if (argc != 0) | ifp = if_lookup_by_name_vrf (argv[0], vrf_id); |
| if (ifp == NULL) |
{ |
{ |
ifp = if_lookup_by_name (argv[0]); | vty_out (vty, "%% Can't find interface %s%s", argv[0], |
if (ifp == NULL) | VTY_NEWLINE); |
{ | return CMD_WARNING; |
vty_out (vty, "%% Can't find interface %s%s", argv[0], | |
VTY_NEWLINE); | |
return CMD_WARNING; | |
} | |
if_dump_vty (vty, ifp); | |
return CMD_SUCCESS; | |
} |
} |
|
if_dump_vty (vty, ifp); |
|
|
/* All interface print. */ |
|
for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) |
|
if_dump_vty (vty, ifp); |
|
|
|
return CMD_SUCCESS; |
return CMD_SUCCESS; |
} |
} |
|
|
DEFUN (show_interface_desc, | ALIAS (show_interface_name, |
show_interface_desc_cmd, | show_interface_name_vrf_cmd, |
"show interface description", | "show interface IFNAME " VRF_CMD_STR, |
SHOW_STR |
SHOW_STR |
"Interface status and configuration\n" |
"Interface status and configuration\n" |
"Interface description\n") | "Inteface name\n" |
| VRF_CMD_HELP_STR) |
| |
| /* Show specified interface to vty. */ |
| DEFUN (show_interface_name_vrf_all, show_interface_name_vrf_all_cmd, |
| "show interface IFNAME " VRF_ALL_CMD_STR, |
| SHOW_STR |
| "Interface status and configuration\n" |
| "Inteface name\n" |
| VRF_ALL_CMD_HELP_STR) |
{ |
{ |
|
struct interface *ifp; |
|
vrf_iter_t iter; |
|
int found = 0; |
|
|
|
#ifdef HAVE_PROC_NET_DEV |
|
/* If system has interface statistics via proc file system, update |
|
statistics. */ |
|
ifstat_update_proc (); |
|
#endif /* HAVE_PROC_NET_DEV */ |
|
#ifdef HAVE_NET_RT_IFLIST |
|
ifstat_update_sysctl (); |
|
#endif /* HAVE_NET_RT_IFLIST */ |
|
|
|
/* All interface print. */ |
|
for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
|
{ |
|
/* Specified interface print. */ |
|
ifp = if_lookup_by_name_vrf (argv[0], vrf_iter2id (iter)); |
|
if (ifp) |
|
{ |
|
if_dump_vty (vty, ifp); |
|
found++; |
|
} |
|
} |
|
|
|
if (!found) |
|
{ |
|
vty_out (vty, "%% Can't find interface %s%s", argv[0], VTY_NEWLINE); |
|
return CMD_WARNING; |
|
} |
|
|
|
return CMD_SUCCESS; |
|
} |
|
|
|
static void |
|
if_show_description (struct vty *vty, vrf_id_t vrf_id) |
|
{ |
struct listnode *node; |
struct listnode *node; |
struct interface *ifp; |
struct interface *ifp; |
|
|
vty_out (vty, "Interface Status Protocol Description%s", VTY_NEWLINE); |
vty_out (vty, "Interface Status Protocol Description%s", VTY_NEWLINE); |
for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) | for (ALL_LIST_ELEMENTS_RO (vrf_iflist (vrf_id), node, ifp)) |
{ |
{ |
int len; |
int len; |
|
|
Line 964 DEFUN (show_interface_desc,
|
Line 1102 DEFUN (show_interface_desc,
|
vty_out (vty, "%s", ifp->desc); |
vty_out (vty, "%s", ifp->desc); |
vty_out (vty, "%s", VTY_NEWLINE); |
vty_out (vty, "%s", VTY_NEWLINE); |
} |
} |
|
} |
|
|
|
DEFUN (show_interface_desc, |
|
show_interface_desc_cmd, |
|
"show interface description", |
|
SHOW_STR |
|
"Interface status and configuration\n" |
|
"Interface description\n") |
|
{ |
|
vrf_id_t vrf_id = VRF_DEFAULT; |
|
|
|
if (argc > 0) |
|
VTY_GET_INTEGER ("VRF ID", vrf_id, argv[0]); |
|
|
|
if_show_description (vty, vrf_id); |
|
|
return CMD_SUCCESS; |
return CMD_SUCCESS; |
} |
} |
|
|
|
ALIAS (show_interface_desc, |
|
show_interface_desc_vrf_cmd, |
|
"show interface description " VRF_CMD_STR, |
|
SHOW_STR |
|
"Interface status and configuration\n" |
|
"Interface description\n" |
|
VRF_CMD_HELP_STR) |
|
|
|
DEFUN (show_interface_desc_vrf_all, |
|
show_interface_desc_vrf_all_cmd, |
|
"show interface description " VRF_ALL_CMD_STR, |
|
SHOW_STR |
|
"Interface status and configuration\n" |
|
"Interface description\n" |
|
VRF_ALL_CMD_HELP_STR) |
|
{ |
|
vrf_iter_t iter; |
|
|
|
for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
|
if (!list_isempty (vrf_iter2iflist (iter))) |
|
{ |
|
vty_out (vty, "%s\tVRF %u%s%s", VTY_NEWLINE, |
|
vrf_iter2id (iter), |
|
VTY_NEWLINE, VTY_NEWLINE); |
|
if_show_description (vty, vrf_iter2id (iter)); |
|
} |
|
|
|
return CMD_SUCCESS; |
|
} |
|
|
DEFUN (multicast, |
DEFUN (multicast, |
multicast_cmd, |
multicast_cmd, |
"multicast", |
"multicast", |
Line 1073 DEFUN (shutdown_if,
|
Line 1257 DEFUN (shutdown_if,
|
struct zebra_if *if_data; |
struct zebra_if *if_data; |
|
|
ifp = (struct interface *) vty->index; |
ifp = (struct interface *) vty->index; |
ret = if_unset_flags (ifp, IFF_UP); | if (ifp->ifindex != IFINDEX_INTERNAL) |
if (ret < 0) | |
{ |
{ |
vty_out (vty, "Can't shutdown interface%s", VTY_NEWLINE); | ret = if_unset_flags (ifp, IFF_UP); |
return CMD_WARNING; | if (ret < 0) |
| { |
| vty_out (vty, "Can't shutdown interface%s", VTY_NEWLINE); |
| return CMD_WARNING; |
| } |
| if_refresh (ifp); |
} |
} |
if_refresh (ifp); |
|
if_data = ifp->info; |
if_data = ifp->info; |
if_data->shutdown = IF_ZEBRA_SHUTDOWN_ON; |
if_data->shutdown = IF_ZEBRA_SHUTDOWN_ON; |
|
|
Line 1097 DEFUN (no_shutdown_if,
|
Line 1284 DEFUN (no_shutdown_if,
|
struct zebra_if *if_data; |
struct zebra_if *if_data; |
|
|
ifp = (struct interface *) vty->index; |
ifp = (struct interface *) vty->index; |
ret = if_set_flags (ifp, IFF_UP | IFF_RUNNING); | |
if (ret < 0) | if (ifp->ifindex != IFINDEX_INTERNAL) |
{ |
{ |
vty_out (vty, "Can't up interface%s", VTY_NEWLINE); | ret = if_set_flags (ifp, IFF_UP | IFF_RUNNING); |
return CMD_WARNING; | if (ret < 0) |
| { |
| vty_out (vty, "Can't up interface%s", VTY_NEWLINE); |
| return CMD_WARNING; |
| } |
| if_refresh (ifp); |
| |
| /* Some addresses (in particular, IPv6 addresses on Linux) get |
| * removed when the interface goes down. They need to be readded. |
| */ |
| if_addr_wakeup(ifp); |
} |
} |
if_refresh (ifp); | |
if_data = ifp->info; |
if_data = ifp->info; |
if_data->shutdown = IF_ZEBRA_SHUTDOWN_OFF; |
if_data->shutdown = IF_ZEBRA_SHUTDOWN_OFF; |
|
|
Line 1163 ALIAS (no_bandwidth_if,
|
Line 1360 ALIAS (no_bandwidth_if,
|
NO_STR |
NO_STR |
"Set bandwidth informational parameter\n" |
"Set bandwidth informational parameter\n" |
"Bandwidth in kilobits\n") |
"Bandwidth in kilobits\n") |
| |
static int |
static int |
ip_address_install (struct vty *vty, struct interface *ifp, |
ip_address_install (struct vty *vty, struct interface *ifp, |
const char *addr_str, const char *peer_str, |
const char *addr_str, const char *peer_str, |
const char *label) |
const char *label) |
{ |
{ |
|
struct zebra_if *if_data; |
struct prefix_ipv4 cp; |
struct prefix_ipv4 cp; |
struct connected *ifc; |
struct connected *ifc; |
struct prefix_ipv4 *p; |
struct prefix_ipv4 *p; |
int ret; |
int ret; |
|
|
|
if_data = ifp->info; |
|
|
ret = str2prefix_ipv4 (addr_str, &cp); |
ret = str2prefix_ipv4 (addr_str, &cp); |
if (ret <= 0) |
if (ret <= 0) |
{ |
{ |
Line 1214 ip_address_install (struct vty *vty, struct interface
|
Line 1414 ip_address_install (struct vty *vty, struct interface
|
SET_FLAG (ifc->conf, ZEBRA_IFC_CONFIGURED); |
SET_FLAG (ifc->conf, ZEBRA_IFC_CONFIGURED); |
|
|
/* In case of this route need to install kernel. */ |
/* In case of this route need to install kernel. */ |
if (! CHECK_FLAG (ifc->conf, ZEBRA_IFC_REAL) | if (! CHECK_FLAG (ifc->conf, ZEBRA_IFC_QUEUED) |
&& CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE)) | && CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE) |
| && !(if_data && if_data->shutdown == IF_ZEBRA_SHUTDOWN_ON)) |
{ |
{ |
/* Some system need to up the interface to set IP address. */ |
/* Some system need to up the interface to set IP address. */ |
if (! if_is_up (ifp)) |
if (! if_is_up (ifp)) |
Line 1232 ip_address_install (struct vty *vty, struct interface
|
Line 1433 ip_address_install (struct vty *vty, struct interface
|
return CMD_WARNING; |
return CMD_WARNING; |
} |
} |
|
|
/* Add to subnet chain list (while marking secondary attribute). */ | SET_FLAG (ifc->conf, ZEBRA_IFC_QUEUED); |
if_subnet_add (ifp, ifc); | /* The address will be advertised to zebra clients when the notification |
| * from the kernel has been received. |
/* IP address propery set. */ | * It will also be added to the subnet chain list, then. */ |
SET_FLAG (ifc->conf, ZEBRA_IFC_REAL); | |
| |
/* Update interface address information to protocol daemon. */ | |
zebra_interface_address_add_update (ifp, ifc); | |
| |
/* If interface is up register connected route. */ | |
if (if_is_operative(ifp)) | |
connected_up_ipv4 (ifp, ifc); | |
} |
} |
|
|
return CMD_SUCCESS; |
return CMD_SUCCESS; |
Line 1281 ip_address_uninstall (struct vty *vty, struct interfac
|
Line 1474 ip_address_uninstall (struct vty *vty, struct interfac
|
UNSET_FLAG (ifc->conf, ZEBRA_IFC_CONFIGURED); |
UNSET_FLAG (ifc->conf, ZEBRA_IFC_CONFIGURED); |
|
|
/* This is not real address or interface is not active. */ |
/* This is not real address or interface is not active. */ |
if (! CHECK_FLAG (ifc->conf, ZEBRA_IFC_REAL) | if (! CHECK_FLAG (ifc->conf, ZEBRA_IFC_QUEUED) |
|| ! CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE)) |
|| ! CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE)) |
{ |
{ |
listnode_delete (ifp->connected, ifc); |
listnode_delete (ifp->connected, ifc); |
Line 1297 ip_address_uninstall (struct vty *vty, struct interfac
|
Line 1490 ip_address_uninstall (struct vty *vty, struct interfac
|
safe_strerror(errno), VTY_NEWLINE); |
safe_strerror(errno), VTY_NEWLINE); |
return CMD_WARNING; |
return CMD_WARNING; |
} |
} |
/* success! call returned that the address deletion went through. | UNSET_FLAG (ifc->conf, ZEBRA_IFC_QUEUED); |
* this is a synchronous operation, so we know it succeeded and can | /* we will receive a kernel notification about this route being removed. |
* now update all internal state. */ | * this will trigger its removal from the connected list. */ |
| |
/* the HAVE_NETLINK check is only here because, on BSD, although the | |
* call above is still synchronous, we get a second confirmation later | |
* through the route socket, and we don't want to touch that behaviour | |
* for now. It should work without the #ifdef, but why take the risk... | |
* -- equinox 2012-07-13 */ | |
#ifdef HAVE_NETLINK | |
| |
/* Remove connected route. */ | |
connected_down_ipv4 (ifp, ifc); | |
| |
/* Redistribute this information. */ | |
zebra_interface_address_delete_update (ifp, ifc); | |
| |
/* IP address propery set. */ | |
UNSET_FLAG (ifc->conf, ZEBRA_IFC_REAL); | |
| |
/* remove from interface, remark secondaries */ | |
if_subnet_delete (ifp, ifc); | |
| |
/* Free address information. */ | |
listnode_delete (ifp->connected, ifc); | |
connected_free (ifc); | |
#endif | |
| |
return CMD_SUCCESS; |
return CMD_SUCCESS; |
} |
} |
|
|
Line 1382 ipv6_address_install (struct vty *vty, struct interfac
|
Line 1550 ipv6_address_install (struct vty *vty, struct interfac
|
const char *addr_str, const char *peer_str, |
const char *addr_str, const char *peer_str, |
const char *label, int secondary) |
const char *label, int secondary) |
{ |
{ |
|
struct zebra_if *if_data; |
struct prefix_ipv6 cp; |
struct prefix_ipv6 cp; |
struct connected *ifc; |
struct connected *ifc; |
struct prefix_ipv6 *p; |
struct prefix_ipv6 *p; |
int ret; |
int ret; |
|
|
|
if_data = ifp->info; |
|
|
ret = str2prefix_ipv6 (addr_str, &cp); |
ret = str2prefix_ipv6 (addr_str, &cp); |
if (ret <= 0) |
if (ret <= 0) |
{ |
{ |
Line 1422 ipv6_address_install (struct vty *vty, struct interfac
|
Line 1593 ipv6_address_install (struct vty *vty, struct interfac
|
SET_FLAG (ifc->conf, ZEBRA_IFC_CONFIGURED); |
SET_FLAG (ifc->conf, ZEBRA_IFC_CONFIGURED); |
|
|
/* In case of this route need to install kernel. */ |
/* In case of this route need to install kernel. */ |
if (! CHECK_FLAG (ifc->conf, ZEBRA_IFC_REAL) | if (! CHECK_FLAG (ifc->conf, ZEBRA_IFC_QUEUED) |
&& CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE)) | && CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE) |
| && !(if_data && if_data->shutdown == IF_ZEBRA_SHUTDOWN_ON)) |
{ |
{ |
/* Some system need to up the interface to set IP address. */ |
/* Some system need to up the interface to set IP address. */ |
if (! if_is_up (ifp)) |
if (! if_is_up (ifp)) |
Line 1441 ipv6_address_install (struct vty *vty, struct interfac
|
Line 1613 ipv6_address_install (struct vty *vty, struct interfac
|
return CMD_WARNING; |
return CMD_WARNING; |
} |
} |
|
|
/* IP address propery set. */ | SET_FLAG (ifc->conf, ZEBRA_IFC_QUEUED); |
SET_FLAG (ifc->conf, ZEBRA_IFC_REAL); | /* The address will be advertised to zebra clients when the notification |
| * from the kernel has been received. */ |
/* Update interface address information to protocol daemon. */ | |
zebra_interface_address_add_update (ifp, ifc); | |
| |
/* If interface is up register connected route. */ | |
if (if_is_operative(ifp)) | |
connected_up_ipv6 (ifp, ifc); | |
} |
} |
|
|
return CMD_SUCCESS; |
return CMD_SUCCESS; |
Line 1484 ipv6_address_uninstall (struct vty *vty, struct interf
|
Line 1650 ipv6_address_uninstall (struct vty *vty, struct interf
|
if (! CHECK_FLAG (ifc->conf, ZEBRA_IFC_CONFIGURED)) |
if (! CHECK_FLAG (ifc->conf, ZEBRA_IFC_CONFIGURED)) |
return CMD_WARNING; |
return CMD_WARNING; |
|
|
|
UNSET_FLAG (ifc->conf, ZEBRA_IFC_CONFIGURED); |
|
|
/* This is not real address or interface is not active. */ |
/* This is not real address or interface is not active. */ |
if (! CHECK_FLAG (ifc->conf, ZEBRA_IFC_REAL) | if (! CHECK_FLAG (ifc->conf, ZEBRA_IFC_QUEUED) |
|| ! CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE)) |
|| ! CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE)) |
{ |
{ |
listnode_delete (ifp->connected, ifc); |
listnode_delete (ifp->connected, ifc); |
Line 1502 ipv6_address_uninstall (struct vty *vty, struct interf
|
Line 1670 ipv6_address_uninstall (struct vty *vty, struct interf
|
return CMD_WARNING; |
return CMD_WARNING; |
} |
} |
|
|
/* Redistribute this information. */ | UNSET_FLAG (ifc->conf, ZEBRA_IFC_QUEUED); |
zebra_interface_address_delete_update (ifp, ifc); | /* This information will be propagated to the zclients when the |
| * kernel notification is received. */ |
/* Remove connected route. */ | |
connected_down_ipv6 (ifp, ifc); | |
| |
/* Free address information. */ | |
listnode_delete (ifp->connected, ifc); | |
connected_free (ifc); | |
| |
return CMD_SUCCESS; |
return CMD_SUCCESS; |
} |
} |
|
|
Line 1542 if_config_write (struct vty *vty)
|
Line 1703 if_config_write (struct vty *vty)
|
{ |
{ |
struct listnode *node; |
struct listnode *node; |
struct interface *ifp; |
struct interface *ifp; |
|
vrf_iter_t iter; |
|
|
for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) | for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter)) |
| for (ALL_LIST_ELEMENTS_RO (vrf_iter2iflist (iter), node, ifp)) |
{ |
{ |
struct zebra_if *if_data; |
struct zebra_if *if_data; |
struct listnode *addrnode; |
struct listnode *addrnode; |
Line 1551 if_config_write (struct vty *vty)
|
Line 1714 if_config_write (struct vty *vty)
|
struct prefix *p; |
struct prefix *p; |
|
|
if_data = ifp->info; |
if_data = ifp->info; |
|
|
vty_out (vty, "interface %s%s", ifp->name, |
|
VTY_NEWLINE); |
|
|
|
|
if (ifp->vrf_id == VRF_DEFAULT) |
|
vty_out (vty, "interface %s%s", ifp->name, VTY_NEWLINE); |
|
else |
|
vty_out (vty, "interface %s vrf %u%s", ifp->name, ifp->vrf_id, |
|
VTY_NEWLINE); |
|
|
|
if (if_data) |
|
{ |
|
if (if_data->shutdown == IF_ZEBRA_SHUTDOWN_ON) |
|
vty_out (vty, " shutdown%s", VTY_NEWLINE); |
|
} |
|
|
if (ifp->desc) |
if (ifp->desc) |
vty_out (vty, " description %s%s", ifp->desc, |
vty_out (vty, " description %s%s", ifp->desc, |
VTY_NEWLINE); |
VTY_NEWLINE); |
Line 1566 if_config_write (struct vty *vty)
|
Line 1738 if_config_write (struct vty *vty)
|
|
|
if (CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_LINKDETECTION)) |
if (CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_LINKDETECTION)) |
vty_out(vty, " link-detect%s", VTY_NEWLINE); |
vty_out(vty, " link-detect%s", VTY_NEWLINE); |
|
else |
|
vty_out(vty, " no link-detect%s", VTY_NEWLINE); |
|
|
for (ALL_LIST_ELEMENTS_RO (ifp->connected, addrnode, ifc)) |
for (ALL_LIST_ELEMENTS_RO (ifp->connected, addrnode, ifc)) |
{ |
{ |
Line 1573 if_config_write (struct vty *vty)
|
Line 1747 if_config_write (struct vty *vty)
|
{ |
{ |
char buf[INET6_ADDRSTRLEN]; |
char buf[INET6_ADDRSTRLEN]; |
p = ifc->address; |
p = ifc->address; |
vty_out (vty, " ip%s address %s/%d", | vty_out (vty, " ip%s address %s", |
p->family == AF_INET ? "" : "v6", |
p->family == AF_INET ? "" : "v6", |
inet_ntop (p->family, &p->u.prefix, buf, sizeof(buf)), | prefix2str (p, buf, sizeof(buf))); |
p->prefixlen); | |
|
|
if (ifc->label) |
if (ifc->label) |
vty_out (vty, " label %s", ifc->label); |
vty_out (vty, " label %s", ifc->label); |
Line 1587 if_config_write (struct vty *vty)
|
Line 1760 if_config_write (struct vty *vty)
|
|
|
if (if_data) |
if (if_data) |
{ |
{ |
if (if_data->shutdown == IF_ZEBRA_SHUTDOWN_ON) |
|
vty_out (vty, " shutdown%s", VTY_NEWLINE); |
|
|
|
if (if_data->multicast != IF_ZEBRA_MULTICAST_UNSPEC) |
if (if_data->multicast != IF_ZEBRA_MULTICAST_UNSPEC) |
vty_out (vty, " %smulticast%s", |
vty_out (vty, " %smulticast%s", |
if_data->multicast == IF_ZEBRA_MULTICAST_ON ? "" : "no ", |
if_data->multicast == IF_ZEBRA_MULTICAST_ON ? "" : "no ", |
VTY_NEWLINE); |
VTY_NEWLINE); |
} |
} |
|
|
#ifdef RTADV | #if defined (HAVE_RTADV) |
rtadv_config_write (vty, ifp); |
rtadv_config_write (vty, ifp); |
#endif /* RTADV */ | #endif /* HAVE_RTADV */ |
|
|
#ifdef HAVE_IRDP |
#ifdef HAVE_IRDP |
irdp_config_write (vty, ifp); |
irdp_config_write (vty, ifp); |
Line 1614 void
|
Line 1784 void
|
zebra_if_init (void) |
zebra_if_init (void) |
{ |
{ |
/* Initialize interface and new hook. */ |
/* Initialize interface and new hook. */ |
if_init (); |
|
if_add_hook (IF_NEW_HOOK, if_zebra_new_hook); |
if_add_hook (IF_NEW_HOOK, if_zebra_new_hook); |
if_add_hook (IF_DELETE_HOOK, if_zebra_delete_hook); |
if_add_hook (IF_DELETE_HOOK, if_zebra_delete_hook); |
|
|
Line 1622 zebra_if_init (void)
|
Line 1791 zebra_if_init (void)
|
install_node (&interface_node, if_config_write); |
install_node (&interface_node, if_config_write); |
|
|
install_element (VIEW_NODE, &show_interface_cmd); |
install_element (VIEW_NODE, &show_interface_cmd); |
|
install_element (VIEW_NODE, &show_interface_vrf_cmd); |
|
install_element (VIEW_NODE, &show_interface_vrf_all_cmd); |
|
install_element (VIEW_NODE, &show_interface_name_cmd); |
|
install_element (VIEW_NODE, &show_interface_name_vrf_cmd); |
|
install_element (VIEW_NODE, &show_interface_name_vrf_all_cmd); |
install_element (ENABLE_NODE, &show_interface_cmd); |
install_element (ENABLE_NODE, &show_interface_cmd); |
|
install_element (ENABLE_NODE, &show_interface_vrf_cmd); |
|
install_element (ENABLE_NODE, &show_interface_vrf_all_cmd); |
|
install_element (ENABLE_NODE, &show_interface_name_cmd); |
|
install_element (ENABLE_NODE, &show_interface_name_vrf_cmd); |
|
install_element (ENABLE_NODE, &show_interface_name_vrf_all_cmd); |
install_element (ENABLE_NODE, &show_interface_desc_cmd); |
install_element (ENABLE_NODE, &show_interface_desc_cmd); |
|
install_element (ENABLE_NODE, &show_interface_desc_vrf_cmd); |
|
install_element (ENABLE_NODE, &show_interface_desc_vrf_all_cmd); |
install_element (CONFIG_NODE, &zebra_interface_cmd); |
install_element (CONFIG_NODE, &zebra_interface_cmd); |
|
install_element (CONFIG_NODE, &zebra_interface_vrf_cmd); |
install_element (CONFIG_NODE, &no_interface_cmd); |
install_element (CONFIG_NODE, &no_interface_cmd); |
|
install_element (CONFIG_NODE, &no_interface_vrf_cmd); |
install_default (INTERFACE_NODE); |
install_default (INTERFACE_NODE); |
install_element (INTERFACE_NODE, &interface_desc_cmd); |
install_element (INTERFACE_NODE, &interface_desc_cmd); |
install_element (INTERFACE_NODE, &no_interface_desc_cmd); |
install_element (INTERFACE_NODE, &no_interface_desc_cmd); |