2
* RIPng related value and structure.
3
* Copyright (C) 1998 Kunihiro Ishiguro
5
* This file is part of GNU Zebra.
7
* GNU Zebra is free software; you can redistribute it and/or modify it
8
* under the terms of the GNU General Public License as published by the
9
* Free Software Foundation; either version 2, or (at your option) any
12
* GNU Zebra is distributed in the hope that it will be useful, but
13
* WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with GNU Zebra; see the file COPYING. If not, write to the Free
19
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23
#ifndef _ZEBRA_RIPNG_RIPNGD_H
24
#define _ZEBRA_RIPNG_RIPNGD_H
26
/* RIPng version and port number. */
28
#define RIPNG_PORT_DEFAULT 521
29
#define RIPNG_VTY_PORT 2603
30
#define RIPNG_MAX_PACKET_SIZE 1500
31
#define RIPNG_PRIORITY_DEFAULT 0
34
#define RIPNG_REQUEST 1
35
#define RIPNG_RESPONSE 2
37
/* RIPng metric and multicast group address. */
38
#define RIPNG_METRIC_INFINITY 16
39
#define RIPNG_METRIC_NEXTHOP 0xff
40
#define RIPNG_GROUP "ff02::9"
43
#define RIPNG_UPDATE_TIMER_DEFAULT 30
44
#define RIPNG_TIMEOUT_TIMER_DEFAULT 180
45
#define RIPNG_GARBAGE_TIMER_DEFAULT 120
47
/* RIPng peer timeout value. */
48
#define RIPNG_PEER_TIMER_DEFAULT 180
50
/* Default config file name. */
51
#define RIPNG_DEFAULT_CONFIG "ripngd.conf"
53
/* RIPng route types. */
54
#define RIPNG_ROUTE_RTE 0
55
#define RIPNG_ROUTE_STATIC 1
56
#define RIPNG_ROUTE_DEFAULT 2
57
#define RIPNG_ROUTE_REDISTRIBUTE 3
58
#define RIPNG_ROUTE_INTERFACE 4
59
#define RIPNG_ROUTE_AGGREGATE 5
61
/* Interface send/receive configuration. */
62
#define RIPNG_SEND_UNSPEC 0
63
#define RIPNG_SEND_OFF 1
64
#define RIPNG_RECEIVE_UNSPEC 0
65
#define RIPNG_RECEIVE_OFF 1
67
/* RIP default route's accept/announce methods. */
68
#define RIPNG_DEFAULT_ADVERTISE_UNSPEC 0
69
#define RIPNG_DEFAULT_ADVERTISE_NONE 1
70
#define RIPNG_DEFAULT_ADVERTISE 2
72
#define RIPNG_DEFAULT_ACCEPT_UNSPEC 0
73
#define RIPNG_DEFAULT_ACCEPT_NONE 1
74
#define RIPNG_DEFAULT_ACCEPT 2
76
/* Default value for "default-metric" command. */
77
#define RIPNG_DEFAULT_METRIC_DEFAULT 1
79
/* For max RTE calculation. */
81
#define IPV6_HDRLEN 40
82
#endif /* IPV6_HDRLEN */
88
/* RIPng structure. */
94
/* RIPng Parameters.*/
97
unsigned long update_time;
98
unsigned long timeout_time;
99
unsigned long garbage_time;
102
int default_information;
104
/* Input/output buffer of RIPng. */
108
/* RIPng routing information base. */
109
struct route_table *table;
111
/* RIPng only static route information. */
112
struct route_table *route;
114
/* RIPng aggregate route information. */
115
struct route_table *aggregate;
118
struct thread *t_read;
119
struct thread *t_write;
120
struct thread *t_update;
121
struct thread *t_garbage;
122
struct thread *t_zebra;
124
/* Triggered update hack. */
126
struct thread *t_triggered_update;
127
struct thread *t_triggered_interval;
129
/* For redistribute route map. */
133
struct route_map *map;
136
} route_map[ZEBRA_ROUTE_MAX];
139
/* Routing table entry. */
142
struct in6_addr addr; /* RIPng destination prefix */
143
u_short tag; /* RIPng tag */
144
u_char prefixlen; /* Length of the RIPng prefix */
145
u_char metric; /* Metric of the RIPng route */
146
/* The nexthop is stored by the structure
147
* ripng_nexthop within ripngd.c */
150
/* RIPNG send packet. */
159
/* Each route's information. */
162
/* This route's type. Static, ripng or aggregate. */
165
/* Sub type for static route. */
168
/* RIPng specific information */
169
struct in6_addr nexthop;
170
struct in6_addr from;
172
/* Which interface does this route come from. */
173
unsigned int ifindex;
175
/* Metric of this route. */
178
/* Tag field of RIPng packet.*/
181
/* For aggregation. */
182
unsigned int suppress;
184
/* Flags of RIPng route. */
185
#define RIPNG_RTF_FIB 1
186
#define RIPNG_RTF_CHANGED 2
189
/* Garbage collect timer. */
190
struct thread *t_timeout;
191
struct thread *t_garbage_collect;
193
/* Route-map features - this variables can be changed. */
194
struct in6_addr nexthop_out;
199
struct route_node *rp;
204
/* RIPng tag structure. */
213
/* Multicast group. */
214
struct in6_addr maddr;
223
u_char split_horizon;
225
/* Poison reverse. */
226
u_char poison_reverse;
232
RIPNG_NO_SPLIT_HORIZON = 0,
234
RIPNG_SPLIT_HORIZON_POISONED_REVERSE
235
} split_horizon_policy_t;
237
/* RIPng specific interface configuration. */
238
struct ripng_interface
240
/* RIPng is enabled on this interface. */
242
int enable_interface;
244
/* RIPng is running on this interface. */
247
/* Split horizon flag. */
248
split_horizon_policy_t split_horizon;
249
split_horizon_policy_t split_horizon_default;
251
/* For filter type slot. */
252
#define RIPNG_FILTER_IN 0
253
#define RIPNG_FILTER_OUT 1
254
#define RIPNG_FILTER_MAX 2
257
struct access_list *list[RIPNG_FILTER_MAX];
260
struct prefix_list *prefix[RIPNG_FILTER_MAX];
263
struct route_map *routemap[RIPNG_FILTER_MAX];
267
/* RIPng tag configuration. */
268
struct ripng_tag *rtag;
272
/* Default information originate. */
273
u_char default_originate;
275
/* Default information only. */
278
/* Wake up thread. */
279
struct thread *t_wakeup;
281
/* Passive interface. */
285
/* RIPng peer information. */
289
struct in6_addr addr;
291
/* Peer RIPng tag value. */
294
/* Last update time. */
297
/* Peer RIP version. */
304
/* Timeout thread. */
305
struct thread *t_timeout;
308
/* All RIPng events. */
315
RIPNG_TRIGGERED_UPDATE,
318
/* RIPng timer on/off macro. */
319
#define RIPNG_TIMER_ON(T,F,V) \
322
(T) = thread_add_timer (master, (F), rinfo, (V)); \
325
#define RIPNG_TIMER_OFF(T) \
334
/* Count prefix size from mask length */
335
#define PSIZE(a) (((a) + 7) / (8))
337
/* Extern variables. */
338
extern struct ripng *ripng;
340
extern struct thread_master *master;
346
void ripng_clean_network ();
347
void ripng_interface_clean ();
348
void ripng_interface_reset ();
349
void ripng_passive_interface_clean ();
350
void ripng_if_init ();
351
void ripng_route_map_init ();
352
void ripng_route_map_reset ();
353
void ripng_terminate ();
354
/* zclient_init() is done by ripng_zebra.c:zebra_init() */
356
void ripng_zclient_start ();
357
void ripng_zclient_reset ();
358
void ripng_offset_init ();
360
int config_write_ripng_offset_list (struct vty *);
362
void ripng_peer_init ();
363
void ripng_peer_update (struct sockaddr_in6 *, u_char);
364
void ripng_peer_bad_route (struct sockaddr_in6 *);
365
void ripng_peer_bad_packet (struct sockaddr_in6 *);
366
void ripng_peer_display (struct vty *);
367
struct ripng_peer *ripng_peer_lookup (struct in6_addr *);
368
struct ripng_peer *ripng_peer_lookup_next (struct in6_addr *);
370
int ripng_offset_list_apply_in (struct prefix_ipv6 *, struct interface *, u_char *);
371
int ripng_offset_list_apply_out (struct prefix_ipv6 *, struct interface *, u_char *);
372
void ripng_offset_clean ();
374
struct ripng_info * ripng_info_new ();
375
void ripng_info_free (struct ripng_info *rinfo);
376
void ripng_event (enum ripng_event, int);
377
int ripng_request (struct interface *ifp);
378
void ripng_redistribute_add (int, int, struct prefix_ipv6 *, unsigned int,
380
void ripng_redistribute_delete (int, int, struct prefix_ipv6 *, unsigned int);
381
void ripng_redistribute_withdraw (int type);
383
void ripng_distribute_update_interface (struct interface *);
384
void ripng_if_rmap_update_interface (struct interface *);
386
void ripng_zebra_ipv6_add (struct prefix_ipv6 *p, struct in6_addr *nexthop, unsigned int ifindex);
387
void ripng_zebra_ipv6_delete (struct prefix_ipv6 *p, struct in6_addr *nexthop, unsigned int ifindex);
389
void ripng_redistribute_clean ();
391
const char *inet6_ntop (struct in6_addr *p);
393
int ripng_write_rte (int num, struct stream *s, struct prefix_ipv6 *p,
394
struct in6_addr *nexthop, u_int16_t tag, u_char metric);
395
int ripng_send_packet (caddr_t buf, int bufsize, struct sockaddr_in6 *to,
396
struct interface *ifp);
398
void ripng_packet_dump (struct ripng_packet *packet, int size, char *sndrcv);
401
#endif /* _ZEBRA_RIPNG_RIPNGD_H */