blob: fe2460435a23f62779ce3bb482b301c3d3ea4226 [file] [log] [blame]
paul718e3742002-12-13 20:15:29 +00001/* 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
paul5b73a672004-07-23 15:26:14 +000022#ifndef _ZEBRA_INTERFACE_H
23#define _ZEBRA_INTERFACE_H
24
25#include "redistribute.h"
26
hassoca776982004-06-12 14:33:05 +000027#ifdef HAVE_IRDP
28#include "zebra/irdp.h"
29#endif
30
paul718e3742002-12-13 20:15:29 +000031/* 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 Frankebfac8dc2013-01-24 14:04:50 +000037#define IF_ZEBRA_SHUTDOWN_OFF 0
paul718e3742002-12-13 20:15:29 +000038#define IF_ZEBRA_SHUTDOWN_ON 1
paul718e3742002-12-13 20:15:29 +000039
40/* Router advertisement feature. */
Feng Lu49f76092015-05-22 11:40:10 +020041#ifndef RTADV
Timo Teräsb40e1782015-04-29 09:43:00 +030042#if (defined(LINUX_IPV6) && (!defined(__GLIBC__) || defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1)) || defined(KAME)
hasso726f9b22003-05-25 21:04:54 +000043 #ifdef HAVE_RTADV
44 #define RTADV
45 #endif
paul718e3742002-12-13 20:15:29 +000046#endif
Feng Lu49f76092015-05-22 11:40:10 +020047#endif
paul718e3742002-12-13 20:15:29 +000048
49#ifdef RTADV
Denis Ovsienko6eb0c5a2012-01-24 11:02:03 +040050/* Router advertisement parameter. From RFC4861, RFC6275 and RFC4191. */
paul718e3742002-12-13 20:15:29 +000051struct rtadvconf
52{
53 /* A flag indicating whether or not the router sends periodic Router
54 Advertisements and responds to Router Solicitations.
55 Default: FALSE */
56 int AdvSendAdvertisements;
57
58 /* The maximum time allowed between sending unsolicited multicast
vincent7cee1bb2005-03-25 13:08:53 +000059 Router Advertisements from the interface, in milliseconds.
Denis Ovsienko6eb0c5a2012-01-24 11:02:03 +040060 MUST be no less than 70 ms [RFC6275 7.5] and no greater
61 than 1800000 ms [RFC4861 6.2.1].
paul718e3742002-12-13 20:15:29 +000062
vincent7cee1bb2005-03-25 13:08:53 +000063 Default: 600000 milliseconds */
paul718e3742002-12-13 20:15:29 +000064 int MaxRtrAdvInterval;
vincent7cee1bb2005-03-25 13:08:53 +000065#define RTADV_MAX_RTR_ADV_INTERVAL 600000
paul718e3742002-12-13 20:15:29 +000066
67 /* The minimum time allowed between sending unsolicited multicast
vincent7cee1bb2005-03-25 13:08:53 +000068 Router Advertisements from the interface, in milliseconds.
Denis Ovsienko6eb0c5a2012-01-24 11:02:03 +040069 MUST be no less than 30 ms [RFC6275 7.5].
vincent7cee1bb2005-03-25 13:08:53 +000070 MUST be no greater than .75 * MaxRtrAdvInterval.
paul718e3742002-12-13 20:15:29 +000071
72 Default: 0.33 * MaxRtrAdvInterval */
Denis Ovsienkod660f692011-12-30 21:55:49 +040073 int MinRtrAdvInterval; /* This field is currently unused. */
paul718e3742002-12-13 20:15:29 +000074#define RTADV_MIN_RTR_ADV_INTERVAL (0.33 * RTADV_MAX_RTR_ADV_INTERVAL)
75
76 /* Unsolicited Router Advertisements' interval timer. */
77 int AdvIntervalTimer;
78
79 /* The TRUE/FALSE value to be placed in the "Managed address
80 configuration" flag field in the Router Advertisement. See
81 [ADDRCONF].
82
83 Default: FALSE */
84 int AdvManagedFlag;
85
86
87 /* The TRUE/FALSE value to be placed in the "Other stateful
88 configuration" flag field in the Router Advertisement. See
89 [ADDRCONF].
90
91 Default: FALSE */
92 int AdvOtherConfigFlag;
93
94 /* The value to be placed in MTU options sent by the router. A
95 value of zero indicates that no MTU options are sent.
96
97 Default: 0 */
98 int AdvLinkMTU;
99
100
101 /* The value to be placed in the Reachable Time field in the Router
102 Advertisement messages sent by the router. The value zero means
103 unspecified (by this router). MUST be no greater than 3,600,000
104 milliseconds (1 hour).
105
106 Default: 0 */
107 u_int32_t AdvReachableTime;
108#define RTADV_MAX_REACHABLE_TIME 3600000
109
110
111 /* The value to be placed in the Retrans Timer field in the Router
112 Advertisement messages sent by the router. The value zero means
113 unspecified (by this router).
114
115 Default: 0 */
116 int AdvRetransTimer;
117
118 /* The default value to be placed in the Cur Hop Limit field in the
119 Router Advertisement messages sent by the router. The value
120 should be set to that current diameter of the Internet. The
121 value zero means unspecified (by this router).
122
123 Default: The value specified in the "Assigned Numbers" RFC
124 [ASSIGNED] that was in effect at the time of implementation. */
125 int AdvCurHopLimit;
126
127 /* The value to be placed in the Router Lifetime field of Router
128 Advertisements sent from the interface, in seconds. MUST be
129 either zero or between MaxRtrAdvInterval and 9000 seconds. A
130 value of zero indicates that the router is not to be used as a
131 default router.
132
133 Default: 3 * MaxRtrAdvInterval */
134 int AdvDefaultLifetime;
Denis Ovsienkod660f692011-12-30 21:55:49 +0400135#define RTADV_MAX_RTRLIFETIME 9000 /* 2.5 hours */
paul718e3742002-12-13 20:15:29 +0000136
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. */
hasso52dc7ee2004-09-23 19:18:23 +0000144 struct list *AdvPrefixList;
vincent7cee1bb2005-03-25 13:08:53 +0000145
146 /* The TRUE/FALSE value to be placed in the "Home agent"
Denis Ovsienko6eb0c5a2012-01-24 11:02:03 +0400147 flag field in the Router Advertisement. See [RFC6275 7.1].
vincent7cee1bb2005-03-25 13:08:53 +0000148
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
Denis Ovsienko6eb0c5a2012-01-24 11:02:03 +0400170 option. See [RFC 6275 7.3]
vincent7cee1bb2005-03-25 13:08:53 +0000171
172 Default: FALSE */
173 int AdvIntervalOption;
Chris Caputob60668d2009-05-03 04:40:57 +0000174
175 /* The value to be placed in the Default Router Preference field of
176 a router advertisement. See [RFC 4191 2.1 & 2.2]
177
178 Default: 0 (medium) */
179 int DefaultPreference;
180#define RTADV_PREF_MEDIUM 0x0 /* Per RFC4191. */
paul718e3742002-12-13 20:15:29 +0000181};
182
183#endif /* RTADV */
184
185/* `zebra' daemon local interface structure. */
186struct zebra_if
187{
188 /* Shutdown configuration. */
189 u_char shutdown;
190
191 /* Multicast configuration. */
192 u_char multicast;
193
194 /* Router advertise configuration. */
195 u_char rtadv_enable;
196
hassoeef1fe12004-10-03 18:46:08 +0000197 /* Installed addresses chains tree. */
198 struct route_table *ipv4_subnets;
199
paul718e3742002-12-13 20:15:29 +0000200#ifdef RTADV
201 struct rtadvconf rtadv;
202#endif /* RTADV */
hassoca776982004-06-12 14:33:05 +0000203
204#ifdef HAVE_IRDP
205 struct irdp_interface irdp;
206#endif
207
paul5c78b3d2006-01-25 04:31:40 +0000208#ifdef SUNOS_5
209 /* the real IFF_UP state of the primary interface.
210 * need this to differentiate between all interfaces being
211 * down (but primary still plumbed) and primary having gone
212 * ~IFF_UP, and all addresses gone.
213 */
214 u_char primary_state;
215#endif /* SUNOS_5 */
paul718e3742002-12-13 20:15:29 +0000216};
217
paula1ac18c2005-06-28 17:17:12 +0000218extern void if_delete_update (struct interface *ifp);
219extern void if_add_update (struct interface *ifp);
220extern void if_up (struct interface *);
221extern void if_down (struct interface *);
222extern void if_refresh (struct interface *);
paul5c78b3d2006-01-25 04:31:40 +0000223extern void if_flags_update (struct interface *, uint64_t);
paula1ac18c2005-06-28 17:17:12 +0000224extern int if_subnet_add (struct interface *, struct connected *);
225extern int if_subnet_delete (struct interface *, struct connected *);
paul718e3742002-12-13 20:15:29 +0000226
227#ifdef HAVE_PROC_NET_DEV
Paul Jakmaf28b0e52006-08-06 15:57:59 +0000228extern void ifstat_update_proc (void);
paul718e3742002-12-13 20:15:29 +0000229#endif /* HAVE_PROC_NET_DEV */
230#ifdef HAVE_NET_RT_IFLIST
paula1ac18c2005-06-28 17:17:12 +0000231extern void ifstat_update_sysctl (void);
paul718e3742002-12-13 20:15:29 +0000232
233#endif /* HAVE_NET_RT_IFLIST */
234#ifdef HAVE_PROC_NET_DEV
paula1ac18c2005-06-28 17:17:12 +0000235extern int interface_list_proc (void);
paul718e3742002-12-13 20:15:29 +0000236#endif /* HAVE_PROC_NET_DEV */
237#ifdef HAVE_PROC_NET_IF_INET6
paula1ac18c2005-06-28 17:17:12 +0000238extern int ifaddr_proc_ipv6 (void);
paul718e3742002-12-13 20:15:29 +0000239#endif /* HAVE_PROC_NET_IF_INET6 */
240
paul5b73a672004-07-23 15:26:14 +0000241#endif /* _ZEBRA_INTERFACE_H */