blob: b38a9221df7170333496c9838468da205c70f58b [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. */
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)
hasso726f9b22003-05-25 21:04:54 +000043 #ifdef HAVE_RTADV
44 #define RTADV
45 #endif
paul718e3742002-12-13 20:15:29 +000046#endif
47
48#ifdef RTADV
49/* Router advertisement parameter. From RFC2461. */
50struct 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
58 Router Advertisements from the interface, in seconds. MUST be no
59 less than 4 seconds and no greater than 1800 seconds.
60
61 Default: 600 seconds */
62 int MaxRtrAdvInterval;
63#define RTADV_MAX_RTR_ADV_INTERVAL 600
64
65 /* The minimum time allowed between sending unsolicited multicast
66 Router Advertisements from the interface, in seconds. MUST be no
67 less than 3 seconds and no greater than .75 * MaxRtrAdvInterval.
68
69 Default: 0.33 * MaxRtrAdvInterval */
70 int MinRtrAdvInterval;
71#define RTADV_MIN_RTR_ADV_INTERVAL (0.33 * RTADV_MAX_RTR_ADV_INTERVAL)
72
73 /* Unsolicited Router Advertisements' interval timer. */
74 int AdvIntervalTimer;
75
76 /* The TRUE/FALSE value to be placed in the "Managed address
77 configuration" flag field in the Router Advertisement. See
78 [ADDRCONF].
79
80 Default: FALSE */
81 int AdvManagedFlag;
82
83
84 /* The TRUE/FALSE value to be placed in the "Other stateful
85 configuration" flag field in the Router Advertisement. See
86 [ADDRCONF].
87
88 Default: FALSE */
89 int AdvOtherConfigFlag;
90
91 /* The value to be placed in MTU options sent by the router. A
92 value of zero indicates that no MTU options are sent.
93
94 Default: 0 */
95 int AdvLinkMTU;
96
97
98 /* The value to be placed in the Reachable Time field in the Router
99 Advertisement messages sent by the router. The value zero means
100 unspecified (by this router). MUST be no greater than 3,600,000
101 milliseconds (1 hour).
102
103 Default: 0 */
104 u_int32_t AdvReachableTime;
105#define RTADV_MAX_REACHABLE_TIME 3600000
106
107
108 /* The value to be placed in the Retrans Timer field in the Router
109 Advertisement messages sent by the router. The value zero means
110 unspecified (by this router).
111
112 Default: 0 */
113 int AdvRetransTimer;
114
115 /* The default value to be placed in the Cur Hop Limit field in the
116 Router Advertisement messages sent by the router. The value
117 should be set to that current diameter of the Internet. The
118 value zero means unspecified (by this router).
119
120 Default: The value specified in the "Assigned Numbers" RFC
121 [ASSIGNED] that was in effect at the time of implementation. */
122 int AdvCurHopLimit;
123
124 /* The value to be placed in the Router Lifetime field of Router
125 Advertisements sent from the interface, in seconds. MUST be
126 either zero or between MaxRtrAdvInterval and 9000 seconds. A
127 value of zero indicates that the router is not to be used as a
128 default router.
129
130 Default: 3 * MaxRtrAdvInterval */
131 int AdvDefaultLifetime;
132#define RTADV_ADV_DEFAULT_LIFETIME (3 * RTADV_MAX_RTR_ADV_INTERVAL)
133
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. */
hasso52dc7ee2004-09-23 19:18:23 +0000142 struct list *AdvPrefixList;
paul718e3742002-12-13 20:15:29 +0000143};
144
145#endif /* RTADV */
146
147/* `zebra' daemon local interface structure. */
148struct zebra_if
149{
150 /* Shutdown configuration. */
151 u_char shutdown;
152
153 /* Multicast configuration. */
154 u_char multicast;
155
156 /* Router advertise configuration. */
157 u_char rtadv_enable;
158
159 /* Interface's address. */
hasso52dc7ee2004-09-23 19:18:23 +0000160 struct list *address;
paul718e3742002-12-13 20:15:29 +0000161
162#ifdef RTADV
163 struct rtadvconf rtadv;
164#endif /* RTADV */
hassoca776982004-06-12 14:33:05 +0000165
166#ifdef HAVE_IRDP
167 struct irdp_interface irdp;
168#endif
169
paul718e3742002-12-13 20:15:29 +0000170};
171
172void if_delete_update (struct interface *ifp);
173void if_add_update (struct interface *ifp);
174void if_up (struct interface *);
175void if_down (struct interface *);
176void if_refresh (struct interface *);
paul718e3742002-12-13 20:15:29 +0000177
178#ifdef HAVE_PROC_NET_DEV
179int ifstat_update_proc ();
180#endif /* HAVE_PROC_NET_DEV */
181#ifdef HAVE_NET_RT_IFLIST
182void ifstat_update_sysctl ();
183
184#endif /* HAVE_NET_RT_IFLIST */
185#ifdef HAVE_PROC_NET_DEV
186int interface_list_proc ();
187#endif /* HAVE_PROC_NET_DEV */
188#ifdef HAVE_PROC_NET_IF_INET6
189int ifaddr_proc_ipv6 ();
190#endif /* HAVE_PROC_NET_IF_INET6 */
191
192#ifdef BSDI
193int if_kvm_get_mtu (struct interface *);
194#endif /* BSDI */
paul5b73a672004-07-23 15:26:14 +0000195
196#endif /* _ZEBRA_INTERFACE_H */