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 along
18 * with this program; see the file COPYING; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #ifndef _ZEBRA_RIPNG_RIPNGD_H
23 #define _ZEBRA_RIPNG_RIPNGD_H
28 #include "ripng_memory.h"
30 /* RIPng version and port number. */
32 #define RIPNG_PORT_DEFAULT 521
33 #define RIPNG_VTY_PORT 2603
34 #define RIPNG_MAX_PACKET_SIZE 1500
35 #define RIPNG_PRIORITY_DEFAULT 0
38 #define RIPNG_REQUEST 1
39 #define RIPNG_RESPONSE 2
41 /* RIPng metric and multicast group address. */
42 #define RIPNG_METRIC_INFINITY 16
43 #define RIPNG_METRIC_NEXTHOP 0xff
44 #define RIPNG_GROUP "ff02::9"
46 /* RIPng peer timeout value. */
47 #define RIPNG_PEER_TIMER_DEFAULT 180
49 /* Default config file name. */
50 #define RIPNG_DEFAULT_CONFIG "ripngd.conf"
52 /* RIPng route types. */
53 #define RIPNG_ROUTE_RTE 0
54 #define RIPNG_ROUTE_STATIC 1
55 #define RIPNG_ROUTE_DEFAULT 2
56 #define RIPNG_ROUTE_REDISTRIBUTE 3
57 #define RIPNG_ROUTE_INTERFACE 4
58 #define RIPNG_ROUTE_AGGREGATE 5
60 /* Interface send/receive configuration. */
61 #define RIPNG_SEND_UNSPEC 0
62 #define RIPNG_SEND_OFF 1
63 #define RIPNG_RECEIVE_UNSPEC 0
64 #define RIPNG_RECEIVE_OFF 1
66 /* RIP default route's accept/announce methods. */
67 #define RIPNG_DEFAULT_ADVERTISE_UNSPEC 0
68 #define RIPNG_DEFAULT_ADVERTISE_NONE 1
69 #define RIPNG_DEFAULT_ADVERTISE 2
71 #define RIPNG_DEFAULT_ACCEPT_UNSPEC 0
72 #define RIPNG_DEFAULT_ACCEPT_NONE 1
73 #define RIPNG_DEFAULT_ACCEPT 2
75 /* For max RTE calculation. */
77 #define IPV6_HDRLEN 40
78 #endif /* IPV6_HDRLEN */
85 #define RIPNG_INSTANCE "/frr-ripngd:ripngd/instance"
86 #define RIPNG_IFACE "/frr-interface:lib/interface/frr-ripngd:ripng"
88 /* RIPng structure. */
93 /* RIPng Parameters.*/
97 uint16_t timeout_time
;
98 uint16_t garbage_time
;
100 uint8_t default_metric
;
102 /* Input/output buffer of RIPng. */
106 /* RIPng routing information base. */
107 struct agg_table
*table
;
110 struct thread
*t_read
;
111 struct thread
*t_write
;
112 struct thread
*t_update
;
113 struct thread
*t_garbage
;
114 struct thread
*t_zebra
;
116 /* Triggered update hack. */
118 struct thread
*t_triggered_update
;
119 struct thread
*t_triggered_interval
;
121 /* RIPng ECMP flag */
124 /* For redistribute route map. */
127 struct route_map
*map
;
130 } route_map
[ZEBRA_ROUTE_MAX
];
133 /* Routing table entry. */
135 struct in6_addr addr
; /* RIPng destination prefix */
136 uint16_t tag
; /* RIPng tag */
137 uint8_t prefixlen
; /* Length of the RIPng prefix */
138 uint8_t metric
; /* Metric of the RIPng route */
139 /* The nexthop is stored by the structure
140 * ripng_nexthop within ripngd.c */
143 /* RIPNG send packet. */
144 struct ripng_packet
{
151 /* Each route's information. */
153 /* This route's type. Static, ripng or aggregate. */
156 /* Sub type for static route. */
159 /* RIPng specific information */
160 struct in6_addr nexthop
;
161 struct in6_addr from
;
163 /* Which interface does this route come from. */
166 /* Metric of this route. */
169 /* Tag field of RIPng packet.*/
172 /* For aggregation. */
173 unsigned int suppress
;
175 /* Flags of RIPng route. */
176 #define RIPNG_RTF_FIB 1
177 #define RIPNG_RTF_CHANGED 2
180 /* Garbage collect timer. */
181 struct thread
*t_timeout
;
182 struct thread
*t_garbage_collect
;
184 /* Route-map features - this variables can be changed. */
185 struct in6_addr nexthop_out
;
195 /* RIPng tag structure. */
204 /* Multicast group. */
205 struct in6_addr maddr
;
214 uint8_t split_horizon
;
216 /* Poison reverse. */
217 uint8_t poison_reverse
;
223 RIPNG_NO_SPLIT_HORIZON
= 0,
225 RIPNG_SPLIT_HORIZON_POISONED_REVERSE
226 } split_horizon_policy_t
;
228 /* RIPng specific interface configuration. */
229 struct ripng_interface
{
230 /* RIPng is enabled on this interface. */
232 int enable_interface
;
234 /* RIPng is running on this interface. */
237 /* Split horizon flag. */
238 split_horizon_policy_t split_horizon
;
239 split_horizon_policy_t split_horizon_default
;
241 /* For filter type slot. */
242 #define RIPNG_FILTER_IN 0
243 #define RIPNG_FILTER_OUT 1
244 #define RIPNG_FILTER_MAX 2
247 struct access_list
*list
[RIPNG_FILTER_MAX
];
250 struct prefix_list
*prefix
[RIPNG_FILTER_MAX
];
253 struct route_map
*routemap
[RIPNG_FILTER_MAX
];
257 /* RIPng tag configuration. */
258 struct ripng_tag
*rtag
;
262 /* Default information originate. */
263 uint8_t default_originate
;
265 /* Default information only. */
266 uint8_t default_only
;
268 /* Wake up thread. */
269 struct thread
*t_wakeup
;
271 /* Passive interface. */
275 /* RIPng peer information. */
278 struct in6_addr addr
;
280 /* Peer RIPng tag value. */
283 /* Last update time. */
286 /* Peer RIP version. */
293 /* Timeout thread. */
294 struct thread
*t_timeout
;
297 /* All RIPng events. */
303 RIPNG_TRIGGERED_UPDATE
,
306 /* RIPng timer on/off macro. */
307 #define RIPNG_TIMER_ON(T,F,V) thread_add_timer (master, (F), rinfo, (V), &(T))
309 #define RIPNG_TIMER_OFF(T) \
317 #define RIPNG_OFFSET_LIST_IN 0
318 #define RIPNG_OFFSET_LIST_OUT 1
319 #define RIPNG_OFFSET_LIST_MAX 2
321 struct ripng_offset_list
{
326 /* struct access_list *alist; */
328 } direct
[RIPNG_OFFSET_LIST_MAX
];
331 /* Extern variables. */
332 extern struct ripng
*ripng
;
333 extern struct zebra_privs_t ripngd_privs
;
334 extern struct thread_master
*master
;
337 extern void ripng_init(void);
338 extern void ripng_reset(void);
339 extern void ripng_clean(void);
340 extern void ripng_clean_network(void);
341 extern void ripng_interface_clean(void);
342 extern void ripng_interface_reset(void);
343 extern int ripng_enable_network_add(struct prefix
*p
);
344 extern int ripng_enable_network_delete(struct prefix
*p
);
345 extern int ripng_enable_if_add(const char *ifname
);
346 extern int ripng_enable_if_delete(const char *ifname
);
347 extern int ripng_passive_interface_set(const char *ifname
);
348 extern int ripng_passive_interface_unset(const char *ifname
);
349 extern void ripng_passive_interface_clean(void);
350 extern void ripng_if_init(void);
351 extern void ripng_route_map_init(void);
352 extern void ripng_route_map_reset(void);
353 extern void ripng_terminate(void);
354 /* zclient_init() is done by ripng_zebra.c:zebra_init() */
355 extern void zebra_init(struct thread_master
*);
356 extern void ripng_zebra_stop(void);
357 extern void ripng_zclient_reset(void);
358 extern void ripng_redistribute_conf_update(int type
);
359 extern void ripng_redistribute_conf_delete(int type
);
361 extern void ripng_peer_init(void);
362 extern void ripng_peer_update(struct sockaddr_in6
*, uint8_t);
363 extern void ripng_peer_bad_route(struct sockaddr_in6
*);
364 extern void ripng_peer_bad_packet(struct sockaddr_in6
*);
365 extern void ripng_peer_display(struct vty
*);
366 extern struct ripng_peer
*ripng_peer_lookup(struct in6_addr
*);
367 extern struct ripng_peer
*ripng_peer_lookup_next(struct in6_addr
*);
369 extern struct ripng_offset_list
*ripng_offset_list_new(const char *ifname
);
370 extern void ripng_offset_list_del(struct ripng_offset_list
*offset
);
371 extern struct ripng_offset_list
*ripng_offset_list_lookup(const char *ifname
);
372 extern struct ripng_offset_list
*ripng_offset_list_lookup(const char *ifname
);
373 extern int ripng_offset_list_apply_in(struct prefix_ipv6
*, struct interface
*,
375 extern int ripng_offset_list_apply_out(struct prefix_ipv6
*, struct interface
*,
377 extern void ripng_offset_init(void);
378 extern void ripng_offset_clean(void);
380 extern struct ripng_info
*ripng_info_new(void);
381 extern void ripng_info_free(struct ripng_info
*rinfo
);
382 extern void ripng_event(enum ripng_event
, int);
383 extern int ripng_request(struct interface
*ifp
);
384 extern void ripng_redistribute_add(int, int, struct prefix_ipv6
*, ifindex_t
,
385 struct in6_addr
*, route_tag_t
);
386 extern void ripng_redistribute_delete(int, int, struct prefix_ipv6
*,
388 extern void ripng_redistribute_withdraw(int type
);
390 extern void ripng_ecmp_disable(void);
391 extern void ripng_distribute_update_interface(struct interface
*);
392 extern void ripng_if_rmap_update_interface(struct interface
*);
394 extern void ripng_zebra_ipv6_add(struct agg_node
*node
);
395 extern void ripng_zebra_ipv6_delete(struct agg_node
*node
);
397 extern void ripng_redistribute_clean(void);
398 extern int ripng_redistribute_check(int);
399 extern void ripng_redistribute_write(struct vty
*);
401 extern int ripng_write_rte(int num
, struct stream
*s
, struct prefix_ipv6
*p
,
402 struct in6_addr
*nexthop
, uint16_t tag
,
404 extern int ripng_send_packet(caddr_t buf
, int bufsize
, struct sockaddr_in6
*to
,
405 struct interface
*ifp
);
407 extern void ripng_packet_dump(struct ripng_packet
*packet
, int size
,
410 extern int ripng_interface_up(int command
, struct zclient
*, zebra_size_t
,
412 extern int ripng_interface_down(int command
, struct zclient
*, zebra_size_t
,
414 extern int ripng_interface_add(int command
, struct zclient
*, zebra_size_t
,
416 extern int ripng_interface_delete(int command
, struct zclient
*, zebra_size_t
,
418 extern int ripng_interface_address_add(int command
, struct zclient
*,
419 zebra_size_t
, vrf_id_t
);
420 extern int ripng_interface_address_delete(int command
, struct zclient
*,
421 zebra_size_t
, vrf_id_t
);
423 extern int ripng_create(int socket
);
424 extern int ripng_make_socket(void);
425 extern int ripng_network_write(struct vty
*);
427 extern struct ripng_info
*ripng_ecmp_add(struct ripng_info
*);
428 extern struct ripng_info
*ripng_ecmp_replace(struct ripng_info
*);
429 extern struct ripng_info
*ripng_ecmp_delete(struct ripng_info
*);
432 extern void ripng_cli_init(void);
433 extern const struct frr_yang_module_info frr_ripngd_info
;
435 #endif /* _ZEBRA_RIPNG_RIPNGD_H */