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