Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 1 | /* dnsmasq is Copyright (c) 2000-2012 Simon Kelley |
| 2 | |
| 3 | This program is free software; you can redistribute it and/or modify |
| 4 | it under the terms of the GNU General Public License as published by |
| 5 | the Free Software Foundation; version 2 dated June, 1991, or |
| 6 | (at your option) version 3 dated 29 June, 2007. |
| 7 | |
| 8 | This program is distributed in the hope that it will be useful, |
| 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | GNU General Public License for more details. |
| 12 | |
| 13 | You should have received a copy of the GNU General Public License |
| 14 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ |
| 16 | |
| 17 | |
Simon Kelley | 843c96b | 2012-02-27 17:42:38 +0000 | [diff] [blame] | 18 | /* NB. This code may be called during a DHCPv4 or transaction which is in ping-wait |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 19 | It therefore cannot use any DHCP buffer resources except outpacket, which is |
Simon Kelley | 843c96b | 2012-02-27 17:42:38 +0000 | [diff] [blame] | 20 | not used by DHCPv4 code. This code may also be called when DHCP 4 or 6 isn't |
| 21 | active, so we ensure that outpacket is allocated here too */ |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 22 | |
| 23 | #include "dnsmasq.h" |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 24 | |
| 25 | #ifdef HAVE_DHCP6 |
| 26 | |
Simon Kelley | 22d904d | 2012-02-26 20:13:45 +0000 | [diff] [blame] | 27 | #include <netinet/icmp6.h> |
| 28 | |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 29 | struct ra_param { |
Simon Kelley | 1f77693 | 2012-12-16 19:46:08 +0000 | [diff] [blame] | 30 | time_t now; |
Simon Kelley | 30cd966 | 2012-03-25 20:44:38 +0100 | [diff] [blame] | 31 | int ind, managed, other, found_context, first; |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 32 | char *if_name; |
Simon Kelley | 18f0fb0 | 2012-03-31 21:18:55 +0100 | [diff] [blame] | 33 | struct dhcp_netid *tags; |
Simon Kelley | 55b42f6 | 2012-12-21 16:53:15 +0000 | [diff] [blame] | 34 | struct in6_addr link_local, link_global; |
| 35 | unsigned int pref_time; |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 36 | }; |
| 37 | |
| 38 | struct search_param { |
| 39 | time_t now; int iface; |
| 40 | }; |
| 41 | |
Simon Kelley | 1f77693 | 2012-12-16 19:46:08 +0000 | [diff] [blame] | 42 | static void send_ra(time_t now, int iface, char *iface_name, struct in6_addr *dest); |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 43 | static int add_prefixes(struct in6_addr *local, int prefix, |
Simon Kelley | bad7b87 | 2012-12-20 22:00:39 +0000 | [diff] [blame] | 44 | int scope, int if_index, int flags, |
Simon Kelley | 55b42f6 | 2012-12-21 16:53:15 +0000 | [diff] [blame] | 45 | unsigned int preferred, unsigned int valid, void *vparam); |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 46 | static int iface_search(struct in6_addr *local, int prefix, |
Simon Kelley | bad7b87 | 2012-12-20 22:00:39 +0000 | [diff] [blame] | 47 | int scope, int if_index, int flags, |
Simon Kelley | 1f77693 | 2012-12-16 19:46:08 +0000 | [diff] [blame] | 48 | int prefered, int valid, void *vparam); |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 49 | static int add_lla(int index, unsigned int type, char *mac, size_t maclen, void *parm); |
| 50 | |
Simon Kelley | c5379c1 | 2012-02-24 20:05:52 +0000 | [diff] [blame] | 51 | static int hop_limit; |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 52 | |
| 53 | void ra_init(time_t now) |
| 54 | { |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 55 | struct icmp6_filter filter; |
| 56 | int fd; |
Simon Kelley | 0e88d53 | 2012-03-28 22:22:05 +0100 | [diff] [blame] | 57 | #if defined(IPV6_TCLASS) && defined(IPTOS_CLASS_CS6) |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 58 | int class = IPTOS_CLASS_CS6; |
| 59 | #endif |
| 60 | int val = 255; /* radvd uses this value */ |
Simon Kelley | 7b6dd88 | 2012-03-01 10:26:16 +0000 | [diff] [blame] | 61 | socklen_t len = sizeof(int); |
Simon Kelley | 353ae4d | 2012-03-19 20:07:51 +0000 | [diff] [blame] | 62 | struct dhcp_context *context; |
| 63 | |
Simon Kelley | 843c96b | 2012-02-27 17:42:38 +0000 | [diff] [blame] | 64 | /* ensure this is around even if we're not doing DHCPv6 */ |
| 65 | expand_buf(&daemon->outpacket, sizeof(struct dhcp_packet)); |
Simon Kelley | 353ae4d | 2012-03-19 20:07:51 +0000 | [diff] [blame] | 66 | |
| 67 | /* See if we're guessing SLAAC addresses, if so we need to recieve ping replies */ |
Simon Kelley | 1f77693 | 2012-12-16 19:46:08 +0000 | [diff] [blame] | 68 | for (context = daemon->dhcp6; context; context = context->next) |
Simon Kelley | 353ae4d | 2012-03-19 20:07:51 +0000 | [diff] [blame] | 69 | if ((context->flags & CONTEXT_RA_NAME)) |
| 70 | break; |
| 71 | |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 72 | ICMP6_FILTER_SETBLOCKALL(&filter); |
| 73 | ICMP6_FILTER_SETPASS(ND_ROUTER_SOLICIT, &filter); |
Simon Kelley | 353ae4d | 2012-03-19 20:07:51 +0000 | [diff] [blame] | 74 | if (context) |
| 75 | ICMP6_FILTER_SETPASS(ICMP6_ECHO_REPLY, &filter); |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 76 | |
| 77 | if ((fd = socket(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6)) == -1 || |
Simon Kelley | c5379c1 | 2012-02-24 20:05:52 +0000 | [diff] [blame] | 78 | getsockopt(fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &hop_limit, &len) || |
Simon Kelley | 0e88d53 | 2012-03-28 22:22:05 +0100 | [diff] [blame] | 79 | #if defined(IPV6_TCLASS) && defined(IPTOS_CLASS_CS6) |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 80 | setsockopt(fd, IPPROTO_IPV6, IPV6_TCLASS, &class, sizeof(class)) == -1 || |
| 81 | #endif |
| 82 | !fix_fd(fd) || |
| 83 | !set_ipv6pktinfo(fd) || |
| 84 | setsockopt(fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &val, sizeof(val)) || |
| 85 | setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &val, sizeof(val)) || |
| 86 | setsockopt(fd, IPPROTO_ICMPV6, ICMP6_FILTER, &filter, sizeof(filter)) == -1) |
| 87 | die (_("cannot create ICMPv6 socket: %s"), NULL, EC_BADNET); |
| 88 | |
| 89 | daemon->icmp6fd = fd; |
| 90 | |
Simon Kelley | 353ae4d | 2012-03-19 20:07:51 +0000 | [diff] [blame] | 91 | ra_start_unsolicted(now, NULL); |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 92 | } |
| 93 | |
Simon Kelley | 353ae4d | 2012-03-19 20:07:51 +0000 | [diff] [blame] | 94 | void ra_start_unsolicted(time_t now, struct dhcp_context *context) |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 95 | { |
Simon Kelley | 353ae4d | 2012-03-19 20:07:51 +0000 | [diff] [blame] | 96 | /* init timers so that we do ra's for some/all soon. some ra_times will end up zeroed |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 97 | if it's not appropriate to advertise those contexts. |
| 98 | This gets re-called on a netlink route-change to re-do the advertisement |
| 99 | and pick up new interfaces */ |
Simon Kelley | 6e3dba3 | 2012-12-16 21:52:45 +0000 | [diff] [blame] | 100 | |
Simon Kelley | 353ae4d | 2012-03-19 20:07:51 +0000 | [diff] [blame] | 101 | if (context) |
Simon Kelley | 1b75c1e | 2012-12-18 19:55:25 +0000 | [diff] [blame] | 102 | context->ra_short_period_start = context->ra_time = now; |
Simon Kelley | 353ae4d | 2012-03-19 20:07:51 +0000 | [diff] [blame] | 103 | else |
Simon Kelley | 1f77693 | 2012-12-16 19:46:08 +0000 | [diff] [blame] | 104 | for (context = daemon->dhcp6; context; context = context->next) |
Simon Kelley | 6e3dba3 | 2012-12-16 21:52:45 +0000 | [diff] [blame] | 105 | if (!(context->flags & CONTEXT_TEMPLATE)) |
Simon Kelley | 1b75c1e | 2012-12-18 19:55:25 +0000 | [diff] [blame] | 106 | { |
| 107 | context->ra_time = now + (rand16()/13000); /* range 0 - 5 */ |
| 108 | /* re-do frequently for a minute or so, in case the first gets lost. */ |
| 109 | context->ra_short_period_start = now; |
| 110 | } |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 111 | } |
| 112 | |
Simon Kelley | 1f77693 | 2012-12-16 19:46:08 +0000 | [diff] [blame] | 113 | void icmp6_packet(time_t now) |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 114 | { |
| 115 | char interface[IF_NAMESIZE+1]; |
| 116 | ssize_t sz; |
| 117 | int if_index = 0; |
| 118 | struct cmsghdr *cmptr; |
| 119 | struct msghdr msg; |
| 120 | union { |
| 121 | struct cmsghdr align; /* this ensures alignment */ |
| 122 | char control6[CMSG_SPACE(sizeof(struct in6_pktinfo))]; |
| 123 | } control_u; |
| 124 | struct sockaddr_in6 from; |
Simon Kelley | 5ef3327 | 2012-03-30 15:10:28 +0100 | [diff] [blame] | 125 | unsigned char *packet; |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 126 | struct iname *tmp; |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 127 | |
| 128 | /* Note: use outpacket for input buffer */ |
| 129 | msg.msg_control = control_u.control6; |
| 130 | msg.msg_controllen = sizeof(control_u); |
| 131 | msg.msg_flags = 0; |
| 132 | msg.msg_name = &from; |
| 133 | msg.msg_namelen = sizeof(from); |
| 134 | msg.msg_iov = &daemon->outpacket; |
| 135 | msg.msg_iovlen = 1; |
| 136 | |
| 137 | if ((sz = recv_dhcp_packet(daemon->icmp6fd, &msg)) == -1 || sz < 8) |
| 138 | return; |
Simon Kelley | 5ef3327 | 2012-03-30 15:10:28 +0100 | [diff] [blame] | 139 | |
| 140 | packet = (unsigned char *)daemon->outpacket.iov_base; |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 141 | |
| 142 | for (cmptr = CMSG_FIRSTHDR(&msg); cmptr; cmptr = CMSG_NXTHDR(&msg, cmptr)) |
| 143 | if (cmptr->cmsg_level == IPPROTO_IPV6 && cmptr->cmsg_type == daemon->v6pktinfo) |
| 144 | { |
| 145 | union { |
| 146 | unsigned char *c; |
| 147 | struct in6_pktinfo *p; |
| 148 | } p; |
| 149 | p.c = CMSG_DATA(cmptr); |
| 150 | |
| 151 | if_index = p.p->ipi6_ifindex; |
| 152 | } |
| 153 | |
| 154 | if (!indextoname(daemon->icmp6fd, if_index, interface)) |
| 155 | return; |
| 156 | |
Simon Kelley | 4f7b304 | 2012-11-28 21:27:02 +0000 | [diff] [blame] | 157 | if (!iface_check(AF_LOCAL, NULL, interface, NULL)) |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 158 | return; |
| 159 | |
| 160 | for (tmp = daemon->dhcp_except; tmp; tmp = tmp->next) |
| 161 | if (tmp->name && (strcmp(tmp->name, interface) == 0)) |
| 162 | return; |
| 163 | |
Simon Kelley | 8bc4cec | 2012-07-03 21:04:11 +0100 | [diff] [blame] | 164 | if (packet[1] != 0) |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 165 | return; |
Simon Kelley | 8bc4cec | 2012-07-03 21:04:11 +0100 | [diff] [blame] | 166 | |
Simon Kelley | 5ef3327 | 2012-03-30 15:10:28 +0100 | [diff] [blame] | 167 | if (packet[0] == ICMP6_ECHO_REPLY) |
| 168 | lease_ping_reply(&from.sin6_addr, packet, interface); |
| 169 | else if (packet[0] == ND_ROUTER_SOLICIT) |
Simon Kelley | 353ae4d | 2012-03-19 20:07:51 +0000 | [diff] [blame] | 170 | { |
Simon Kelley | 5ef3327 | 2012-03-30 15:10:28 +0100 | [diff] [blame] | 171 | char *mac = ""; |
| 172 | |
| 173 | /* look for link-layer address option for logging */ |
| 174 | if (sz >= 16 && packet[8] == ICMP6_OPT_SOURCE_MAC && (packet[9] * 8) + 8 <= sz) |
| 175 | { |
| 176 | print_mac(daemon->namebuff, &packet[10], (packet[9] * 8) - 2); |
| 177 | mac = daemon->namebuff; |
| 178 | } |
| 179 | |
| 180 | my_syslog(MS_DHCP | LOG_INFO, "RTR-SOLICIT(%s) %s", interface, mac); |
Simon Kelley | f632e56 | 2012-05-12 15:05:34 +0100 | [diff] [blame] | 181 | /* source address may not be valid in solicit request. */ |
Simon Kelley | 1f77693 | 2012-12-16 19:46:08 +0000 | [diff] [blame] | 182 | send_ra(now, if_index, interface, !IN6_IS_ADDR_UNSPECIFIED(&from.sin6_addr) ? &from.sin6_addr : NULL); |
Simon Kelley | 353ae4d | 2012-03-19 20:07:51 +0000 | [diff] [blame] | 183 | } |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 184 | } |
| 185 | |
Simon Kelley | 1f77693 | 2012-12-16 19:46:08 +0000 | [diff] [blame] | 186 | static void send_ra(time_t now, int iface, char *iface_name, struct in6_addr *dest) |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 187 | { |
| 188 | struct ra_packet *ra; |
| 189 | struct ra_param parm; |
| 190 | struct ifreq ifr; |
| 191 | struct sockaddr_in6 addr; |
| 192 | struct dhcp_context *context; |
Simon Kelley | 18f0fb0 | 2012-03-31 21:18:55 +0100 | [diff] [blame] | 193 | struct dhcp_netid iface_id; |
| 194 | struct dhcp_opt *opt_cfg; |
| 195 | int done_dns = 0; |
Simon Kelley | 3b43646 | 2012-12-28 11:55:45 +0000 | [diff] [blame^] | 196 | #ifdef HAVE_LINUX_NETWORK |
| 197 | FILE *f; |
| 198 | #endif |
| 199 | |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 200 | save_counter(0); |
| 201 | ra = expand(sizeof(struct ra_packet)); |
| 202 | |
Simon Kelley | 353ae4d | 2012-03-19 20:07:51 +0000 | [diff] [blame] | 203 | ra->type = ND_ROUTER_ADVERT; |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 204 | ra->code = 0; |
Simon Kelley | c5379c1 | 2012-02-24 20:05:52 +0000 | [diff] [blame] | 205 | ra->hop_limit = hop_limit; |
Simon Kelley | 884a6df | 2012-03-20 16:20:22 +0000 | [diff] [blame] | 206 | ra->flags = 0x00; |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 207 | ra->lifetime = htons(1800); /* AdvDefaultLifetime*/ |
| 208 | ra->reachable_time = 0; |
| 209 | ra->retrans_time = 0; |
| 210 | |
| 211 | parm.ind = iface; |
| 212 | parm.managed = 0; |
Simon Kelley | 30cd966 | 2012-03-25 20:44:38 +0100 | [diff] [blame] | 213 | parm.other = 0; |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 214 | parm.found_context = 0; |
| 215 | parm.if_name = iface_name; |
| 216 | parm.first = 1; |
Simon Kelley | 1f77693 | 2012-12-16 19:46:08 +0000 | [diff] [blame] | 217 | parm.now = now; |
Simon Kelley | 55b42f6 | 2012-12-21 16:53:15 +0000 | [diff] [blame] | 218 | parm.pref_time = 0; |
Simon Kelley | 1f77693 | 2012-12-16 19:46:08 +0000 | [diff] [blame] | 219 | |
Simon Kelley | 18f0fb0 | 2012-03-31 21:18:55 +0100 | [diff] [blame] | 220 | /* set tag with name == interface */ |
| 221 | iface_id.net = iface_name; |
| 222 | iface_id.next = NULL; |
| 223 | parm.tags = &iface_id; |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 224 | |
Simon Kelley | 1f77693 | 2012-12-16 19:46:08 +0000 | [diff] [blame] | 225 | for (context = daemon->dhcp6; context; context = context->next) |
Simon Kelley | 18f0fb0 | 2012-03-31 21:18:55 +0100 | [diff] [blame] | 226 | { |
| 227 | context->flags &= ~CONTEXT_RA_DONE; |
| 228 | context->netid.next = &context->netid; |
| 229 | } |
| 230 | |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 231 | if (!iface_enumerate(AF_INET6, &parm, add_prefixes) || |
| 232 | !parm.found_context) |
| 233 | return; |
| 234 | |
| 235 | strncpy(ifr.ifr_name, iface_name, IF_NAMESIZE); |
Simon Kelley | 3b43646 | 2012-12-28 11:55:45 +0000 | [diff] [blame^] | 236 | |
| 237 | #ifdef HAVE_LINUX_NETWORK |
| 238 | /* Note that IPv6 MTU is not necessarilly the same as the IPv4 MTU |
| 239 | available from SIOCGIFMTU */ |
| 240 | sprintf(daemon->namebuff, "/proc/sys/net/ipv6/conf/%s/mtu", iface_name); |
| 241 | if ((f = fopen(daemon->namebuff, "r"))) |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 242 | { |
Simon Kelley | 3b43646 | 2012-12-28 11:55:45 +0000 | [diff] [blame^] | 243 | if (fgets(daemon->namebuff, MAXDNAME, f)) |
| 244 | { |
| 245 | put_opt6_char(ICMP6_OPT_MTU); |
| 246 | put_opt6_char(1); |
| 247 | put_opt6_short(0); |
| 248 | put_opt6_long(atoi(daemon->namebuff)); |
| 249 | } |
| 250 | fclose(f); |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 251 | } |
Simon Kelley | 3b43646 | 2012-12-28 11:55:45 +0000 | [diff] [blame^] | 252 | #endif |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 253 | |
| 254 | iface_enumerate(AF_LOCAL, &iface, add_lla); |
Simon Kelley | 18f0fb0 | 2012-03-31 21:18:55 +0100 | [diff] [blame] | 255 | |
| 256 | /* RDNSS, RFC 6106, use relevant DHCP6 options */ |
| 257 | (void)option_filter(parm.tags, NULL, daemon->dhcp_opts6); |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 258 | |
Simon Kelley | 18f0fb0 | 2012-03-31 21:18:55 +0100 | [diff] [blame] | 259 | for (opt_cfg = daemon->dhcp_opts6; opt_cfg; opt_cfg = opt_cfg->next) |
| 260 | { |
| 261 | int i; |
| 262 | |
| 263 | /* netids match and not encapsulated? */ |
| 264 | if (!(opt_cfg->flags & DHOPT_TAGOK)) |
| 265 | continue; |
| 266 | |
| 267 | if (opt_cfg->opt == OPTION6_DNS_SERVER) |
| 268 | { |
| 269 | struct in6_addr *a = (struct in6_addr *)opt_cfg->val; |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 270 | |
Simon Kelley | 18f0fb0 | 2012-03-31 21:18:55 +0100 | [diff] [blame] | 271 | done_dns = 1; |
| 272 | if (opt_cfg->len == 0) |
| 273 | continue; |
| 274 | |
| 275 | put_opt6_char(ICMP6_OPT_RDNSS); |
| 276 | put_opt6_char((opt_cfg->len/8) + 1); |
| 277 | put_opt6_short(0); |
| 278 | put_opt6_long(1800); /* lifetime - twice RA retransmit */ |
| 279 | /* zero means "self" */ |
| 280 | for (i = 0; i < opt_cfg->len; i += IN6ADDRSZ, a++) |
| 281 | if (IN6_IS_ADDR_UNSPECIFIED(a)) |
Simon Kelley | 55b42f6 | 2012-12-21 16:53:15 +0000 | [diff] [blame] | 282 | put_opt6(&parm.link_global, IN6ADDRSZ); |
Simon Kelley | 18f0fb0 | 2012-03-31 21:18:55 +0100 | [diff] [blame] | 283 | else |
| 284 | put_opt6(a, IN6ADDRSZ); |
| 285 | } |
| 286 | |
| 287 | if (opt_cfg->opt == OPTION6_DOMAIN_SEARCH && opt_cfg->len != 0) |
| 288 | { |
| 289 | int len = ((opt_cfg->len+7)/8); |
| 290 | |
| 291 | put_opt6_char(ICMP6_OPT_DNSSL); |
| 292 | put_opt6_char(len + 1); |
| 293 | put_opt6_short(0); |
| 294 | put_opt6_long(1800); /* lifetime - twice RA retransmit */ |
| 295 | put_opt6(opt_cfg->val, opt_cfg->len); |
| 296 | |
| 297 | /* pad */ |
| 298 | for (i = opt_cfg->len; i < len * 8; i++) |
| 299 | put_opt6_char(0); |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | if (!done_dns) |
| 304 | { |
| 305 | /* default == us. */ |
| 306 | put_opt6_char(ICMP6_OPT_RDNSS); |
| 307 | put_opt6_char(3); |
| 308 | put_opt6_short(0); |
| 309 | put_opt6_long(1800); /* lifetime - twice RA retransmit */ |
Simon Kelley | 55b42f6 | 2012-12-21 16:53:15 +0000 | [diff] [blame] | 310 | put_opt6(&parm.link_global, IN6ADDRSZ); |
Simon Kelley | 18f0fb0 | 2012-03-31 21:18:55 +0100 | [diff] [blame] | 311 | } |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 312 | |
| 313 | /* set managed bits unless we're providing only RA on this link */ |
| 314 | if (parm.managed) |
Simon Kelley | 30cd966 | 2012-03-25 20:44:38 +0100 | [diff] [blame] | 315 | ra->flags |= 0x80; /* M flag, managed, */ |
| 316 | if (parm.other) |
| 317 | ra->flags |= 0x40; /* O flag, other */ |
| 318 | |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 319 | /* decide where we're sending */ |
| 320 | memset(&addr, 0, sizeof(addr)); |
Simon Kelley | 22d904d | 2012-02-26 20:13:45 +0000 | [diff] [blame] | 321 | #ifdef HAVE_SOCKADDR_SA_LEN |
| 322 | addr.sin6_len = sizeof(struct sockaddr_in6); |
| 323 | #endif |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 324 | addr.sin6_family = AF_INET6; |
| 325 | addr.sin6_port = htons(IPPROTO_ICMPV6); |
| 326 | if (dest) |
| 327 | { |
Simon Kelley | 353ae4d | 2012-03-19 20:07:51 +0000 | [diff] [blame] | 328 | addr.sin6_addr = *dest; |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 329 | if (IN6_IS_ADDR_LINKLOCAL(dest) || |
| 330 | IN6_IS_ADDR_MC_LINKLOCAL(dest)) |
| 331 | addr.sin6_scope_id = iface; |
| 332 | } |
| 333 | else |
Simon Kelley | f632e56 | 2012-05-12 15:05:34 +0100 | [diff] [blame] | 334 | inet_pton(AF_INET6, ALL_NODES, &addr.sin6_addr); |
Simon Kelley | 22d904d | 2012-02-26 20:13:45 +0000 | [diff] [blame] | 335 | |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 336 | send_from(daemon->icmp6fd, 0, daemon->outpacket.iov_base, save_counter(0), |
Simon Kelley | 50303b1 | 2012-04-04 22:13:17 +0100 | [diff] [blame] | 337 | (union mysockaddr *)&addr, (struct all_addr *)&parm.link_local, iface); |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 338 | |
| 339 | } |
| 340 | |
| 341 | static int add_prefixes(struct in6_addr *local, int prefix, |
Simon Kelley | bad7b87 | 2012-12-20 22:00:39 +0000 | [diff] [blame] | 342 | int scope, int if_index, int flags, |
Simon Kelley | 55b42f6 | 2012-12-21 16:53:15 +0000 | [diff] [blame] | 343 | unsigned int preferred, unsigned int valid, void *vparam) |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 344 | { |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 345 | struct ra_param *param = vparam; |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 346 | |
| 347 | (void)scope; /* warning */ |
Simon Kelley | ed8b68a | 2012-12-21 16:23:26 +0000 | [diff] [blame] | 348 | |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 349 | if (if_index == param->ind) |
| 350 | { |
| 351 | if (IN6_IS_ADDR_LINKLOCAL(local)) |
| 352 | param->link_local = *local; |
| 353 | else if (!IN6_IS_ADDR_LOOPBACK(local) && |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 354 | !IN6_IS_ADDR_MULTICAST(local)) |
| 355 | { |
Simon Kelley | 1e02a85 | 2012-03-29 11:07:25 +0100 | [diff] [blame] | 356 | int do_prefix = 0; |
Simon Kelley | c825754 | 2012-03-28 21:15:41 +0100 | [diff] [blame] | 357 | int do_slaac = 0; |
| 358 | int deprecate = 0; |
Simon Kelley | 3bc0d93 | 2012-12-28 11:31:44 +0000 | [diff] [blame] | 359 | int constructed = 0; |
Simon Kelley | c825754 | 2012-03-28 21:15:41 +0100 | [diff] [blame] | 360 | unsigned int time = 0xffffffff; |
Simon Kelley | 1e02a85 | 2012-03-29 11:07:25 +0100 | [diff] [blame] | 361 | struct dhcp_context *context; |
| 362 | |
Simon Kelley | 1f77693 | 2012-12-16 19:46:08 +0000 | [diff] [blame] | 363 | for (context = daemon->dhcp6; context; context = context->next) |
Simon Kelley | 6e3dba3 | 2012-12-16 21:52:45 +0000 | [diff] [blame] | 364 | if (!(context->flags & CONTEXT_TEMPLATE) && |
| 365 | prefix == context->prefix && |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 366 | is_same_net6(local, &context->start6, prefix) && |
| 367 | is_same_net6(local, &context->end6, prefix)) |
| 368 | { |
Simon Kelley | 30cd966 | 2012-03-25 20:44:38 +0100 | [diff] [blame] | 369 | if ((context->flags & |
| 370 | (CONTEXT_RA_ONLY | CONTEXT_RA_NAME | CONTEXT_RA_STATELESS))) |
| 371 | { |
| 372 | do_slaac = 1; |
Simon Kelley | 4723d49 | 2012-03-30 21:04:17 +0100 | [diff] [blame] | 373 | if (context->flags & CONTEXT_DHCP) |
Simon Kelley | 05e92e5 | 2012-03-30 22:24:15 +0100 | [diff] [blame] | 374 | { |
| 375 | param->other = 1; |
| 376 | if (!(context->flags & CONTEXT_RA_STATELESS)) |
| 377 | param->managed = 1; |
| 378 | } |
Simon Kelley | 30cd966 | 2012-03-25 20:44:38 +0100 | [diff] [blame] | 379 | } |
Simon Kelley | 884a6df | 2012-03-20 16:20:22 +0000 | [diff] [blame] | 380 | else |
Simon Kelley | 0010b47 | 2012-02-29 12:18:30 +0000 | [diff] [blame] | 381 | { |
| 382 | /* don't do RA for non-ra-only unless --enable-ra is set */ |
| 383 | if (!option_bool(OPT_RA)) |
| 384 | continue; |
| 385 | param->managed = 1; |
Simon Kelley | 30cd966 | 2012-03-25 20:44:38 +0100 | [diff] [blame] | 386 | param->other = 1; |
Simon Kelley | 0010b47 | 2012-02-29 12:18:30 +0000 | [diff] [blame] | 387 | } |
Simon Kelley | 1f77693 | 2012-12-16 19:46:08 +0000 | [diff] [blame] | 388 | |
Simon Kelley | 7f035f5 | 2012-12-22 21:27:08 +0000 | [diff] [blame] | 389 | /* find floor time, don't reduce below RA interval. */ |
Simon Kelley | c825754 | 2012-03-28 21:15:41 +0100 | [diff] [blame] | 390 | if (time > context->lease_time) |
Simon Kelley | 7f035f5 | 2012-12-22 21:27:08 +0000 | [diff] [blame] | 391 | { |
| 392 | time = context->lease_time; |
| 393 | if (time < 600u) |
| 394 | time = 600; |
| 395 | } |
| 396 | |
Simon Kelley | c825754 | 2012-03-28 21:15:41 +0100 | [diff] [blame] | 397 | if (context->flags & CONTEXT_DEPRECATE) |
| 398 | deprecate = 1; |
Simon Kelley | 3bc0d93 | 2012-12-28 11:31:44 +0000 | [diff] [blame] | 399 | |
| 400 | if (context->flags & CONTEXT_CONSTRUCTED) |
| 401 | constructed = 1; |
| 402 | |
Simon Kelley | c825754 | 2012-03-28 21:15:41 +0100 | [diff] [blame] | 403 | |
Simon Kelley | 18f0fb0 | 2012-03-31 21:18:55 +0100 | [diff] [blame] | 404 | /* collect dhcp-range tags */ |
| 405 | if (context->netid.next == &context->netid && context->netid.net) |
| 406 | { |
| 407 | context->netid.next = param->tags; |
| 408 | param->tags = &context->netid; |
| 409 | } |
| 410 | |
Simon Kelley | 5ae34bf | 2012-06-04 21:14:03 +0100 | [diff] [blame] | 411 | /* subsequent prefixes on the same interface |
| 412 | and subsequent instances of this prefix don't need timers. |
| 413 | Be careful not to find the same prefix twice with different |
| 414 | addresses. */ |
Simon Kelley | 1e02a85 | 2012-03-29 11:07:25 +0100 | [diff] [blame] | 415 | if (!(context->flags & CONTEXT_RA_DONE)) |
| 416 | { |
Simon Kelley | 5ae34bf | 2012-06-04 21:14:03 +0100 | [diff] [blame] | 417 | if (!param->first) |
| 418 | context->ra_time = 0; |
Simon Kelley | 1e02a85 | 2012-03-29 11:07:25 +0100 | [diff] [blame] | 419 | context->flags |= CONTEXT_RA_DONE; |
| 420 | do_prefix = 1; |
| 421 | } |
Simon Kelley | 5ae34bf | 2012-06-04 21:14:03 +0100 | [diff] [blame] | 422 | |
| 423 | param->first = 0; |
| 424 | param->found_context = 1; |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 425 | } |
Simon Kelley | 1f77693 | 2012-12-16 19:46:08 +0000 | [diff] [blame] | 426 | |
Simon Kelley | ed8b68a | 2012-12-21 16:23:26 +0000 | [diff] [blame] | 427 | /* configured time is ceiling */ |
Simon Kelley | 3bc0d93 | 2012-12-28 11:31:44 +0000 | [diff] [blame] | 428 | if (!constructed || valid > time) |
Simon Kelley | ed8b68a | 2012-12-21 16:23:26 +0000 | [diff] [blame] | 429 | valid = time; |
| 430 | |
Simon Kelley | 3bc0d93 | 2012-12-28 11:31:44 +0000 | [diff] [blame] | 431 | if (flags & IFACE_DEPRECATED) |
Simon Kelley | ed8b68a | 2012-12-21 16:23:26 +0000 | [diff] [blame] | 432 | preferred = 0; |
Simon Kelley | 1e02a85 | 2012-03-29 11:07:25 +0100 | [diff] [blame] | 433 | |
Simon Kelley | 3bc0d93 | 2012-12-28 11:31:44 +0000 | [diff] [blame] | 434 | if (deprecate) |
| 435 | time = 0; |
| 436 | |
| 437 | /* configured time is ceiling */ |
| 438 | if (!constructed || preferred > time) |
| 439 | preferred = time; |
| 440 | |
Simon Kelley | 55b42f6 | 2012-12-21 16:53:15 +0000 | [diff] [blame] | 441 | if (preferred > param->pref_time) |
| 442 | { |
| 443 | param->pref_time = preferred; |
| 444 | param->link_global = *local; |
| 445 | } |
| 446 | |
Simon Kelley | 1e02a85 | 2012-03-29 11:07:25 +0100 | [diff] [blame] | 447 | if (do_prefix) |
Simon Kelley | c825754 | 2012-03-28 21:15:41 +0100 | [diff] [blame] | 448 | { |
Simon Kelley | 1e02a85 | 2012-03-29 11:07:25 +0100 | [diff] [blame] | 449 | struct prefix_opt *opt; |
| 450 | |
| 451 | if ((opt = expand(sizeof(struct prefix_opt)))) |
| 452 | { |
Simon Kelley | 5ef3327 | 2012-03-30 15:10:28 +0100 | [diff] [blame] | 453 | /* zero net part of address */ |
| 454 | setaddr6part(local, addr6part(local) & ~((prefix == 64) ? (u64)-1LL : (1LLU << (128 - prefix)) - 1LLU)); |
| 455 | |
Simon Kelley | 1e02a85 | 2012-03-29 11:07:25 +0100 | [diff] [blame] | 456 | opt->type = ICMP6_OPT_PREFIX; |
| 457 | opt->len = 4; |
| 458 | opt->prefix_len = prefix; |
Simon Kelley | fd05f12 | 2012-08-12 17:48:50 +0100 | [diff] [blame] | 459 | /* autonomous only if we're not doing dhcp, always set "on-link" */ |
| 460 | opt->flags = do_slaac ? 0xC0 : 0x80; |
Simon Kelley | ed8b68a | 2012-12-21 16:23:26 +0000 | [diff] [blame] | 461 | opt->valid_lifetime = htonl(valid); |
| 462 | opt->preferred_lifetime = htonl(preferred); |
Simon Kelley | 5ef3327 | 2012-03-30 15:10:28 +0100 | [diff] [blame] | 463 | opt->reserved = 0; |
Simon Kelley | 1e02a85 | 2012-03-29 11:07:25 +0100 | [diff] [blame] | 464 | opt->prefix = *local; |
Simon Kelley | 1e02a85 | 2012-03-29 11:07:25 +0100 | [diff] [blame] | 465 | |
Simon Kelley | 5ef3327 | 2012-03-30 15:10:28 +0100 | [diff] [blame] | 466 | inet_ntop(AF_INET6, local, daemon->addrbuff, ADDRSTRLEN); |
Simon Kelley | 1e02a85 | 2012-03-29 11:07:25 +0100 | [diff] [blame] | 467 | my_syslog(MS_DHCP | LOG_INFO, "RTR-ADVERT(%s) %s", param->if_name, daemon->addrbuff); |
| 468 | } |
Simon Kelley | c825754 | 2012-03-28 21:15:41 +0100 | [diff] [blame] | 469 | } |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 470 | } |
| 471 | } |
| 472 | return 1; |
| 473 | } |
| 474 | |
| 475 | static int add_lla(int index, unsigned int type, char *mac, size_t maclen, void *parm) |
| 476 | { |
| 477 | (void)type; |
| 478 | |
| 479 | if (index == *((int *)parm)) |
| 480 | { |
| 481 | /* size is in units of 8 octets and includes type and length (2 bytes) |
| 482 | add 7 to round up */ |
| 483 | int len = (maclen + 9) >> 3; |
| 484 | unsigned char *p = expand(len << 3); |
| 485 | memset(p, 0, len << 3); |
| 486 | *p++ = ICMP6_OPT_SOURCE_MAC; |
| 487 | *p++ = len; |
| 488 | memcpy(p, mac, maclen); |
| 489 | |
| 490 | return 0; |
| 491 | } |
| 492 | |
| 493 | return 1; |
| 494 | } |
| 495 | |
| 496 | time_t periodic_ra(time_t now) |
| 497 | { |
| 498 | struct search_param param; |
| 499 | struct dhcp_context *context; |
| 500 | time_t next_event; |
| 501 | char interface[IF_NAMESIZE+1]; |
| 502 | |
| 503 | param.now = now; |
Simon Kelley | 29d28dd | 2012-12-03 14:05:59 +0000 | [diff] [blame] | 504 | param.iface = 0; |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 505 | |
| 506 | while (1) |
| 507 | { |
| 508 | /* find overdue events, and time of first future event */ |
Simon Kelley | 1f77693 | 2012-12-16 19:46:08 +0000 | [diff] [blame] | 509 | for (next_event = 0, context = daemon->dhcp6; context; context = context->next) |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 510 | if (context->ra_time != 0) |
| 511 | { |
Simon Kelley | 7dbe981 | 2012-03-25 14:49:54 +0100 | [diff] [blame] | 512 | if (difftime(context->ra_time, now) <= 0.0) |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 513 | break; /* overdue */ |
| 514 | |
Simon Kelley | 7dbe981 | 2012-03-25 14:49:54 +0100 | [diff] [blame] | 515 | if (next_event == 0 || difftime(next_event, context->ra_time) > 0.0) |
| 516 | next_event = context->ra_time; |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 517 | } |
| 518 | |
| 519 | /* none overdue */ |
| 520 | if (!context) |
| 521 | break; |
| 522 | |
| 523 | /* There's a context overdue, but we can't find an interface |
| 524 | associated with it, because it's for a subnet we dont |
| 525 | have an interface on. Probably we're doing DHCP on |
| 526 | a remote subnet via a relay. Zero the timer, since we won't |
| 527 | ever be able to send ra's and satistfy it. */ |
| 528 | if (iface_enumerate(AF_INET6, ¶m, iface_search)) |
| 529 | context->ra_time = 0; |
Simon Kelley | 29d28dd | 2012-12-03 14:05:59 +0000 | [diff] [blame] | 530 | else if (param.iface != 0 && |
| 531 | indextoname(daemon->icmp6fd, param.iface, interface) && |
Simon Kelley | f7fe362 | 2012-12-04 20:55:54 +0000 | [diff] [blame] | 532 | iface_check(AF_LOCAL, NULL, interface, NULL)) |
Simon Kelley | 421594f | 2012-12-02 12:17:35 +0000 | [diff] [blame] | 533 | { |
| 534 | struct iname *tmp; |
| 535 | for (tmp = daemon->dhcp_except; tmp; tmp = tmp->next) |
| 536 | if (tmp->name && (strcmp(tmp->name, interface) == 0)) |
| 537 | break; |
| 538 | if (!tmp) |
Simon Kelley | 1f77693 | 2012-12-16 19:46:08 +0000 | [diff] [blame] | 539 | send_ra(now, param.iface, interface, NULL); |
Simon Kelley | 421594f | 2012-12-02 12:17:35 +0000 | [diff] [blame] | 540 | } |
| 541 | } |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 542 | return next_event; |
| 543 | } |
Simon Kelley | 421594f | 2012-12-02 12:17:35 +0000 | [diff] [blame] | 544 | |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 545 | static int iface_search(struct in6_addr *local, int prefix, |
Simon Kelley | bad7b87 | 2012-12-20 22:00:39 +0000 | [diff] [blame] | 546 | int scope, int if_index, int flags, |
Simon Kelley | 1f77693 | 2012-12-16 19:46:08 +0000 | [diff] [blame] | 547 | int preferred, int valid, void *vparam) |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 548 | { |
| 549 | struct search_param *param = vparam; |
Simon Kelley | 741c295 | 2012-02-25 13:09:18 +0000 | [diff] [blame] | 550 | struct dhcp_context *context; |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 551 | |
| 552 | (void)scope; |
Simon Kelley | 1f77693 | 2012-12-16 19:46:08 +0000 | [diff] [blame] | 553 | (void)preferred; |
| 554 | (void)valid; |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 555 | |
Simon Kelley | 1f77693 | 2012-12-16 19:46:08 +0000 | [diff] [blame] | 556 | for (context = daemon->dhcp6; context; context = context->next) |
Simon Kelley | 6e3dba3 | 2012-12-16 21:52:45 +0000 | [diff] [blame] | 557 | if (!(context->flags & CONTEXT_TEMPLATE) && |
| 558 | prefix == context->prefix && |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 559 | is_same_net6(local, &context->start6, prefix) && |
Simon Kelley | 6e3dba3 | 2012-12-16 21:52:45 +0000 | [diff] [blame] | 560 | is_same_net6(local, &context->end6, prefix) && |
| 561 | context->ra_time != 0 && |
| 562 | difftime(context->ra_time, param->now) <= 0.0) |
| 563 | { |
| 564 | /* found an interface that's overdue for RA determine new |
| 565 | timeout value and arrange for RA to be sent unless interface is |
| 566 | still doing DAD.*/ |
| 567 | |
Simon Kelley | bad7b87 | 2012-12-20 22:00:39 +0000 | [diff] [blame] | 568 | if (!(flags & IFACE_TENTATIVE)) |
Simon Kelley | 6e3dba3 | 2012-12-16 21:52:45 +0000 | [diff] [blame] | 569 | param->iface = if_index; |
| 570 | |
Simon Kelley | 1b75c1e | 2012-12-18 19:55:25 +0000 | [diff] [blame] | 571 | if (difftime(param->now, context->ra_short_period_start) < 60.0) |
Simon Kelley | 6e3dba3 | 2012-12-16 21:52:45 +0000 | [diff] [blame] | 572 | /* range 5 - 20 */ |
| 573 | context->ra_time = param->now + 5 + (rand16()/4400); |
| 574 | else |
| 575 | /* range 450 - 600 */ |
| 576 | context->ra_time = param->now + 450 + (rand16()/440); |
| 577 | |
| 578 | /* zero timers for other contexts on the same subnet, so they don't timeout |
| 579 | independently */ |
| 580 | for (context = context->next; context; context = context->next) |
| 581 | if (prefix == context->prefix && |
| 582 | is_same_net6(local, &context->start6, prefix) && |
| 583 | is_same_net6(local, &context->end6, prefix)) |
| 584 | context->ra_time = 0; |
| 585 | |
| 586 | return 0; /* found, abort */ |
| 587 | } |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 588 | |
| 589 | return 1; /* keep searching */ |
| 590 | } |
| 591 | |
Simon Kelley | 801ca9a | 2012-03-06 19:30:17 +0000 | [diff] [blame] | 592 | |
Simon Kelley | c5ad4e7 | 2012-02-24 16:06:20 +0000 | [diff] [blame] | 593 | #endif |