[collectd] Collectd on freebsd 7x (specificially 7.2)

Brett Hawn brett.hawn at gmail.com
Wed Jun 10 09:12:58 CEST 2009


I chased this for a while tonight, and what I've discovered is, at this 
point, beyond my level of C comprehension, but the short version is that
so->xso_protocol is being set to 262145 instead of 6 (IPPROTO_TCP). The 
following chunk of code in tcpconns.c is where things go
horribly wrong, the workwround of course is to re-define IPPROTO_TCP to 
be 262145, or comment out that line and fake it with a new one
that checks against that #.

  for (in_ptr = (struct xinpgen *) (((char *) in_orig) + in_orig->xig_len);
      in_ptr->xig_len > sizeof (struct xinpgen);
      in_ptr = (struct xinpgen *) (((char *) in_ptr) + in_ptr->xig_len))
  {

    struct tcpcb *tp = &((struct xtcpcb *) in_ptr)->xt_tp;
    struct inpcb *inp = &((struct xtcpcb *) in_ptr)->xt_inp;
    struct xsocket *so = &((struct xtcpcb *) in_ptr)->xt_socket;

    /* Ignore non-TCP sockets */
     if (so->xso_protocol != IPPROTO_TCP)
      continue;

    /* Ignore PCBs which were freed during copyout. */
    if (inp->inp_gencnt > in_orig->xig_gen)
      continue;

    if (((inp->inp_vflag & INP_IPV4) == 0)
        && ((inp->inp_vflag & INP_IPV6) == 0))
      continue;

    conn_handle_ports (ntohs (inp->inp_lport), ntohs (inp->inp_fport),
        tp->t_state);
  } /* for (in_ptr) */

  in_orig = NULL;
  in_ptr = NULL;
  sfree (buffer);

  conn_submit_all ();

  return (0);
} /* int conn_read */
/* #endif HAVE_SYSCTLBYNAME */




More information about the collectd mailing list