1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-29 05:38:00 +00:00

- fix UDP checksums in odd sized packets

PR:		165355
Submitted by:	Y.A.
Obtained from:	debian
This commit is contained in:
Dirk Meyer 2012-02-22 04:49:08 +00:00
parent c44902c585
commit 481254d60d
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=292029
2 changed files with 24 additions and 1 deletions

View File

@ -7,7 +7,7 @@
PORTNAME= libnet
PORTVERSION= 1.1.2.1
PORTREVISION= 3
PORTREVISION= 4
PORTEPOCH= 1
CATEGORIES= net
MASTER_SITES= http://www.packetfactory.net/libnet/dist/ \

View File

@ -0,0 +1,23 @@
--- 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);