UDP checksum broken, -head and releng_8

Daniel Eischen deischen at freebsd.org
Sat Jan 8 18:22:01 UTC 2011


On Fri, 7 Jan 2011, Daniel Eischen wrote:

> On Fri, 7 Jan 2011, Daniel Eischen wrote:
>
>> On Fri, 7 Jan 2011, Bjoern A. Zeeb wrote:
>> 
>>> On Fri, 7 Jan 2011, Daniel Eischen wrote:
>>> 
>>>> When sending multicast packets to a socket that is _not_
>>>> bound to the multicast address, this generates bad UDP
>>>> checksums.  This use to work and was broke sometime between
>>>> the middle of October and late December as far as I can
>>>> tell.
>>> 
>>> My very best guess would be: r215110
>> 
>> It doesn't look very harmful, but I'll try backing it out.
>
> Backing this out seems to fix it.  I'll have to test it
> more after I get some sleep ;-)

I've attached what may be a proper patch.  Please review.
I'd like to get this fixed in releng_8 too.

-- 
DE
-------------- next part --------------
Index: netinet/in_pcb.c
===================================================================
--- netinet/in_pcb.c	(revision 216690)
+++ netinet/in_pcb.c	(working copy)
@@ -874,6 +874,7 @@
 		}
 	}
 	if (laddr.s_addr == INADDR_ANY) {
+		error = in_pcbladdr(inp, &faddr, &laddr, cred);
 		/*
 		 * If the destination address is multicast and an outgoing
 		 * interface has been set as a multicast option, use the
@@ -893,16 +894,17 @@
 						break;
 				if (ia == NULL) {
 					IN_IFADDR_RUNLOCK();
-					return (EADDRNOTAVAIL);
+					error = EADDRNOTAVAIL;
+				} else {
+					laddr = ia->ia_addr.sin_addr;
+					IN_IFADDR_RUNLOCK();
+					/* Override error from in_pcbladdr(). */
+					error = 0;
 				}
-				laddr = ia->ia_addr.sin_addr;
-				IN_IFADDR_RUNLOCK();
 			}
-		} else {
-			error = in_pcbladdr(inp, &faddr, &laddr, cred);
-			if (error) 
-				return (error);
 		}
+		if (error)
+			return (error);
 	}
 	oinp = in_pcblookup_hash(inp->inp_pcbinfo, faddr, fport, laddr, lport,
 	    0, NULL);


More information about the freebsd-current mailing list