void fetchtcp(void) { KREAD((void *)namelist[0].n_value, &newstat, sizeof(newstat)); ADJINETCTR(curstat, oldstat, newstat, tcps_connattempt); ADJINETCTR(curstat, oldstat, newstat, tcps_accepts); ADJINETCTR(curstat, oldstat, newstat, tcps_connects); ADJINETCTR(curstat, oldstat, newstat, tcps_drops); ADJINETCTR(curstat, oldstat, newstat, tcps_conndrops); ADJINETCTR(curstat, oldstat, newstat, tcps_timeoutdrop); ADJINETCTR(curstat, oldstat, newstat, tcps_keepdrops); ADJINETCTR(curstat, oldstat, newstat, tcps_persistdrops); ADJINETCTR(curstat, oldstat, newstat, tcps_segstimed); ADJINETCTR(curstat, oldstat, newstat, tcps_rttupdated); ADJINETCTR(curstat, oldstat, newstat, tcps_delack); ADJINETCTR(curstat, oldstat, newstat, tcps_rexmttimeo); ADJINETCTR(curstat, oldstat, newstat, tcps_persisttimeo); ADJINETCTR(curstat, oldstat, newstat, tcps_keepprobe); ADJINETCTR(curstat, oldstat, newstat, tcps_keeptimeo); ADJINETCTR(curstat, oldstat, newstat, tcps_sndtotal); ADJINETCTR(curstat, oldstat, newstat, tcps_sndpack); ADJINETCTR(curstat, oldstat, newstat, tcps_sndrexmitpack); ADJINETCTR(curstat, oldstat, newstat, tcps_sndacks); ADJINETCTR(curstat, oldstat, newstat, tcps_sndprobe); ADJINETCTR(curstat, oldstat, newstat, tcps_sndwinup); ADJINETCTR(curstat, oldstat, newstat, tcps_sndurg); ADJINETCTR(curstat, oldstat, newstat, tcps_sndctrl); ADJINETCTR(curstat, oldstat, newstat, tcps_rcvtotal); ADJINETCTR(curstat, oldstat, newstat, tcps_rcvpack); ADJINETCTR(curstat, oldstat, newstat, tcps_rcvduppack); ADJINETCTR(curstat, oldstat, newstat, tcps_rcvpartduppack); ADJINETCTR(curstat, oldstat, newstat, tcps_rcvoopack); ADJINETCTR(curstat, oldstat, newstat, tcps_rcvdupack); ADJINETCTR(curstat, oldstat, newstat, tcps_rcvackpack); ADJINETCTR(curstat, oldstat, newstat, tcps_rcvwinprobe); ADJINETCTR(curstat, oldstat, newstat, tcps_rcvwinupd); if (update == UPDATE_TIME) memcpy(&oldstat, &newstat, sizeof(oldstat)); }
void fetchip(void) { size_t size; size = sizeof(newstat.i); if (sysctlbyname("net.inet.ip.stats", newstat.i, &size, NULL, 0) == -1) return; size = sizeof(newstat.u); if (sysctlbyname("net.inet.udp.stats", newstat.u, &size, NULL, 0) == -1) return; ADJINETCTR(curstat, oldstat, newstat, i[IP_STAT_TOTAL]); ADJINETCTR(curstat, oldstat, newstat, i[IP_STAT_DELIVERED]); ADJINETCTR(curstat, oldstat, newstat, i[IP_STAT_BADSUM]); ADJINETCTR(curstat, oldstat, newstat, i[IP_STAT_TOOSHORT]); ADJINETCTR(curstat, oldstat, newstat, i[IP_STAT_TOOSMALL]); ADJINETCTR(curstat, oldstat, newstat, i[IP_STAT_BADHLEN]); ADJINETCTR(curstat, oldstat, newstat, i[IP_STAT_BADLEN]); ADJINETCTR(curstat, oldstat, newstat, i[IP_STAT_BADVERS]); ADJINETCTR(curstat, oldstat, newstat, i[IP_STAT_TOOLONG]); ADJINETCTR(curstat, oldstat, newstat, i[IP_STAT_BADOPTIONS]); ADJINETCTR(curstat, oldstat, newstat, i[IP_STAT_LOCALOUT]); ADJINETCTR(curstat, oldstat, newstat, i[IP_STAT_ODROPPED]); ADJINETCTR(curstat, oldstat, newstat, i[IP_STAT_OFRAGMENTS]); ADJINETCTR(curstat, oldstat, newstat, i[IP_STAT_CANTFRAG]); ADJINETCTR(curstat, oldstat, newstat, i[IP_STAT_NOROUTE]); ADJINETCTR(curstat, oldstat, newstat, i[IP_STAT_RAWOUT]); ADJINETCTR(curstat, oldstat, newstat, i[IP_STAT_FRAGMENTS]); ADJINETCTR(curstat, oldstat, newstat, i[IP_STAT_FRAGDROPPED]); ADJINETCTR(curstat, oldstat, newstat, i[IP_STAT_FRAGTIMEOUT]); ADJINETCTR(curstat, oldstat, newstat, i[IP_STAT_REASSEMBLED]); ADJINETCTR(curstat, oldstat, newstat, i[IP_STAT_FORWARD]); ADJINETCTR(curstat, oldstat, newstat, i[IP_STAT_FASTFORWARD]); ADJINETCTR(curstat, oldstat, newstat, i[IP_STAT_CANTFORWARD]); ADJINETCTR(curstat, oldstat, newstat, i[IP_STAT_REDIRECTSENT]); ADJINETCTR(curstat, oldstat, newstat, u[UDP_STAT_OPACKETS]); ADJINETCTR(curstat, oldstat, newstat, u[UDP_STAT_IPACKETS]); ADJINETCTR(curstat, oldstat, newstat, u[UDP_STAT_HDROPS]); ADJINETCTR(curstat, oldstat, newstat, u[UDP_STAT_BADSUM]); ADJINETCTR(curstat, oldstat, newstat, u[UDP_STAT_BADLEN]); ADJINETCTR(curstat, oldstat, newstat, u[UDP_STAT_NOPORT]); ADJINETCTR(curstat, oldstat, newstat, u[UDP_STAT_NOPORTBCAST]); ADJINETCTR(curstat, oldstat, newstat, u[UDP_STAT_FULLSOCK]); if (update == UPDATE_TIME) memcpy(&oldstat, &newstat, sizeof(oldstat)); }
void fetchip6(void) { KREAD((void *)namelist[0].n_value, &newstat, sizeof(newstat)); ADJINETCTR(curstat, oldstat, newstat, ip6s_total); ADJINETCTR(curstat, oldstat, newstat, ip6s_toosmall); ADJINETCTR(curstat, oldstat, newstat, ip6s_tooshort); ADJINETCTR(curstat, oldstat, newstat, ip6s_badoptions); ADJINETCTR(curstat, oldstat, newstat, ip6s_badvers); ADJINETCTR(curstat, oldstat, newstat, ip6s_exthdrtoolong); ADJINETCTR(curstat, oldstat, newstat, ip6s_delivered); ADJINETCTR(curstat, oldstat, newstat, ip6s_notmember); ADJINETCTR(curstat, oldstat, newstat, ip6s_toomanyhdr); ADJINETCTR(curstat, oldstat, newstat, ip6s_nogif); ADJINETCTR(curstat, oldstat, newstat, ip6s_fragments); ADJINETCTR(curstat, oldstat, newstat, ip6s_fragdropped); ADJINETCTR(curstat, oldstat, newstat, ip6s_fragtimeout); ADJINETCTR(curstat, oldstat, newstat, ip6s_fragoverflow); ADJINETCTR(curstat, oldstat, newstat, ip6s_reassembled); ADJINETCTR(curstat, oldstat, newstat, ip6s_m1); ADJINETCTR(curstat, oldstat, newstat, ip6s_mext1); ADJINETCTR(curstat, oldstat, newstat, ip6s_mext2m); ADJINETCTR(curstat, oldstat, newstat, ip6s_forward); ADJINETCTR(curstat, oldstat, newstat, ip6s_cantforward); ADJINETCTR(curstat, oldstat, newstat, ip6s_redirectsent); ADJINETCTR(curstat, oldstat, newstat, ip6s_localout); ADJINETCTR(curstat, oldstat, newstat, ip6s_rawout); ADJINETCTR(curstat, oldstat, newstat, ip6s_odropped); ADJINETCTR(curstat, oldstat, newstat, ip6s_noroute); ADJINETCTR(curstat, oldstat, newstat, ip6s_fragmented); ADJINETCTR(curstat, oldstat, newstat, ip6s_ofragments); ADJINETCTR(curstat, oldstat, newstat, ip6s_cantfrag); ADJINETCTR(curstat, oldstat, newstat, ip6s_badscope); if (update == UPDATE_TIME) memcpy(&oldstat, &newstat, sizeof(oldstat)); }