blob: 38d605c6d162448b93317afdcebf8a8fcef6ba21 [file] [log] [blame]
Eric Andersen51b8bd62002-07-03 11:46:38 +00001/* vi: set sw=4 ts=4: */
2/*
Eric Andersenc7bda1c2004-03-15 08:29:22 +00003 * $Id: ping6.c,v 1.6 2004/03/15 08:28:48 andersen Exp $
Eric Andersen51b8bd62002-07-03 11:46:38 +00004 * Mini ping implementation for busybox
5 *
6 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
7 *
"Robert P. J. Day"2819f752006-07-11 11:32:31 +00008 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
Eric Andersen51b8bd62002-07-03 11:46:38 +00009 *
10 * This version of ping is adapted from the ping in netkit-base 0.10,
11 * which is:
12 *
13 * Copyright (c) 1989 The Regents of the University of California.
14 * All rights reserved.
15 *
16 * This code is derived from software contributed to Berkeley by
17 * Mike Muuss.
Eric Andersenc7bda1c2004-03-15 08:29:22 +000018 *
Eric Andersen51b8bd62002-07-03 11:46:38 +000019 * Original copyright notice is retained at the end of this file.
20 *
21 * This version is an adaptation of ping.c from busybox.
22 * The code was modified by Bart Visscher <magick@linux-fan.com>
23 */
24
25#include <sys/param.h>
26#include <sys/socket.h>
27#include <sys/file.h>
Eric Andersen51b8bd62002-07-03 11:46:38 +000028#include <sys/times.h>
Mike Frysinger06adf5f2006-03-22 00:25:07 +000029#include <signal.h>
Eric Andersen51b8bd62002-07-03 11:46:38 +000030
31#include <netinet/in.h>
32#include <netinet/ip6.h>
33#include <netinet/icmp6.h>
34#include <arpa/inet.h>
35#include <net/if.h>
36#include <netdb.h>
37#include <stdio.h>
38#include <stdlib.h>
39#include <errno.h>
40#include <unistd.h>
41#include <string.h>
42#include <stdlib.h>
43#include <stddef.h> /* offsetof */
44#include "busybox.h"
45
Rob Landleybc68cd12006-03-10 19:22:06 +000046enum {
47 DEFDATALEN = 56,
48 MAXIPLEN = 60,
49 MAXICMPLEN = 76,
50 MAXPACKET = 65468,
51 MAX_DUP_CHK = (8 * 128),
52 MAXWAIT = 10,
53 PINGINTERVAL = 1 /* second */
54};
Eric Andersen51b8bd62002-07-03 11:46:38 +000055
56#define O_QUIET (1 << 0)
57#define O_VERBOSE (1 << 1)
58
59#define A(bit) rcvd_tbl[(bit)>>3] /* identify byte in array */
60#define B(bit) (1 << ((bit) & 0x07)) /* identify bit in byte */
61#define SET(bit) (A(bit) |= B(bit))
62#define CLR(bit) (A(bit) &= (~B(bit)))
63#define TST(bit) (A(bit) & B(bit))
64
65static void ping(const char *host);
66
67/* simple version */
68#ifndef CONFIG_FEATURE_FANCY_PING6
Eric Andersen787ff552003-05-22 07:10:22 +000069static struct hostent *h;
70
Denis Vlasenkocb6874c2006-09-02 16:13:36 +000071static void noresp(int ign)
Eric Andersen4e486a52003-01-12 06:08:33 +000072{
73 printf("No response from %s\n", h->h_name);
74 exit(EXIT_FAILURE);
75}
Eric Andersen51b8bd62002-07-03 11:46:38 +000076
77static void ping(const char *host)
78{
Eric Andersen51b8bd62002-07-03 11:46:38 +000079 struct sockaddr_in6 pingaddr;
80 struct icmp6_hdr *pkt;
81 int pingsock, c;
82 int sockopt;
83 char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN];
84
Eric Andersen51b8bd62002-07-03 11:46:38 +000085 pingsock = create_icmp6_socket();
86
87 memset(&pingaddr, 0, sizeof(struct sockaddr_in));
88
89 pingaddr.sin6_family = AF_INET6;
90 h = xgethostbyname2(host, AF_INET6);
91 memcpy(&pingaddr.sin6_addr, h->h_addr, sizeof(pingaddr.sin6_addr));
92
93 pkt = (struct icmp6_hdr *) packet;
94 memset(pkt, 0, sizeof(packet));
95 pkt->icmp6_type = ICMP6_ECHO_REQUEST;
96
97 sockopt = offsetof(struct icmp6_hdr, icmp6_cksum);
98 setsockopt(pingsock, SOL_RAW, IPV6_CHECKSUM, (char *) &sockopt,
99 sizeof(sockopt));
100
Rob Landley07a637d2006-04-01 17:28:11 +0000101 c = sendto(pingsock, packet, DEFDATALEN + sizeof (struct icmp6_hdr), 0,
Eric Andersen51b8bd62002-07-03 11:46:38 +0000102 (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in6));
103
Denis Vlasenkocb6874c2006-09-02 16:13:36 +0000104 if (c < 0 || c != sizeof(packet)) {
105 if (ENABLE_FEATURE_CLEAN_UP) close(pingsock);
Manuel Novoa III cad53642003-03-19 09:13:01 +0000106 bb_perror_msg_and_die("sendto");
Denis Vlasenkocb6874c2006-09-02 16:13:36 +0000107 }
Eric Andersen51b8bd62002-07-03 11:46:38 +0000108
109 signal(SIGALRM, noresp);
110 alarm(5); /* give the host 5000ms to respond */
111 /* listen for replies */
112 while (1) {
113 struct sockaddr_in6 from;
114 size_t fromlen = sizeof(from);
115
116 if ((c = recvfrom(pingsock, packet, sizeof(packet), 0,
117 (struct sockaddr *) &from, &fromlen)) < 0) {
118 if (errno == EINTR)
119 continue;
Manuel Novoa III cad53642003-03-19 09:13:01 +0000120 bb_perror_msg("recvfrom");
Eric Andersen51b8bd62002-07-03 11:46:38 +0000121 continue;
122 }
123 if (c >= 8) { /* icmp6_hdr */
124 pkt = (struct icmp6_hdr *) packet;
125 if (pkt->icmp6_type == ICMP6_ECHO_REPLY)
126 break;
127 }
128 }
Denis Vlasenkocb6874c2006-09-02 16:13:36 +0000129 if (ENABLE_FEATURE_CLEAN_UP) close(pingsock);
Eric Andersen51b8bd62002-07-03 11:46:38 +0000130 printf("%s is alive!\n", h->h_name);
131 return;
132}
133
Rob Landleydfba7412006-03-06 20:47:33 +0000134int ping6_main(int argc, char **argv)
Eric Andersen51b8bd62002-07-03 11:46:38 +0000135{
136 argc--;
137 argv++;
138 if (argc < 1)
Manuel Novoa III cad53642003-03-19 09:13:01 +0000139 bb_show_usage();
Eric Andersen51b8bd62002-07-03 11:46:38 +0000140 ping(*argv);
141 return EXIT_SUCCESS;
142}
143
144#else /* ! CONFIG_FEATURE_FANCY_PING6 */
145/* full(er) version */
146static struct sockaddr_in6 pingaddr;
147static int pingsock = -1;
148static int datalen; /* intentionally uninitialized to work around gcc bug */
Denis Vlasenkodb7f2e52006-09-02 16:16:23 +0000149static int if_index;
Eric Andersen51b8bd62002-07-03 11:46:38 +0000150
151static long ntransmitted, nreceived, nrepeats, pingcount;
152static int myid, options;
153static unsigned long tmin = ULONG_MAX, tmax, tsum;
154static char rcvd_tbl[MAX_DUP_CHK / 8];
155
Denis Vlasenkocb6874c2006-09-02 16:13:36 +0000156static struct hostent *hostent;
Eric Andersen51b8bd62002-07-03 11:46:38 +0000157
158static void sendping(int);
159static void pingstats(int);
160static void unpack(char *, int, struct sockaddr_in6 *, int);
161
162/**************************************************************************/
163
164static void pingstats(int junk)
165{
166 int status;
167
168 signal(SIGINT, SIG_IGN);
169
170 printf("\n--- %s ping statistics ---\n", hostent->h_name);
171 printf("%ld packets transmitted, ", ntransmitted);
172 printf("%ld packets received, ", nreceived);
173 if (nrepeats)
174 printf("%ld duplicates, ", nrepeats);
175 if (ntransmitted)
176 printf("%ld%% packet loss\n",
177 (ntransmitted - nreceived) * 100 / ntransmitted);
178 if (nreceived)
179 printf("round-trip min/avg/max = %lu.%lu/%lu.%lu/%lu.%lu ms\n",
180 tmin / 10, tmin % 10,
181 (tsum / (nreceived + nrepeats)) / 10,
182 (tsum / (nreceived + nrepeats)) % 10, tmax / 10, tmax % 10);
183 if (nreceived != 0)
184 status = EXIT_SUCCESS;
185 else
186 status = EXIT_FAILURE;
187 exit(status);
188}
189
190static void sendping(int junk)
191{
192 struct icmp6_hdr *pkt;
193 int i;
Rob Landley07a637d2006-04-01 17:28:11 +0000194 char packet[datalen + sizeof (struct icmp6_hdr)];
Eric Andersen51b8bd62002-07-03 11:46:38 +0000195
196 pkt = (struct icmp6_hdr *) packet;
197
198 pkt->icmp6_type = ICMP6_ECHO_REQUEST;
199 pkt->icmp6_code = 0;
200 pkt->icmp6_cksum = 0;
Denis Vlasenkod53dd3e2006-09-02 16:11:44 +0000201 pkt->icmp6_seq = SWAP_BE16(ntransmitted++);
Eric Andersen51b8bd62002-07-03 11:46:38 +0000202 pkt->icmp6_id = myid;
203 CLR(pkt->icmp6_seq % MAX_DUP_CHK);
204
205 gettimeofday((struct timeval *) &pkt->icmp6_data8[4], NULL);
206
207 i = sendto(pingsock, packet, sizeof(packet), 0,
208 (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in6));
209
210 if (i < 0)
Manuel Novoa III cad53642003-03-19 09:13:01 +0000211 bb_perror_msg_and_die("sendto");
Eric Andersen51b8bd62002-07-03 11:46:38 +0000212 else if ((size_t)i != sizeof(packet))
Manuel Novoa III cad53642003-03-19 09:13:01 +0000213 bb_error_msg_and_die("ping wrote %d chars; %d expected", i,
Eric Andersen51b8bd62002-07-03 11:46:38 +0000214 (int)sizeof(packet));
215
216 signal(SIGALRM, sendping);
217 if (pingcount == 0 || ntransmitted < pingcount) { /* schedule next in 1s */
218 alarm(PINGINTERVAL);
219 } else { /* done, wait for the last ping to come back */
220 /* todo, don't necessarily need to wait so long... */
221 signal(SIGALRM, pingstats);
222 alarm(MAXWAIT);
223 }
224}
225
Mike Frysinger2f135fc2006-03-13 23:48:18 +0000226/* RFC3542 changed some definitions from RFC2292 for no good reason, whee !
227 * the newer 3542 uses a MLD_ prefix where as 2292 uses ICMP6_ prefix */
228#ifndef MLD_LISTENER_QUERY
229# define MLD_LISTENER_QUERY ICMP6_MEMBERSHIP_QUERY
Mike Frysinger9e094552006-03-10 23:41:29 +0000230#endif
Mike Frysinger2f135fc2006-03-13 23:48:18 +0000231#ifndef MLD_LISTENER_REPORT
232# define MLD_LISTENER_REPORT ICMP6_MEMBERSHIP_REPORT
Mike Frysinger9e094552006-03-10 23:41:29 +0000233#endif
Mike Frysinger2f135fc2006-03-13 23:48:18 +0000234#ifndef MLD_LISTENER_REDUCTION
235# define MLD_LISTENER_REDUCTION ICMP6_MEMBERSHIP_REDUCTION
Mike Frysinger9e094552006-03-10 23:41:29 +0000236#endif
Eric Andersen51b8bd62002-07-03 11:46:38 +0000237static char *icmp6_type_name (int id)
238{
239 switch (id) {
240 case ICMP6_DST_UNREACH: return "Destination Unreachable";
241 case ICMP6_PACKET_TOO_BIG: return "Packet too big";
242 case ICMP6_TIME_EXCEEDED: return "Time Exceeded";
243 case ICMP6_PARAM_PROB: return "Parameter Problem";
244 case ICMP6_ECHO_REPLY: return "Echo Reply";
245 case ICMP6_ECHO_REQUEST: return "Echo Request";
Mike Frysinger2f135fc2006-03-13 23:48:18 +0000246 case MLD_LISTENER_QUERY: return "Listener Query";
247 case MLD_LISTENER_REPORT: return "Listener Report";
248 case MLD_LISTENER_REDUCTION: return "Listener Reduction";
Tim Rikerc1ef7bd2006-01-25 00:08:53 +0000249 default: return "unknown ICMP type";
Eric Andersen51b8bd62002-07-03 11:46:38 +0000250 }
251}
252
253static void unpack(char *packet, int sz, struct sockaddr_in6 *from, int hoplimit)
254{
255 struct icmp6_hdr *icmppkt;
256 struct timeval tv, *tp;
257 int dupflag;
258 unsigned long triptime;
259 char buf[INET6_ADDRSTRLEN];
260
261 gettimeofday(&tv, NULL);
262
263 /* discard if too short */
264 if (sz < (datalen + sizeof(struct icmp6_hdr)))
265 return;
266
267 icmppkt = (struct icmp6_hdr *) packet;
268
269 if (icmppkt->icmp6_id != myid)
Denis Vlasenkocb6874c2006-09-02 16:13:36 +0000270 return; /* not our ping */
Eric Andersen51b8bd62002-07-03 11:46:38 +0000271
272 if (icmppkt->icmp6_type == ICMP6_ECHO_REPLY) {
Denis Vlasenkocb6874c2006-09-02 16:13:36 +0000273 ++nreceived;
Eric Andersen51b8bd62002-07-03 11:46:38 +0000274 tp = (struct timeval *) &icmppkt->icmp6_data8[4];
275
276 if ((tv.tv_usec -= tp->tv_usec) < 0) {
277 --tv.tv_sec;
278 tv.tv_usec += 1000000;
279 }
280 tv.tv_sec -= tp->tv_sec;
281
282 triptime = tv.tv_sec * 10000 + (tv.tv_usec / 100);
283 tsum += triptime;
284 if (triptime < tmin)
285 tmin = triptime;
286 if (triptime > tmax)
287 tmax = triptime;
288
289 if (TST(icmppkt->icmp6_seq % MAX_DUP_CHK)) {
290 ++nrepeats;
291 --nreceived;
292 dupflag = 1;
293 } else {
294 SET(icmppkt->icmp6_seq % MAX_DUP_CHK);
295 dupflag = 0;
296 }
297
298 if (options & O_QUIET)
299 return;
300
301 printf("%d bytes from %s: icmp6_seq=%u", sz,
Rob Landley7a260f02006-06-19 03:20:03 +0000302 inet_ntop(AF_INET6, &pingaddr.sin6_addr,
Eric Andersen51b8bd62002-07-03 11:46:38 +0000303 buf, sizeof(buf)),
304 icmppkt->icmp6_seq);
Eric Andersenc7bda1c2004-03-15 08:29:22 +0000305 printf(" ttl=%d time=%lu.%lu ms", hoplimit,
Eric Andersen51b8bd62002-07-03 11:46:38 +0000306 triptime / 10, triptime % 10);
307 if (dupflag)
308 printf(" (DUP!)");
309 printf("\n");
Eric Andersenc7bda1c2004-03-15 08:29:22 +0000310 } else
Eric Andersen51b8bd62002-07-03 11:46:38 +0000311 if (icmppkt->icmp6_type != ICMP6_ECHO_REQUEST)
Manuel Novoa III cad53642003-03-19 09:13:01 +0000312 bb_error_msg("Warning: Got ICMP %d (%s)",
Eric Andersen51b8bd62002-07-03 11:46:38 +0000313 icmppkt->icmp6_type, icmp6_type_name (icmppkt->icmp6_type));
314}
315
316static void ping(const char *host)
317{
318 char packet[datalen + MAXIPLEN + MAXICMPLEN];
319 char buf[INET6_ADDRSTRLEN];
320 int sockopt;
321 struct msghdr msg;
322 struct sockaddr_in6 from;
323 struct iovec iov;
324 char control_buf[CMSG_SPACE(36)];
325
326 pingsock = create_icmp6_socket();
327
328 memset(&pingaddr, 0, sizeof(struct sockaddr_in));
329
330 pingaddr.sin6_family = AF_INET6;
331 hostent = xgethostbyname2(host, AF_INET6);
332 if (hostent->h_addrtype != AF_INET6)
Manuel Novoa III cad53642003-03-19 09:13:01 +0000333 bb_error_msg_and_die("unknown address type; only AF_INET6 is currently supported.");
Eric Andersen51b8bd62002-07-03 11:46:38 +0000334
335 memcpy(&pingaddr.sin6_addr, hostent->h_addr, sizeof(pingaddr.sin6_addr));
336
337#ifdef ICMP6_FILTER
338 {
339 struct icmp6_filter filt;
340 if (!(options & O_VERBOSE)) {
341 ICMP6_FILTER_SETBLOCKALL(&filt);
Denis Vlasenkocb6874c2006-09-02 16:13:36 +0000342 ICMP6_FILTER_SETPASS(ICMP6_ECHO_REPLY, &filt);
Eric Andersen51b8bd62002-07-03 11:46:38 +0000343 } else {
344 ICMP6_FILTER_SETPASSALL(&filt);
345 }
346 if (setsockopt(pingsock, IPPROTO_ICMPV6, ICMP6_FILTER, &filt,
347 sizeof(filt)) < 0)
Manuel Novoa III cad53642003-03-19 09:13:01 +0000348 bb_error_msg_and_die("setsockopt(ICMP6_FILTER)");
Eric Andersen51b8bd62002-07-03 11:46:38 +0000349 }
350#endif /*ICMP6_FILTER*/
351
352 /* enable broadcast pings */
353 sockopt = 1;
354 setsockopt(pingsock, SOL_SOCKET, SO_BROADCAST, (char *) &sockopt,
355 sizeof(sockopt));
356
357 /* set recv buf for broadcast pings */
358 sockopt = 48 * 1024;
359 setsockopt(pingsock, SOL_SOCKET, SO_RCVBUF, (char *) &sockopt,
360 sizeof(sockopt));
361
362 sockopt = offsetof(struct icmp6_hdr, icmp6_cksum);
363 setsockopt(pingsock, SOL_RAW, IPV6_CHECKSUM, (char *) &sockopt,
364 sizeof(sockopt));
365
366 sockopt = 1;
367 setsockopt(pingsock, SOL_IPV6, IPV6_HOPLIMIT, (char *) &sockopt,
368 sizeof(sockopt));
369
Denis Vlasenkodb7f2e52006-09-02 16:16:23 +0000370 if (if_index)
371 pingaddr.sin6_scope_id = if_index;
Eric Andersen51b8bd62002-07-03 11:46:38 +0000372
373 printf("PING %s (%s): %d data bytes\n",
374 hostent->h_name,
Denis Vlasenkocb6874c2006-09-02 16:13:36 +0000375 inet_ntop(AF_INET6, &pingaddr.sin6_addr,
376 buf, sizeof(buf)),
Eric Andersen51b8bd62002-07-03 11:46:38 +0000377 datalen);
378
379 signal(SIGINT, pingstats);
380
381 /* start the ping's going ... */
382 sendping(0);
383
384 /* listen for replies */
Denis Vlasenkocb6874c2006-09-02 16:13:36 +0000385 msg.msg_name = &from;
386 msg.msg_namelen = sizeof(from);
387 msg.msg_iov = &iov;
388 msg.msg_iovlen = 1;
389 msg.msg_control = control_buf;
390 iov.iov_base = packet;
391 iov.iov_len = sizeof(packet);
Eric Andersen51b8bd62002-07-03 11:46:38 +0000392 while (1) {
393 int c;
394 struct cmsghdr *cmsgptr = NULL;
Denis Vlasenkocb6874c2006-09-02 16:13:36 +0000395 int hoplimit = -1;
396 msg.msg_controllen = sizeof(control_buf);
Eric Andersen51b8bd62002-07-03 11:46:38 +0000397
398 if ((c = recvmsg(pingsock, &msg, 0)) < 0) {
399 if (errno == EINTR)
400 continue;
Manuel Novoa III cad53642003-03-19 09:13:01 +0000401 bb_perror_msg("recvfrom");
Eric Andersen51b8bd62002-07-03 11:46:38 +0000402 continue;
403 }
404 for (cmsgptr = CMSG_FIRSTHDR(&msg); cmsgptr != NULL;
405 cmsgptr = CMSG_NXTHDR(&msg, cmsgptr)) {
406 if (cmsgptr->cmsg_level == SOL_IPV6 &&
407 cmsgptr->cmsg_type == IPV6_HOPLIMIT ) {
Denis Vlasenkocb6874c2006-09-02 16:13:36 +0000408 hoplimit = *(int*)CMSG_DATA(cmsgptr);
Eric Andersen51b8bd62002-07-03 11:46:38 +0000409 }
410 }
411 unpack(packet, c, &from, hoplimit);
412 if (pingcount > 0 && nreceived >= pingcount)
413 break;
414 }
415 pingstats(0);
416}
417
Rob Landleydfba7412006-03-06 20:47:33 +0000418int ping6_main(int argc, char **argv)
Eric Andersen51b8bd62002-07-03 11:46:38 +0000419{
420 char *thisarg;
421
422 datalen = DEFDATALEN; /* initialized here rather than in global scope to work around gcc bug */
423
424 argc--;
425 argv++;
426 options = 0;
427 /* Parse any options */
428 while (argc >= 1 && **argv == '-') {
429 thisarg = *argv;
430 thisarg++;
431 switch (*thisarg) {
432 case 'v':
433 options &= ~O_QUIET;
434 options |= O_VERBOSE;
435 break;
436 case 'q':
437 options &= ~O_VERBOSE;
438 options |= O_QUIET;
439 break;
440 case 'c':
441 if (--argc <= 0)
Denis Vlasenkocb6874c2006-09-02 16:13:36 +0000442 bb_show_usage();
Eric Andersen51b8bd62002-07-03 11:46:38 +0000443 argv++;
444 pingcount = atoi(*argv);
445 break;
446 case 's':
447 if (--argc <= 0)
Denis Vlasenkocb6874c2006-09-02 16:13:36 +0000448 bb_show_usage();
Eric Andersen51b8bd62002-07-03 11:46:38 +0000449 argv++;
450 datalen = atoi(*argv);
451 break;
452 case 'I':
453 if (--argc <= 0)
Denis Vlasenkocb6874c2006-09-02 16:13:36 +0000454 bb_show_usage();
Eric Andersen51b8bd62002-07-03 11:46:38 +0000455 argv++;
Denis Vlasenkodb7f2e52006-09-02 16:16:23 +0000456 if_index = if_nametoindex(*argv);
457 if (!if_index)
458 bb_error_msg_and_die(
459 "%s: invalid interface name", *argv);
Eric Andersen51b8bd62002-07-03 11:46:38 +0000460 break;
461 default:
Manuel Novoa III cad53642003-03-19 09:13:01 +0000462 bb_show_usage();
Eric Andersen51b8bd62002-07-03 11:46:38 +0000463 }
464 argc--;
465 argv++;
466 }
467 if (argc < 1)
Manuel Novoa III cad53642003-03-19 09:13:01 +0000468 bb_show_usage();
Eric Andersen51b8bd62002-07-03 11:46:38 +0000469
Denis Vlasenkodb7f2e52006-09-02 16:16:23 +0000470 myid = (int16_t) getpid();
Eric Andersen51b8bd62002-07-03 11:46:38 +0000471 ping(*argv);
472 return EXIT_SUCCESS;
473}
474#endif /* ! CONFIG_FEATURE_FANCY_PING6 */
475
476/*
477 * Copyright (c) 1989 The Regents of the University of California.
478 * All rights reserved.
479 *
480 * This code is derived from software contributed to Berkeley by
481 * Mike Muuss.
482 *
483 * Redistribution and use in source and binary forms, with or without
484 * modification, are permitted provided that the following conditions
485 * are met:
486 * 1. Redistributions of source code must retain the above copyright
487 * notice, this list of conditions and the following disclaimer.
488 * 2. Redistributions in binary form must reproduce the above copyright
489 * notice, this list of conditions and the following disclaimer in the
490 * documentation and/or other materials provided with the distribution.
491 *
Eric Andersenc7bda1c2004-03-15 08:29:22 +0000492 * 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change
493 * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change>
Eric Andersen51b8bd62002-07-03 11:46:38 +0000494 *
495 * 4. Neither the name of the University nor the names of its contributors
496 * may be used to endorse or promote products derived from this software
497 * without specific prior written permission.
498 *
499 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
500 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
501 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
502 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
503 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
504 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
505 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
506 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
507 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
508 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
509 * SUCH DAMAGE.
510 */