inet.c (5e0517186d418529323a5eb007287145e4fd3b50) | inet.c (f964d60dd3287932055bfdaadf3cba4a7ff2d648) |
---|---|
1/* 2 * Copyright (c) 1983, 1988, 1993, 1995 3 * The Regents of the University of California. 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 --- 151 unchanged lines hidden (view full) --- 160 inp = &((struct xtcpcb *)xig)->xt_inp; 161 so = &((struct xtcpcb *)xig)->xt_socket; 162 } else { 163 inp = &((struct xinpcb *)xig)->xi_inp; 164 so = &((struct xinpcb *)xig)->xi_socket; 165 } 166 167 /* Ignore sockets for protocols other than the desired one. */ | 1/* 2 * Copyright (c) 1983, 1988, 1993, 1995 3 * The Regents of the University of California. 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 --- 151 unchanged lines hidden (view full) --- 160 inp = &((struct xtcpcb *)xig)->xt_inp; 161 so = &((struct xtcpcb *)xig)->xt_socket; 162 } else { 163 inp = &((struct xinpcb *)xig)->xi_inp; 164 so = &((struct xinpcb *)xig)->xi_socket; 165 } 166 167 /* Ignore sockets for protocols other than the desired one. */ |
168 if (so->xso_protocol != proto) | 168 if (so->xso_protocol != (int)proto) |
169 continue; 170 171 /* Ignore PCBs which were freed during copyout. */ 172 if (inp->inp_gencnt > oxig->xig_gen) 173 continue; 174 175 if ((af == AF_INET && (inp->inp_vflag & INP_IPV4) == 0) 176#ifdef INET6 --- 164 unchanged lines hidden (view full) --- 341 } 342 free(buf); 343} 344 345/* 346 * Dump TCP statistics structure. 347 */ 348void | 169 continue; 170 171 /* Ignore PCBs which were freed during copyout. */ 172 if (inp->inp_gencnt > oxig->xig_gen) 173 continue; 174 175 if ((af == AF_INET && (inp->inp_vflag & INP_IPV4) == 0) 176#ifdef INET6 --- 164 unchanged lines hidden (view full) --- 341 } 342 free(buf); 343} 344 345/* 346 * Dump TCP statistics structure. 347 */ 348void |
349tcp_stats(u_long off, char *name) | 349tcp_stats(u_long off __unused, char *name, int af __unused) |
350{ 351 struct tcpstat tcpstat; 352 size_t len = sizeof tcpstat; 353 354 if (sysctlbyname("net.inet.tcp.stats", &tcpstat, &len, 0, 0) < 0) { 355 warn("sysctl: net.inet.tcp.stats"); 356 return; 357 } --- 81 unchanged lines hidden (view full) --- 439#undef p2a 440#undef p3 441} 442 443/* 444 * Dump UDP statistics structure. 445 */ 446void | 350{ 351 struct tcpstat tcpstat; 352 size_t len = sizeof tcpstat; 353 354 if (sysctlbyname("net.inet.tcp.stats", &tcpstat, &len, 0, 0) < 0) { 355 warn("sysctl: net.inet.tcp.stats"); 356 return; 357 } --- 81 unchanged lines hidden (view full) --- 439#undef p2a 440#undef p3 441} 442 443/* 444 * Dump UDP statistics structure. 445 */ 446void |
447udp_stats(u_long off, char *name) | 447udp_stats(u_long off __unused, char *name, int af __unused) |
448{ 449 struct udpstat udpstat; 450 size_t len = sizeof udpstat; 451 u_long delivered; 452 453 if (sysctlbyname("net.inet.udp.stats", &udpstat, &len, 0, 0) < 0) { 454 warn("sysctl: net.inet.udp.stats"); 455 return; --- 34 unchanged lines hidden (view full) --- 490#undef p 491#undef p1a 492} 493 494/* 495 * Dump IP statistics structure. 496 */ 497void | 448{ 449 struct udpstat udpstat; 450 size_t len = sizeof udpstat; 451 u_long delivered; 452 453 if (sysctlbyname("net.inet.udp.stats", &udpstat, &len, 0, 0) < 0) { 454 warn("sysctl: net.inet.udp.stats"); 455 return; --- 34 unchanged lines hidden (view full) --- 490#undef p 491#undef p1a 492} 493 494/* 495 * Dump IP statistics structure. 496 */ 497void |
498ip_stats(u_long off, char *name) | 498ip_stats(u_long off __unused, char *name, int af __unused) |
499{ 500 struct ipstat ipstat; 501 size_t len = sizeof ipstat; 502 503 if (sysctlbyname("net.inet.ip.stats", &ipstat, &len, 0, 0) < 0) { 504 warn("sysctl: net.inet.ip.stats"); 505 return; 506 } --- 63 unchanged lines hidden (view full) --- 570 "address mask request", 571 "address mask reply", 572}; 573 574/* 575 * Dump ICMP statistics. 576 */ 577void | 499{ 500 struct ipstat ipstat; 501 size_t len = sizeof ipstat; 502 503 if (sysctlbyname("net.inet.ip.stats", &ipstat, &len, 0, 0) < 0) { 504 warn("sysctl: net.inet.ip.stats"); 505 return; 506 } --- 63 unchanged lines hidden (view full) --- 570 "address mask request", 571 "address mask reply", 572}; 573 574/* 575 * Dump ICMP statistics. 576 */ 577void |
578icmp_stats(u_long off, char *name) | 578icmp_stats(u_long off __unused, char *name, int af __unused) |
579{ 580 struct icmpstat icmpstat; 581 int i, first; 582 int mib[4]; /* CTL_NET + PF_INET + IPPROTO_ICMP + req */ 583 size_t len; 584 585 mib[0] = CTL_NET; 586 mib[1] = PF_INET; --- 49 unchanged lines hidden (view full) --- 636 printf("\tICMP address mask responses are %sabled\n", 637 i ? "en" : "dis"); 638} 639 640/* 641 * Dump IGMP statistics structure. 642 */ 643void | 579{ 580 struct icmpstat icmpstat; 581 int i, first; 582 int mib[4]; /* CTL_NET + PF_INET + IPPROTO_ICMP + req */ 583 size_t len; 584 585 mib[0] = CTL_NET; 586 mib[1] = PF_INET; --- 49 unchanged lines hidden (view full) --- 636 printf("\tICMP address mask responses are %sabled\n", 637 i ? "en" : "dis"); 638} 639 640/* 641 * Dump IGMP statistics structure. 642 */ 643void |
644igmp_stats(u_long off, char *name) | 644igmp_stats(u_long off __unused, char *name, int af __unused) |
645{ 646 struct igmpstat igmpstat; 647 size_t len = sizeof igmpstat; 648 649 if (sysctlbyname("net.inet.igmp.stats", &igmpstat, &len, 0, 0) < 0) { 650 warn("sysctl: net.inet.igmp.stats"); 651 return; 652 } --- 92 unchanged lines hidden --- | 645{ 646 struct igmpstat igmpstat; 647 size_t len = sizeof igmpstat; 648 649 if (sysctlbyname("net.inet.igmp.stats", &igmpstat, &len, 0, 0) < 0) { 650 warn("sysctl: net.inet.igmp.stats"); 651 return; 652 } --- 92 unchanged lines hidden --- |