Subject: Re: ucd-snmp-3.1.2.1 comile error
To: Mike Long <mike.long@analog.com>
From: Bill Studenmund <skippy@macro.stanford.edu>
List: port-i386
Date: 01/13/1997 21:51:16
On Mon, 13 Jan 1997, Mike Long wrote:
Mike's right, but there seem to be a few typos in the original post.
> >From: Berndt Josef Wulf <wulf@ping.net.au>
> >Date: Tue, 14 Jan 1997 12:50:53 +1030 (CST)
>
> > snmp_vars.c: In function `var_ipAddrEntry':
> > snmp_vars.c:2202: invalid operands to binary ==
> > *** Error code 1
>
> >the code in question looks like this:
> >
> > if ( ifnet.if_addrlist == 0 )
> > continue; /* No address found for interface */
> >
> >/usr/include/net/if.h defines struct ifnet as:
> >
> >struct ifnet {
> > void *if_softc;
> > TAILQ_ENTRY(ifnet) if_list;
> > are chained */
> > TAILQ_HEAD(, ifaddr) if_addrlist;
> > ....
> >
> >and TAILQ_HEAD is defined in /usr/include/sys/queue.h
> >
> >#define TAILQ_HEAD(name, type)
> >struct name {
> > struct type *tqe_next;
> > struct type **tqe_prev;
> >}
I thnk those are the innards of a TAILQ_ENTRY, and a TAILQ_HEAD is:
struct name { \
struct type *tqh_first; /* first element */ \
struct type **tqh_last; /* addr of last next element */ \
}
> >How do I get it to compile? The README file reports this package to be
> >working under NetBSD-1.1 and NetBSD-1.2.... which gives me some hope
> >to complete my project ;)
>
> The compiler complains because the code is trying to compare a
> structure to a scalar.
>
> You need to port any code which accesses if_addrlist to access it as a
> TAILQ instead of a straightforward linked list. That means replacing
> 'if_addrlist' with 'if_addrlist.tqe_next', etc.
If it were a TAILQ_ENTRY, but for a TAILQ_HEAD, try if_addrlist.tqh_first.
Hmm. Can you guess what bit me hard in one part of a recent networking
port??? :-)
Take care,
Bill