paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Interface function. |
| 3 | * Copyright (C) 1997, 1999 Kunihiro Ishiguro |
| 4 | * |
| 5 | * This file is part of GNU Zebra. |
| 6 | * |
| 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 |
| 10 | * later version. |
| 11 | * |
| 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. |
| 16 | * |
| 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 |
| 20 | * 02111-1307, USA. |
| 21 | */ |
| 22 | |
| 23 | #include <zebra.h> |
| 24 | |
| 25 | #include "if.h" |
| 26 | #include "vty.h" |
| 27 | #include "sockunion.h" |
| 28 | #include "prefix.h" |
| 29 | #include "command.h" |
| 30 | #include "memory.h" |
| 31 | #include "ioctl.h" |
| 32 | #include "connected.h" |
| 33 | #include "log.h" |
| 34 | #include "zclient.h" |
| 35 | |
| 36 | #include "zebra/interface.h" |
| 37 | #include "zebra/rtadv.h" |
| 38 | #include "zebra/rib.h" |
| 39 | #include "zebra/zserv.h" |
| 40 | #include "zebra/redistribute.h" |
| 41 | #include "zebra/debug.h" |
hasso | ca77698 | 2004-06-12 14:33:05 +0000 | [diff] [blame] | 42 | #include "zebra/irdp.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 43 | |
| 44 | /* Allocate a new internal interface index |
| 45 | * This works done from the top so that %d macros |
| 46 | * print a - sign! |
| 47 | */ |
| 48 | static unsigned int |
| 49 | if_new_intern_ifindex (void) |
| 50 | { |
| 51 | /* Start here so that first one assigned is 0xFFFFFFFF */ |
| 52 | static unsigned int ifindex = IFINDEX_INTERNBASE + 1; |
| 53 | |
| 54 | for (;;) |
| 55 | { |
| 56 | ifindex--; |
| 57 | if ( ifindex <= IFINDEX_INTERNBASE ) |
| 58 | ifindex = 0xFFFFFFFF; |
| 59 | |
| 60 | if (if_lookup_by_index(ifindex) == NULL) |
| 61 | return ifindex; |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | /* Called when new interface is added. */ |
| 66 | int |
| 67 | if_zebra_new_hook (struct interface *ifp) |
| 68 | { |
| 69 | struct zebra_if *zebra_if; |
| 70 | |
| 71 | zebra_if = XMALLOC (MTYPE_TMP, sizeof (struct zebra_if)); |
| 72 | memset (zebra_if, 0, sizeof (struct zebra_if)); |
| 73 | |
| 74 | zebra_if->multicast = IF_ZEBRA_MULTICAST_UNSPEC; |
| 75 | zebra_if->shutdown = IF_ZEBRA_SHUTDOWN_UNSPEC; |
| 76 | |
| 77 | #ifdef RTADV |
| 78 | { |
| 79 | /* Set default router advertise values. */ |
| 80 | struct rtadvconf *rtadv; |
| 81 | |
| 82 | rtadv = &zebra_if->rtadv; |
| 83 | |
| 84 | rtadv->AdvSendAdvertisements = 0; |
| 85 | rtadv->MaxRtrAdvInterval = RTADV_MAX_RTR_ADV_INTERVAL; |
| 86 | rtadv->MinRtrAdvInterval = RTADV_MIN_RTR_ADV_INTERVAL; |
| 87 | rtadv->AdvIntervalTimer = 0; |
| 88 | rtadv->AdvManagedFlag = 0; |
| 89 | rtadv->AdvOtherConfigFlag = 0; |
| 90 | rtadv->AdvLinkMTU = 0; |
| 91 | rtadv->AdvReachableTime = 0; |
| 92 | rtadv->AdvRetransTimer = 0; |
| 93 | rtadv->AdvCurHopLimit = 0; |
| 94 | rtadv->AdvDefaultLifetime = RTADV_ADV_DEFAULT_LIFETIME; |
| 95 | |
| 96 | rtadv->AdvPrefixList = list_new (); |
| 97 | } |
| 98 | #endif /* RTADV */ |
| 99 | |
| 100 | ifp->info = zebra_if; |
| 101 | return 0; |
| 102 | } |
| 103 | |
| 104 | /* Called when interface is deleted. */ |
| 105 | int |
| 106 | if_zebra_delete_hook (struct interface *ifp) |
| 107 | { |
| 108 | if (ifp->info) |
| 109 | XFREE (MTYPE_TMP, ifp->info); |
| 110 | return 0; |
| 111 | } |
| 112 | |
| 113 | /* Wake up configured address if it is not in current kernel |
| 114 | address. */ |
| 115 | void |
| 116 | if_addr_wakeup (struct interface *ifp) |
| 117 | { |
| 118 | struct listnode *node; |
| 119 | struct connected *ifc; |
| 120 | struct prefix *p; |
| 121 | int ret; |
| 122 | |
| 123 | for (node = listhead (ifp->connected); node; nextnode (node)) |
| 124 | { |
| 125 | ifc = getdata (node); |
| 126 | p = ifc->address; |
| 127 | |
| 128 | if (CHECK_FLAG (ifc->conf, ZEBRA_IFC_CONFIGURED) |
| 129 | && ! CHECK_FLAG (ifc->conf, ZEBRA_IFC_REAL)) |
| 130 | { |
| 131 | /* Address check. */ |
| 132 | if (p->family == AF_INET) |
| 133 | { |
| 134 | if (! if_is_up (ifp)) |
| 135 | { |
| 136 | if_set_flags (ifp, IFF_UP | IFF_RUNNING); |
| 137 | if_refresh (ifp); |
| 138 | } |
| 139 | |
| 140 | ret = if_set_prefix (ifp, ifc); |
| 141 | if (ret < 0) |
| 142 | { |
| 143 | zlog_warn ("Can't set interface's address: %s", |
| 144 | strerror(errno)); |
| 145 | continue; |
| 146 | } |
| 147 | SET_FLAG (ifc->conf, ZEBRA_IFC_REAL); |
| 148 | |
| 149 | zebra_interface_address_add_update (ifp, ifc); |
| 150 | |
paul | 2e3b2e4 | 2002-12-13 21:03:13 +0000 | [diff] [blame] | 151 | if (if_is_operative(ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 152 | connected_up_ipv4 (ifp, ifc); |
| 153 | } |
| 154 | #ifdef HAVE_IPV6 |
| 155 | if (p->family == AF_INET6) |
| 156 | { |
| 157 | if (! if_is_up (ifp)) |
| 158 | { |
| 159 | if_set_flags (ifp, IFF_UP | IFF_RUNNING); |
| 160 | if_refresh (ifp); |
| 161 | } |
| 162 | |
| 163 | ret = if_prefix_add_ipv6 (ifp, ifc); |
| 164 | if (ret < 0) |
| 165 | { |
| 166 | zlog_warn ("Can't set interface's address: %s", |
| 167 | strerror(errno)); |
| 168 | continue; |
| 169 | } |
| 170 | SET_FLAG (ifc->conf, ZEBRA_IFC_REAL); |
| 171 | |
| 172 | zebra_interface_address_add_update (ifp, ifc); |
| 173 | |
paul | 2e3b2e4 | 2002-12-13 21:03:13 +0000 | [diff] [blame] | 174 | if (if_is_operative(ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 175 | connected_up_ipv6 (ifp, ifc); |
| 176 | } |
| 177 | #endif /* HAVE_IPV6 */ |
| 178 | } |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | /* Handle interface addition */ |
| 183 | void |
| 184 | if_add_update (struct interface *ifp) |
| 185 | { |
paul | 48b33aa | 2002-12-13 20:52:52 +0000 | [diff] [blame] | 186 | struct zebra_if *if_data; |
| 187 | |
| 188 | if_data = ifp->info; |
| 189 | if (if_data->multicast == IF_ZEBRA_MULTICAST_ON) |
| 190 | if_set_flags (ifp, IFF_MULTICAST); |
| 191 | else if (if_data->multicast == IF_ZEBRA_MULTICAST_OFF) |
| 192 | if_unset_flags (ifp, IFF_MULTICAST); |
| 193 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 194 | zebra_interface_add_update (ifp); |
| 195 | |
| 196 | if (! CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE)) |
| 197 | { |
| 198 | SET_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE); |
| 199 | |
| 200 | if_addr_wakeup (ifp); |
| 201 | |
| 202 | if (IS_ZEBRA_DEBUG_KERNEL) |
| 203 | zlog_info ("interface %s index %d becomes active.", |
| 204 | ifp->name, ifp->ifindex); |
| 205 | } |
| 206 | else |
| 207 | { |
| 208 | if (IS_ZEBRA_DEBUG_KERNEL) |
| 209 | zlog_info ("interface %s index %d is added.", ifp->name, ifp->ifindex); |
| 210 | } |
| 211 | } |
| 212 | |
paul | 44145db | 2004-05-09 11:00:23 +0000 | [diff] [blame] | 213 | |
| 214 | /* Handle an interface delete event |
| 215 | * |
| 216 | * This function is only called when support for |
| 217 | * RTM_IFANNOUNCE or AF_NETLINK sockets (RTM_DELLINK message) |
| 218 | * is available. It is not called on, eg, Solaris. |
| 219 | */ |
| 220 | #if (defined(RTM_IFANNOUNCE) || defined(HAVE_NETLINK)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 221 | void |
| 222 | if_delete_update (struct interface *ifp) |
| 223 | { |
| 224 | struct listnode *node; |
| 225 | struct listnode *next; |
| 226 | struct connected *ifc; |
| 227 | struct prefix *p; |
| 228 | |
| 229 | if (if_is_up(ifp)) |
| 230 | { |
| 231 | zlog_err ("interface %s index %d is still up while being deleted.", |
| 232 | ifp->name, ifp->ifindex); |
| 233 | return; |
| 234 | } |
| 235 | |
| 236 | /* Mark interface as inactive */ |
| 237 | UNSET_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE); |
| 238 | |
| 239 | if (IS_ZEBRA_DEBUG_KERNEL) |
| 240 | zlog_info ("interface %s index %d is now inactive.", |
| 241 | ifp->name, ifp->ifindex); |
| 242 | |
| 243 | /* Delete connected routes from the kernel. */ |
| 244 | if (ifp->connected) |
| 245 | { |
| 246 | for (node = listhead (ifp->connected); node; node = next) |
| 247 | { |
| 248 | next = node->next; |
| 249 | ifc = getdata (node); |
| 250 | p = ifc->address; |
| 251 | |
| 252 | if (p->family == AF_INET) |
| 253 | connected_down_ipv4 (ifp, ifc); |
| 254 | #ifdef HAVE_IPV6 |
| 255 | else if (p->family == AF_INET6) |
| 256 | connected_down_ipv6 (ifp, ifc); |
| 257 | #endif /* HAVE_IPV6 */ |
| 258 | |
| 259 | zebra_interface_address_delete_update (ifp, ifc); |
| 260 | |
| 261 | UNSET_FLAG (ifc->conf, ZEBRA_IFC_REAL); |
| 262 | |
| 263 | if (! CHECK_FLAG (ifc->conf, ZEBRA_IFC_CONFIGURED)) |
| 264 | { |
| 265 | listnode_delete (ifp->connected, ifc); |
| 266 | connected_free (ifc); |
| 267 | } |
| 268 | } |
| 269 | } |
| 270 | zebra_interface_delete_update (ifp); |
| 271 | } |
paul | 44145db | 2004-05-09 11:00:23 +0000 | [diff] [blame] | 272 | #endif /* (defined(RTM_IFANNOUNCE) || defined(HAVE_NETLINK) */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 273 | |
| 274 | /* Interface is up. */ |
| 275 | void |
| 276 | if_up (struct interface *ifp) |
| 277 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 278 | struct listnode *node; |
| 279 | struct listnode *next; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 280 | struct connected *ifc; |
| 281 | struct prefix *p; |
| 282 | |
| 283 | /* Notify the protocol daemons. */ |
| 284 | zebra_interface_up_update (ifp); |
| 285 | |
| 286 | /* Install connected routes to the kernel. */ |
| 287 | if (ifp->connected) |
| 288 | { |
| 289 | for (node = listhead (ifp->connected); node; node = next) |
| 290 | { |
| 291 | next = node->next; |
| 292 | ifc = getdata (node); |
| 293 | p = ifc->address; |
| 294 | |
| 295 | if (p->family == AF_INET) |
| 296 | connected_up_ipv4 (ifp, ifc); |
| 297 | #ifdef HAVE_IPV6 |
| 298 | else if (p->family == AF_INET6) |
| 299 | connected_up_ipv6 (ifp, ifc); |
| 300 | #endif /* HAVE_IPV6 */ |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | /* Examine all static routes. */ |
| 305 | rib_update (); |
| 306 | } |
| 307 | |
| 308 | /* Interface goes down. We have to manage different behavior of based |
| 309 | OS. */ |
| 310 | void |
| 311 | if_down (struct interface *ifp) |
| 312 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 313 | struct listnode *node; |
| 314 | struct listnode *next; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 315 | struct connected *ifc; |
| 316 | struct prefix *p; |
| 317 | |
| 318 | /* Notify to the protocol daemons. */ |
| 319 | zebra_interface_down_update (ifp); |
| 320 | |
| 321 | /* Delete connected routes from the kernel. */ |
| 322 | if (ifp->connected) |
| 323 | { |
| 324 | for (node = listhead (ifp->connected); node; node = next) |
| 325 | { |
| 326 | next = node->next; |
| 327 | ifc = getdata (node); |
| 328 | p = ifc->address; |
| 329 | |
| 330 | if (p->family == AF_INET) |
| 331 | connected_down_ipv4 (ifp, ifc); |
| 332 | #ifdef HAVE_IPV6 |
| 333 | else if (p->family == AF_INET6) |
| 334 | connected_down_ipv6 (ifp, ifc); |
| 335 | #endif /* HAVE_IPV6 */ |
| 336 | } |
| 337 | } |
| 338 | |
| 339 | /* Examine all static routes which direct to the interface. */ |
| 340 | rib_update (); |
| 341 | } |
| 342 | |
| 343 | void |
| 344 | if_refresh (struct interface *ifp) |
| 345 | { |
paul | 2e3b2e4 | 2002-12-13 21:03:13 +0000 | [diff] [blame] | 346 | if (if_is_operative (ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 347 | { |
| 348 | if_get_flags (ifp); |
paul | 2e3b2e4 | 2002-12-13 21:03:13 +0000 | [diff] [blame] | 349 | if (! if_is_operative (ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 350 | if_down (ifp); |
| 351 | } |
| 352 | else |
| 353 | { |
| 354 | if_get_flags (ifp); |
paul | 2e3b2e4 | 2002-12-13 21:03:13 +0000 | [diff] [blame] | 355 | if (if_is_operative (ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 356 | if_up (ifp); |
| 357 | } |
| 358 | } |
| 359 | |
| 360 | /* Printout flag information into vty */ |
| 361 | void |
| 362 | if_flag_dump_vty (struct vty *vty, unsigned long flag) |
| 363 | { |
| 364 | int separator = 0; |
| 365 | |
| 366 | #define IFF_OUT_VTY(X, Y) \ |
| 367 | if ((X) && (flag & (X))) \ |
| 368 | { \ |
| 369 | if (separator) \ |
| 370 | vty_out (vty, ","); \ |
| 371 | else \ |
| 372 | separator = 1; \ |
| 373 | vty_out (vty, Y); \ |
| 374 | } |
| 375 | |
| 376 | vty_out (vty, "<"); |
| 377 | IFF_OUT_VTY (IFF_UP, "UP"); |
| 378 | IFF_OUT_VTY (IFF_BROADCAST, "BROADCAST"); |
| 379 | IFF_OUT_VTY (IFF_DEBUG, "DEBUG"); |
| 380 | IFF_OUT_VTY (IFF_LOOPBACK, "LOOPBACK"); |
| 381 | IFF_OUT_VTY (IFF_POINTOPOINT, "POINTOPOINT"); |
| 382 | IFF_OUT_VTY (IFF_NOTRAILERS, "NOTRAILERS"); |
| 383 | IFF_OUT_VTY (IFF_RUNNING, "RUNNING"); |
| 384 | IFF_OUT_VTY (IFF_NOARP, "NOARP"); |
| 385 | IFF_OUT_VTY (IFF_PROMISC, "PROMISC"); |
| 386 | IFF_OUT_VTY (IFF_ALLMULTI, "ALLMULTI"); |
| 387 | IFF_OUT_VTY (IFF_OACTIVE, "OACTIVE"); |
| 388 | IFF_OUT_VTY (IFF_SIMPLEX, "SIMPLEX"); |
| 389 | IFF_OUT_VTY (IFF_LINK0, "LINK0"); |
| 390 | IFF_OUT_VTY (IFF_LINK1, "LINK1"); |
| 391 | IFF_OUT_VTY (IFF_LINK2, "LINK2"); |
| 392 | IFF_OUT_VTY (IFF_MULTICAST, "MULTICAST"); |
paul | 44145db | 2004-05-09 11:00:23 +0000 | [diff] [blame] | 393 | #ifdef SOLARIS_IPV6 |
| 394 | IFF_OUT_VTY (IFF_IPV4, "IFF_IPv4"); |
| 395 | IFF_OUT_VTY (IFF_IPV6, "IFF_IPv6"); |
| 396 | #endif /* SOLARIS_IPV6 */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 397 | vty_out (vty, ">"); |
| 398 | } |
| 399 | |
| 400 | /* Output prefix string to vty. */ |
| 401 | int |
| 402 | prefix_vty_out (struct vty *vty, struct prefix *p) |
| 403 | { |
| 404 | char str[INET6_ADDRSTRLEN]; |
| 405 | |
| 406 | inet_ntop (p->family, &p->u.prefix, str, sizeof (str)); |
| 407 | vty_out (vty, "%s", str); |
| 408 | return strlen (str); |
| 409 | } |
| 410 | |
| 411 | /* Dump if address information to vty. */ |
| 412 | void |
| 413 | connected_dump_vty (struct vty *vty, struct connected *connected) |
| 414 | { |
| 415 | struct prefix *p; |
| 416 | struct interface *ifp; |
| 417 | |
| 418 | /* Set interface pointer. */ |
| 419 | ifp = connected->ifp; |
| 420 | |
| 421 | /* Print interface address. */ |
| 422 | p = connected->address; |
| 423 | vty_out (vty, " %s ", prefix_family_str (p)); |
| 424 | prefix_vty_out (vty, p); |
| 425 | vty_out (vty, "/%d", p->prefixlen); |
| 426 | |
| 427 | /* If there is destination address, print it. */ |
| 428 | p = connected->destination; |
| 429 | if (p) |
| 430 | { |
| 431 | if (p->family == AF_INET) |
| 432 | if (ifp->flags & IFF_BROADCAST) |
| 433 | { |
| 434 | vty_out (vty, " broadcast "); |
| 435 | prefix_vty_out (vty, p); |
| 436 | } |
| 437 | |
| 438 | if (ifp->flags & IFF_POINTOPOINT) |
| 439 | { |
| 440 | vty_out (vty, " pointopoint "); |
| 441 | prefix_vty_out (vty, p); |
| 442 | } |
| 443 | } |
| 444 | |
| 445 | if (CHECK_FLAG (connected->flags, ZEBRA_IFA_SECONDARY)) |
| 446 | vty_out (vty, " secondary"); |
| 447 | |
| 448 | if (connected->label) |
| 449 | vty_out (vty, " %s", connected->label); |
| 450 | |
| 451 | vty_out (vty, "%s", VTY_NEWLINE); |
| 452 | } |
| 453 | |
| 454 | #ifdef RTADV |
| 455 | /* Dump interface ND information to vty. */ |
| 456 | void |
| 457 | nd_dump_vty (struct vty *vty, struct interface *ifp) |
| 458 | { |
| 459 | struct zebra_if *zif; |
| 460 | struct rtadvconf *rtadv; |
| 461 | |
| 462 | zif = (struct zebra_if *) ifp->info; |
| 463 | rtadv = &zif->rtadv; |
| 464 | |
| 465 | if (rtadv->AdvSendAdvertisements) |
| 466 | { |
| 467 | vty_out (vty, " ND advertised reachable time is %d milliseconds%s", |
| 468 | rtadv->AdvReachableTime, VTY_NEWLINE); |
| 469 | vty_out (vty, " ND advertised retransmit interval is %d milliseconds%s", |
| 470 | rtadv->AdvRetransTimer, VTY_NEWLINE); |
| 471 | vty_out (vty, " ND router advertisements are sent every %d seconds%s", |
| 472 | rtadv->MaxRtrAdvInterval, VTY_NEWLINE); |
| 473 | vty_out (vty, " ND router advertisements live for %d seconds%s", |
| 474 | rtadv->AdvDefaultLifetime, VTY_NEWLINE); |
| 475 | if (rtadv->AdvManagedFlag) |
| 476 | vty_out (vty, " Hosts use DHCP to obtain routable addresses.%s", |
| 477 | VTY_NEWLINE); |
| 478 | else |
| 479 | vty_out (vty, " Hosts use stateless autoconfig for addresses.%s", |
| 480 | VTY_NEWLINE); |
| 481 | } |
| 482 | } |
| 483 | #endif /* RTADV */ |
| 484 | |
| 485 | /* Interface's information print out to vty interface. */ |
| 486 | void |
| 487 | if_dump_vty (struct vty *vty, struct interface *ifp) |
| 488 | { |
| 489 | #ifdef HAVE_SOCKADDR_DL |
| 490 | struct sockaddr_dl *sdl; |
| 491 | #endif /* HAVE_SOCKADDR_DL */ |
| 492 | struct connected *connected; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 493 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 494 | |
paul | 2e3b2e4 | 2002-12-13 21:03:13 +0000 | [diff] [blame] | 495 | vty_out (vty, "Interface %s is ", ifp->name); |
| 496 | if (if_is_up(ifp)) { |
| 497 | vty_out (vty, "up, line protocol "); |
| 498 | |
| 499 | if (CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_LINKDETECTION)) { |
| 500 | if (if_is_running(ifp)) |
| 501 | vty_out (vty, "is up%s", VTY_NEWLINE); |
| 502 | else |
| 503 | vty_out (vty, "is down%s", VTY_NEWLINE); |
| 504 | } else { |
| 505 | vty_out (vty, "detection is disabled%s", VTY_NEWLINE); |
| 506 | } |
| 507 | } else { |
| 508 | vty_out (vty, "down%s", VTY_NEWLINE); |
| 509 | } |
| 510 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 511 | if (ifp->desc) |
| 512 | vty_out (vty, " Description: %s%s", ifp->desc, |
| 513 | VTY_NEWLINE); |
| 514 | if (ifp->ifindex <= 0) |
| 515 | { |
| 516 | vty_out(vty, " index %d pseudo interface%s", ifp->ifindex, VTY_NEWLINE); |
| 517 | return; |
| 518 | } |
| 519 | else if (! CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE)) |
| 520 | { |
| 521 | vty_out(vty, " index %d inactive interface%s", |
| 522 | ifp->ifindex, |
| 523 | VTY_NEWLINE); |
| 524 | return; |
| 525 | } |
| 526 | |
| 527 | vty_out (vty, " index %d metric %d mtu %d ", |
| 528 | ifp->ifindex, ifp->metric, ifp->mtu); |
| 529 | if_flag_dump_vty (vty, ifp->flags); |
paul | 44145db | 2004-05-09 11:00:23 +0000 | [diff] [blame] | 530 | #ifdef HAVE_IPV6 |
| 531 | if (ifp->mtu6 != ifp->mtu) |
| 532 | vty_out (vty, "mtu6 %d ", ifp->mtu6); |
| 533 | #endif |
| 534 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 535 | vty_out (vty, "%s", VTY_NEWLINE); |
| 536 | |
| 537 | /* Hardware address. */ |
| 538 | #ifdef HAVE_SOCKADDR_DL |
| 539 | sdl = &ifp->sdl; |
| 540 | if (sdl != NULL && sdl->sdl_alen != 0) |
| 541 | { |
| 542 | int i; |
| 543 | u_char *ptr; |
| 544 | |
| 545 | vty_out (vty, " HWaddr: "); |
paul | 5b73a67 | 2004-07-23 15:26:14 +0000 | [diff] [blame] | 546 | for (i = 0, ptr = (u_char *)LLADDR (sdl); i < sdl->sdl_alen; i++, ptr++) |
| 547 | vty_out (vty, "%s%02x", i == 0 ? "" : ":", *ptr); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 548 | vty_out (vty, "%s", VTY_NEWLINE); |
| 549 | } |
| 550 | #else |
| 551 | if (ifp->hw_addr_len != 0) |
| 552 | { |
| 553 | int i; |
| 554 | |
| 555 | vty_out (vty, " HWaddr: "); |
| 556 | for (i = 0; i < ifp->hw_addr_len; i++) |
| 557 | vty_out (vty, "%s%02x", i == 0 ? "" : ":", ifp->hw_addr[i]); |
| 558 | vty_out (vty, "%s", VTY_NEWLINE); |
| 559 | } |
| 560 | #endif /* HAVE_SOCKADDR_DL */ |
| 561 | |
| 562 | /* Bandwidth in kbps */ |
| 563 | if (ifp->bandwidth != 0) |
| 564 | { |
| 565 | vty_out(vty, " bandwidth %u kbps", ifp->bandwidth); |
| 566 | vty_out(vty, "%s", VTY_NEWLINE); |
| 567 | } |
| 568 | |
| 569 | for (node = listhead (ifp->connected); node; nextnode (node)) |
| 570 | { |
| 571 | connected = getdata (node); |
| 572 | if (CHECK_FLAG (connected->conf, ZEBRA_IFC_REAL)) |
| 573 | connected_dump_vty (vty, connected); |
| 574 | } |
| 575 | |
| 576 | #ifdef RTADV |
| 577 | nd_dump_vty (vty, ifp); |
| 578 | #endif /* RTADV */ |
| 579 | |
| 580 | #ifdef HAVE_PROC_NET_DEV |
| 581 | /* Statistics print out using proc file system. */ |
| 582 | vty_out (vty, " input packets %lu, bytes %lu, dropped %lu," |
| 583 | " multicast packets %lu%s", |
| 584 | ifp->stats.rx_packets, ifp->stats.rx_bytes, |
| 585 | ifp->stats.rx_dropped, ifp->stats.rx_multicast, VTY_NEWLINE); |
| 586 | |
| 587 | vty_out (vty, " input errors %lu, length %lu, overrun %lu," |
| 588 | " CRC %lu, frame %lu, fifo %lu, missed %lu%s", |
| 589 | ifp->stats.rx_errors, ifp->stats.rx_length_errors, |
| 590 | ifp->stats.rx_over_errors, ifp->stats.rx_crc_errors, |
| 591 | ifp->stats.rx_frame_errors, ifp->stats.rx_fifo_errors, |
| 592 | ifp->stats.rx_missed_errors, VTY_NEWLINE); |
| 593 | |
| 594 | vty_out (vty, " output packets %lu, bytes %lu, dropped %lu%s", |
| 595 | ifp->stats.tx_packets, ifp->stats.tx_bytes, |
| 596 | ifp->stats.tx_dropped, VTY_NEWLINE); |
| 597 | |
| 598 | vty_out (vty, " output errors %lu, aborted %lu, carrier %lu," |
| 599 | " fifo %lu, heartbeat %lu, window %lu%s", |
| 600 | ifp->stats.tx_errors, ifp->stats.tx_aborted_errors, |
| 601 | ifp->stats.tx_carrier_errors, ifp->stats.tx_fifo_errors, |
| 602 | ifp->stats.tx_heartbeat_errors, ifp->stats.tx_window_errors, |
| 603 | VTY_NEWLINE); |
| 604 | |
| 605 | vty_out (vty, " collisions %lu%s", ifp->stats.collisions, VTY_NEWLINE); |
| 606 | #endif /* HAVE_PROC_NET_DEV */ |
| 607 | |
| 608 | #ifdef HAVE_NET_RT_IFLIST |
| 609 | #if defined (__bsdi__) || defined (__NetBSD__) |
| 610 | /* Statistics print out using sysctl (). */ |
| 611 | vty_out (vty, " input packets %qu, bytes %qu, dropped %qu," |
| 612 | " multicast packets %qu%s", |
| 613 | ifp->stats.ifi_ipackets, ifp->stats.ifi_ibytes, |
| 614 | ifp->stats.ifi_iqdrops, ifp->stats.ifi_imcasts, |
| 615 | VTY_NEWLINE); |
| 616 | |
| 617 | vty_out (vty, " input errors %qu%s", |
| 618 | ifp->stats.ifi_ierrors, VTY_NEWLINE); |
| 619 | |
| 620 | vty_out (vty, " output packets %qu, bytes %qu, multicast packets %qu%s", |
| 621 | ifp->stats.ifi_opackets, ifp->stats.ifi_obytes, |
| 622 | ifp->stats.ifi_omcasts, VTY_NEWLINE); |
| 623 | |
| 624 | vty_out (vty, " output errors %qu%s", |
| 625 | ifp->stats.ifi_oerrors, VTY_NEWLINE); |
| 626 | |
| 627 | vty_out (vty, " collisions %qu%s", |
| 628 | ifp->stats.ifi_collisions, VTY_NEWLINE); |
| 629 | #else |
| 630 | /* Statistics print out using sysctl (). */ |
| 631 | vty_out (vty, " input packets %lu, bytes %lu, dropped %lu," |
| 632 | " multicast packets %lu%s", |
| 633 | ifp->stats.ifi_ipackets, ifp->stats.ifi_ibytes, |
| 634 | ifp->stats.ifi_iqdrops, ifp->stats.ifi_imcasts, |
| 635 | VTY_NEWLINE); |
| 636 | |
| 637 | vty_out (vty, " input errors %lu%s", |
| 638 | ifp->stats.ifi_ierrors, VTY_NEWLINE); |
| 639 | |
| 640 | vty_out (vty, " output packets %lu, bytes %lu, multicast packets %lu%s", |
| 641 | ifp->stats.ifi_opackets, ifp->stats.ifi_obytes, |
| 642 | ifp->stats.ifi_omcasts, VTY_NEWLINE); |
| 643 | |
| 644 | vty_out (vty, " output errors %lu%s", |
| 645 | ifp->stats.ifi_oerrors, VTY_NEWLINE); |
| 646 | |
| 647 | vty_out (vty, " collisions %lu%s", |
| 648 | ifp->stats.ifi_collisions, VTY_NEWLINE); |
| 649 | #endif /* __bsdi__ || __NetBSD__ */ |
| 650 | #endif /* HAVE_NET_RT_IFLIST */ |
| 651 | } |
| 652 | |
| 653 | /* Check supported address family. */ |
| 654 | int |
| 655 | if_supported_family (int family) |
| 656 | { |
| 657 | if (family == AF_INET) |
| 658 | return 1; |
| 659 | #ifdef HAVE_IPV6 |
| 660 | if (family == AF_INET6) |
| 661 | return 1; |
| 662 | #endif /* HAVE_IPV6 */ |
| 663 | return 0; |
| 664 | } |
| 665 | |
| 666 | /* Wrapper hook point for zebra daemon so that ifindex can be set |
| 667 | * DEFUN macro not used as extract.pl HAS to ignore this |
| 668 | * See also interface_cmd in lib/if.c |
| 669 | */ |
| 670 | DEFUN_NOSH (zebra_interface, |
| 671 | zebra_interface_cmd, |
| 672 | "interface IFNAME", |
| 673 | "Select an interface to configure\n" |
| 674 | "Interface's name\n") |
| 675 | { |
| 676 | int ret; |
| 677 | struct interface * ifp; |
| 678 | |
| 679 | /* Call lib interface() */ |
| 680 | ret = interface_cmd.func (self, vty, argc, argv); |
| 681 | |
| 682 | ifp = vty->index; |
| 683 | |
| 684 | /* Set ifindex |
| 685 | this only happens if interface is NOT in kernel */ |
| 686 | if (ifp->ifindex == 0) |
| 687 | { |
| 688 | ifp->ifindex = if_new_intern_ifindex (); |
| 689 | UNSET_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE); |
| 690 | } |
| 691 | |
| 692 | return ret; |
| 693 | } |
| 694 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 695 | struct cmd_node interface_node = |
| 696 | { |
| 697 | INTERFACE_NODE, |
| 698 | "%s(config-if)# ", |
| 699 | 1 |
| 700 | }; |
| 701 | |
| 702 | /* Show all or specified interface to vty. */ |
| 703 | DEFUN (show_interface, show_interface_cmd, |
| 704 | "show interface [IFNAME]", |
| 705 | SHOW_STR |
| 706 | "Interface status and configuration\n" |
| 707 | "Inteface name\n") |
| 708 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 709 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 710 | struct interface *ifp; |
| 711 | |
| 712 | #ifdef HAVE_PROC_NET_DEV |
| 713 | /* If system has interface statistics via proc file system, update |
| 714 | statistics. */ |
| 715 | ifstat_update_proc (); |
| 716 | #endif /* HAVE_PROC_NET_DEV */ |
| 717 | #ifdef HAVE_NET_RT_IFLIST |
| 718 | ifstat_update_sysctl (); |
| 719 | #endif /* HAVE_NET_RT_IFLIST */ |
| 720 | |
| 721 | /* Specified interface print. */ |
| 722 | if (argc != 0) |
| 723 | { |
| 724 | ifp = if_lookup_by_name (argv[0]); |
| 725 | if (ifp == NULL) |
| 726 | { |
| 727 | vty_out (vty, "%% Can't find interface %s%s", argv[0], |
| 728 | VTY_NEWLINE); |
| 729 | return CMD_WARNING; |
| 730 | } |
| 731 | if_dump_vty (vty, ifp); |
| 732 | return CMD_SUCCESS; |
| 733 | } |
| 734 | |
| 735 | /* All interface print. */ |
| 736 | for (node = listhead (iflist); node; nextnode (node)) |
| 737 | if_dump_vty (vty, getdata (node)); |
| 738 | |
| 739 | return CMD_SUCCESS; |
| 740 | } |
| 741 | |
| 742 | DEFUN (multicast, |
| 743 | multicast_cmd, |
| 744 | "multicast", |
| 745 | "Set multicast flag to interface\n") |
| 746 | { |
| 747 | int ret; |
| 748 | struct interface *ifp; |
| 749 | struct zebra_if *if_data; |
| 750 | |
| 751 | ifp = (struct interface *) vty->index; |
paul | 48b33aa | 2002-12-13 20:52:52 +0000 | [diff] [blame] | 752 | if (CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 753 | { |
paul | 48b33aa | 2002-12-13 20:52:52 +0000 | [diff] [blame] | 754 | ret = if_set_flags (ifp, IFF_MULTICAST); |
| 755 | if (ret < 0) |
| 756 | { |
| 757 | vty_out (vty, "Can't set multicast flag%s", VTY_NEWLINE); |
| 758 | return CMD_WARNING; |
| 759 | } |
| 760 | if_refresh (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 761 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 762 | if_data = ifp->info; |
| 763 | if_data->multicast = IF_ZEBRA_MULTICAST_ON; |
paul | 48b33aa | 2002-12-13 20:52:52 +0000 | [diff] [blame] | 764 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 765 | return CMD_SUCCESS; |
| 766 | } |
| 767 | |
| 768 | DEFUN (no_multicast, |
| 769 | no_multicast_cmd, |
| 770 | "no multicast", |
| 771 | NO_STR |
| 772 | "Unset multicast flag to interface\n") |
| 773 | { |
| 774 | int ret; |
| 775 | struct interface *ifp; |
| 776 | struct zebra_if *if_data; |
| 777 | |
| 778 | ifp = (struct interface *) vty->index; |
paul | 48b33aa | 2002-12-13 20:52:52 +0000 | [diff] [blame] | 779 | if (CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 780 | { |
paul | 48b33aa | 2002-12-13 20:52:52 +0000 | [diff] [blame] | 781 | ret = if_unset_flags (ifp, IFF_MULTICAST); |
| 782 | if (ret < 0) |
| 783 | { |
| 784 | vty_out (vty, "Can't unset multicast flag%s", VTY_NEWLINE); |
| 785 | return CMD_WARNING; |
| 786 | } |
| 787 | if_refresh (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 788 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 789 | if_data = ifp->info; |
| 790 | if_data->multicast = IF_ZEBRA_MULTICAST_OFF; |
| 791 | |
| 792 | return CMD_SUCCESS; |
| 793 | } |
| 794 | |
paul | 2e3b2e4 | 2002-12-13 21:03:13 +0000 | [diff] [blame] | 795 | DEFUN (linkdetect, |
| 796 | linkdetect_cmd, |
| 797 | "link-detect", |
| 798 | "Enable link detection on interface\n") |
| 799 | { |
paul | 2e3b2e4 | 2002-12-13 21:03:13 +0000 | [diff] [blame] | 800 | struct interface *ifp; |
| 801 | int if_was_operative; |
| 802 | |
| 803 | ifp = (struct interface *) vty->index; |
| 804 | if_was_operative = if_is_operative(ifp); |
| 805 | SET_FLAG(ifp->status, ZEBRA_INTERFACE_LINKDETECTION); |
| 806 | |
| 807 | /* When linkdetection is enabled, if might come down */ |
| 808 | if (!if_is_operative(ifp) && if_was_operative) if_down(ifp); |
| 809 | |
| 810 | /* FIXME: Will defer status change forwarding if interface |
| 811 | does not come down! */ |
| 812 | |
| 813 | return CMD_SUCCESS; |
| 814 | } |
| 815 | |
| 816 | |
| 817 | DEFUN (no_linkdetect, |
| 818 | no_linkdetect_cmd, |
| 819 | "no link-detect", |
| 820 | NO_STR |
| 821 | "Disable link detection on interface\n") |
| 822 | { |
paul | 2e3b2e4 | 2002-12-13 21:03:13 +0000 | [diff] [blame] | 823 | struct interface *ifp; |
| 824 | int if_was_operative; |
| 825 | |
| 826 | ifp = (struct interface *) vty->index; |
| 827 | if_was_operative = if_is_operative(ifp); |
| 828 | UNSET_FLAG(ifp->status, ZEBRA_INTERFACE_LINKDETECTION); |
| 829 | |
| 830 | /* Interface may come up after disabling link detection */ |
| 831 | if (if_is_operative(ifp) && !if_was_operative) if_up(ifp); |
| 832 | |
| 833 | /* FIXME: see linkdetect_cmd */ |
| 834 | |
| 835 | return CMD_SUCCESS; |
| 836 | } |
| 837 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 838 | DEFUN (shutdown_if, |
| 839 | shutdown_if_cmd, |
| 840 | "shutdown", |
| 841 | "Shutdown the selected interface\n") |
| 842 | { |
| 843 | int ret; |
| 844 | struct interface *ifp; |
| 845 | struct zebra_if *if_data; |
| 846 | |
| 847 | ifp = (struct interface *) vty->index; |
| 848 | ret = if_unset_flags (ifp, IFF_UP); |
| 849 | if (ret < 0) |
| 850 | { |
| 851 | vty_out (vty, "Can't shutdown interface%s", VTY_NEWLINE); |
| 852 | return CMD_WARNING; |
| 853 | } |
| 854 | if_refresh (ifp); |
| 855 | if_data = ifp->info; |
| 856 | if_data->shutdown = IF_ZEBRA_SHUTDOWN_ON; |
| 857 | |
| 858 | return CMD_SUCCESS; |
| 859 | } |
| 860 | |
| 861 | DEFUN (no_shutdown_if, |
| 862 | no_shutdown_if_cmd, |
| 863 | "no shutdown", |
| 864 | NO_STR |
| 865 | "Shutdown the selected interface\n") |
| 866 | { |
| 867 | int ret; |
| 868 | struct interface *ifp; |
| 869 | struct zebra_if *if_data; |
| 870 | |
| 871 | ifp = (struct interface *) vty->index; |
| 872 | ret = if_set_flags (ifp, IFF_UP | IFF_RUNNING); |
| 873 | if (ret < 0) |
| 874 | { |
| 875 | vty_out (vty, "Can't up interface%s", VTY_NEWLINE); |
| 876 | return CMD_WARNING; |
| 877 | } |
| 878 | if_refresh (ifp); |
| 879 | if_data = ifp->info; |
| 880 | if_data->shutdown = IF_ZEBRA_SHUTDOWN_OFF; |
| 881 | |
| 882 | return CMD_SUCCESS; |
| 883 | } |
| 884 | |
| 885 | DEFUN (bandwidth_if, |
| 886 | bandwidth_if_cmd, |
| 887 | "bandwidth <1-10000000>", |
| 888 | "Set bandwidth informational parameter\n" |
| 889 | "Bandwidth in kilobits\n") |
| 890 | { |
| 891 | struct interface *ifp; |
| 892 | unsigned int bandwidth; |
| 893 | |
| 894 | ifp = (struct interface *) vty->index; |
| 895 | bandwidth = strtol(argv[0], NULL, 10); |
| 896 | |
| 897 | /* bandwidth range is <1-10000000> */ |
| 898 | if (bandwidth < 1 || bandwidth > 10000000) |
| 899 | { |
| 900 | vty_out (vty, "Bandwidth is invalid%s", VTY_NEWLINE); |
| 901 | return CMD_WARNING; |
| 902 | } |
| 903 | |
| 904 | ifp->bandwidth = bandwidth; |
| 905 | |
| 906 | /* force protocols to recalculate routes due to cost change */ |
paul | 2e3b2e4 | 2002-12-13 21:03:13 +0000 | [diff] [blame] | 907 | if (if_is_operative (ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 908 | zebra_interface_up_update (ifp); |
| 909 | |
| 910 | return CMD_SUCCESS; |
| 911 | } |
| 912 | |
| 913 | DEFUN (no_bandwidth_if, |
| 914 | no_bandwidth_if_cmd, |
| 915 | "no bandwidth", |
| 916 | NO_STR |
| 917 | "Set bandwidth informational parameter\n") |
| 918 | { |
| 919 | struct interface *ifp; |
| 920 | |
| 921 | ifp = (struct interface *) vty->index; |
| 922 | |
| 923 | ifp->bandwidth = 0; |
| 924 | |
| 925 | /* force protocols to recalculate routes due to cost change */ |
paul | 2e3b2e4 | 2002-12-13 21:03:13 +0000 | [diff] [blame] | 926 | if (if_is_operative (ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 927 | zebra_interface_up_update (ifp); |
| 928 | |
| 929 | return CMD_SUCCESS; |
| 930 | } |
| 931 | |
| 932 | ALIAS (no_bandwidth_if, |
| 933 | no_bandwidth_if_val_cmd, |
| 934 | "no bandwidth <1-10000000>", |
| 935 | NO_STR |
| 936 | "Set bandwidth informational parameter\n" |
| 937 | "Bandwidth in kilobits\n") |
| 938 | |
| 939 | int |
| 940 | ip_address_install (struct vty *vty, struct interface *ifp, char *addr_str, |
| 941 | char *peer_str, char *label, int secondary) |
| 942 | { |
| 943 | struct prefix_ipv4 cp; |
| 944 | struct connected *ifc; |
| 945 | struct prefix_ipv4 *p; |
| 946 | struct in_addr mask; |
| 947 | int ret; |
| 948 | |
| 949 | ret = str2prefix_ipv4 (addr_str, &cp); |
| 950 | if (ret <= 0) |
| 951 | { |
| 952 | vty_out (vty, "%% Malformed address %s", VTY_NEWLINE); |
| 953 | return CMD_WARNING; |
| 954 | } |
| 955 | |
| 956 | ifc = connected_check_ipv4 (ifp, (struct prefix *) &cp); |
| 957 | if (! ifc) |
| 958 | { |
| 959 | ifc = connected_new (); |
| 960 | ifc->ifp = ifp; |
| 961 | |
| 962 | /* Address. */ |
| 963 | p = prefix_ipv4_new (); |
| 964 | *p = cp; |
| 965 | ifc->address = (struct prefix *) p; |
| 966 | |
| 967 | /* Broadcast. */ |
| 968 | if (p->prefixlen <= 30) |
| 969 | { |
| 970 | p = prefix_ipv4_new (); |
| 971 | *p = cp; |
| 972 | masklen2ip (p->prefixlen, &mask); |
| 973 | p->prefix.s_addr |= ~mask.s_addr; |
| 974 | ifc->destination = (struct prefix *) p; |
| 975 | } |
| 976 | |
| 977 | /* Secondary. */ |
| 978 | if (secondary) |
| 979 | SET_FLAG (ifc->flags, ZEBRA_IFA_SECONDARY); |
| 980 | |
| 981 | /* Label. */ |
| 982 | if (label) |
| 983 | ifc->label = strdup (label); |
| 984 | |
| 985 | /* Add to linked list. */ |
| 986 | listnode_add (ifp->connected, ifc); |
| 987 | } |
| 988 | |
| 989 | /* This address is configured from zebra. */ |
| 990 | if (! CHECK_FLAG (ifc->conf, ZEBRA_IFC_CONFIGURED)) |
| 991 | SET_FLAG (ifc->conf, ZEBRA_IFC_CONFIGURED); |
| 992 | |
| 993 | /* In case of this route need to install kernel. */ |
| 994 | if (! CHECK_FLAG (ifc->conf, ZEBRA_IFC_REAL) |
| 995 | && CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE)) |
| 996 | { |
| 997 | /* Some system need to up the interface to set IP address. */ |
| 998 | if (! if_is_up (ifp)) |
| 999 | { |
| 1000 | if_set_flags (ifp, IFF_UP | IFF_RUNNING); |
| 1001 | if_refresh (ifp); |
| 1002 | } |
| 1003 | |
| 1004 | ret = if_set_prefix (ifp, ifc); |
| 1005 | if (ret < 0) |
| 1006 | { |
| 1007 | vty_out (vty, "%% Can't set interface IP address: %s.%s", |
| 1008 | strerror(errno), VTY_NEWLINE); |
| 1009 | return CMD_WARNING; |
| 1010 | } |
| 1011 | |
| 1012 | /* IP address propery set. */ |
| 1013 | SET_FLAG (ifc->conf, ZEBRA_IFC_REAL); |
| 1014 | |
| 1015 | /* Update interface address information to protocol daemon. */ |
| 1016 | zebra_interface_address_add_update (ifp, ifc); |
| 1017 | |
| 1018 | /* If interface is up register connected route. */ |
paul | 2e3b2e4 | 2002-12-13 21:03:13 +0000 | [diff] [blame] | 1019 | if (if_is_operative(ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1020 | connected_up_ipv4 (ifp, ifc); |
| 1021 | } |
| 1022 | |
| 1023 | return CMD_SUCCESS; |
| 1024 | } |
| 1025 | |
| 1026 | int |
| 1027 | ip_address_uninstall (struct vty *vty, struct interface *ifp, char *addr_str, |
| 1028 | char *peer_str, char *label, int secondry) |
| 1029 | { |
| 1030 | struct prefix_ipv4 cp; |
| 1031 | struct connected *ifc; |
| 1032 | int ret; |
| 1033 | |
| 1034 | /* Convert to prefix structure. */ |
| 1035 | ret = str2prefix_ipv4 (addr_str, &cp); |
| 1036 | if (ret <= 0) |
| 1037 | { |
| 1038 | vty_out (vty, "%% Malformed address %s", VTY_NEWLINE); |
| 1039 | return CMD_WARNING; |
| 1040 | } |
| 1041 | |
| 1042 | /* Check current interface address. */ |
| 1043 | ifc = connected_check_ipv4 (ifp, (struct prefix *) &cp); |
| 1044 | if (! ifc) |
| 1045 | { |
| 1046 | vty_out (vty, "%% Can't find address%s", VTY_NEWLINE); |
| 1047 | return CMD_WARNING; |
| 1048 | } |
| 1049 | |
| 1050 | /* This is not configured address. */ |
| 1051 | if (! CHECK_FLAG (ifc->conf, ZEBRA_IFC_CONFIGURED)) |
| 1052 | return CMD_WARNING; |
| 1053 | |
| 1054 | /* This is not real address or interface is not active. */ |
| 1055 | if (! CHECK_FLAG (ifc->conf, ZEBRA_IFC_REAL) |
| 1056 | || ! CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE)) |
| 1057 | { |
| 1058 | listnode_delete (ifp->connected, ifc); |
| 1059 | connected_free (ifc); |
| 1060 | return CMD_WARNING; |
| 1061 | } |
| 1062 | |
| 1063 | /* This is real route. */ |
| 1064 | ret = if_unset_prefix (ifp, ifc); |
| 1065 | if (ret < 0) |
| 1066 | { |
| 1067 | vty_out (vty, "%% Can't unset interface IP address: %s.%s", |
| 1068 | strerror(errno), VTY_NEWLINE); |
| 1069 | return CMD_WARNING; |
| 1070 | } |
| 1071 | |
| 1072 | /* Redistribute this information. */ |
| 1073 | zebra_interface_address_delete_update (ifp, ifc); |
| 1074 | |
| 1075 | /* Remove connected route. */ |
| 1076 | connected_down_ipv4 (ifp, ifc); |
| 1077 | |
| 1078 | /* Free address information. */ |
| 1079 | listnode_delete (ifp->connected, ifc); |
| 1080 | connected_free (ifc); |
| 1081 | |
| 1082 | return CMD_SUCCESS; |
| 1083 | } |
| 1084 | |
| 1085 | DEFUN (ip_address, |
| 1086 | ip_address_cmd, |
| 1087 | "ip address A.B.C.D/M", |
| 1088 | "Interface Internet Protocol config commands\n" |
| 1089 | "Set the IP address of an interface\n" |
| 1090 | "IP address (e.g. 10.0.0.1/8)\n") |
| 1091 | { |
| 1092 | return ip_address_install (vty, vty->index, argv[0], NULL, NULL, 0); |
| 1093 | } |
| 1094 | |
| 1095 | DEFUN (no_ip_address, |
| 1096 | no_ip_address_cmd, |
| 1097 | "no ip address A.B.C.D/M", |
| 1098 | NO_STR |
| 1099 | "Interface Internet Protocol config commands\n" |
| 1100 | "Set the IP address of an interface\n" |
| 1101 | "IP Address (e.g. 10.0.0.1/8)") |
| 1102 | { |
| 1103 | return ip_address_uninstall (vty, vty->index, argv[0], NULL, NULL, 0); |
| 1104 | } |
| 1105 | |
| 1106 | #ifdef HAVE_NETLINK |
| 1107 | DEFUN (ip_address_secondary, |
| 1108 | ip_address_secondary_cmd, |
| 1109 | "ip address A.B.C.D/M secondary", |
| 1110 | "Interface Internet Protocol config commands\n" |
| 1111 | "Set the IP address of an interface\n" |
| 1112 | "IP address (e.g. 10.0.0.1/8)\n" |
| 1113 | "Secondary IP address\n") |
| 1114 | { |
| 1115 | return ip_address_install (vty, vty->index, argv[0], NULL, NULL, 1); |
| 1116 | } |
| 1117 | |
| 1118 | DEFUN (ip_address_label, |
| 1119 | ip_address_label_cmd, |
| 1120 | "ip address A.B.C.D/M label LINE", |
| 1121 | "Interface Internet Protocol config commands\n" |
| 1122 | "Set the IP address of an interface\n" |
| 1123 | "IP address (e.g. 10.0.0.1/8)\n" |
| 1124 | "Label of this address\n" |
| 1125 | "Label\n") |
| 1126 | { |
| 1127 | return ip_address_install (vty, vty->index, argv[0], NULL, argv[1], 1); |
| 1128 | } |
| 1129 | |
hasso | f1d92e1 | 2004-03-18 15:40:33 +0000 | [diff] [blame] | 1130 | ALIAS (ip_address_label, |
| 1131 | ip_address_secondary_label_cmd, |
| 1132 | "ip address A.B.C.D/M secondary label LINE", |
| 1133 | "Interface Internet Protocol config commands\n" |
| 1134 | "Set the IP address of an interface\n" |
| 1135 | "IP address (e.g. 10.0.0.1/8)\n" |
| 1136 | "Secondary IP address\n" |
| 1137 | "Label of this address\n" |
| 1138 | "Label\n") |
| 1139 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1140 | DEFUN (no_ip_address_secondary, |
| 1141 | no_ip_address_secondary_cmd, |
| 1142 | "no ip address A.B.C.D/M secondary", |
| 1143 | NO_STR |
| 1144 | "Interface Internet Protocol config commands\n" |
| 1145 | "Set the IP address of an interface\n" |
| 1146 | "IP address (e.g. 10.0.0.1/8)\n" |
| 1147 | "Secondary IP address\n") |
| 1148 | { |
| 1149 | return ip_address_uninstall (vty, vty->index, argv[0], NULL, NULL, 1); |
| 1150 | } |
| 1151 | |
| 1152 | DEFUN (no_ip_address_label, |
| 1153 | no_ip_address_label_cmd, |
| 1154 | "no ip address A.B.C.D/M label LINE", |
| 1155 | NO_STR |
| 1156 | "Interface Internet Protocol config commands\n" |
| 1157 | "Set the IP address of an interface\n" |
| 1158 | "IP address (e.g. 10.0.0.1/8)\n" |
| 1159 | "Label of this address\n" |
| 1160 | "Label\n") |
| 1161 | { |
| 1162 | return ip_address_uninstall (vty, vty->index, argv[0], NULL, argv[1], 1); |
| 1163 | } |
hasso | f1d92e1 | 2004-03-18 15:40:33 +0000 | [diff] [blame] | 1164 | |
| 1165 | ALIAS (no_ip_address_label, |
| 1166 | no_ip_address_secondary_label_cmd, |
| 1167 | "no ip address A.B.C.D/M secondary label LINE", |
| 1168 | NO_STR |
| 1169 | "Interface Internet Protocol config commands\n" |
| 1170 | "Set the IP address of an interface\n" |
| 1171 | "IP address (e.g. 10.0.0.1/8)\n" |
| 1172 | "Secondary IP address\n" |
| 1173 | "Label of this address\n" |
| 1174 | "Label\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1175 | #endif /* HAVE_NETLINK */ |
| 1176 | |
| 1177 | #ifdef HAVE_IPV6 |
| 1178 | int |
| 1179 | ipv6_address_install (struct vty *vty, struct interface *ifp, char *addr_str, |
| 1180 | char *peer_str, char *label, int secondary) |
| 1181 | { |
| 1182 | struct prefix_ipv6 cp; |
| 1183 | struct connected *ifc; |
| 1184 | struct prefix_ipv6 *p; |
| 1185 | int ret; |
| 1186 | |
| 1187 | ret = str2prefix_ipv6 (addr_str, &cp); |
| 1188 | if (ret <= 0) |
| 1189 | { |
| 1190 | vty_out (vty, "%% Malformed address %s", VTY_NEWLINE); |
| 1191 | return CMD_WARNING; |
| 1192 | } |
| 1193 | |
| 1194 | ifc = connected_check_ipv6 (ifp, (struct prefix *) &cp); |
| 1195 | if (! ifc) |
| 1196 | { |
| 1197 | ifc = connected_new (); |
| 1198 | ifc->ifp = ifp; |
| 1199 | |
| 1200 | /* Address. */ |
| 1201 | p = prefix_ipv6_new (); |
| 1202 | *p = cp; |
| 1203 | ifc->address = (struct prefix *) p; |
| 1204 | |
| 1205 | /* Secondary. */ |
| 1206 | if (secondary) |
| 1207 | SET_FLAG (ifc->flags, ZEBRA_IFA_SECONDARY); |
| 1208 | |
| 1209 | /* Label. */ |
| 1210 | if (label) |
| 1211 | ifc->label = strdup (label); |
| 1212 | |
| 1213 | /* Add to linked list. */ |
| 1214 | listnode_add (ifp->connected, ifc); |
| 1215 | } |
| 1216 | |
| 1217 | /* This address is configured from zebra. */ |
| 1218 | if (! CHECK_FLAG (ifc->conf, ZEBRA_IFC_CONFIGURED)) |
| 1219 | SET_FLAG (ifc->conf, ZEBRA_IFC_CONFIGURED); |
| 1220 | |
| 1221 | /* In case of this route need to install kernel. */ |
| 1222 | if (! CHECK_FLAG (ifc->conf, ZEBRA_IFC_REAL) |
| 1223 | && CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE)) |
| 1224 | { |
| 1225 | /* Some system need to up the interface to set IP address. */ |
| 1226 | if (! if_is_up (ifp)) |
| 1227 | { |
| 1228 | if_set_flags (ifp, IFF_UP | IFF_RUNNING); |
| 1229 | if_refresh (ifp); |
| 1230 | } |
| 1231 | |
| 1232 | ret = if_prefix_add_ipv6 (ifp, ifc); |
| 1233 | |
| 1234 | if (ret < 0) |
| 1235 | { |
| 1236 | vty_out (vty, "%% Can't set interface IP address: %s.%s", |
| 1237 | strerror(errno), VTY_NEWLINE); |
| 1238 | return CMD_WARNING; |
| 1239 | } |
| 1240 | |
| 1241 | /* IP address propery set. */ |
| 1242 | SET_FLAG (ifc->conf, ZEBRA_IFC_REAL); |
| 1243 | |
| 1244 | /* Update interface address information to protocol daemon. */ |
| 1245 | zebra_interface_address_add_update (ifp, ifc); |
| 1246 | |
| 1247 | /* If interface is up register connected route. */ |
paul | 2e3b2e4 | 2002-12-13 21:03:13 +0000 | [diff] [blame] | 1248 | if (if_is_operative(ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1249 | connected_up_ipv6 (ifp, ifc); |
| 1250 | } |
| 1251 | |
| 1252 | return CMD_SUCCESS; |
| 1253 | } |
| 1254 | |
| 1255 | int |
| 1256 | ipv6_address_uninstall (struct vty *vty, struct interface *ifp, char *addr_str, |
| 1257 | char *peer_str, char *label, int secondry) |
| 1258 | { |
| 1259 | struct prefix_ipv6 cp; |
| 1260 | struct connected *ifc; |
| 1261 | int ret; |
| 1262 | |
| 1263 | /* Convert to prefix structure. */ |
| 1264 | ret = str2prefix_ipv6 (addr_str, &cp); |
| 1265 | if (ret <= 0) |
| 1266 | { |
| 1267 | vty_out (vty, "%% Malformed address %s", VTY_NEWLINE); |
| 1268 | return CMD_WARNING; |
| 1269 | } |
| 1270 | |
| 1271 | /* Check current interface address. */ |
| 1272 | ifc = connected_check_ipv6 (ifp, (struct prefix *) &cp); |
| 1273 | if (! ifc) |
| 1274 | { |
| 1275 | vty_out (vty, "%% Can't find address%s", VTY_NEWLINE); |
| 1276 | return CMD_WARNING; |
| 1277 | } |
| 1278 | |
| 1279 | /* This is not configured address. */ |
| 1280 | if (! CHECK_FLAG (ifc->conf, ZEBRA_IFC_CONFIGURED)) |
| 1281 | return CMD_WARNING; |
| 1282 | |
| 1283 | /* This is not real address or interface is not active. */ |
| 1284 | if (! CHECK_FLAG (ifc->conf, ZEBRA_IFC_REAL) |
| 1285 | || ! CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE)) |
| 1286 | { |
| 1287 | listnode_delete (ifp->connected, ifc); |
| 1288 | connected_free (ifc); |
| 1289 | return CMD_WARNING; |
| 1290 | } |
| 1291 | |
| 1292 | /* This is real route. */ |
| 1293 | ret = if_prefix_delete_ipv6 (ifp, ifc); |
| 1294 | if (ret < 0) |
| 1295 | { |
| 1296 | vty_out (vty, "%% Can't unset interface IP address: %s.%s", |
| 1297 | strerror(errno), VTY_NEWLINE); |
| 1298 | return CMD_WARNING; |
| 1299 | } |
| 1300 | |
| 1301 | /* Redistribute this information. */ |
| 1302 | zebra_interface_address_delete_update (ifp, ifc); |
| 1303 | |
| 1304 | /* Remove connected route. */ |
| 1305 | connected_down_ipv6 (ifp, ifc); |
| 1306 | |
| 1307 | /* Free address information. */ |
| 1308 | listnode_delete (ifp->connected, ifc); |
| 1309 | connected_free (ifc); |
| 1310 | |
| 1311 | return CMD_SUCCESS; |
| 1312 | } |
| 1313 | |
| 1314 | DEFUN (ipv6_address, |
| 1315 | ipv6_address_cmd, |
| 1316 | "ipv6 address X:X::X:X/M", |
hasso | e23949c | 2004-03-11 15:54:02 +0000 | [diff] [blame] | 1317 | "Interface IPv6 config commands\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1318 | "Set the IP address of an interface\n" |
| 1319 | "IPv6 address (e.g. 3ffe:506::1/48)\n") |
| 1320 | { |
| 1321 | return ipv6_address_install (vty, vty->index, argv[0], NULL, NULL, 0); |
| 1322 | } |
| 1323 | |
| 1324 | DEFUN (no_ipv6_address, |
| 1325 | no_ipv6_address_cmd, |
| 1326 | "no ipv6 address X:X::X:X/M", |
| 1327 | NO_STR |
hasso | e23949c | 2004-03-11 15:54:02 +0000 | [diff] [blame] | 1328 | "Interface IPv6 config commands\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1329 | "Set the IP address of an interface\n" |
| 1330 | "IPv6 address (e.g. 3ffe:506::1/48)\n") |
| 1331 | { |
| 1332 | return ipv6_address_uninstall (vty, vty->index, argv[0], NULL, NULL, 0); |
| 1333 | } |
| 1334 | #endif /* HAVE_IPV6 */ |
| 1335 | |
| 1336 | #ifdef KAME |
| 1337 | DEFUN (ip_tunnel, |
| 1338 | ip_tunnel_cmd, |
| 1339 | "ip tunnel IP_address IP_address", |
| 1340 | "KAME ip tunneling configuration commands\n" |
| 1341 | "Set FROM IP address and TO IP address\n") |
| 1342 | { |
| 1343 | return CMD_SUCCESS; |
| 1344 | } |
| 1345 | |
| 1346 | DEFUN (no_ip_tunnel, no_ip_tunnel_cmd, |
| 1347 | "no ip tunnel", |
| 1348 | NO_STR |
| 1349 | "Set FROM IP address and TO IP address\n") |
| 1350 | { |
| 1351 | return CMD_SUCCESS; |
| 1352 | } |
| 1353 | #endif /* KAME */ |
| 1354 | |
| 1355 | int |
| 1356 | if_config_write (struct vty *vty) |
| 1357 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 1358 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1359 | struct interface *ifp; |
| 1360 | char buf[BUFSIZ]; |
| 1361 | |
| 1362 | for (node = listhead (iflist); node; nextnode (node)) |
| 1363 | { |
| 1364 | struct zebra_if *if_data; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 1365 | struct listnode *addrnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1366 | struct connected *ifc; |
| 1367 | struct prefix *p; |
| 1368 | |
| 1369 | ifp = getdata (node); |
| 1370 | if_data = ifp->info; |
| 1371 | |
| 1372 | vty_out (vty, "interface %s%s", ifp->name, |
| 1373 | VTY_NEWLINE); |
| 1374 | |
| 1375 | if (ifp->desc) |
| 1376 | vty_out (vty, " description %s%s", ifp->desc, |
| 1377 | VTY_NEWLINE); |
| 1378 | |
| 1379 | /* Assign bandwidth here to avoid unnecessary interface flap |
| 1380 | while processing config script */ |
| 1381 | if (ifp->bandwidth != 0) |
| 1382 | vty_out(vty, " bandwidth %u%s", ifp->bandwidth, VTY_NEWLINE); |
| 1383 | |
paul | 2e3b2e4 | 2002-12-13 21:03:13 +0000 | [diff] [blame] | 1384 | if (CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_LINKDETECTION)) |
| 1385 | vty_out(vty, " link-detect%s", VTY_NEWLINE); |
| 1386 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1387 | for (addrnode = listhead (ifp->connected); addrnode; nextnode (addrnode)) |
| 1388 | { |
| 1389 | ifc = getdata (addrnode); |
| 1390 | if (CHECK_FLAG (ifc->conf, ZEBRA_IFC_CONFIGURED)) |
| 1391 | { |
| 1392 | p = ifc->address; |
| 1393 | vty_out (vty, " ip%s address %s/%d", |
| 1394 | p->family == AF_INET ? "" : "v6", |
| 1395 | inet_ntop (p->family, &p->u.prefix, buf, BUFSIZ), |
| 1396 | p->prefixlen); |
| 1397 | |
| 1398 | if (CHECK_FLAG (ifc->flags, ZEBRA_IFA_SECONDARY)) |
| 1399 | vty_out (vty, " secondary"); |
| 1400 | |
| 1401 | if (ifc->label) |
| 1402 | vty_out (vty, " label %s", ifc->label); |
| 1403 | |
| 1404 | vty_out (vty, "%s", VTY_NEWLINE); |
| 1405 | } |
| 1406 | } |
| 1407 | |
| 1408 | if (if_data) |
| 1409 | { |
| 1410 | if (if_data->shutdown == IF_ZEBRA_SHUTDOWN_ON) |
| 1411 | vty_out (vty, " shutdown%s", VTY_NEWLINE); |
| 1412 | |
| 1413 | if (if_data->multicast != IF_ZEBRA_MULTICAST_UNSPEC) |
| 1414 | vty_out (vty, " %smulticast%s", |
| 1415 | if_data->multicast == IF_ZEBRA_MULTICAST_ON ? "" : "no ", |
| 1416 | VTY_NEWLINE); |
| 1417 | } |
| 1418 | |
| 1419 | #ifdef RTADV |
| 1420 | rtadv_config_write (vty, ifp); |
| 1421 | #endif /* RTADV */ |
| 1422 | |
hasso | ca77698 | 2004-06-12 14:33:05 +0000 | [diff] [blame] | 1423 | #ifdef HAVE_IRDP |
| 1424 | irdp_config_write (vty, ifp); |
| 1425 | #endif /* IRDP */ |
| 1426 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1427 | vty_out (vty, "!%s", VTY_NEWLINE); |
| 1428 | } |
| 1429 | return 0; |
| 1430 | } |
| 1431 | |
| 1432 | /* Allocate and initialize interface vector. */ |
| 1433 | void |
| 1434 | zebra_if_init () |
| 1435 | { |
| 1436 | /* Initialize interface and new hook. */ |
| 1437 | if_init (); |
| 1438 | if_add_hook (IF_NEW_HOOK, if_zebra_new_hook); |
| 1439 | if_add_hook (IF_DELETE_HOOK, if_zebra_delete_hook); |
| 1440 | |
| 1441 | /* Install configuration write function. */ |
| 1442 | install_node (&interface_node, if_config_write); |
| 1443 | |
| 1444 | install_element (VIEW_NODE, &show_interface_cmd); |
| 1445 | install_element (ENABLE_NODE, &show_interface_cmd); |
| 1446 | install_element (CONFIG_NODE, &zebra_interface_cmd); |
paul | bfc1353 | 2003-05-24 06:40:04 +0000 | [diff] [blame] | 1447 | install_element (CONFIG_NODE, &no_interface_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1448 | install_default (INTERFACE_NODE); |
| 1449 | install_element (INTERFACE_NODE, &interface_desc_cmd); |
| 1450 | install_element (INTERFACE_NODE, &no_interface_desc_cmd); |
| 1451 | install_element (INTERFACE_NODE, &multicast_cmd); |
| 1452 | install_element (INTERFACE_NODE, &no_multicast_cmd); |
paul | 2e3b2e4 | 2002-12-13 21:03:13 +0000 | [diff] [blame] | 1453 | install_element (INTERFACE_NODE, &linkdetect_cmd); |
| 1454 | install_element (INTERFACE_NODE, &no_linkdetect_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1455 | install_element (INTERFACE_NODE, &shutdown_if_cmd); |
| 1456 | install_element (INTERFACE_NODE, &no_shutdown_if_cmd); |
| 1457 | install_element (INTERFACE_NODE, &bandwidth_if_cmd); |
| 1458 | install_element (INTERFACE_NODE, &no_bandwidth_if_cmd); |
| 1459 | install_element (INTERFACE_NODE, &no_bandwidth_if_val_cmd); |
| 1460 | install_element (INTERFACE_NODE, &ip_address_cmd); |
| 1461 | install_element (INTERFACE_NODE, &no_ip_address_cmd); |
| 1462 | #ifdef HAVE_IPV6 |
| 1463 | install_element (INTERFACE_NODE, &ipv6_address_cmd); |
| 1464 | install_element (INTERFACE_NODE, &no_ipv6_address_cmd); |
| 1465 | #endif /* HAVE_IPV6 */ |
| 1466 | #ifdef KAME |
| 1467 | install_element (INTERFACE_NODE, &ip_tunnel_cmd); |
| 1468 | install_element (INTERFACE_NODE, &no_ip_tunnel_cmd); |
| 1469 | #endif /* KAME */ |
| 1470 | #ifdef HAVE_NETLINK |
| 1471 | install_element (INTERFACE_NODE, &ip_address_secondary_cmd); |
| 1472 | install_element (INTERFACE_NODE, &ip_address_label_cmd); |
hasso | f1d92e1 | 2004-03-18 15:40:33 +0000 | [diff] [blame] | 1473 | install_element (INTERFACE_NODE, &ip_address_secondary_label_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1474 | install_element (INTERFACE_NODE, &no_ip_address_secondary_cmd); |
| 1475 | install_element (INTERFACE_NODE, &no_ip_address_label_cmd); |
hasso | f1d92e1 | 2004-03-18 15:40:33 +0000 | [diff] [blame] | 1476 | install_element (INTERFACE_NODE, &no_ip_address_secondary_label_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1477 | #endif /* HAVE_NETLINK */ |
| 1478 | } |