Menu

#1811 at.c compile fails on CRISv32 port

embedded
open
nobody
agent (1105)
5
2012-11-08
2007-04-24
No

When cross compiling net-snmp 5.4 for the CRISv32 architecture, there is an error in the net-snmp-5.4/agent/mibgroup/mibII/at.c file at line 727 where the ifIndex pointer is dereferenced even though it is not defined in the context. The relevant code is:

...
#ifdef ARP_SCAN_FOUR_ARGUMENTS
static int
ARP_Scan_Next(u_long * IPAddr, char *PhysAddr, u_long * ifType, u_short * ifIndex)
#else
static int
ARP_Scan_Next(u_long * IPAddr, char *PhysAddr, u_long * ifType)
#endif
{
#ifndef NETSNMP_CAN_USE_SYSCTL
#ifdef linux
if (arptab_current < arptab_size) {
/*
* copy values
*/
*IPAddr = at[arptab_current].at_iaddr.s_addr;
*ifType =
(at[arptab_current].
at_flags & ATF_PERM) ? 4 /*static */ : 3 /*dynamic */ ;
*ifIndex = at[arptab_current].if_index;
...

When compiling for the CRISv32 architecture, apparently, the combination CAN be achieved where the following conditional can be true: !ARP_SCAN_FOUR_ARGUMENTS && !NETSNMP_CAN_USE_SYSCTL && linux.

Any help is greatly appreciated. This failure can be reproduced reliably on the CRISv32 architecture.

My configure statement is:

C=gcc-cris CFLAGS="-mlinux -march=v32" ./configure \ --build=i686-pc-linux \ --host=cris \ --enable-shared \ --enable-as-needed \ --enable-ucd-snmp-compatibility \ --disable-manuals \ --disable-mibs \ --disable-mib-loading \ --enable-ipv6 \ --disable-debugging \ --enable-reentrant \ --disable-embedded-perl \ --without-rpm \ --without-root-access \ --without-kmem-usage \ --with-endianness=little \ --with-default-snmp-version="3" \ --with-logfile="/var/log/snmpd.log" \ --with-persistent-directory="/var/net-snmp" \ --enable-mini-agent \ --with-transports="TCP UDP" \ --with-mib-modules="mibII/interfaces mibII/ip"

The output just prior to the make failing is:

/bin/sh ../../libtool --mode=compile gcc-cris -I../../include -I. -I../../agent -I../../agent/mibgroup -I../../snmplib -DNETSNMP_ENABLE_IPV6 -mlinux -march=v32 -Unone -Dnone=none -c -o mibII/at.lo mibII/at.c
gcc-cris -I../../include -I. -I../../agent -I../../agent/mibgroup -I../../snmplib -DNETSNMP_ENABLE_IPV6 -mlinux -march=v32 -Unone -Dnone=none -c mibII/at.c -o mibII/at.o
In file included from /usr/local/cris/crisv32-axis-linux-gnu/sys-include/linux/sysctl.h:23,
from /usr/local/cris/crisv32-axis-linux-gnu/sys-include/sys/sysctl.h:28,
from mibII/at.c:72:
/usr/local/cris/crisv32-axis-linux-gnu/sys-include/linux/list.h:715:2: warning: #warning "don't include kernel headers in userspace"
In file included from ../../include/net-snmp/definitions.h:22,
from ../../include/net-snmp/net-snmp-includes.h:71,
from mibII/at.c:99:
../../include/net-snmp/types.h:59: warning: redefinition of `socklen_t'
/usr/local/cris/crisv32-axis-linux-gnu/sys-include/bits/socket.h:36: warning: `socklen_t' previously declared here
../../include/net-snmp/types.h:63: warning: redefinition of `in_addr_t'
/usr/local/cris/crisv32-axis-linux-gnu/sys-include/netinet/in.h:133: warning: `in_addr_t' previously declared here
mibII/at.c: In function `ARP_Scan_Next':
mibII/at.c:727: `ifIndex' undeclared (first use in this function)
mibII/at.c:727: (Each undeclared identifier is reported only once
mibII/at.c:727: for each function it appears in.)

Discussion


Log in to post a comment.