compiling host-sflow on Solaris 11

35 views
Skip to first unread message

Johan De Graeve

unread,
Jan 10, 2017, 4:32:39 AM1/10/17
to Host-sFlow
Hi guys,

While compile host-sflow 2.0.7 on Solaris 11, I get the following error

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

in src/SunOS/hsflowd.h line 344
    EnumIPSelectionPriority agentAddressPriority(HSP *sp, SFLAddress *addr, int vlan, int loopback);

but

in src/SunOS/hsflowconfig.c line 511
  /*_________________---------------------------__________________
    _________________   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;
  }

I compile with Solaris Studio 12.4

Any ideas!

Best Regards,
Johan

Neil McKee

unread,
Jan 10, 2017, 1:24:55 PM1/10/17
to Johan De Graeve, Host-sFlow
It looks like line 344 in hsflowd.h should be changed from:

EnumIPSelectionPriority agentAddressPriority(HSP *sp, SFLAddress *addr, int vlan, int loopback);

to:

uint32_t agentAddressPriority(HSP *sp, SFLAddress *addr, int vlan, int loopback);

Let me know if that helps.

Neil


--
You received this message because you are subscribed to the Google Groups "Host-sFlow" group.
To unsubscribe from this group and stop receiving emails from it, send an email to host-sflow+unsubscribe@googlegroups.com.
To post to this group, send email to host-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/host-sflow/2cb2adf5-767c-4870-8b22-3cd70b0f6d5d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Johan De Graeve

unread,
Jan 11, 2017, 4:36:02 AM1/11/17
to Host-sFlow, jo...@jdegraeve.be
That did the trick! Thx

I also had to change something in src/SunOS/Makefile

change line 81:
        LIBS += $(JSONDIR)/libjson.a -lm
into
        LIBS += $(JSONDIR)/libcjson.a -lm
Reply all
Reply to author
Forward
0 new messages