]>
git.proxmox.com Git - mirror_frr.git/blob - ripngd/ripngd.h
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_VTYSH_PATH "/tmp/.ripngd"
31 #define RIPNG_MAX_PACKET_SIZE 1500
32 #define RIPNG_PRIORITY_DEFAULT 0
35 #define RIPNG_REQUEST 1
36 #define RIPNG_RESPONSE 2
38 /* RIPng metric and multicast group address. */
39 #define RIPNG_METRIC_INFINITY 16
40 #define RIPNG_METRIC_NEXTHOP 0xff
41 #define RIPNG_GROUP "ff02::9"
44 #define RIPNG_UPDATE_TIMER_DEFAULT 30
45 #define RIPNG_TIMEOUT_TIMER_DEFAULT 180
46 #define RIPNG_GARBAGE_TIMER_DEFAULT 120
48 /* Default config file name. */
49 #define RIPNG_DEFAULT_CONFIG "ripngd.conf"
51 /* RIPng route types. */
52 #define RIPNG_ROUTE_RTE 0
53 #define RIPNG_ROUTE_STATIC 1
54 #define RIPNG_ROUTE_AGGREGATE 2
56 /* Interface send/receive configuration. */
57 #define RIPNG_SEND_UNSPEC 0
58 #define RIPNG_SEND_OFF 1
59 #define RIPNG_RECEIVE_UNSPEC 0
60 #define RIPNG_RECEIVE_OFF 1
62 /* Split horizon definitions. */
63 #define RIPNG_SPLIT_HORIZON_UNSPEC 0
64 #define RIPNG_SPLIT_HORIZON_NONE 1
65 #define RIPNG_SPLIT_HORIZON 2
66 #define RIPNG_SPLIT_HORIZON_POISONED 3
68 /* RIP default route's accept/announce methods. */
69 #define RIPNG_DEFAULT_ADVERTISE_UNSPEC 0
70 #define RIPNG_DEFAULT_ADVERTISE_NONE 1
71 #define RIPNG_DEFAULT_ADVERTISE 2
73 #define RIPNG_DEFAULT_ACCEPT_UNSPEC 0
74 #define RIPNG_DEFAULT_ACCEPT_NONE 1
75 #define RIPNG_DEFAULT_ACCEPT 2
77 /* Default value for "default-metric" command. */
78 #define RIPNG_DEFAULT_METRIC_DEFAULT 1
80 /* For max RTE calculation. */
82 #define IPV6_HDRLEN 40
83 #endif /* IPV6_HDRLEN */
89 /* RIPng structure. */
95 /* RIPng Parameters.*/
98 unsigned long update_time
;
99 unsigned long timeout_time
;
100 unsigned long garbage_time
;
103 int default_information
;
105 /* Input/output buffer of RIPng. */
109 /* RIPng routing information base. */
110 struct route_table
*table
;
112 /* RIPng only static route information. */
113 struct route_table
*route
;
115 /* RIPng aggregate route information. */
116 struct route_table
*aggregate
;
119 struct thread
*t_read
;
120 struct thread
*t_write
;
121 struct thread
*t_update
;
122 struct thread
*t_garbage
;
123 struct thread
*t_zebra
;
125 /* Triggered update hack. */
127 struct thread
*t_triggered_update
;
128 struct thread
*t_triggered_interval
;
130 /* For redistribute route map. */
134 struct route_map
*map
;
137 } route_map
[ZEBRA_ROUTE_MAX
];
140 /* Routing table entry. */
143 struct in6_addr addr
;
149 /* RIPNG send packet. */
158 /* Each route's information. */
161 /* This route's type. Static, ripng or aggregate. */
164 /* Sub type for static route. */
167 /* RIPng specific information */
168 struct in6_addr nexthop
;
169 struct in6_addr from
;
171 /* Which interface does this route come from. */
172 unsigned int ifindex
;
174 /* Metric of this route. */
177 /* Tag field of RIPng packet.*/
180 /* For aggregation. */
181 unsigned int suppress
;
183 /* Flags of RIPng route. */
184 #define RIPNG_RTF_FIB 1
185 #define RIPNG_RTF_CHANGED 2
188 /* Garbage collect timer. */
189 struct thread
*t_timeout
;
190 struct thread
*t_garbage_collect
;
192 /* Route-map features - this variables can be changed. */
195 struct route_node
*rp
;
198 /* RIPng tag structure. */
207 /* Multicast group. */
208 struct in6_addr maddr
;
217 u_char split_horizon
;
219 /* Poison reverse. */
220 u_char poison_reverse
;
223 /* RIPng specific interface configuration. */
224 struct ripng_interface
226 /* RIPng is enabled on this interface. */
228 int enable_interface
;
230 /* RIPng is running on this interface. */
233 /* For filter type slot. */
234 #define RIPNG_FILTER_IN 0
235 #define RIPNG_FILTER_OUT 1
236 #define RIPNG_FILTER_MAX 2
239 struct access_list
*list
[RIPNG_FILTER_MAX
];
242 struct prefix_list
*prefix
[RIPNG_FILTER_MAX
];
245 struct route_map
*routemap
[RIPNG_FILTER_MAX
];
247 /* RIPng tag configuration. */
248 struct ripng_tag
*rtag
;
250 /* Default information originate. */
251 u_char default_originate
;
253 /* Default information only. */
256 /* Wake up thread. */
257 struct thread
*t_wakeup
;
259 /* Passive interface. */
263 /* All RIPng events. */
270 RIPNG_TRIGGERED_UPDATE
,
273 /* RIPng timer on/off macro. */
274 #define RIPNG_TIMER_ON(T,F,V) \
277 (T) = thread_add_timer (master, (F), rinfo, (V)); \
280 #define RIPNG_TIMER_OFF(T) \
289 /* Count prefix size from mask length */
290 #define PSIZE(a) (((a) + 7) / (8))
292 /* Extern variables. */
293 extern struct ripng
*ripng
;
295 extern struct thread_master
*master
;
299 void ripng_if_init ();
300 void ripng_terminate ();
301 void ripng_zclient_start ();
303 struct ripng_info
* ripng_info_new ();
304 void ripng_info_free (struct ripng_info
*rinfo
);
305 void ripng_event (enum ripng_event
, int);
306 int ripng_request (struct interface
*ifp
);
307 void ripng_redistribute_add (int, int, struct prefix_ipv6
*, unsigned int);
308 void ripng_redistribute_delete (int, int, struct prefix_ipv6
*, unsigned int);
309 void ripng_redistribute_withdraw (int type
);
311 void ripng_distribute_update_interface (struct interface
*);
312 void ripng_if_rmap_update_interface (struct interface
*);
314 void ripng_zebra_ipv6_add (struct prefix_ipv6
*p
, struct in6_addr
*nexthop
, unsigned int ifindex
);
315 void ripng_zebra_ipv6_delete (struct prefix_ipv6
*p
, struct in6_addr
*nexthop
, unsigned int ifindex
);
316 void ripng_route_map_init ();
318 #endif /* _ZEBRA_RIPNG_RIPNGD_H */