]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | /* ICMP Router Discovery Messages |
2 | * Copyright (C) 1997, 2000 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 | ||
d62a17ae | 21 | /* |
ca776988 | 22 | * This file is modified and completed for the Zebra IRDP implementation |
23 | * by Robert Olsson, Swedish University of Agricultural Sciences | |
24 | */ | |
25 | ||
26 | #ifndef _IRDP_H | |
27 | #define _IRDP_H | |
28 | ||
29 | #include "lib/vty.h" | |
30 | ||
31 | #define TRUE 1 | |
32 | #define FALSE 0 | |
33 | ||
718e3744 | 34 | /* ICMP Messages */ |
35 | #ifndef ICMP_ROUTERADVERT | |
36 | #define ICMP_ROUTERADVERT 9 | |
37 | #endif /* ICMP_ROUTERADVERT */ | |
38 | ||
39 | #ifndef ICMP_ROUTERSOLICIT | |
40 | #define ICMP_ROUTERSOLICIT 10 | |
41 | #endif /* ICMP_ROUTERSOLICT */ | |
42 | ||
43 | /* Multicast groups */ | |
44 | #ifndef INADDR_ALLHOSTS_GROUP | |
ca776988 | 45 | #define INADDR_ALLHOSTS_GROUP 0xe0000001U /* 224.0.0.1 */ |
718e3744 | 46 | #endif /* INADDR_ALLHOSTS_GROUP */ |
47 | ||
48 | #ifndef INADDR_ALLRTRS_GROUP | |
ca776988 | 49 | #define INADDR_ALLRTRS_GROUP 0xe0000002U /* 224.0.0.2 */ |
718e3744 | 50 | #endif /* INADDR_ALLRTRS_GROUP */ |
51 | ||
ca776988 | 52 | /* Default irdp packet interval */ |
53 | #define IRDP_DEFAULT_INTERVAL 300 | |
54 | ||
55 | /* Router constants from RFC1256 */ | |
56 | #define MAX_INITIAL_ADVERT_INTERVAL 16 | |
57 | #define MAX_INITIAL_ADVERTISEMENTS 3 | |
58 | #define MAX_RESPONSE_DELAY 2 | |
59 | ||
60 | #define IRDP_MAXADVERTINTERVAL 600 | |
61 | #define IRDP_MINADVERTINTERVAL 450 /* 0.75*600 */ | |
62 | #define IRDP_LIFETIME 1350 /* 3*450 */ | |
63 | #define IRDP_PREFERENCE 0 | |
64 | ||
65 | #define ICMP_MINLEN 8 | |
66 | ||
67 | #define IRDP_LAST_ADVERT_MESSAGES 2 /* The last adverts with Holdtime 0 */ | |
68 | ||
69 | #define IRDP_RX_BUF 1500 | |
70 | ||
d62a17ae | 71 | /* |
72 | Comments comes from RFC1256 ICMP Router Discovery Messages. | |
ca776988 | 73 | |
74 | The IP destination address to be used for multicast Router | |
718e3744 | 75 | Advertisements sent from the interface. The only permissible |
76 | values are the all-systems multicast address, 224.0.0.1, or the | |
77 | limited-broadcast address, 255.255.255.255. (The all-systems | |
78 | address is preferred wherever possible, i.e., on any link where | |
79 | all listening hosts support IP multicast.) | |
80 | ||
81 | Default: 224.0.0.1 if the router supports IP multicast on the | |
d62a17ae | 82 | interface, else 255.255.255.255 |
718e3744 | 83 | |
ca776988 | 84 | The maximum time allowed between sending multicast Router |
718e3744 | 85 | Advertisements from the interface, in seconds. Must be no less |
86 | than 4 seconds and no greater than 1800 seconds. | |
87 | ||
d62a17ae | 88 | Default: 600 seconds |
718e3744 | 89 | |
ca776988 | 90 | The minimum time allowed between sending unsolicited multicast |
718e3744 | 91 | Router Advertisements from the interface, in seconds. Must be no |
92 | less than 3 seconds and no greater than MaxAdvertisementInterval. | |
93 | ||
d62a17ae | 94 | Default: 0.75 * MaxAdvertisementInterval |
718e3744 | 95 | |
ca776988 | 96 | The value to be placed in the Lifetime field of Router |
718e3744 | 97 | Advertisements sent from the interface, in seconds. Must be no |
98 | less than MaxAdvertisementInterval and no greater than 9000 | |
99 | seconds. | |
100 | ||
d62a17ae | 101 | Default: 3 * MaxAdvertisementInterval |
718e3744 | 102 | |
ca776988 | 103 | The preferability of the address as a default router address, |
718e3744 | 104 | relative to other router addresses on the same subnet. A 32-bit, |
105 | signed, twos-complement integer, with higher values meaning more | |
106 | preferable. The minimum value (hex 80000000) is used to indicate | |
107 | that the address, even though it may be advertised, is not to be | |
108 | used by neighboring hosts as a default router address. | |
109 | ||
d62a17ae | 110 | Default: 0 |
ca776988 | 111 | */ |
718e3744 | 112 | |
d62a17ae | 113 | struct irdp_interface { |
e92044cd DS |
114 | bool started; |
115 | ||
d62a17ae | 116 | unsigned long MaxAdvertInterval; |
117 | unsigned long MinAdvertInterval; | |
118 | unsigned long Preference; | |
718e3744 | 119 | |
d7c0a89a | 120 | uint32_t flags; |
718e3744 | 121 | |
ca776988 | 122 | #define IF_ACTIVE (1<<0) /* ICMP Active */ |
123 | #define IF_BROADCAST (1<<1) /* 255.255.255.255 */ | |
124 | #define IF_SOLICIT (1<<2) /* Solicit active */ | |
125 | #define IF_DEBUG_MESSAGES (1<<3) | |
126 | #define IF_DEBUG_PACKET (1<<4) | |
127 | #define IF_DEBUG_MISC (1<<5) | |
128 | #define IF_SHUTDOWN (1<<6) | |
718e3744 | 129 | |
d62a17ae | 130 | struct interface *ifp; |
131 | struct thread *t_advertise; | |
132 | unsigned long irdp_sent; | |
d7c0a89a | 133 | uint16_t Lifetime; |
718e3744 | 134 | |
d62a17ae | 135 | struct list *AdvPrefList; |
ca776988 | 136 | }; |
718e3744 | 137 | |
d62a17ae | 138 | struct Adv { |
139 | struct in_addr ip; | |
140 | int pref; | |
718e3744 | 141 | }; |
142 | ||
2eb27eec | 143 | extern void irdp_if_init(void); |
2da40f49 | 144 | extern int irdp_sock_init(void); |
2eb27eec | 145 | extern int irdp_config_write(struct vty *, struct interface *); |
ab0f6155 SH |
146 | extern int irdp_send_thread(struct thread *t_advert); |
147 | extern void irdp_advert_off(struct interface *ifp); | |
d62a17ae | 148 | extern void process_solicit(struct interface *ifp); |
ab0f6155 | 149 | extern int irdp_read_raw(struct thread *r); |
d7c0a89a QY |
150 | extern void send_packet(struct interface *ifp, struct stream *s, uint32_t dst, |
151 | struct prefix *p, uint32_t ttl); | |
ab0f6155 | 152 | |
ca776988 | 153 | |
2da40f49 | 154 | #endif /* _IRDP_H */ |