Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet Call icmp_error() at the bottom of rip_input IFF...



details:   https://anonhg.NetBSD.org/src/rev/4870581749ca
branches:  trunk
changeset: 474393:4870581749ca
user:      darrenr <darrenr%NetBSD.org@localhost>
date:      Mon Jul 05 07:24:38 1999 +0000

description:
Call icmp_error() at the bottom of rip_input IFF rip_input is the handler
for the protocol in the specified packet.
Fix statistic gathering to not make bogus increments of ips_delivered and
ips_noproto for cases where rip_input() is called by a protocol handler
(such as icmp_input or igmp_input) which has already processed the packet.

diffstat:

 sys/netinet/raw_ip.c |  14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diffs (42 lines):

diff -r 4c32a425e3a2 -r 4870581749ca sys/netinet/raw_ip.c
--- a/sys/netinet/raw_ip.c      Sun Jul 04 22:55:48 1999 +0000
+++ b/sys/netinet/raw_ip.c      Mon Jul 05 07:24:38 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: raw_ip.c,v 1.43 1999/07/01 08:12:51 itojun Exp $       */
+/*     $NetBSD: raw_ip.c,v 1.44 1999/07/05 07:24:38 darrenr Exp $      */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -84,6 +84,7 @@
 #include <netinet/ip.h>
 #include <netinet/ip_var.h>
 #include <netinet/ip_mroute.h>
+#include <netinet/ip_icmp.h>
 #include <netinet/in_pcb.h>
 #include <netinet/in_var.h>
 
@@ -93,6 +94,8 @@
 #include <netinet6/ipsec.h>
 #endif /*IPSEC*/
 
+extern u_char ip_protox[];
+extern struct  protosw inetsw[];
 struct inpcbtable rawcbtable;
 
 int     rip_bind __P((struct inpcb *, struct mbuf *));
@@ -202,9 +205,12 @@
                } else
                        sorwakeup(last->inp_socket);
        } else {
-               m_freem(m);
-               ipstat.ips_noproto++;
-               ipstat.ips_delivered--;
+               if (inetsw[ip_protox[ip->ip_p]].pr_input == rip_input) {
+                       icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_PROTOCOL,0,0);
+                       ipstat.ips_noproto++;
+                       ipstat.ips_delivered--;
+               } else
+                       m_freem(m);
        }
        return;
 }



Home | Main Index | Thread Index | Old Index