Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 109829

Summary: ulogd does not log TOS ip header field correctly
Product: Gentoo Linux Reporter: Jan Safrata <jsafrata>
Component: [OLD] ServerAssignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it <maintainer-needed>
Status: RESOLVED NEEDINFO    
Severity: normal CC: aliz
Priority: High    
Version: unspecified   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Jan Safrata 2005-10-19 10:08:41 UTC
Zero value is logged instead of TOS ip header field.
It is caused by use of ntohs() function for __u8 type of tos field of struct
iphdr, so the real value is lost on little endian architectures.

Here is a patch to fix it:

diff -rc ulogd-1.02/extensions/ulogd_BASE.c
ulogd-1.02-tosfix/extensions/ulogd_BASE.c
*** ulogd-1.02/extensions/ulogd_BASE.c  2003-08-23 19:46:45.000000000 +0200
--- ulogd-1.02-tosfix/extensions/ulogd_BASE.c   2005-10-19 18:32:04.000000000 +0200
***************
*** 173,179 ****
        ret[1].flags |= ULOGD_RETF_VALID;
        ret[2].value.ui8 = iph->protocol;
        ret[2].flags |= ULOGD_RETF_VALID;
!       ret[3].value.ui8 = ntohs(iph->tos);
        ret[3].flags |= ULOGD_RETF_VALID;
        ret[4].value.ui8 = iph->ttl;
        ret[4].flags |= ULOGD_RETF_VALID;
--- 173,179 ----
        ret[1].flags |= ULOGD_RETF_VALID;
        ret[2].value.ui8 = iph->protocol;
        ret[2].flags |= ULOGD_RETF_VALID;
!       ret[3].value.ui8 = iph->tos;
        ret[3].flags |= ULOGD_RETF_VALID;
        ret[4].value.ui8 = iph->ttl;
        ret[4].flags |= ULOGD_RETF_VALID;
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2005-11-11 10:05:58 UTC
Re-assign.
Comment 2 Charlie Shepherd (RETIRED) gentoo-dev 2006-12-16 14:02:06 UTC
Thanks for the patch, but we need in it in unified diff format (diff -ur)