[cups.bugs] [MOD] STR #1686: ifa_broadaddr should be ifa_dstaddr in backend/snmp.c

Kevin Day kevin at kevux.org
Sun May 14 05:22:13 PDT 2006


[STR New]

snmp.c:1379: error: structure has no member named `ifa_ifu'
      :1380:
      :1385:

System header:
/usr/include/net/if.h defines the macro:
#define ifa_broadaddr ifa_ifu.ifu_broadaddr

Source header:
cups/http-private.h defines the following:
struct sockaddr *ifa_dstadr; /* Broadcast or destination address */

Source file:
backend/snmp.c calls:
addr->ifa_broadaddr
with addr defined as:
struct ifaddrs *addrs, *addr;
inside of the function:
static http_addrlist_t * get_interface_addresses(..){..}
on lines: 1364->1399

The problem is that addr->ifa_broadaddr is called, in multiple places at
that.
ifa_broadaddr is a macro defined by <net/if.h> and is thus not part of the
class ifaddrs as defined in the http-private.h file provided by cups'
source.

At first I though there was a problem with my compilation of the
<net/if.h> project. Looking closely I noticed that the addr was defined as
the ifaddrs structure defined in the http-private.h header file.

The comment from ifa_dstaddr in your http-private.h header file says that
it is the broadcast address.

There are two possibilities here:
1) the declarations: addrs and addr are in fact two different types, with
addrs being of the ifaddrs structure from cups/http-private.h and the addr
being of the ifaddr structure from <net/if.h>
- if this is the case, then ifaddr is being converted to your private
ifaddrs implimentation.

2) as addr and addrs are both declared as ifaddrs and thus ifa_broadaddr
should be re-defined as ifa_dstaddr as that is your broadcast address as
commented by the ifaddrs structure.
- I went with this way, but having no exact idea in which way to go.  I
*guessed* that if this way didn't work, then part of that function where 
addr->ifa_broadaddr->sa_family would fail given that the sub-structure
sa_family is not in both cups/http-private.h and <net/if.h>.
- I could not find the sa_family inside of <net/if.h> or
cups/http-private.h :(

Link: http://www.cups.org/str.php?L1686
Version: 1.2.0





More information about the cups-devel mailing list