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