summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_input.c
diff options
context:
space:
mode:
authorDavid Greenman <dg@FreeBSD.org>1998-07-08 08:51:38 +0000
committerDavid Greenman <dg@FreeBSD.org>1998-07-08 08:51:38 +0000
commit438c3db78c2eaa89e66b55a7d7e2a21d8dec695e (patch)
tree91e261c0ed480adc784c80d751e4ec7377650ae2 /sys/netinet/ip_input.c
parent2cb24c3c00ce7ce1d8f1bdf8366c3851c09ea973 (diff)
Notes
Diffstat (limited to 'sys/netinet/ip_input.c')
-rw-r--r--sys/netinet/ip_input.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 2351ba31c218..08b3f9b74d9f 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ip_input.c 8.2 (Berkeley) 1/4/94
- * $Id: ip_input.c,v 1.50.2.17 1998/07/06 08:29:48 julian Exp $
+ * $Id: ip_input.c,v 1.50.2.18 1998/07/06 09:05:32 julian Exp $
* $ANA: ip_input.c,v 1.5 1996/09/18 14:34:59 wollman Exp $
*/
@@ -972,16 +972,27 @@ ip_dooptions(m)
}
if (!ip_dosourceroute) {
- char buf[4*sizeof "123"];
-
+ if (ipforwarding) {
+ char buf[16]; /* aaa.bbb.ccc.ddd\0 */
+ /*
+ * Acting as a router, so generate ICMP
+ */
nosourcerouting:
- strcpy(buf, inet_ntoa(ip->ip_dst));
- log(LOG_WARNING,
- "attempted source route from %s to %s\n",
- inet_ntoa(ip->ip_src), buf);
- type = ICMP_UNREACH;
- code = ICMP_UNREACH_SRCFAIL;
- goto bad;
+ strcpy(buf, inet_ntoa(ip->ip_dst));
+ log(LOG_WARNING,
+ "attempted source route from %s to %s\n",
+ inet_ntoa(ip->ip_src), buf);
+ type = ICMP_UNREACH;
+ code = ICMP_UNREACH_SRCFAIL;
+ goto bad;
+ } else {
+ /*
+ * Not acting as a router, so silently drop.
+ */
+ ipstat.ips_cantforward++;
+ m_freem(m);
+ return (1);
+ }
}
/*