blob: c1f9f71c470d341109821ff243fb7d3fcd528448 [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
hassoca776982004-06-12 14:33:05 +000022#ifdef HAVE_IRDP
23#include "zebra/irdp.h"
24#endif
25
paul718e3742002-12-13 20:15:29 +000026/* For interface multicast configuration. */
27#define IF_ZEBRA_MULTICAST_UNSPEC 0
28#define IF_ZEBRA_MULTICAST_ON 1
29#define IF_ZEBRA_MULTICAST_OFF 2
30
31/* For interface shutdown configuration. */
32#define IF_ZEBRA_SHUTDOWN_UNSPEC 0
33#define IF_ZEBRA_SHUTDOWN_ON 1
34#define IF_ZEBRA_SHUTDOWN_OFF 2
35
36/* Router advertisement feature. */
37#if (defined(LINUX_IPV6) && (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1)) || defined(KAME)
hasso726f9b22003-05-25 21:04:54 +000038 #ifdef HAVE_RTADV
39 #define RTADV
40 #endif
paul718e3742002-12-13 20:15:29 +000041#endif
42
43#ifdef RTADV
44/* Router advertisement parameter. From RFC2461. */
45struct rtadvconf
46{
47 /* A flag indicating whether or not the router sends periodic Router
48 Advertisements and responds to Router Solicitations.
49 Default: FALSE */
50 int AdvSendAdvertisements;
51
52 /* The maximum time allowed between sending unsolicited multicast
53 Router Advertisements from the interface, in seconds. MUST be no
54 less than 4 seconds and no greater than 1800 seconds.
55
56 Default: 600 seconds */
57 int MaxRtrAdvInterval;
58#define RTADV_MAX_RTR_ADV_INTERVAL 600
59
60 /* The minimum time allowed between sending unsolicited multicast
61 Router Advertisements from the interface, in seconds. MUST be no
62 less than 3 seconds and no greater than .75 * MaxRtrAdvInterval.
63
64 Default: 0.33 * MaxRtrAdvInterval */
65 int MinRtrAdvInterval;
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;
127#define RTADV_ADV_DEFAULT_LIFETIME (3 * RTADV_MAX_RTR_ADV_INTERVAL)
128
129
130 /* A list of prefixes to be placed in Prefix Information options in
131 Router Advertisement messages sent from the interface.
132
133 Default: all prefixes that the router advertises via routing
134 protocols as being on-link for the interface from which the
135 advertisement is sent. The link-local prefix SHOULD NOT be
136 included in the list of advertised prefixes. */
137 list AdvPrefixList;
138};
139
140#endif /* RTADV */
141
142/* `zebra' daemon local interface structure. */
143struct zebra_if
144{
145 /* Shutdown configuration. */
146 u_char shutdown;
147
148 /* Multicast configuration. */
149 u_char multicast;
150
151 /* Router advertise configuration. */
152 u_char rtadv_enable;
153
154 /* Interface's address. */
155 list address;
156
157#ifdef RTADV
158 struct rtadvconf rtadv;
159#endif /* RTADV */
hassoca776982004-06-12 14:33:05 +0000160
161#ifdef HAVE_IRDP
162 struct irdp_interface irdp;
163#endif
164
paul718e3742002-12-13 20:15:29 +0000165};
166
167void if_delete_update (struct interface *ifp);
168void if_add_update (struct interface *ifp);
169void if_up (struct interface *);
170void if_down (struct interface *);
171void if_refresh (struct interface *);
172void zebra_interface_up_update (struct interface *ifp);
173void zebra_interface_down_update (struct interface *ifp);
174
175#ifdef HAVE_PROC_NET_DEV
176int ifstat_update_proc ();
177#endif /* HAVE_PROC_NET_DEV */
178#ifdef HAVE_NET_RT_IFLIST
179void ifstat_update_sysctl ();
180
181#endif /* HAVE_NET_RT_IFLIST */
182#ifdef HAVE_PROC_NET_DEV
183int interface_list_proc ();
184#endif /* HAVE_PROC_NET_DEV */
185#ifdef HAVE_PROC_NET_IF_INET6
186int ifaddr_proc_ipv6 ();
187#endif /* HAVE_PROC_NET_IF_INET6 */
188
189#ifdef BSDI
190int if_kvm_get_mtu (struct interface *);
191#endif /* BSDI */