Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Feb 2009 19:59:28 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r188760 - head/contrib/bsnmp/snmp_mibII
Message-ID:  <200902181959.n1IJxSJV073305@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Wed Feb 18 19:59:27 2009
New Revision: 188760
URL: http://svn.freebsd.org/changeset/base/188760

Log:
  Add an extra (void *) cast.  The struct if_msghdr has an 8 byte
  alignment requirement, while rt_msghdr has a 4 byte alignment
  requirement.  The root cause is that if_msghdr has an struct if_data
  which has an 8-byte alignment requirement due to a time_t that's
  embedded in it.  On MIPS, time_t is a 64-bit number, so must be 64-bit
  aligned.
  
  Since we don't access ifm_data.ifi_epoch, a simple cast is all that's
  necessary here.  It is likely the case that ifi_epoch should *NOT* be
  a time_t because it is an uptime (time delta) an not an absolute time
  since 1970.  u_long is likely sufficient there since that gives an
  uptime of 136 years will suffice for the foreseeable future.

Modified:
  head/contrib/bsnmp/snmp_mibII/mibII.c

Modified: head/contrib/bsnmp/snmp_mibII/mibII.c
==============================================================================
--- head/contrib/bsnmp/snmp_mibII/mibII.c	Wed Feb 18 19:05:27 2009	(r188759)
+++ head/contrib/bsnmp/snmp_mibII/mibII.c	Wed Feb 18 19:59:27 2009	(r188760)
@@ -1013,7 +1013,7 @@ handle_rtmsg(struct rt_msghdr *rtm)
 		break;
 
 	  case RTM_IFINFO:
-		ifm = (struct if_msghdr *)rtm;
+		ifm = (struct if_msghdr *)(void *)rtm;
 		mib_extract_addrs(ifm->ifm_addrs, (u_char *)(ifm + 1), addrs);
 		if ((ifp = mib_find_if_sys(ifm->ifm_index)) == NULL)
 			break;



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