kern/120304: Netgraph Source assumes 32-bit timeval on AMD64
Mike Neuman
mcn at EnGarde.com
Tue Feb 5 21:20:03 UTC 2008
>Number: 120304
>Category: kern
>Synopsis: Netgraph Source assumes 32-bit timeval on AMD64
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Tue Feb 05 21:20:02 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator: Mike Neuman
>Release: 6.3-RELEASE
>Organization:
En Garde Systems
>Environment:
FreeBSD xeonpm.engarde.com 6.3-RELEASE FreeBSD 6.3-RELEASE #0: Tue Feb 5 10:54:16 PST 2008 mcn at xeonpm.engarde.com:/usr/src/sys/amd64/compile/PRIVATE amd64
>Description:
The ng_source module assumes that struct timevals contain 32-bit fields, which is not the case on amd64 machines.
>How-To-Repeat:
kldload ng_ether
ngctl mkpeer em0: source orphans output
nghook em0:orphans input <raw-packet.cap
ngctl msg em0:orphans start 16
ngctl msg em0:orphans getstats
Note the stats show the various timevals precessing based upon word length.
>Fix:
The fix for amd64 is simple, however the patch is not suitable because it should handle both 32-bit and 64-bit timeval lengths. I did not readily find the proper way to do this.
Patch attached with submission follows:
*** sys/netgraph/ng_source.c.orig Tue Feb 5 13:00:47 2008
--- sys/netgraph/ng_source.c Tue Feb 5 12:17:36 2008
***************
*** 113,120 ****
/* Parse type for timeval */
static const struct ng_parse_struct_field ng_source_timeval_type_fields[] = {
! { "tv_sec", &ng_parse_int32_type },
! { "tv_usec", &ng_parse_int32_type },
{ NULL }
};
const struct ng_parse_type ng_source_timeval_type = {
--- 113,120 ----
/* Parse type for timeval */
static const struct ng_parse_struct_field ng_source_timeval_type_fields[] = {
! { "tv_sec", &ng_parse_int64_type },
! { "tv_usec", &ng_parse_int64_type },
{ NULL }
};
const struct ng_parse_type ng_source_timeval_type = {
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list