tcp_hostcache.c (139823) | tcp_hostcache.c (165118) |
---|---|
1/*- 2 * Copyright (c) 2002 Andre Oppermann, Internet Business Solutions AG 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * | 1/*- 2 * Copyright (c) 2002 Andre Oppermann, Internet Business Solutions AG 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * |
29 * $FreeBSD: head/sys/netinet/tcp_hostcache.c 139823 2005-01-07 01:45:51Z imp $ | 29 * $FreeBSD: head/sys/netinet/tcp_hostcache.c 165118 2006-12-12 12:17:58Z bz $ |
30 */ 31 32/* 33 * The tcp_hostcache moves the tcp specific cached metrics from the routing 34 * table into a dedicated structure indexed by the remote IP address. It 35 * keeps information on the measured tcp parameters of past tcp sessions 36 * to have better initial start values for following connections from the 37 * same source. Depending on the network parameters (delay, bandwidth, max --- 544 unchanged lines hidden (view full) --- 582static int 583sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) 584{ 585 int bufsize; 586 int linesize = 128; 587 char *p, *buf; 588 int len, i, error; 589 struct hc_metrics *hc_entry; | 30 */ 31 32/* 33 * The tcp_hostcache moves the tcp specific cached metrics from the routing 34 * table into a dedicated structure indexed by the remote IP address. It 35 * keeps information on the measured tcp parameters of past tcp sessions 36 * to have better initial start values for following connections from the 37 * same source. Depending on the network parameters (delay, bandwidth, max --- 544 unchanged lines hidden (view full) --- 582static int 583sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) 584{ 585 int bufsize; 586 int linesize = 128; 587 char *p, *buf; 588 int len, i, error; 589 struct hc_metrics *hc_entry; |
590#ifdef INET6 591 char ip6buf[INET6_ADDRSTRLEN]; 592#endif |
|
590 591 bufsize = linesize * (tcp_hostcache.cache_count + 1); 592 593 p = buf = (char *)malloc(bufsize, M_TEMP, M_WAITOK|M_ZERO); 594 595 len = snprintf(p, linesize, 596 "\nIP address MTU SSTRESH RTT RTTVAR BANDWIDTH " 597 " CWND SENDPIPE RECVPIPE HITS UPD EXP\n"); --- 4 unchanged lines hidden (view full) --- 602 THC_LOCK(&tcp_hostcache.hashbase[i].hch_mtx); 603 TAILQ_FOREACH(hc_entry, &tcp_hostcache.hashbase[i].hch_bucket, 604 rmx_q) { 605 len = snprintf(p, linesize, 606 "%-15s %5lu %8lu %6lums %6lums %9lu %8lu %8lu %8lu " 607 "%4lu %4lu %4i\n", 608 hc_entry->ip4.s_addr ? inet_ntoa(hc_entry->ip4) : 609#ifdef INET6 | 593 594 bufsize = linesize * (tcp_hostcache.cache_count + 1); 595 596 p = buf = (char *)malloc(bufsize, M_TEMP, M_WAITOK|M_ZERO); 597 598 len = snprintf(p, linesize, 599 "\nIP address MTU SSTRESH RTT RTTVAR BANDWIDTH " 600 " CWND SENDPIPE RECVPIPE HITS UPD EXP\n"); --- 4 unchanged lines hidden (view full) --- 605 THC_LOCK(&tcp_hostcache.hashbase[i].hch_mtx); 606 TAILQ_FOREACH(hc_entry, &tcp_hostcache.hashbase[i].hch_bucket, 607 rmx_q) { 608 len = snprintf(p, linesize, 609 "%-15s %5lu %8lu %6lums %6lums %9lu %8lu %8lu %8lu " 610 "%4lu %4lu %4i\n", 611 hc_entry->ip4.s_addr ? inet_ntoa(hc_entry->ip4) : 612#ifdef INET6 |
610 ip6_sprintf(&hc_entry->ip6), | 613 ip6_sprintf(ip6buf, &hc_entry->ip6), |
611#else 612 "IPv6?", 613#endif 614 hc_entry->rmx_mtu, 615 hc_entry->rmx_ssthresh, 616 msec(hc_entry->rmx_rtt * 617 (RTM_RTTUNIT / (hz * TCP_RTT_SCALE))), 618 msec(hc_entry->rmx_rttvar * --- 51 unchanged lines hidden --- | 614#else 615 "IPv6?", 616#endif 617 hc_entry->rmx_mtu, 618 hc_entry->rmx_ssthresh, 619 msec(hc_entry->rmx_rtt * 620 (RTM_RTTUNIT / (hz * TCP_RTT_SCALE))), 621 msec(hc_entry->rmx_rttvar * --- 51 unchanged lines hidden --- |