paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 5b73a67 | 2004-07-23 15:26:14 +0000 | [diff] [blame] | 22 | #ifndef _ZEBRA_INTERFACE_H |
| 23 | #define _ZEBRA_INTERFACE_H |
| 24 | |
| 25 | #include "redistribute.h" |
| 26 | |
hasso | ca77698 | 2004-06-12 14:33:05 +0000 | [diff] [blame] | 27 | #ifdef HAVE_IRDP |
| 28 | #include "zebra/irdp.h" |
| 29 | #endif |
| 30 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 31 | /* For interface multicast configuration. */ |
| 32 | #define IF_ZEBRA_MULTICAST_UNSPEC 0 |
| 33 | #define IF_ZEBRA_MULTICAST_ON 1 |
| 34 | #define IF_ZEBRA_MULTICAST_OFF 2 |
| 35 | |
| 36 | /* For interface shutdown configuration. */ |
| 37 | #define IF_ZEBRA_SHUTDOWN_UNSPEC 0 |
| 38 | #define IF_ZEBRA_SHUTDOWN_ON 1 |
| 39 | #define IF_ZEBRA_SHUTDOWN_OFF 2 |
| 40 | |
| 41 | /* Router advertisement feature. */ |
| 42 | #if (defined(LINUX_IPV6) && (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1)) || defined(KAME) |
hasso | 726f9b2 | 2003-05-25 21:04:54 +0000 | [diff] [blame] | 43 | #ifdef HAVE_RTADV |
| 44 | #define RTADV |
| 45 | #endif |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 46 | #endif |
| 47 | |
| 48 | #ifdef RTADV |
vincent | 7cee1bb | 2005-03-25 13:08:53 +0000 | [diff] [blame] | 49 | /* Router advertisement parameter. From RFC2461 and RFC3775. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 50 | struct rtadvconf |
| 51 | { |
| 52 | /* A flag indicating whether or not the router sends periodic Router |
| 53 | Advertisements and responds to Router Solicitations. |
| 54 | Default: FALSE */ |
| 55 | int AdvSendAdvertisements; |
| 56 | |
| 57 | /* The maximum time allowed between sending unsolicited multicast |
vincent | 7cee1bb | 2005-03-25 13:08:53 +0000 | [diff] [blame] | 58 | Router Advertisements from the interface, in milliseconds. |
| 59 | MUST be no less than 70 ms (RFC3775, section 7.4) and no greater |
| 60 | than 1800000 ms (See RFC2461). |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 61 | |
vincent | 7cee1bb | 2005-03-25 13:08:53 +0000 | [diff] [blame] | 62 | Default: 600000 milliseconds */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 63 | int MaxRtrAdvInterval; |
vincent | 7cee1bb | 2005-03-25 13:08:53 +0000 | [diff] [blame] | 64 | #define RTADV_MAX_RTR_ADV_INTERVAL 600000 |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 65 | |
| 66 | /* The minimum time allowed between sending unsolicited multicast |
vincent | 7cee1bb | 2005-03-25 13:08:53 +0000 | [diff] [blame] | 67 | Router Advertisements from the interface, in milliseconds. |
| 68 | MUST be no less than 30 ms (See RFC3775, section 7.4). |
| 69 | MUST be no greater than .75 * MaxRtrAdvInterval. |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 70 | |
| 71 | Default: 0.33 * MaxRtrAdvInterval */ |
| 72 | int MinRtrAdvInterval; |
| 73 | #define RTADV_MIN_RTR_ADV_INTERVAL (0.33 * RTADV_MAX_RTR_ADV_INTERVAL) |
| 74 | |
| 75 | /* Unsolicited Router Advertisements' interval timer. */ |
| 76 | int AdvIntervalTimer; |
| 77 | |
| 78 | /* The TRUE/FALSE value to be placed in the "Managed address |
| 79 | configuration" flag field in the Router Advertisement. See |
| 80 | [ADDRCONF]. |
| 81 | |
| 82 | Default: FALSE */ |
| 83 | int AdvManagedFlag; |
| 84 | |
| 85 | |
| 86 | /* The TRUE/FALSE value to be placed in the "Other stateful |
| 87 | configuration" flag field in the Router Advertisement. See |
| 88 | [ADDRCONF]. |
| 89 | |
| 90 | Default: FALSE */ |
| 91 | int AdvOtherConfigFlag; |
| 92 | |
| 93 | /* The value to be placed in MTU options sent by the router. A |
| 94 | value of zero indicates that no MTU options are sent. |
| 95 | |
| 96 | Default: 0 */ |
| 97 | int AdvLinkMTU; |
| 98 | |
| 99 | |
| 100 | /* The value to be placed in the Reachable Time field in the Router |
| 101 | Advertisement messages sent by the router. The value zero means |
| 102 | unspecified (by this router). MUST be no greater than 3,600,000 |
| 103 | milliseconds (1 hour). |
| 104 | |
| 105 | Default: 0 */ |
| 106 | u_int32_t AdvReachableTime; |
| 107 | #define RTADV_MAX_REACHABLE_TIME 3600000 |
| 108 | |
| 109 | |
| 110 | /* The value to be placed in the Retrans Timer field in the Router |
| 111 | Advertisement messages sent by the router. The value zero means |
| 112 | unspecified (by this router). |
| 113 | |
| 114 | Default: 0 */ |
| 115 | int AdvRetransTimer; |
| 116 | |
| 117 | /* The default value to be placed in the Cur Hop Limit field in the |
| 118 | Router Advertisement messages sent by the router. The value |
| 119 | should be set to that current diameter of the Internet. The |
| 120 | value zero means unspecified (by this router). |
| 121 | |
| 122 | Default: The value specified in the "Assigned Numbers" RFC |
| 123 | [ASSIGNED] that was in effect at the time of implementation. */ |
| 124 | int AdvCurHopLimit; |
| 125 | |
| 126 | /* The value to be placed in the Router Lifetime field of Router |
| 127 | Advertisements sent from the interface, in seconds. MUST be |
| 128 | either zero or between MaxRtrAdvInterval and 9000 seconds. A |
| 129 | value of zero indicates that the router is not to be used as a |
| 130 | default router. |
| 131 | |
| 132 | Default: 3 * MaxRtrAdvInterval */ |
| 133 | int AdvDefaultLifetime; |
| 134 | #define RTADV_ADV_DEFAULT_LIFETIME (3 * RTADV_MAX_RTR_ADV_INTERVAL) |
| 135 | |
| 136 | |
| 137 | /* A list of prefixes to be placed in Prefix Information options in |
| 138 | Router Advertisement messages sent from the interface. |
| 139 | |
| 140 | Default: all prefixes that the router advertises via routing |
| 141 | protocols as being on-link for the interface from which the |
| 142 | advertisement is sent. The link-local prefix SHOULD NOT be |
| 143 | included in the list of advertised prefixes. */ |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 144 | struct list *AdvPrefixList; |
vincent | 7cee1bb | 2005-03-25 13:08:53 +0000 | [diff] [blame] | 145 | |
| 146 | /* The TRUE/FALSE value to be placed in the "Home agent" |
| 147 | flag field in the Router Advertisement. See [RFC3775 7.1]. |
| 148 | |
| 149 | Default: FALSE */ |
| 150 | int AdvHomeAgentFlag; |
| 151 | #ifndef ND_RA_FLAG_HOME_AGENT |
| 152 | #define ND_RA_FLAG_HOME_AGENT 0x20 |
| 153 | #endif |
| 154 | |
| 155 | /* The value to be placed in Home Agent Information option if Home |
| 156 | Flag is set. |
| 157 | Default: 0 */ |
| 158 | int HomeAgentPreference; |
| 159 | |
| 160 | /* The value to be placed in Home Agent Information option if Home |
| 161 | Flag is set. Lifetime (seconds) MUST not be greater than 18.2 |
| 162 | hours. |
| 163 | The value 0 has special meaning: use of AdvDefaultLifetime value. |
| 164 | |
| 165 | Default: 0 */ |
| 166 | int HomeAgentLifetime; |
| 167 | #define RTADV_MAX_HALIFETIME 65520 /* 18.2 hours */ |
| 168 | |
| 169 | /* The TRUE/FALSE value to insert or not an Advertisement Interval |
| 170 | option. See [RFC 3775 7.3] |
| 171 | |
| 172 | Default: FALSE */ |
| 173 | int AdvIntervalOption; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 174 | }; |
| 175 | |
| 176 | #endif /* RTADV */ |
| 177 | |
| 178 | /* `zebra' daemon local interface structure. */ |
| 179 | struct zebra_if |
| 180 | { |
| 181 | /* Shutdown configuration. */ |
| 182 | u_char shutdown; |
| 183 | |
| 184 | /* Multicast configuration. */ |
| 185 | u_char multicast; |
| 186 | |
| 187 | /* Router advertise configuration. */ |
| 188 | u_char rtadv_enable; |
| 189 | |
hasso | eef1fe1 | 2004-10-03 18:46:08 +0000 | [diff] [blame] | 190 | /* Installed addresses chains tree. */ |
| 191 | struct route_table *ipv4_subnets; |
| 192 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 193 | #ifdef RTADV |
| 194 | struct rtadvconf rtadv; |
| 195 | #endif /* RTADV */ |
hasso | ca77698 | 2004-06-12 14:33:05 +0000 | [diff] [blame] | 196 | |
| 197 | #ifdef HAVE_IRDP |
| 198 | struct irdp_interface irdp; |
| 199 | #endif |
| 200 | |
paul | 5c78b3d | 2006-01-25 04:31:40 +0000 | [diff] [blame] | 201 | #ifdef SUNOS_5 |
| 202 | /* the real IFF_UP state of the primary interface. |
| 203 | * need this to differentiate between all interfaces being |
| 204 | * down (but primary still plumbed) and primary having gone |
| 205 | * ~IFF_UP, and all addresses gone. |
| 206 | */ |
| 207 | u_char primary_state; |
| 208 | #endif /* SUNOS_5 */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 209 | }; |
| 210 | |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 211 | extern void if_delete_update (struct interface *ifp); |
| 212 | extern void if_add_update (struct interface *ifp); |
| 213 | extern void if_up (struct interface *); |
| 214 | extern void if_down (struct interface *); |
| 215 | extern void if_refresh (struct interface *); |
paul | 5c78b3d | 2006-01-25 04:31:40 +0000 | [diff] [blame] | 216 | extern void if_flags_update (struct interface *, uint64_t); |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 217 | extern int if_subnet_add (struct interface *, struct connected *); |
| 218 | extern int if_subnet_delete (struct interface *, struct connected *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 219 | |
| 220 | #ifdef HAVE_PROC_NET_DEV |
Paul Jakma | f28b0e5 | 2006-08-06 15:57:59 +0000 | [diff] [blame] | 221 | extern void ifstat_update_proc (void); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 222 | #endif /* HAVE_PROC_NET_DEV */ |
| 223 | #ifdef HAVE_NET_RT_IFLIST |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 224 | extern void ifstat_update_sysctl (void); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 225 | |
| 226 | #endif /* HAVE_NET_RT_IFLIST */ |
| 227 | #ifdef HAVE_PROC_NET_DEV |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 228 | extern int interface_list_proc (void); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 229 | #endif /* HAVE_PROC_NET_DEV */ |
| 230 | #ifdef HAVE_PROC_NET_IF_INET6 |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 231 | extern int ifaddr_proc_ipv6 (void); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 232 | #endif /* HAVE_PROC_NET_IF_INET6 */ |
| 233 | |
| 234 | #ifdef BSDI |
paul | a1ac18c | 2005-06-28 17:17:12 +0000 | [diff] [blame] | 235 | extern int if_kvm_get_mtu (struct interface *); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 236 | #endif /* BSDI */ |
paul | 5b73a67 | 2004-07-23 15:26:14 +0000 | [diff] [blame] | 237 | |
| 238 | #endif /* _ZEBRA_INTERFACE_H */ |