interface.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /* Interface function header.
  2. * Copyright (C) 1999 Kunihiro Ishiguro
  3. *
  4. * This file is part of GNU Zebra.
  5. *
  6. * GNU Zebra is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation; either version 2, or (at your option) any
  9. * later version.
  10. *
  11. * GNU Zebra is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with GNU Zebra; see the file COPYING. If not, write to the Free
  18. * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  19. * 02111-1307, USA.
  20. */
  21. #ifndef _ZEBRA_INTERFACE_H
  22. #define _ZEBRA_INTERFACE_H
  23. #include "redistribute.h"
  24. #ifdef HAVE_IRDP
  25. #include "zebra/irdp.h"
  26. #endif
  27. /* For interface multicast configuration. */
  28. #define IF_ZEBRA_MULTICAST_UNSPEC 0
  29. #define IF_ZEBRA_MULTICAST_ON 1
  30. #define IF_ZEBRA_MULTICAST_OFF 2
  31. /* For interface shutdown configuration. */
  32. #define IF_ZEBRA_SHUTDOWN_UNSPEC 0
  33. #define IF_ZEBRA_SHUTDOWN_ON 1
  34. #define IF_ZEBRA_SHUTDOWN_OFF 2
  35. /* Router advertisement feature. */
  36. #if (defined(LINUX_IPV6) && (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1)) || defined(KAME)
  37. #ifdef HAVE_RTADV
  38. #define RTADV
  39. #endif
  40. #endif
  41. #ifdef RTADV
  42. /* Router advertisement parameter. From RFC2461. */
  43. struct rtadvconf
  44. {
  45. /* A flag indicating whether or not the router sends periodic Router
  46. Advertisements and responds to Router Solicitations.
  47. Default: FALSE */
  48. int AdvSendAdvertisements;
  49. /* The maximum time allowed between sending unsolicited multicast
  50. Router Advertisements from the interface, in seconds. MUST be no
  51. less than 4 seconds and no greater than 1800 seconds.
  52. Default: 600 seconds */
  53. int MaxRtrAdvInterval;
  54. #define RTADV_MAX_RTR_ADV_INTERVAL 600
  55. /* The minimum time allowed between sending unsolicited multicast
  56. Router Advertisements from the interface, in seconds. MUST be no
  57. less than 3 seconds and no greater than .75 * MaxRtrAdvInterval.
  58. Default: 0.33 * MaxRtrAdvInterval */
  59. int MinRtrAdvInterval;
  60. #define RTADV_MIN_RTR_ADV_INTERVAL (0.33 * RTADV_MAX_RTR_ADV_INTERVAL)
  61. /* Unsolicited Router Advertisements' interval timer. */
  62. int AdvIntervalTimer;
  63. /* The TRUE/FALSE value to be placed in the "Managed address
  64. configuration" flag field in the Router Advertisement. See
  65. [ADDRCONF].
  66. Default: FALSE */
  67. int AdvManagedFlag;
  68. /* The TRUE/FALSE value to be placed in the "Other stateful
  69. configuration" flag field in the Router Advertisement. See
  70. [ADDRCONF].
  71. Default: FALSE */
  72. int AdvOtherConfigFlag;
  73. /* The value to be placed in MTU options sent by the router. A
  74. value of zero indicates that no MTU options are sent.
  75. Default: 0 */
  76. int AdvLinkMTU;
  77. /* The value to be placed in the Reachable Time field in the Router
  78. Advertisement messages sent by the router. The value zero means
  79. unspecified (by this router). MUST be no greater than 3,600,000
  80. milliseconds (1 hour).
  81. Default: 0 */
  82. u_int32_t AdvReachableTime;
  83. #define RTADV_MAX_REACHABLE_TIME 3600000
  84. /* The value to be placed in the Retrans Timer field in the Router
  85. Advertisement messages sent by the router. The value zero means
  86. unspecified (by this router).
  87. Default: 0 */
  88. int AdvRetransTimer;
  89. /* The default value to be placed in the Cur Hop Limit field in the
  90. Router Advertisement messages sent by the router. The value
  91. should be set to that current diameter of the Internet. The
  92. value zero means unspecified (by this router).
  93. Default: The value specified in the "Assigned Numbers" RFC
  94. [ASSIGNED] that was in effect at the time of implementation. */
  95. int AdvCurHopLimit;
  96. /* The value to be placed in the Router Lifetime field of Router
  97. Advertisements sent from the interface, in seconds. MUST be
  98. either zero or between MaxRtrAdvInterval and 9000 seconds. A
  99. value of zero indicates that the router is not to be used as a
  100. default router.
  101. Default: 3 * MaxRtrAdvInterval */
  102. int AdvDefaultLifetime;
  103. #define RTADV_ADV_DEFAULT_LIFETIME (3 * RTADV_MAX_RTR_ADV_INTERVAL)
  104. /* A list of prefixes to be placed in Prefix Information options in
  105. Router Advertisement messages sent from the interface.
  106. Default: all prefixes that the router advertises via routing
  107. protocols as being on-link for the interface from which the
  108. advertisement is sent. The link-local prefix SHOULD NOT be
  109. included in the list of advertised prefixes. */
  110. list AdvPrefixList;
  111. };
  112. #endif /* RTADV */
  113. /* `zebra' daemon local interface structure. */
  114. struct zebra_if
  115. {
  116. /* Shutdown configuration. */
  117. u_char shutdown;
  118. /* Multicast configuration. */
  119. u_char multicast;
  120. /* Router advertise configuration. */
  121. u_char rtadv_enable;
  122. /* Interface's address. */
  123. list address;
  124. #ifdef RTADV
  125. struct rtadvconf rtadv;
  126. #endif /* RTADV */
  127. #ifdef HAVE_IRDP
  128. struct irdp_interface irdp;
  129. #endif
  130. };
  131. void if_delete_update (struct interface *ifp);
  132. void if_add_update (struct interface *ifp);
  133. void if_up (struct interface *);
  134. void if_down (struct interface *);
  135. void if_refresh (struct interface *);
  136. #ifdef HAVE_PROC_NET_DEV
  137. int ifstat_update_proc ();
  138. #endif /* HAVE_PROC_NET_DEV */
  139. #ifdef HAVE_NET_RT_IFLIST
  140. void ifstat_update_sysctl ();
  141. #endif /* HAVE_NET_RT_IFLIST */
  142. #ifdef HAVE_PROC_NET_DEV
  143. int interface_list_proc ();
  144. #endif /* HAVE_PROC_NET_DEV */
  145. #ifdef HAVE_PROC_NET_IF_INET6
  146. int ifaddr_proc_ipv6 ();
  147. #endif /* HAVE_PROC_NET_IF_INET6 */
  148. #ifdef BSDI
  149. int if_kvm_get_mtu (struct interface *);
  150. #endif /* BSDI */
  151. #endif /* _ZEBRA_INTERFACE_H */