/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 1991-2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* icmp4.c, Code implementing the Internet Control Message Protocol (v4) ICMP.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <socket_impl.h>
#include <socket_inet.h>
#include <netinet/in_systm.h>
#include <sys/bootconf.h>
#include "icmp4.h"
#include "ipv4.h"
#include "ipv4_impl.h"
#include "mac.h"
#include "v4_sum_impl.h"
#include <sys/bootdebug.h>
/*
* Handle ICMP redirects, ICMP echo messages. We only deal with redirects to a
* different default router by changing the default route to the specified
* value.
*/
void
{
int icmp_len;
if (icmp_len < ICMP_MINLEN) {
#ifdef DEBUG
printf("icmp4: ICMP message from %s is too short\n",
#endif /* DEBUG */
return;
}
/* check alignment */
dprintf("icmp4: ICMP header not aligned (from %s)\n",
return;
}
dprintf("icmp4: Bad ICMP checksum (from %s)\n",
return;
}
case ICMP_REDIRECT:
break;
dprintf("ICMP Redirect to gateway %s.\n",
&icmphp->icmp_gwaddr) != 0) {
dprintf("icmp4: Cannot add route %s, %d\n",
}
break;
case ICMP_UNREACH:
/*
* Need to highlight an error on the socket, and save the
* destination address so that we can ensure it is destined
* to this socket. We need the port number to be sure...
*/
dprintf("ICMP destination unreachable (%s)\n",
break;
case ICMP_ECHO:
/*
* swap the source and destination IP addresses
* and send a reply right out.
*/
int s;
break;
}
icmphp->icmp_cksum = 0;
icmp_len);
(void) socket_close(s);
}
break;
default:
dprintf("icmp4: Unsupported ICMP message type: 0x%x "
break;
}
}