paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame^] | 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 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with GNU Zebra; see the file COPYING. If not, write to the Free |
| 18 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
| 19 | * 02111-1307, USA. |
| 20 | */ |
| 21 | |
| 22 | /* ICMP Messages */ |
| 23 | #ifndef ICMP_ROUTERADVERT |
| 24 | #define ICMP_ROUTERADVERT 9 |
| 25 | #endif /* ICMP_ROUTERADVERT */ |
| 26 | |
| 27 | #ifndef ICMP_ROUTERSOLICIT |
| 28 | #define ICMP_ROUTERSOLICIT 10 |
| 29 | #endif /* ICMP_ROUTERSOLICT */ |
| 30 | |
| 31 | /* Multicast groups */ |
| 32 | #ifndef INADDR_ALLHOSTS_GROUP |
| 33 | #define INADDR_ALLHOSTS_GROUP 0xe0000001 /* 224.0.0.1 */ |
| 34 | #endif /* INADDR_ALLHOSTS_GROUP */ |
| 35 | |
| 36 | #ifndef INADDR_ALLRTRS_GROUP |
| 37 | #define INADDR_ALLRTRS_GROUP 0xe0000002 /* 224.0.0.2 */ |
| 38 | #endif /* INADDR_ALLRTRS_GROUP */ |
| 39 | |
| 40 | /* Comments comes from RFC1256 ICMP Router Discovery Messages. */ |
| 41 | struct irdp_router_interface |
| 42 | { |
| 43 | /* The IP destination address to be used for multicast Router |
| 44 | Advertisements sent from the interface. The only permissible |
| 45 | values are the all-systems multicast address, 224.0.0.1, or the |
| 46 | limited-broadcast address, 255.255.255.255. (The all-systems |
| 47 | address is preferred wherever possible, i.e., on any link where |
| 48 | all listening hosts support IP multicast.) |
| 49 | |
| 50 | Default: 224.0.0.1 if the router supports IP multicast on the |
| 51 | interface, else 255.255.255.255 */ |
| 52 | |
| 53 | struct in_addr AdvertisementAddress; |
| 54 | |
| 55 | /* The maximum time allowed between sending multicast Router |
| 56 | Advertisements from the interface, in seconds. Must be no less |
| 57 | than 4 seconds and no greater than 1800 seconds. |
| 58 | |
| 59 | Default: 600 seconds */ |
| 60 | |
| 61 | unsigned long MaxAdvertisementInterval; |
| 62 | |
| 63 | /* The minimum time allowed between sending unsolicited multicast |
| 64 | Router Advertisements from the interface, in seconds. Must be no |
| 65 | less than 3 seconds and no greater than MaxAdvertisementInterval. |
| 66 | |
| 67 | Default: 0.75 * MaxAdvertisementInterval */ |
| 68 | |
| 69 | unsigned long MinAdvertisementInterval; |
| 70 | |
| 71 | |
| 72 | /* The value to be placed in the Lifetime field of Router |
| 73 | Advertisements sent from the interface, in seconds. Must be no |
| 74 | less than MaxAdvertisementInterval and no greater than 9000 |
| 75 | seconds. |
| 76 | |
| 77 | Default: 3 * MaxAdvertisementInterval */ |
| 78 | |
| 79 | unsigned long AdvertisementLifetime; |
| 80 | |
| 81 | /* A flag indicating whether or not the address is to be advertised. |
| 82 | |
| 83 | Default: TRUE */ |
| 84 | |
| 85 | int Advertise; |
| 86 | |
| 87 | |
| 88 | /* The preferability of the address as a default router address, |
| 89 | relative to other router addresses on the same subnet. A 32-bit, |
| 90 | signed, twos-complement integer, with higher values meaning more |
| 91 | preferable. The minimum value (hex 80000000) is used to indicate |
| 92 | that the address, even though it may be advertised, is not to be |
| 93 | used by neighboring hosts as a default router address. |
| 94 | |
| 95 | Default: 0 */ |
| 96 | |
| 97 | unsigned long PreferenceLevel; |
| 98 | }; |
| 99 | |
| 100 | struct irdp_host_interface |
| 101 | { |
| 102 | /* A flag indicating whether or not the host is to perform ICMP router |
| 103 | discovery on the interface. */ |
| 104 | int PerformRouerDiscovery; |
| 105 | |
| 106 | /* The IP destination address to be used for sending Router |
| 107 | Solicitations from the interface. The only permissible values |
| 108 | are the all-routers multicast address, 224.0.0.2, or the |
| 109 | limited-broadcast address, 255.255.255.255. (The all-routers |
| 110 | address is preferred wherever possible, i.e., on any link where |
| 111 | all advertising routers support IP multicast.) */ |
| 112 | unsigned long SolicitationAddress; |
| 113 | }; |
| 114 | |
| 115 | |
| 116 | /* Route preference structure */ |
| 117 | struct irdp |
| 118 | { |
| 119 | struct in_addr prefix; |
| 120 | long pref; /* preference level */ |
| 121 | long timer; /* lifetime timer */ |
| 122 | |
| 123 | struct irdp *next; /* doubly linked list */ |
| 124 | struct irdp *prev; /* doubly linked list */ |
| 125 | }; |
| 126 | |
| 127 | /* Default irdp packet interval */ |
| 128 | #define IRDP_DEFAULT_INTERVAL 300 |
| 129 | |
| 130 | /* Router constants from RFC1256 */ |
| 131 | #define MAX_INITIAL_ADVERT_INTERVAL 16 |
| 132 | #define MAX_INITIAL_ADVERTISEMENTS 3 |
| 133 | #define MAX_RESPONSE_DELAY 2 |
| 134 | |
| 135 | /* Host constants from RFC1256 */ |
| 136 | #define MAX_SOLICITATION_DELAY 1 |
| 137 | #define SOLICITATION_INTERVAL 3 |
| 138 | #define MAX_SOLICITATIONS 3 |
| 139 | |
| 140 | enum |
| 141 | { |
| 142 | IRDP_NONE, |
| 143 | IRDP_ROUTER, |
| 144 | IRDP_HOST, |
| 145 | }; |
| 146 | |
| 147 | /* default is host mode */ |
| 148 | extern int irdp_mode; |