]> git.proxmox.com Git - mirror_frr.git/blame - zebra/interface.h
Merge pull request #791 from LabNConsulting/working/master/patch-set/style
[mirror_frr.git] / zebra / interface.h
CommitLineData
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 *
896014f4
DL
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
718e3744 19 */
20
5b73a671 21#ifndef _ZEBRA_INTERFACE_H
22#define _ZEBRA_INTERFACE_H
23
24#include "redistribute.h"
12f6fb97 25#include "vrf.h"
5b73a671 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
8da4e946 40#if defined (HAVE_RTADV)
6eb0c5ab 41/* Router advertisement parameter. From RFC4861, RFC6275 and RFC4191. */
718e3744 42struct rtadvconf
43{
44 /* A flag indicating whether or not the router sends periodic Router
45 Advertisements and responds to Router Solicitations.
46 Default: FALSE */
47 int AdvSendAdvertisements;
48
49 /* The maximum time allowed between sending unsolicited multicast
7cee1bb1 50 Router Advertisements from the interface, in milliseconds.
6eb0c5ab
DO
51 MUST be no less than 70 ms [RFC6275 7.5] and no greater
52 than 1800000 ms [RFC4861 6.2.1].
718e3744 53
7cee1bb1 54 Default: 600000 milliseconds */
718e3744 55 int MaxRtrAdvInterval;
7cee1bb1 56#define RTADV_MAX_RTR_ADV_INTERVAL 600000
718e3744 57
58 /* The minimum time allowed between sending unsolicited multicast
7cee1bb1 59 Router Advertisements from the interface, in milliseconds.
6eb0c5ab 60 MUST be no less than 30 ms [RFC6275 7.5].
7cee1bb1 61 MUST be no greater than .75 * MaxRtrAdvInterval.
718e3744 62
63 Default: 0.33 * MaxRtrAdvInterval */
d660f698 64 int MinRtrAdvInterval; /* This field is currently unused. */
718e3744 65#define RTADV_MIN_RTR_ADV_INTERVAL (0.33 * RTADV_MAX_RTR_ADV_INTERVAL)
66
67 /* Unsolicited Router Advertisements' interval timer. */
68 int AdvIntervalTimer;
69
70 /* The TRUE/FALSE value to be placed in the "Managed address
71 configuration" flag field in the Router Advertisement. See
72 [ADDRCONF].
73
74 Default: FALSE */
75 int AdvManagedFlag;
76
77
78 /* The TRUE/FALSE value to be placed in the "Other stateful
79 configuration" flag field in the Router Advertisement. See
80 [ADDRCONF].
81
82 Default: FALSE */
83 int AdvOtherConfigFlag;
84
85 /* The value to be placed in MTU options sent by the router. A
86 value of zero indicates that no MTU options are sent.
87
88 Default: 0 */
89 int AdvLinkMTU;
90
91
92 /* The value to be placed in the Reachable Time field in the Router
93 Advertisement messages sent by the router. The value zero means
94 unspecified (by this router). MUST be no greater than 3,600,000
95 milliseconds (1 hour).
96
97 Default: 0 */
98 u_int32_t AdvReachableTime;
99#define RTADV_MAX_REACHABLE_TIME 3600000
100
101
102 /* The value to be placed in the Retrans Timer field in the Router
103 Advertisement messages sent by the router. The value zero means
104 unspecified (by this router).
105
106 Default: 0 */
107 int AdvRetransTimer;
108
109 /* The default value to be placed in the Cur Hop Limit field in the
110 Router Advertisement messages sent by the router. The value
111 should be set to that current diameter of the Internet. The
112 value zero means unspecified (by this router).
113
114 Default: The value specified in the "Assigned Numbers" RFC
115 [ASSIGNED] that was in effect at the time of implementation. */
116 int AdvCurHopLimit;
117
118 /* The value to be placed in the Router Lifetime field of Router
119 Advertisements sent from the interface, in seconds. MUST be
120 either zero or between MaxRtrAdvInterval and 9000 seconds. A
121 value of zero indicates that the router is not to be used as a
122 default router.
123
124 Default: 3 * MaxRtrAdvInterval */
125 int AdvDefaultLifetime;
d660f698 126#define RTADV_MAX_RTRLIFETIME 9000 /* 2.5 hours */
718e3744 127
128 /* A list of prefixes to be placed in Prefix Information options in
129 Router Advertisement messages sent from the interface.
130
131 Default: all prefixes that the router advertises via routing
132 protocols as being on-link for the interface from which the
133 advertisement is sent. The link-local prefix SHOULD NOT be
134 included in the list of advertised prefixes. */
52dc7ee6 135 struct list *AdvPrefixList;
7cee1bb1 136
137 /* The TRUE/FALSE value to be placed in the "Home agent"
6eb0c5ab 138 flag field in the Router Advertisement. See [RFC6275 7.1].
7cee1bb1 139
140 Default: FALSE */
141 int AdvHomeAgentFlag;
142#ifndef ND_RA_FLAG_HOME_AGENT
143#define ND_RA_FLAG_HOME_AGENT 0x20
144#endif
145
146 /* The value to be placed in Home Agent Information option if Home
147 Flag is set.
148 Default: 0 */
149 int HomeAgentPreference;
150
151 /* The value to be placed in Home Agent Information option if Home
152 Flag is set. Lifetime (seconds) MUST not be greater than 18.2
153 hours.
154 The value 0 has special meaning: use of AdvDefaultLifetime value.
155
156 Default: 0 */
157 int HomeAgentLifetime;
158#define RTADV_MAX_HALIFETIME 65520 /* 18.2 hours */
159
160 /* The TRUE/FALSE value to insert or not an Advertisement Interval
6eb0c5ab 161 option. See [RFC 6275 7.3]
7cee1bb1 162
163 Default: FALSE */
164 int AdvIntervalOption;
b60668d0
CC
165
166 /* The value to be placed in the Default Router Preference field of
167 a router advertisement. See [RFC 4191 2.1 & 2.2]
168
169 Default: 0 (medium) */
170 int DefaultPreference;
171#define RTADV_PREF_MEDIUM 0x0 /* Per RFC4191. */
6c9678b4
DD
172
173 u_char inFastRexmit; /* True if we're rexmits faster than usual */
4a04e5f7 174 u_char configured; /* Has operator configured RA? */
6c9678b4
DD
175 int NumFastReXmitsRemain; /* Loaded first with number of fast rexmits to do */
176
177#define RTADV_FAST_REXMIT_PERIOD 1 /* 1 sec */
178#define RTADV_NUM_FAST_REXMITS 4 /* Fast Rexmit RA 4 times on certain events */
718e3744 179};
180
8da4e946 181#endif /* HAVE_RTADV */
718e3744 182
183/* `zebra' daemon local interface structure. */
184struct 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
55ce4d3a
CF
198 /* Information about up/down changes */
199 unsigned int up_count;
200 char up_last[QUAGGA_TIMESTAMP_LEN];
201 unsigned int down_count;
202 char down_last[QUAGGA_TIMESTAMP_LEN];
203
8da4e946 204#if defined(HAVE_RTADV)
718e3744 205 struct rtadvconf rtadv;
795b5abf 206 unsigned int ra_sent, ra_rcvd;
8da4e946 207#endif /* HAVE_RTADV */
ca776988 208
209#ifdef HAVE_IRDP
210 struct irdp_interface irdp;
211#endif
212
8ccc7e80
TT
213#ifdef HAVE_STRUCT_SOCKADDR_DL
214 union {
215 /* note that sdl_storage is never accessed, it only exists to make space.
216 * all actual uses refer to sdl - but use sizeof(sdl_storage)! this fits
217 * best with C aliasing rules. */
218 struct sockaddr_dl sdl;
219 struct sockaddr_storage sdl_storage;
220 };
221#endif
222
5c78b3d0 223#ifdef SUNOS_5
224 /* the real IFF_UP state of the primary interface.
225 * need this to differentiate between all interfaces being
226 * down (but primary still plumbed) and primary having gone
227 * ~IFF_UP, and all addresses gone.
228 */
229 u_char primary_state;
230#endif /* SUNOS_5 */
986aa00f 231
232 /* ptm enable configuration */
233 u_char ptm_enable;
718e3744 234};
235
12f6fb97
DS
236
237extern struct interface *if_lookup_by_index_per_ns (struct zebra_ns *, u_int32_t);
b8af3fbb 238extern struct interface *if_lookup_by_name_per_ns (struct zebra_ns *, const char *);
12f6fb97 239extern struct interface *if_link_per_ns (struct zebra_ns *, struct interface *);
a815b788 240extern const char *ifindex2ifname_per_ns (struct zebra_ns *, unsigned int);
241
12f6fb97 242extern void if_unlink_per_ns (struct interface *);
5c610faf
DS
243extern void if_nbr_ipv6ll_to_ipv4ll_neigh_update (struct interface *ifp,
244 struct in6_addr *address, int add);
245extern void if_nbr_ipv6ll_to_ipv4ll_neigh_del_all (struct interface *ifp);
a1ac18c4 246extern void if_delete_update (struct interface *ifp);
247extern void if_add_update (struct interface *ifp);
248extern void if_up (struct interface *);
249extern void if_down (struct interface *);
250extern void if_refresh (struct interface *);
5c78b3d0 251extern void if_flags_update (struct interface *, uint64_t);
a1ac18c4 252extern int if_subnet_add (struct interface *, struct connected *);
253extern int if_subnet_delete (struct interface *, struct connected *);
b6120505 254extern int ipv6_address_configured (struct interface *ifp);
c8e264b6 255extern void if_handle_vrf_change (struct interface *ifp, vrf_id_t vrf_id);
718e3744 256
12f6fb97
DS
257extern void vrf_add_update (struct vrf *vrfp);
258
718e3744 259#ifdef HAVE_PROC_NET_DEV
f28b0e57 260extern void ifstat_update_proc (void);
718e3744 261#endif /* HAVE_PROC_NET_DEV */
262#ifdef HAVE_NET_RT_IFLIST
a1ac18c4 263extern void ifstat_update_sysctl (void);
718e3744 264
265#endif /* HAVE_NET_RT_IFLIST */
266#ifdef HAVE_PROC_NET_DEV
a1ac18c4 267extern int interface_list_proc (void);
718e3744 268#endif /* HAVE_PROC_NET_DEV */
269#ifdef HAVE_PROC_NET_IF_INET6
a1ac18c4 270extern int ifaddr_proc_ipv6 (void);
718e3744 271#endif /* HAVE_PROC_NET_IF_INET6 */
272
5b73a671 273#endif /* _ZEBRA_INTERFACE_H */