Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 May 2000 23:51:52 -0700 (PDT)
From:      jgibbons@n2.net
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   kern/18741: [PATCH] Multicast loopback interface not receiving packets; checksum errors
Message-ID:  <200005220651.XAA57598@nike.relcast.com>

next in thread | raw e-mail | index | archive | help

>Number:         18741
>Category:       kern
>Synopsis:       [PATCH] Multicast loopback interface not receiving packets; checksum errors
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun May 21 23:50:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Jeff Gibbons
>Release:        FreeBSD 4.0-STABLE i386
>Organization:
>Environment:

	FreeBSD nike.relcast.com 4.0-STABLE FreeBSD 4.0-STABLE #2: Sat May 20 20:36:16 PDT 2000  i386
        2 Intel EtherExpress Pro 10/100B Ethernet boards

>Description:

	The loopback IP interface does not receive multicast packets
	which are sent by the local machine; instead each packet
	is counted as a checksum error.  This problem began sometime
	between about 01 April, 2000 and 20 May, 2000; the problem
	does not occur in 4-STABLE prior to 01 April, 2000.  I
	believe the problem is related to the new "delayed checksum"
	code which has been MFCed into the IP and UDP network
	routines (ip_input.c, ip_output.c, udp_usrreq.c, etc.).
	This problem also probably occurs on current, but I have
	not tested that, nor have I tested the fix on any version
	of FreeBSD except 4-STABLE.
        
>How-To-Repeat:

	Join a multicast address on an fxp Ethernet interface, then
	send packets through that interface to that multicast
	address.  Your machine (the machine which is sending the
	packets) will not receive those packets.  Use "netstat -p udp"
        before and after sending the packets, and you will see the
        number of packets "with bad checksum" increasing for every
        packet you send.

>Fix:

	The following code, when added to src/sys/netinet/ip_output.c,
	cures the problem.  It is in the ip_mloopback() routine,
	which calls if_simloop() to put a packet onto an input
	queue so that it will later be retrieved and processed by
	ip_input().  ip_mloopback() is only called when sending a
	multicast packet on an interface which belongs to the
	destination multicast group.  The added code sets flags so
	that the udp_input() routine (which eventually receives
	and handles the packet) will not attempt to verify the UDP
	checksum field.

	Note that this may not be the best fix -- someone who
	understands the delayed checksum processing should review
	this.  In particular, I do not know if the added "if"
	statement is necessary or desirable; it may be better just
	to _always_ set the flags here, since it should never be
	necessary to check the checksum of a looped-back packet.

Index: /usr/src/sys/netinet/ip_output.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/ip_output.c,v
retrieving revision 1.99.2.1
diff -u -r1.99.2.1 ip_output.c
--- /usr/src/sys/netinet/ip_output.c	2000/05/05 13:36:52	1.99.2.1
+++ /usr/src/sys/netinet/ip_output.c	2000/05/22 04:30:46
@@ -1869,6 +1869,12 @@
 		copym->m_pkthdr.rcvif = ifp;
 		ip_input(copym);
 #else
+		/* tell udp_input() not to check the udp checksum */
+		if (copym->m_pkthdr.csum_flags & CSUM_DELAY_DATA) {
+			copym->m_pkthdr.csum_flags |=
+			    CSUM_DATA_VALID | CSUM_PSEUDO_HDR;
+			copym->m_pkthdr.csum_data = 0xffff;
+		}
 		if_simloop(ifp, copym, (struct sockaddr *)dst, 0);
 #endif
 	}


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200005220651.XAA57598>