buildsolaris01dev:~/host-sflow-2.0.7-4/src/SunOS$ gmake
cc -std=c99 -I. -I../sflow -O3 -DNDEBUG -DHSP_VERSION= -DHSP_SOLARIS=5011 -DUTHEAP -DHSF_JSON -I../json -c hsflowconfig.c
"hsflowconfig.c", line 511: identifier redeclared: agentAddressPriority
current : function(pointer to struct _HSP {enum {HSPSTATE_END(3), HSPSTATE_RUN(2), HSPSTATE_WAITCONFIG(1), HSPSTATE_READCONFIG(0)} state, long clk, pointer to struct _HSPSFlow {..} sFlow, pointer to char configFile, pointer to char outputFile, pointer to char pidFile, int dropPriv, unsigned int outputRevisionNo, pointer to struct __FILE {..} f_out, pointer to char crashFile, array[65] of char hostname, array[33] of char os_release, array[16] of unsigned char uuid, pointer to char uuidFile, pointer to struct _SFLAdaptorList {..} adaptorList, long nio_last_update, long nio_polling_secs, int refreshAdaptorList, int refreshVMList, struct _HSPDiskIO {..} diskIO, int socket4, int socket6, unsigned int num_domains, unsigned int maxDsIndex, pointer to char vmStoreFile, pointer to struct __FILE {..} f_vmStore, int vmStoreInvalid, pointer to struct _HSPVMStore {..} vmStore, pointer to struct _pthread_mutex {..} config_mut, int DNSSD, pointer to char DNSSD_domain, unsigned int previousPollingInterval, pointer to unsigned int DNSSD_thread, int DNSSD_countdown, unsigned int DNSSD_startDelay, unsigned int DNSSD_retryDelay, unsigned int DNSSD_ttl, int json_soc, int json_soc6, pointer to pointer to struct _HSPApplication {..} applicationHT, unsigned int applicationHT_size, unsigned int applicationHT_entries, int use_prstat}, pointer to struct _SFLAddress {unsigned int type, union _SFLAddress_value {..} address}, int, int) returning unsigned int
previous: function(pointer to struct _HSP {enum {HSPSTATE_END(3), HSPSTATE_RUN(2), HSPSTATE_WAITCONFIG(1), HSPSTATE_READCONFIG(0)} state, long clk, pointer to struct _HSPSFlow {..} sFlow, pointer to char configFile, pointer to char outputFile, pointer to char pidFile, int dropPriv, unsigned int outputRevisionNo, pointer to struct __FILE {..} f_out, pointer to char crashFile, array[65] of char hostname, array[33] of char os_release, array[16] of unsigned char uuid, pointer to char uuidFile, pointer to struct _SFLAdaptorList {..} adaptorList, long nio_last_update, long nio_polling_secs, int refreshAdaptorList, int refreshVMList, struct _HSPDiskIO {..} diskIO, int socket4, int socket6, unsigned int num_domains, unsigned int maxDsIndex, pointer to char vmStoreFile, pointer to struct __FILE {..} f_vmStore, int vmStoreInvalid, pointer to struct _HSPVMStore {..} vmStore, pointer to struct _pthread_mutex {..} config_mut, int DNSSD, pointer to char DNSSD_domain, unsigned int previousPollingInterval, pointer to unsigned int DNSSD_thread, int DNSSD_countdown, unsigned int DNSSD_startDelay, unsigned int DNSSD_retryDelay, unsigned int DNSSD_ttl, int json_soc, int json_soc6, pointer to pointer to struct _HSPApplication {..} applicationHT, unsigned int applicationHT_size, unsigned int applicationHT_entries, int use_prstat}, pointer to struct _SFLAddress {unsigned int type, union _SFLAddress_value {..} address}, int, int) returning enum {IPSP_NUM_PRIORITIES(10), IPSP_IP4(9), IPSP_IP6_SCOPE_GLOBAL(8), IPSP_IP6_SCOPE_UNIQUE(7), IPSP_VLAN4(6), IPSP_VLAN6(5), IPSP_IP6_SCOPE_LINK(4), IPSP_SELFASSIGNED4(3), IPSP_LOOPBACK4(2), IPSP_LOOPBACK6(1), IPSP_NONE(0)} : "hsflowd.h", line 344
cc: acomp failed for hsflowconfig.c
gmake: *** [hsflowconfig.o] Error 2
/*_________________---------------------------__________________
_________________ attribute extraction __________________
/agentAddressPriority
return tokens;
_________________ agentAddressPriority __________________
-----------------___________________________------------------
*/
uint32_t agentAddressPriority(HSP *sp, SFLAddress *addr, int vlan, int loopback)
{
EnumIPSelectionPriority ipPriority = IPSP_NONE;
switch(addr->type) {
case SFLADDRESSTYPE_IP_V4:
// start assuming it's a global ip
ipPriority = IPSP_IP4;
// then check for other possibilities
if(loopback) {
ipPriority = IPSP_LOOPBACK4;
}
else if (SFLAddress_isSelfAssigned(addr)) {
ipPriority = IPSP_SELFASSIGNED4;
}
else if(vlan != HSP_VLAN_ALL) {
ipPriority = IPSP_VLAN4;
}
break;
case SFLADDRESSTYPE_IP_V6:
// start by assuming it's a global IP
ipPriority = IPSP_IP6_SCOPE_GLOBAL;
// then check for other possibilities
// now allow the other parameters to override
if(loopback || SFLAddress_isLoopback(addr)) {
ipPriority = IPSP_LOOPBACK6;
}
else if (SFLAddress_isLinkLocal(addr)) {
ipPriority = IPSP_IP6_SCOPE_LINK;
}
else if (SFLAddress_isUniqueLocal(addr)) {
ipPriority = IPSP_IP6_SCOPE_UNIQUE;
}
else if(vlan != HSP_VLAN_ALL) {
ipPriority = IPSP_VLAN6;
}
break;
default:
// not a v4 or v6 ip address at all
break;
}
// just make sure we can't get a multicast in here (somehow)
if(SFLAddress_isMulticast(addr)) {
ipPriority = IPSP_NONE;
}
uint32_t boosted_priority = ipPriority;
if(sp->sFlow && sp->sFlow->sFlowSettings_file) {
// allow the agent.cidr settings to boost the priority
// of this address. The cidrs are in reverse order.
HSPCIDR *cidr = sp->sFlow->sFlowSettings_file->agentCIDRs;
uint32_t cidrIndex = 1;
for(; cidr; cidrIndex++, cidr=cidr->nxt) {
if(debug) myLog(LOG_INFO, "testing CIDR at index %d", cidrIndex);
if(SFLAddress_maskEqual(addr, &cidr->mask, &cidr->ipAddr)) break;
}
if(cidr) {
if(debug) myLog(LOG_INFO, "CIDR at index %d matched: boosting priority", cidrIndex);
boosted_priority += (cidrIndex * IPSP_NUM_PRIORITIES);
}
}
else {
if(debug) myLog(LOG_INFO, "agentAddressPriority: no config yet (so no CIDR boost)");
}
return boosted_priority;
}