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