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