Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Feb 2012 10:12:44 GMT
From:      "Y.A." <nexther0@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/165355: libnet: UDP checksums are bogus in odd sized packets
Message-ID:  <201202211012.q1LACiAT099176@red.freebsd.org>
Resent-Message-ID: <201202211020.q1LAKAg5001771@freefall.freebsd.org>

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

>Number:         165355
>Category:       ports
>Synopsis:       libnet: UDP checksums are bogus in odd sized packets
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 21 10:20:09 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Y.A.
>Release:        FreeBSD 7.2 RELEASE-p6
>Organization:
>Environment:
FreeBSD noc.umc.com.ua 7.2-RELEASE-p6 FreeBSD 7.2-RELEASE-p6 #4: Tue Jan 19 09:36:13 EET 2010     root@noc:/usr/obj/usr/src/sys/NOC  amd64

>Description:
UDP checksums are bogus in odd sized packets
full detail
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=284729

>How-To-Repeat:
simply create odd length packet 
>Fix:
find attached patch

Patch attached with submission follows:

--- src/libnet_checksum.c.orig	Mon Mar  1 22:26:12 2004
+++ src/libnet_checksum.c	Mon Aug 25 15:44:12 2008
@@ -42,8 +42,10 @@
 libnet_in_cksum(u_int16_t *addr, int len)
 {
     int sum;
+    u_int16_t last_byte;
 
     sum = 0;
+    last_byte = 0;
 
     while (len > 1)
     {
@@ -52,7 +54,8 @@
     }
     if (len == 1)
     {
-        sum += *(u_int16_t *)addr;
+        *(u_int8_t*)&last_byte = *(u_int8_t*)addr;
+        sum += last_byte;
     }
 
     return (sum);


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



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