From 342c141ecf761e55ea0f23a89d835a8544df5f2e Mon Sep 17 00:00:00 2001 From: Apple Date: Fri, 11 Jul 2014 19:54:46 +0000 Subject: [PATCH] network_cmds-457.tar.gz --- arp.tproj/arp.c | 6 - cfilutil/cfilstat.c | 328 ++++++++ cfilutil/cfilutil.1 | 56 ++ cfilutil/cfilutil.c | 982 +++++++++++++++++++++++ dnctl/dnctl.8 | 121 +-- ifconfig.tproj/af_inet.c | 5 - ifconfig.tproj/af_inet6.c | 6 +- ifconfig.tproj/af_link.c | 5 - ifconfig.tproj/ifbridge.c | 75 +- ifconfig.tproj/ifclone.c | 5 - ifconfig.tproj/ifconfig.8 | 7 + ifconfig.tproj/ifconfig.c | 40 +- ifconfig.tproj/ifvlan.c | 5 +- kdumpd.tproj/com.apple.kdumpd.plist | 2 + kdumpd.tproj/kdumpd.c | 8 +- mptcp_client/conn_lib.c | 233 ++++++ mptcp_client/conn_lib.h | 53 ++ mptcp_client/mptcp_client.1 | 23 + mptcp_client/mptcp_client.c | 832 +++++++++++++++++++ mtest.tproj/mtest.c | 13 - netstat.tproj/if.c | 16 +- netstat.tproj/inet.c | 64 +- netstat.tproj/inet6.c | 43 - netstat.tproj/ipsec.c | 9 - netstat.tproj/main.c | 47 +- netstat.tproj/mbuf.c | 4 +- netstat.tproj/mptcp.c | 2 - netstat.tproj/mroute.c | 222 ----- netstat.tproj/mroute6.c | 294 ------- netstat.tproj/netstat.h | 18 +- netstat.tproj/systm.c | 406 ++++++++++ netstat.tproj/unix.c | 5 - network-client-server-entitlements.plist | 10 + network_cmds.xcodeproj/project.pbxproj | 775 ++++++++++++++++-- ping.tproj/ping.8 | 9 + ping.tproj/ping.c | 68 +- ping6.tproj/ping6.8 | 10 + ping6.tproj/ping6.c | 47 +- pktmnglr/packet_mangler.c | 329 ++++++++ rarpd.tproj/rarpd.c | 8 +- route.tproj/route.c | 9 +- traceroute.tproj/findsaddr-socket.c | 5 - traceroute.tproj/ifaddrlist.c | 5 - traceroute.tproj/traceroute.c | 10 +- traceroute6.tproj/traceroute6.c | 9 +- 45 files changed, 4312 insertions(+), 917 deletions(-) create mode 100644 cfilutil/cfilstat.c create mode 100644 cfilutil/cfilutil.1 create mode 100644 cfilutil/cfilutil.c create mode 100644 mptcp_client/conn_lib.c create mode 100644 mptcp_client/conn_lib.h create mode 100644 mptcp_client/mptcp_client.1 create mode 100644 mptcp_client/mptcp_client.c delete mode 100644 netstat.tproj/mroute.c delete mode 100644 netstat.tproj/mroute6.c create mode 100644 netstat.tproj/systm.c create mode 100644 network-client-server-entitlements.plist create mode 100644 pktmnglr/packet_mangler.c diff --git a/arp.tproj/arp.c b/arp.tproj/arp.c index a152574..85796eb 100644 --- a/arp.tproj/arp.c +++ b/arp.tproj/arp.c @@ -64,12 +64,6 @@ static char const copyright[] = "@(#) Copyright (c) 1984, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ - -#ifndef lint -static char const sccsid[] = "@(#)from: arp.c 8.2 (Berkeley) 1/2/94"; -#endif /* not lint */ -#include -__FBSDID("$FreeBSD: src/usr.sbin/arp/arp.c,v 1.65.2.1 2008/04/25 16:38:14 sam Exp $"); #endif /* diff --git a/cfilutil/cfilstat.c b/cfilutil/cfilstat.c new file mode 100644 index 0000000..ac4b197 --- /dev/null +++ b/cfilutil/cfilstat.c @@ -0,0 +1,328 @@ +/* + * Copyright (c) 2013-2014 Apple Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +void +print_filter_list() +{ + size_t total_len, curr_len; + void *buffer = NULL; + void *ptr; + uint32_t line = 0; + + if (sysctlbyname("net.cfil.filter_list", NULL, &total_len, NULL, 0) == -1) + err(1, "sysctlbyname(net.cfil.filter_list)"); + + buffer = malloc(total_len); + if (buffer == NULL) + err(1, "malloc()"); + if (sysctlbyname("net.cfil.filter_list", buffer, &total_len, NULL, 0) == -1) + err(1, "sysctlbyname(net.cfil.filter_list)"); + + ptr = buffer; + curr_len = 0; + do { + struct cfil_filter_stat *filter_stat; + + filter_stat = (struct cfil_filter_stat *)ptr; + + if (curr_len + filter_stat->cfs_len > total_len || + filter_stat->cfs_len < sizeof(struct cfil_filter_stat)) + break; + + if (line % 16 == 0) + printf("%10s %10s %10s %10s\n", + "filter", "flags", "count", "necpunit"); + + printf("%10u 0x%08x %10u %10u\n", + filter_stat->cfs_filter_id, + filter_stat->cfs_flags, + filter_stat->cfs_sock_count, + filter_stat->cfs_necp_control_unit); + + ptr += filter_stat->cfs_len; + curr_len += filter_stat->cfs_len; + } while (1); + + free(buffer); +} + +void +sprint_offset(char *str, size_t len, const char *fmt, uint64_t offset) +{ + if (offset == CFM_MAX_OFFSET) + snprintf(str, len, "%s", "MAX"); + else + snprintf(str, len, fmt, offset); +} + +void +print_socket_list() +{ + size_t total_len, curr_len; + void *buffer = NULL; + void *ptr; + int i; + + if (sysctlbyname("net.cfil.sock_list", NULL, &total_len, NULL, 0) == -1) + err(1, "sysctlbyname(net.cfil.sock_list)"); + + buffer = malloc(total_len); + if (buffer == NULL) + err(1, "malloc()"); + if (sysctlbyname("net.cfil.sock_list", buffer, &total_len, NULL, 0) == -1) + err(1, "sysctlbyname(net.cfil.sock_list)"); + + ptr = buffer; + curr_len = 0; + do { + struct cfil_sock_stat *sock_stat; + char opass[32]; + char ipass[32]; + + sock_stat = (struct cfil_sock_stat *)ptr; + + if (curr_len + sock_stat->cfs_len > total_len || + sock_stat->cfs_len < sizeof(struct cfil_sock_stat)) + break; + + sprint_offset(opass, 32, "%8llu", sock_stat->cfs_snd.cbs_pass_offset); + sprint_offset(ipass, 32, "%8llu", sock_stat->cfs_rcv.cbs_pass_offset); + + printf("%18s %10s " + "%8s %8s %8s %8s %8s %8s %8s " + "%8s %8s %8s %8s %8s %8s %8s " + "%8s %8s\n", + "sockid", "flags", + "ofirst", "olast", "oqlen", " ", "opass", " ", " ", + "ifirst", "ilast", "iqlen", " ", "ipass", " ", " ", + "pid", "epid"); + + printf("0x%016llx 0x%08llx " + "%8llu %8llu %8llu %8s %8s %8s %8s " + "%8llu %8llu %8llu %8s %8s %8s %8s " + "%8u %8u\n", + + sock_stat->cfs_sock_id, + sock_stat->cfs_flags, + + sock_stat->cfs_snd.cbs_pending_first, + sock_stat->cfs_snd.cbs_pending_last, + sock_stat->cfs_snd.cbs_inject_q_len, + " ", + opass, + " ", + " ", + + sock_stat->cfs_rcv.cbs_pending_first, + sock_stat->cfs_rcv.cbs_pending_last, + sock_stat->cfs_rcv.cbs_inject_q_len, + " ", + ipass, + " ", + " ", + sock_stat->cfs_pid, + sock_stat->cfs_e_pid); + + printf("%7s %10s %10s " + "%8s %8s %8s %8s %8s %8s %8s " + "%8s %8s %8s %8s %8s %8s %8s\n", + " ", + "filter", "flags", + "octlfrst", "octllast", "opndfrst", "opndlast", "opass", "opked", "opeek", + "ictlfrst", "ictllast", "ipndfrst", "ipndlast", "ipass", "ipked", "ipeek"); + for (i = 0; i < CFIL_MAX_FILTER_COUNT; i++) { + struct cfil_entry_stat *estat; + char spass[32]; + char speek[32]; + char spked[32]; + char rpass[32]; + char rpeek[32]; + char rpked[32]; + + estat = &sock_stat->ces_entries[i]; + + sprint_offset(spass, 32, "%8llu", estat->ces_snd.cbs_pass_offset); + sprint_offset(speek, 32, "%8llu", estat->ces_snd.cbs_peek_offset); + sprint_offset(spked, 32, "%8llu", estat->ces_snd.cbs_peeked); + + sprint_offset(rpass, 32, "%8llu", estat->ces_rcv.cbs_pass_offset); + sprint_offset(rpeek, 32, "%8llu", estat->ces_rcv.cbs_peek_offset); + sprint_offset(rpked, 32, "%8llu", estat->ces_rcv.cbs_peeked); + + printf("%7s %10u 0x%08x " + "%8llu %8llu %8llu %8llu %8s %8s %8s " + "%8llu %8llu %8llu %8llu %8s %8s %8s\n", + + " ", + estat->ces_filter_id, + estat->ces_flags, + + estat->ces_snd.cbs_ctl_first, + estat->ces_snd.cbs_ctl_last, + estat->ces_snd.cbs_pending_first, + estat->ces_snd.cbs_pending_last, + spass, + spked, + speek, + + estat->ces_rcv.cbs_ctl_first, + estat->ces_rcv.cbs_ctl_last, + estat->ces_rcv.cbs_pending_first, + estat->ces_rcv.cbs_pending_last, + rpass, + rpked, + rpeek); + } + + + ptr += sock_stat->cfs_len; + curr_len += sock_stat->cfs_len; + } while (1); + + free(buffer); +} + + +#define PR32(x) printf(#x " %u\n", stats-> x) +#define PR64(x) printf(#x " %llu\n", stats-> x) +void +print_cfil_stats() +{ + size_t len, alloc_len; + void *buffer = NULL; + struct cfil_stats *stats; + + if (sysctlbyname("net.cfil.stats", NULL, &len, NULL, 0) == -1) + err(1, "sysctlbyname(net.cfil.stats)"); + + if (len < sizeof(struct cfil_stats)) + alloc_len = sizeof(struct cfil_stats); + else + alloc_len = len; + + buffer = malloc(alloc_len); + if (buffer == NULL) + err(1, "malloc()"); + if (sysctlbyname("net.cfil.stats", buffer, &len, NULL, 0) == -1) + err(1, "sysctlbyname(net.cfil.stats)"); + stats = (struct cfil_stats *)buffer; + + PR32(cfs_ctl_connect_ok); + PR32(cfs_ctl_connect_fail); + PR32(cfs_ctl_connect_ok); + PR32(cfs_ctl_connect_fail); + PR32(cfs_ctl_disconnect_ok); + PR32(cfs_ctl_disconnect_fail); + PR32(cfs_ctl_send_ok); + PR32(cfs_ctl_send_bad); + PR32(cfs_ctl_rcvd_ok); + PR32(cfs_ctl_rcvd_bad); + PR32(cfs_ctl_rcvd_flow_lift); + PR32(cfs_ctl_action_data_update); + PR32(cfs_ctl_action_drop); + PR32(cfs_ctl_action_bad_op); + PR32(cfs_ctl_action_bad_len); + + PR32(cfs_sock_id_not_found); + + PR32(cfs_cfi_alloc_ok); + PR32(cfs_cfi_alloc_fail); + + PR32(cfs_sock_userspace_only); + PR32(cfs_sock_attach_in_vain); + PR32(cfs_sock_attach_already); + PR32(cfs_sock_attach_no_mem); + PR32(cfs_sock_attach_failed); + PR32(cfs_sock_attached); + PR32(cfs_sock_detached); + + PR32(cfs_attach_event_ok); + PR32(cfs_attach_event_flow_control); + PR32(cfs_attach_event_fail); + + PR32(cfs_closed_event_ok); + PR32(cfs_closed_event_flow_control); + PR32(cfs_closed_event_fail); + + PR32(cfs_data_event_ok); + PR32(cfs_data_event_flow_control); + PR32(cfs_data_event_fail); + + PR32(cfs_disconnect_in_event_ok); + PR32(cfs_disconnect_out_event_ok); + PR32(cfs_disconnect_event_flow_control); + PR32(cfs_disconnect_event_fail); + + PR32(cfs_ctl_q_not_started); + + PR32(cfs_close_wait); + PR32(cfs_close_wait_timeout); + + PR32(cfs_flush_in_drop); + PR32(cfs_flush_out_drop); + PR32(cfs_flush_in_close); + PR32(cfs_flush_out_close); + PR32(cfs_flush_in_free); + PR32(cfs_flush_out_free); + + PR32(cfs_inject_q_nomem); + PR32(cfs_inject_q_nobufs); + PR32(cfs_inject_q_detached); + PR32(cfs_inject_q_in_fail); + PR32(cfs_inject_q_out_fail); + + PR32(cfs_inject_q_in_retry); + PR32(cfs_inject_q_out_retry); + + PR32(cfs_data_in_control); + PR32(cfs_data_in_oob); + PR32(cfs_data_out_control); + PR32(cfs_data_out_oob); + + PR64(cfs_ctl_q_in_enqueued); + PR64(cfs_ctl_q_out_enqueued); + PR64(cfs_ctl_q_in_peeked); + PR64(cfs_ctl_q_out_peeked); + + PR64(cfs_pending_q_in_enqueued); + PR64(cfs_pending_q_out_enqueued); + + PR64(cfs_inject_q_in_enqueued); + PR64(cfs_inject_q_out_enqueued); + PR64(cfs_inject_q_in_passed); + PR64(cfs_inject_q_out_passed); +} diff --git a/cfilutil/cfilutil.1 b/cfilutil/cfilutil.1 new file mode 100644 index 0000000..0d97adf --- /dev/null +++ b/cfilutil/cfilutil.1 @@ -0,0 +1,56 @@ +.Dd 2/10/14 +.Dt cfilutil 1 +.Os Darwin +.Sh NAME +.Nm cfilutil +.Nd Tool to exercise the content filter subsystem. +.Sh SYNOPSIS +.Nm +.Op Fl hilqsv +.Fl u Ar unit +.Op Fl a Ar offset +.Op Fl d Ar offset value +.Op Fl k Ar increment +.Op Fl m Ar length +.Op Fl p Ar offset +.Op Fl r Ar random +.Op Fl t Ar delay +.Sh DESCRIPTION +Use +.Nm +to exercise the content filter subsystem. +.Pp +The flags have the following meaning: +.Bl -tag -width -indent +.It Fl a Ar offset +Auto start filtering with given offset. +.It Fl a Ar offset value +Default values for offset passin, peekin, passout, peekout, pass or peek. +.It Fl h +Display this help. +.It Fl i +Interactive mode. +.It Fl k Ar increment +Peek mode with increment. +.It Fl l +Pass loopback traffic. +.It Fl m Ar length +Maximum dump length. +.It Fl p Ar offset +Pass mode (all or after given offset if it is > 0). +.It Fl q +Decrease verbosity. +.It Fl r Ar rate +Random drop rate. +.It Fl s +display content filter statistics (all, sock, filt, cfil). +.It Fl t Ar delay +Pass delay in microseconds. +.It Fl u Ar unit +NECP filter control unit. +.It Fl v +Increase verbosity. +.El +.Pp +.Sh SEE ALSO +.Xr neutil 1 \" rdar://16115914 diff --git a/cfilutil/cfilutil.c b/cfilutil/cfilutil.c new file mode 100644 index 0000000..546604c --- /dev/null +++ b/cfilutil/cfilutil.c @@ -0,0 +1,982 @@ +/* + * Copyright (c) 2013-2014 Apple Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern void print_filter_list(void); +extern void print_socket_list(void); +extern void print_cfil_stats(void); + +#define MAX_BUFFER (65536 + 1024) + +#define MAXHEXDUMPCOL 16 + + +enum { + MODE_NONE = 0, + MODE_INTERACTIVE = 0x01, + MODE_PEEK = 0x02, + MODE_PASS = 0x04, + MODE_DELAY = 0x08 +}; +int mode = MODE_NONE; + +unsigned long delay_ms = 0; +struct timeval delay_tv = { 0, 0 }; +long verbosity = 0; +uint32_t necp_control_unit = 0; +unsigned long auto_start = 0; +uint64_t peek_inc = 0; +uint64_t pass_offset = 0; +struct timeval now, deadline; +int sf = -1; +int pass_loopback = 0; +uint32_t random_drop = 0; +uint32_t event_total = 0; +uint32_t event_dropped = 0; + +uint64_t default_in_pass = 0; +uint64_t default_in_peek = 0; +uint64_t default_out_pass = 0; +uint64_t default_out_peek = 0; + +unsigned long max_dump_len = 32; + +TAILQ_HEAD(sock_info_head, sock_info) sock_info_head = TAILQ_HEAD_INITIALIZER(sock_info_head); + + +struct sock_info { + TAILQ_ENTRY(sock_info) si_link; + cfil_sock_id_t si_sock_id; + struct timeval si_deadline; + uint64_t si_in_pass; + uint64_t si_in_peek; + uint64_t si_out_pass; + uint64_t si_out_peek; +}; + +static void +HexDump(void *data, size_t len) +{ + size_t i, j, k; + unsigned char *ptr = (unsigned char *)data; + unsigned char buf[32 + 3 * MAXHEXDUMPCOL + 2 + MAXHEXDUMPCOL + 1]; + + for (i = 0; i < len; i += MAXHEXDUMPCOL) { + k = snprintf((char *)buf, sizeof(buf), "\t0x%04lx: ", i); + for (j = i; j < i + MAXHEXDUMPCOL; j++) { + if (j < len) { + unsigned char msnbl = ptr[j] >> 4; + unsigned char lsnbl = ptr[j] & 0x0f; + + buf[k++] = msnbl < 10 ? msnbl + '0' : msnbl + 'a' - 10; + buf[k++] = lsnbl < 10 ? lsnbl + '0' : lsnbl + 'a' - 10; + } else { + buf[k++] = ' '; + buf[k++] = ' '; + } + if ((j % 2) == 1) + buf[k++] = ' '; + if ((j % MAXHEXDUMPCOL) == MAXHEXDUMPCOL - 1) + buf[k++] = ' '; + } + + buf[k++] = ' '; + buf[k++] = ' '; + + for (j = i; j < i + MAXHEXDUMPCOL && j < len; j++) { + if (isprint(ptr[j])) + buf[k++] = ptr[j]; + else + buf[k++] = '.'; + } + buf[k] = 0; + printf("%s\n", buf); + } +} + +void +print_hdr(struct cfil_msg_hdr *hdr) +{ + const char *typestr = "unknown"; + const char *opstr = "unknown"; + + if (hdr->cfm_type == CFM_TYPE_EVENT) { + typestr = "event"; + switch (hdr->cfm_op) { + case CFM_OP_SOCKET_ATTACHED: + opstr = "attached"; + break; + case CFM_OP_SOCKET_CLOSED: + opstr = "closed"; + break; + case CFM_OP_DATA_OUT: + opstr = "dataout"; + break; + case CFM_OP_DATA_IN: + opstr = "datain"; + break; + case CFM_OP_DISCONNECT_OUT: + opstr = "disconnectout"; + break; + case CFM_OP_DISCONNECT_IN: + opstr = "disconnectin"; + break; + + default: + break; + } + } else if (hdr->cfm_type == CFM_TYPE_ACTION) { + typestr = "action"; + switch (hdr->cfm_op) { + case CFM_OP_DATA_UPDATE: + opstr = "update"; + break; + case CFM_OP_DROP: + opstr = "drop"; + break; + + default: + break; + } + + } + printf("%s %s len %u version %u type %u op %u sock_id 0x%llx\n", + typestr, opstr, + hdr->cfm_len, hdr->cfm_version, hdr->cfm_type, + hdr->cfm_op, hdr->cfm_sock_id); +} + +void +print_data_req(struct cfil_msg_data_event *data_req) +{ + size_t datalen; + void *databuf; + + if (verbosity <= 0) + return; + + print_hdr(&data_req->cfd_msghdr); + + printf(" start %llu end %llu\n", + data_req->cfd_start_offset, data_req->cfd_end_offset); + + datalen = (size_t)(data_req->cfd_end_offset - data_req->cfd_start_offset); + + databuf = (void *)(data_req + 1); + + if (verbosity > 1) + HexDump(databuf, MIN(datalen, max_dump_len)); +} + +void +print_action_msg(struct cfil_msg_action *action) +{ + if (verbosity <= 0) + return; + + print_hdr(&action->cfa_msghdr); + + if (action->cfa_msghdr.cfm_op == CFM_OP_DATA_UPDATE) + printf(" out pass %llu peek %llu in pass %llu peek %llu\n", + action->cfa_out_pass_offset, action->cfa_out_peek_offset, + action->cfa_in_pass_offset, action->cfa_in_peek_offset); +} + +struct sock_info * +find_sock_info(cfil_sock_id_t sockid) +{ + struct sock_info *sock_info; + + TAILQ_FOREACH(sock_info, &sock_info_head, si_link) { + if (sock_info->si_sock_id == sockid) + return (sock_info); + } + return (NULL); +} + +struct sock_info * +add_sock_info(cfil_sock_id_t sockid) +{ + struct sock_info *sock_info; + + if (find_sock_info(sockid) != NULL) + return (NULL); + + sock_info = calloc(1, sizeof(struct sock_info)); + if (sock_info == NULL) + err(EX_OSERR, "calloc()"); + sock_info->si_sock_id = sockid; + TAILQ_INSERT_TAIL(&sock_info_head, sock_info, si_link); + + return (sock_info); +} + +void +remove_sock_info(cfil_sock_id_t sockid) +{ + struct sock_info *sock_info = find_sock_info(sockid); + + if (sock_info != NULL) { + TAILQ_REMOVE(&sock_info_head, sock_info, si_link); + free(sock_info); + } +} + +/* return 0 if timer is already set */ +int +set_sock_info_deadline(struct sock_info *sock_info) +{ + if (timerisset(&sock_info->si_deadline)) + return (0); + + timeradd(&now, &sock_info->si_deadline, &sock_info->si_deadline); + + if (!timerisset(&deadline)) { + timeradd(&now, &delay_tv, &deadline); + } + + return (1); +} + +void +send_action_message(uint32_t op, struct sock_info *sock_info, int nodelay) +{ + struct cfil_msg_action action; + + if (!nodelay && delay_ms) { + set_sock_info_deadline(sock_info); + return; + } + bzero(&action, sizeof(struct cfil_msg_action)); + action.cfa_msghdr.cfm_len = sizeof(struct cfil_msg_action); + action.cfa_msghdr.cfm_version = CFM_VERSION_CURRENT; + action.cfa_msghdr.cfm_type = CFM_TYPE_ACTION; + action.cfa_msghdr.cfm_op = op; + action.cfa_msghdr.cfm_sock_id = sock_info->si_sock_id; + switch (op) { + case CFM_OP_DATA_UPDATE: + action.cfa_out_pass_offset = sock_info->si_out_pass; + action.cfa_out_peek_offset = sock_info->si_out_peek; + action.cfa_in_pass_offset = sock_info->si_in_pass; + action.cfa_in_peek_offset = sock_info->si_in_peek; + break; + + default: + break; + } + + if (verbosity > -1) + print_action_msg(&action); + + if (send(sf, &action, sizeof(struct cfil_msg_action), 0) == -1) + warn("send()"); + + timerclear(&sock_info->si_deadline); +} + +void +process_delayed_actions() +{ + struct sock_info *sock_info; + + TAILQ_FOREACH(sock_info, &sock_info_head, si_link) { + if (timerisset(&sock_info->si_deadline) && + timercmp(&sock_info->si_deadline, &now, >=)) + send_action_message(CFM_OP_DATA_UPDATE, sock_info, 1); + } +} + +int +set_non_blocking(int fd) +{ + int flags; + + flags = fcntl(fd, F_GETFL); + if (flags == -1) { + warn("fcntl(F_GETFL)"); + return (-1); + } + flags |= O_NONBLOCK; + if (fcntl(fd, F_SETFL, flags) == -1) { + warn("fcntl(F_SETFL)"); + return (-1); + } + return (0); +} + +int +offset_from_str(const char *str, uint64_t *ret_val) +{ + char *endptr; + uint64_t offset; + int success = 1; + + if (strcasecmp(str, "max") == 0 || strcasecmp(str, "all") == 0) + offset = CFM_MAX_OFFSET; + else { + offset = strtoull(str, &endptr, 0); + if (*str == '\0' || *endptr != '\0') + success = 0; + } + if (success) + *ret_val = offset; + return (success); +} + +#define IN6_IS_ADDR_V4MAPPED_LOOPBACK(a) \ + ((*(const __uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \ + (*(const __uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \ + (*(const __uint32_t *)(const void *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff)) && \ + (*(const __uint32_t *)(const void *)(&(a)->s6_addr[12]) == ntohl(INADDR_LOOPBACK))) + + +int +is_loopback(struct cfil_msg_data_event *data_req) +{ + if (data_req->cfc_dst.sa.sa_family == AF_INET && + ntohl(data_req->cfc_dst.sin.sin_addr.s_addr) == INADDR_LOOPBACK) + return (1); + if (data_req->cfc_dst.sa.sa_family == AF_INET6 && + IN6_IS_ADDR_LOOPBACK(&data_req->cfc_dst.sin6.sin6_addr)) + return (1); + if (data_req->cfc_dst.sa.sa_family == AF_INET6 && + IN6_IS_ADDR_V4MAPPED_LOOPBACK(&data_req->cfc_dst.sin6.sin6_addr)) + return (1); + + if (data_req->cfc_src.sa.sa_family == AF_INET && + ntohl(data_req->cfc_src.sin.sin_addr.s_addr) == INADDR_LOOPBACK) + return (1); + if (data_req->cfc_src.sa.sa_family == AF_INET6 && + IN6_IS_ADDR_LOOPBACK(&data_req->cfc_src.sin6.sin6_addr)) + return (1); + if (data_req->cfc_src.sa.sa_family == AF_INET6 && + IN6_IS_ADDR_V4MAPPED_LOOPBACK(&data_req->cfc_src.sin6.sin6_addr)) + return (1); + + return (0); +} + +int +drop(struct sock_info *sock_info) +{ + event_total++; + if (random_drop > 0) { + uint32_t r = arc4random(); + if (r <= random_drop) { + event_dropped++; + printf("dropping 0x%llx dropped %u total %u rate %f\n", + sock_info->si_sock_id, + event_dropped, event_total, + (double)event_dropped/(double)event_total * 100); + send_action_message(CFM_OP_DROP, sock_info, 0); + return (1); + } + } + return (0); +} + +int +doit() +{ + struct sockaddr_ctl sac; + struct ctl_info ctl_info; + void *buffer = NULL; + struct cfil_msg_hdr *hdr; + int kq = -1; + struct kevent kv; + int fdin = fileno(stdin); + char *linep = NULL; + size_t linecap = 0; + char *cmdptr = NULL; + char *argptr = NULL; + size_t cmdlen = 0; + struct cfil_msg_action action; + cfil_sock_id_t last_sock_id = 0; + struct sock_info *sock_info = NULL; + struct timeval last_time, elapsed, delta; + struct timespec interval, *timeout = NULL; + + kq = kqueue(); + if (kq == -1) + err(1, "kqueue()"); + + sf = socket(PF_SYSTEM, SOCK_DGRAM, SYSPROTO_CONTROL); + if (sf == -1) + err(1, "socket()"); + + bzero(&ctl_info, sizeof(struct ctl_info)); + strlcpy(ctl_info.ctl_name, CONTENT_FILTER_CONTROL_NAME, sizeof(ctl_info.ctl_name)); + if (ioctl(sf, CTLIOCGINFO, &ctl_info) == -1) + err(1, "ioctl(CTLIOCGINFO)"); + + if (fcntl(sf, F_SETNOSIGPIPE, 1) == -1) + err(1, "fcntl(F_SETNOSIGPIPE)"); + + bzero(&sac, sizeof(struct sockaddr_ctl)); + sac.sc_len = sizeof(struct sockaddr_ctl); + sac.sc_family = AF_SYSTEM; + sac.ss_sysaddr = AF_SYS_CONTROL; + sac.sc_id = ctl_info.ctl_id; + + if (connect(sf, (struct sockaddr *)&sac, sizeof(struct sockaddr_ctl)) == -1) + err(1, "connect()"); + + if (set_non_blocking(sf) == -1) + err(1, "set_non_blocking(sf)"); + + if (setsockopt(sf, SYSPROTO_CONTROL, CFIL_OPT_NECP_CONTROL_UNIT, + &necp_control_unit, sizeof(uint32_t)) == -1) + err(1, "setsockopt(CFIL_OPT_NECP_CONTROL_UNIT, %u)", necp_control_unit); + + bzero(&kv, sizeof(struct kevent)); + kv.ident = sf; + kv.filter = EVFILT_READ; + kv.flags = EV_ADD; + if (kevent(kq, &kv, 1, NULL, 0, NULL) == -1) + err(1, "kevent(sf)"); + + bzero(&kv, sizeof(struct kevent)); + kv.ident = fdin; + kv.filter = EVFILT_READ; + kv.flags = EV_ADD; + if (kevent(kq, &kv, 1, NULL, 0, NULL) == -1) + err(1, "kevent(sf)"); + + buffer = malloc(MAX_BUFFER); + if (buffer == NULL) + err(1, "malloc()"); + + gettimeofday(&now, NULL); + + while (1) { + last_time = now; + if (delay_ms && timerisset(&deadline)) { + timersub(&deadline, &now, &delta); + TIMEVAL_TO_TIMESPEC(&delta, &interval); + timeout = &interval; + } else { + timeout = NULL; + } + + if (kevent(kq, NULL, 0, &kv, 1, timeout) == -1) { + if (errno == EINTR) + continue; + err(1, "kevent()"); + } + gettimeofday(&now, NULL); + timersub(&now, &last_time, &elapsed); + if (delay_ms && timerisset(&deadline)) { + if (timercmp(&now, &deadline, >=)) { + process_delayed_actions(); + interval.tv_sec = 0; + interval.tv_nsec = 0; + } + } + + if (kv.ident == sf && kv.filter == EVFILT_READ) { + while (1) { + ssize_t nread; + + nread = recv(sf, buffer, MAX_BUFFER, 0); + if (nread == 0) { + warnx("recv(sf) returned 0, connection closed"); + break; + } + if (nread == -1) { + if (errno == EINTR) + continue; + if (errno == EWOULDBLOCK) + break; + err(1, "recv()"); + + } + if (nread < sizeof(struct cfil_msg_hdr)) + errx(1, "too small"); + hdr = (struct cfil_msg_hdr *)buffer; + + + if (hdr->cfm_type != CFM_TYPE_EVENT) { + warnx("not a content filter event type %u", hdr->cfm_type); + continue; + } + switch (hdr->cfm_op) { + case CFM_OP_SOCKET_ATTACHED: { + struct cfil_msg_sock_attached *msg_attached = (struct cfil_msg_sock_attached *)hdr; + + if (verbosity > -2) + print_hdr(hdr); + if (verbosity > -1) + printf(" fam %d type %d proto %d pid %u epid %u\n", + msg_attached->cfs_sock_family, + msg_attached->cfs_sock_type, + msg_attached->cfs_sock_protocol, + msg_attached->cfs_pid, + msg_attached->cfs_e_pid); + break; + } + case CFM_OP_SOCKET_CLOSED: + case CFM_OP_DISCONNECT_IN: + case CFM_OP_DISCONNECT_OUT: + if (verbosity > -2) + print_hdr(hdr); + break; + case CFM_OP_DATA_OUT: + case CFM_OP_DATA_IN: + if (verbosity > -3) + print_data_req((struct cfil_msg_data_event *)hdr); + break; + default: + warnx("unknown content filter event op %u", hdr->cfm_op); + continue; + } + switch (hdr->cfm_op) { + case CFM_OP_SOCKET_ATTACHED: + sock_info = add_sock_info(hdr->cfm_sock_id); + if (sock_info == NULL) { + warnx("sock_id %llx already exists", hdr->cfm_sock_id); + continue; + } + break; + case CFM_OP_DATA_OUT: + case CFM_OP_DATA_IN: + case CFM_OP_DISCONNECT_IN: + case CFM_OP_DISCONNECT_OUT: + case CFM_OP_SOCKET_CLOSED: + sock_info = find_sock_info(hdr->cfm_sock_id); + + if (sock_info == NULL) { + warnx("unexpected data message, sock_info is NULL"); + continue; + } + break; + default: + warnx("unknown content filter event op %u", hdr->cfm_op); + continue; + } + + + switch (hdr->cfm_op) { + case CFM_OP_SOCKET_ATTACHED: { + if ((mode & MODE_PASS) || (mode & MODE_PEEK) || auto_start) { + sock_info->si_out_pass = default_out_pass; + sock_info->si_out_peek = (mode & MODE_PEEK) ? peek_inc : (mode & MODE_PASS) ? CFM_MAX_OFFSET : default_out_peek; + sock_info->si_in_pass = default_in_pass; + sock_info->si_in_peek = (mode & MODE_PEEK) ? peek_inc : (mode & MODE_PASS) ? CFM_MAX_OFFSET : default_in_peek; + + send_action_message(CFM_OP_DATA_UPDATE, sock_info, 0); + } + break; + } + case CFM_OP_SOCKET_CLOSED: { + remove_sock_info(hdr->cfm_sock_id); + sock_info = NULL; + break; + } + case CFM_OP_DATA_OUT: + case CFM_OP_DATA_IN: { + struct cfil_msg_data_event *data_req = (struct cfil_msg_data_event *)hdr; + + if (pass_loopback && is_loopback(data_req)) { + sock_info->si_out_pass = CFM_MAX_OFFSET; + sock_info->si_in_pass = CFM_MAX_OFFSET; + } else { + if (drop(sock_info)) + continue; + + if ((mode & MODE_PASS)) { + if (data_req->cfd_msghdr.cfm_op == CFM_OP_DATA_OUT) { + if (pass_offset == 0 || pass_offset == CFM_MAX_OFFSET) + sock_info->si_out_pass = data_req->cfd_end_offset; + else if (data_req->cfd_end_offset > pass_offset) { + sock_info->si_out_pass = CFM_MAX_OFFSET; + sock_info->si_in_pass = CFM_MAX_OFFSET; + } + sock_info->si_out_peek = (mode & MODE_PEEK) ? + data_req->cfd_end_offset + peek_inc : 0; + } else { + if (pass_offset == 0 || pass_offset == CFM_MAX_OFFSET) + sock_info->si_in_pass = data_req->cfd_end_offset; + else if (data_req->cfd_end_offset > pass_offset) { + sock_info->si_out_pass = CFM_MAX_OFFSET; + sock_info->si_in_pass = CFM_MAX_OFFSET; + } + sock_info->si_in_peek = (mode & MODE_PEEK) ? + data_req->cfd_end_offset + peek_inc : 0; + } + } else { + break; + } + } + send_action_message(CFM_OP_DATA_UPDATE, sock_info, 0); + + break; + } + case CFM_OP_DISCONNECT_IN: + case CFM_OP_DISCONNECT_OUT: { + if (drop(sock_info)) + continue; + + if ((mode & MODE_PASS)) { + sock_info->si_out_pass = CFM_MAX_OFFSET; + sock_info->si_in_pass = CFM_MAX_OFFSET; + + send_action_message(CFM_OP_DATA_UPDATE, sock_info, 0); + } + break; + } + default: + warnx("unkown message op %u", hdr->cfm_op); + break; + } + if (sock_info) + last_sock_id = sock_info->si_sock_id; + } + } + if (kv.ident == fdin && kv.filter == EVFILT_READ) { + ssize_t nread; + uint64_t offset = 0; + int nitems; + int op = 0; + + nread = getline(&linep, &linecap, stdin); + if (nread == -1) + errx(1, "getline()"); + + if (verbosity > 2) + printf("linecap %lu nread %lu\n", linecap, nread); + if (nread > 0) + linep[nread - 1] = '\0'; + + if (verbosity > 2) + HexDump(linep, linecap); + + if (*linep == 0) + continue; + + if (cmdptr == NULL || argptr == NULL || linecap > cmdlen) { + cmdlen = linecap; + cmdptr = realloc(cmdptr, cmdlen); + argptr = realloc(argptr, cmdlen); + } + + /* + * Trick to support unisgned and hexadecimal arguments + * as I can't figure out sscanf() conversions + */ + nitems = sscanf(linep, "%s %s", cmdptr, argptr); + if (nitems == 0) { + warnx("I didn't get that..."); + continue; + } else if (nitems > 1) { + if (offset_from_str(argptr, &offset) == 0) { + warnx("I didn't get that either..."); + continue; + } + } + if (verbosity > 2) + printf("nitems %d %s %s\n", nitems, cmdptr, argptr); + + bzero(&action, sizeof(struct cfil_msg_action)); + action.cfa_msghdr.cfm_len = sizeof(struct cfil_msg_action); + action.cfa_msghdr.cfm_version = CFM_VERSION_CURRENT; + action.cfa_msghdr.cfm_type = CFM_TYPE_ACTION; + + if (strcasecmp(cmdptr, "passout") == 0 && nitems > 1) { + op = CFM_OP_DATA_UPDATE; + action.cfa_out_pass_offset = offset; + } else if (strcasecmp(cmdptr, "passin") == 0 && nitems > 1) { + op = CFM_OP_DATA_UPDATE; + action.cfa_in_pass_offset = offset; + } else if (strcasecmp(cmdptr, "pass") == 0 && nitems > 1) { + op = CFM_OP_DATA_UPDATE; + action.cfa_out_pass_offset = offset; + action.cfa_in_pass_offset = offset; + } else if (strcasecmp(cmdptr, "peekout") == 0 && nitems > 1) { + op = CFM_OP_DATA_UPDATE; + action.cfa_out_peek_offset = offset; + } else if (strcasecmp(cmdptr, "peekin") == 0 && nitems > 1) { + op = CFM_OP_DATA_UPDATE; + action.cfa_in_peek_offset = offset; + } else if (strcasecmp(cmdptr, "peek") == 0 && nitems > 1) { + op = CFM_OP_DATA_UPDATE; + action.cfa_out_peek_offset = offset; + action.cfa_in_peek_offset = offset; + } else if (strcasecmp(cmdptr, "start") == 0) { + op = CFM_OP_DATA_UPDATE; + action.cfa_out_pass_offset = 0; + action.cfa_out_peek_offset = CFM_MAX_OFFSET; + action.cfa_in_pass_offset = 0; + action.cfa_in_peek_offset = CFM_MAX_OFFSET; + } else if (strcasecmp(cmdptr, "peekall") == 0) { + op = CFM_OP_DATA_UPDATE; + action.cfa_out_peek_offset = CFM_MAX_OFFSET; + action.cfa_in_peek_offset = CFM_MAX_OFFSET; + } else if (strcasecmp(cmdptr, "passall") == 0) { + op = CFM_OP_DATA_UPDATE; + action.cfa_out_pass_offset = CFM_MAX_OFFSET; + action.cfa_out_peek_offset = CFM_MAX_OFFSET; + action.cfa_in_pass_offset = CFM_MAX_OFFSET; + action.cfa_in_peek_offset = CFM_MAX_OFFSET; + } else if (strcasecmp(cmdptr, "drop") == 0) + op = CFM_OP_DROP; + else if (strcasecmp(cmdptr, "sock") == 0) { + last_sock_id = offset; + printf("last_sock_id 0x%llx\n", last_sock_id); + } else + warnx("syntax error"); + + if (op == CFM_OP_DATA_UPDATE || op == CFM_OP_DROP) { + action.cfa_msghdr.cfm_op = op; + action.cfa_msghdr.cfm_sock_id = last_sock_id; + print_action_msg(&action); + + if (send(sf, &action, sizeof(struct cfil_msg_action), 0) == -1) + warn("send()"); + } + } + } + + return 0; +} + +static const char * +basename(const char * str) +{ + const char *last_slash = strrchr(str, '/'); + + if (last_slash == NULL) + return (str); + else + return (last_slash + 1); +} + +struct option_desc { + const char *option; + const char *description; + int required; +}; + +struct option_desc option_desc_list[] = { + { "-a offset", "auto start with offset", 0 }, + { "-d offset value", "default offset value for passin, peekin, passout, peekout, pass, peek", 0 }, + { "-h", "dsiplay this help", 0 }, + { "-i", "interactive mode", 0 }, + { "-k increment", "peek mode with increment", 0 }, + {"-l", "pass loopback", 0 }, + { "-m length", "max dump length", 0 }, + { "-p offset", "pass mode (all or after given offset if > 0)", 0 }, + { "-q", "decrease verbose level", 0 }, + { "-r random", "random drop rate", 0 }, + { "-s ", "display content filter statistics (all, sock, filt, cfil)", 0 }, + { "-t delay", "pass delay in microseconds", 0 }, + { "-u unit", "NECP filter control unit", 1 }, + { "-v", "increase verbose level", 0 }, + { NULL, NULL, 0 } /* Mark end of list */ +}; + +static void +usage(const char *cmd) +{ + struct option_desc *option_desc; + char *usage_str = malloc(LINE_MAX); + size_t usage_len; + + if (usage_str == NULL) + err(1, "%s: malloc(%d)", __func__, LINE_MAX); + + usage_len = snprintf(usage_str, LINE_MAX, "# usage: %s ", basename(cmd)); + + for (option_desc = option_desc_list; option_desc->option != NULL; option_desc++) { + int len; + + if (option_desc->required) + len = snprintf(usage_str + usage_len, LINE_MAX - usage_len, "%s ", option_desc->option); + else + len = snprintf(usage_str + usage_len, LINE_MAX - usage_len, "[%s] ", option_desc->option); + if (len < 0) + err(1, "%s: snprintf(", __func__); + + usage_len += len; + if (usage_len > LINE_MAX) + break; + } + printf("%s\n", usage_str); + printf("options:\n"); + + for (option_desc = option_desc_list; option_desc->option != NULL; option_desc++) { + printf(" %-20s # %s\n", option_desc->option, option_desc->description); + } + +} + +int +main(int argc, char * const argv[]) +{ + int ch; + double d; + int stats_sock_list = 0; + int stats_filt_list = 0; + int stats_cfil_stats = 0; + + while ((ch = getopt(argc, argv, "a:d:hik:lm:p:qr:s:t:u:v")) != -1) { + switch (ch) { + case 'a': + auto_start = strtoul(optarg, NULL, 0); + break; + case 'd': { + if (optind >= argc) + errx(1, "'-d' needs 2 parameters"); + if (strcasecmp(optarg, "passout") == 0) { + if (offset_from_str(argv[optind], &default_out_pass) == 0) + errx(1, "bad %s offset: %s", optarg, argv[optind + 1]); + } else if (strcasecmp(optarg, "passin") == 0) { + if (offset_from_str(argv[optind], &default_in_pass) == 0) + errx(1, "bad %s offset: %s", optarg, argv[optind + 1]); + } else if (strcasecmp(optarg, "pass") == 0) { + if (offset_from_str(argv[optind], &default_out_pass) == 0) + errx(1, "bad %s offset: %s", optarg, argv[optind + 1]); + default_in_pass = default_out_pass; + } else if (strcasecmp(optarg, "peekout") == 0) { + if (offset_from_str(argv[optind], &default_out_peek) == 0) + errx(1, "bad %s offset: %s", optarg, argv[optind + 1]); + } else if (strcasecmp(optarg, "peekin") == 0) { + if (offset_from_str(argv[optind], &default_in_peek) == 0) + errx(1, "bad %s offset: %s", optarg, argv[optind + 1]); + } else if (strcasecmp(optarg, "peek") == 0) { + if (offset_from_str(argv[optind], &default_out_peek) == 0) + errx(1, "bad %s offset: %s", optarg, argv[optind + 1]); + default_in_peek = default_out_peek; + } else + errx(1, "syntax error"); + break; + } + case 'h': + usage(argv[0]); + exit(0); + case 'i': + mode |= MODE_INTERACTIVE; + break; + case 'k': + mode |= MODE_PEEK; + if (offset_from_str(optarg, &peek_inc) == 0) + errx(1, "bad peek offset: %s", optarg); + break; + case 'l': + pass_loopback = 1; + break; + case 'm': + max_dump_len = strtoul(optarg, NULL, 0); + break; + case 'p': + mode |= MODE_PASS; + if (offset_from_str(optarg, &pass_offset) == 0) + errx(1, "bad pass offset: %s", optarg); + break; + case 'q': + verbosity--; + break; + case 'r': + d = strtod(optarg, NULL); + if (d < 0 || d > 1) + errx(1, "bad drop rate: %s -- it must be between 0 and 1", optarg); + random_drop = (uint32_t)(d * UINT32_MAX); + break; + case 's': + if (strcasecmp(optarg, "all") == 0) { + stats_sock_list = 1; + stats_filt_list = 1; + stats_cfil_stats = 1; + } else if (strcasecmp(optarg, "sock") == 0) { + stats_sock_list = 1; + } else if (strcasecmp(optarg, "filt") == 0) { + stats_filt_list = 1; + } else if (strcasecmp(optarg, "cfil") == 0) { + stats_cfil_stats = 1; + } else { + warnx("# Error: unknown type of statistic: %s", optarg); + usage(argv[0]); + exit(0); + } + break; + case 't': + mode |= MODE_DELAY; + delay_ms = strtoul(optarg, NULL, 0); + delay_tv.tv_sec = delay_ms / 1000; + delay_tv.tv_usec = (delay_ms % 1000) * 1000; + break; + case 'u': + necp_control_unit = (uint32_t)strtoul(optarg, NULL, 0); + break; + case 'v': + verbosity++; + break; + default: + errx(1, "# syntax error, unknow option '%d'", ch); + usage(argv[0]); + exit(0); + } + } + + if (stats_filt_list) + print_filter_list(); + if (stats_sock_list) + print_socket_list(); + if (stats_cfil_stats) + print_cfil_stats(); + if (necp_control_unit == 0 && (stats_filt_list || stats_sock_list || stats_cfil_stats)) + return (0); + + if (necp_control_unit == 0) { + warnx("necp filter control unit is 0"); + usage(argv[0]); + exit(EX_USAGE); + } + doit(); + + + return (0); +} + diff --git a/dnctl/dnctl.8 b/dnctl/dnctl.8 index 19c09d4..4da4724 100644 --- a/dnctl/dnctl.8 +++ b/dnctl/dnctl.8 @@ -1,6 +1,3 @@ -.\" -.\" $FreeBSD: /repoman/r/ncvs/src/sbin/ipfw/ipfw.8,v 1.63.2.38 2003/07/28 07:15:13 luigi Exp $ -.\" .Dd August 13, 2002 .Dt DNCTL 8 .Os Darwin @@ -361,9 +358,6 @@ Most connections need packets going in both directions. .It Remember to test very carefully. It is a good idea to be near the console when doing this. -If you cannot be near the console, -use an auto-recovery script such as the one in -.Pa /usr/share/examples/ipfw/change_rules.sh . .It Don't forget the loopback interface. .El @@ -402,40 +396,28 @@ for the RED algorithm. .El .Sh EXAMPLES The following rules show some of the applications of -.Xr dummynet 4 -for simulations and the like. The examples use the obsolete -.Nm ipfw -command for illustration only as the use of -.Nm ipfw -is discouraged. -.Pp -This rule drops random incoming packets with a probability -of 5%: -.Pp -.Dl "ipfw add pipe 10 ip from any to any" +for simulations and the like by using +.Em dummynet +rules in +.Xr pf.conf 8 +configuration files. +.Pp +To drop random incoming IPv4 and IPv6 ICMP packets with a probability of 5%, +create a pipe: .Dl "dnctl pipe 10 config plr 0.05" .Pp -We can use pipes to artificially limit bandwidth, e.g. on a -machine acting as a router, if we want to limit traffic from -local clients on 192.168.2.0/24 we do: -.Pp -.Dl "ipfw add pipe 1 ip from 192.168.2.0/24 to any out" -.Dl "dnctl pipe 1 config bw 300Kbit/s queue 50KBytes" -.Pp -note that we use the -.Cm out -modifier so that the rule is not used twice. -Remember in fact that -.Nm -rules are checked both on incoming and outgoing packets. +and add these rules in your pf.conf file: +.Dl "dummynet in inet proto icmp all pipe 10" +.Dl "dummynet in inet6 proto ipv6-icmp all pipe 10" .Pp Should we want to simulate a bidirectional link with bandwidth -limitations, the correct way is the following: +limitations, the correct way is to create a pipe for each direction: +.Dl "dnctl pipe 1 config bw 14Kbit/s queue 10Kbytes" +.Dl "dnctl pipe 2 config bw 1Kbit/s queue 10Kbytes" .Pp -.Dl "ipfw add pipe 1 ip from any to any out" -.Dl "ipfw add pipe 2 ip from any to any in" -.Dl "dnctl pipe 1 config bw 64Kbit/s queue 10Kbytes" -.Dl "dnctl pipe 2 config bw 64Kbit/s queue 10Kbytes" +and add these rules in your pf.conf file: +.Dl "dummynet in all pipe 1" +.Dl "dummynet out all pipe 2" .Pp The above can be very useful, e.g. if you want to see how your fancy Web page will look for a residential user who @@ -443,80 +425,59 @@ is connected only through a slow link. You should not use only one pipe for both directions, unless you want to simulate a half-duplex medium (e.g. AppleTalk, Ethernet, IRDA). -It is not necessary that both pipes have the same configuration, -so we can also simulate asymmetric links. .Pp -Should we want to verify network performance with the RED queue -management algorithm: +Note that with the above rules the pipes receive traffic for both the +IPv4 and IPv6 protocols. .Pp -.Dl "ipfw add pipe 1 ip from any to any" +Should we want to verify network performance with the RED queue +management algorithm, create this pipe: .Dl "dnctl pipe 1 config bw 500Kbit/s queue 100 red 0.002/30/80/0.1" .Pp +and then add these rules to you pf.conf file: +.Dl "dummynet all pipe 1" +.Pp Another typical application of the traffic shaper is to introduce some delay in the communication. This can significantly affect applications which do a lot of Remote Procedure Calls, and where the round-trip-time of the connection often becomes a limiting factor much more than bandwidth: -.Pp -.Dl "ipfw add pipe 1 ip from any to any out" -.Dl "ipfw add pipe 2 ip from any to any in" .Dl "dnctl pipe 1 config delay 250ms bw 1Mbit/s" .Dl "dnctl pipe 2 config delay 250ms bw 1Mbit/s" .Pp +and add these rules in your pf.conf file: +.Dl "dummynet in all pipe 1" +.Dl "dummynet out all pipe 2" +.Pp Per-flow queueing can be useful for a variety of purposes. A very simple one is counting traffic: -.Pp -.Dl "ipfw add pipe 1 tcp from any to any" -.Dl "ipfw add pipe 1 udp from any to any" -.Dl "ipfw add pipe 1 ip from any to any" .Dl "dnctl pipe 1 config mask all" .Pp +and add these statements in your pf.conf file: +.Dl "dummynet in quick proto tcp all pipe 1" +.Dl "dummynet out quick proto tcp all pipe 1" +.Dl "dummynet in quick proto udp all pipe 1" +.Dl "dummynet out quick proto udp all pipe 1" +.Dl "dummynet in quick all pipe 1" +.Dl "dummynet out quick all pipe 1" +.Pp The above set of rules will create queues (and collect statistics) for all traffic. Because the pipes have no limitations, the only effect is collecting statistics. -Note that we need 3 rules, not just the last one, because +Note that we need six rules, not just the last two one, because when .Nm tries to match IP packets it will not consider ports, so we would not see connections on separate ports as different ones. -.Pp -A more sophisticated example is limiting the outbound traffic -on a net with per-host limits, rather than per-network limits: -.Pp -.Dl "ipfw add pipe 1 ip from 192.168.2.0/24 to any out" -.Dl "ipfw add pipe 2 ip from any to 192.168.2.0/24 in" -.Dl "dnctl pipe 1 config mask src-ip 0x000000ff bw 200Kbit/s queue 20Kbytes" -.Dl "dnctl pipe 2 config mask dst-ip 0x000000ff bw 200Kbit/s queue 20Kbytes" -.Ss SETS OF RULES -To add a set of rules atomically, e.g. set 18: -.Pp -.Dl "ipfw set disable 18" -.Dl "ipfw add NN set 18 ... # repeat as needed" -.Dl "ipfw set enable 18" -.Pp -To delete a set of rules atomically the command is simply: -.Pp -.Dl "ipfw delete set 18" -.Pp -To test a ruleset and disable it and regain control if something goes wrong: -.Pp -.Dl "ipfw set disable 18" -.Dl "ipfw add NN set 18 ... # repeat as needed" -.Dl "ipfw set enable 18; echo done; sleep 30 && ipfw set disable 18" -.Pp -Here if everything goes well, you press control-C before the "sleep" -terminates, and your ruleset will be left active. Otherwise, e.g. if -you cannot access your box, the ruleset will be disabled after -the sleep terminates thus restoring the previous situation. .Sh SEE ALSO .Xr cpp 1 , -.Xr m4 1 , .Xr dummynet 4 , +.Xr m4 1 , .Xr ip 4 , -.Xr ipfirewall 4 , +.Xr pfctl 8 , +.Xr pf.conf 5 , .Xr protocols 5 , .Xr services 5 , .Xr sysctl 8 @@ -545,5 +506,3 @@ was introduced in .Fx 2.2.8 . Stateful extensions were introduced in .Fx 4.0 . -.Nm ipfw2 -was introduced in Summer 2002. diff --git a/ifconfig.tproj/af_inet.c b/ifconfig.tproj/af_inet.c index 9ad175e..ae05970 100644 --- a/ifconfig.tproj/af_inet.c +++ b/ifconfig.tproj/af_inet.c @@ -55,11 +55,6 @@ * SUCH DAMAGE. */ -#ifndef lint -static const char rcsid[] = - "$FreeBSD: src/sbin/ifconfig/af_inet.c,v 1.3.6.1 2008/11/25 02:59:29 kensmith Exp $"; -#endif /* not lint */ - #include #include #include diff --git a/ifconfig.tproj/af_inet6.c b/ifconfig.tproj/af_inet6.c index 14e2a60..6462597 100644 --- a/ifconfig.tproj/af_inet6.c +++ b/ifconfig.tproj/af_inet6.c @@ -55,10 +55,6 @@ * SUCH DAMAGE. */ -#ifndef lint -static const char rcsid[] = - "$FreeBSD: src/sbin/ifconfig/af_inet6.c,v 1.6.6.1 2008/11/25 02:59:29 kensmith Exp $"; -#endif /* not lint */ #include #include @@ -345,6 +341,8 @@ in6_status(int s __unused, const struct ifaddrs *ifa) printf("autoconf "); if ((flags6 & IN6_IFF_TEMPORARY) != 0) printf("temporary "); + if ((flags6 & IN6_IFF_DYNAMIC) != 0) + printf("dynamic "); if ((flags6 & IN6_IFF_SECURED) != 0) printf("secured "); diff --git a/ifconfig.tproj/af_link.c b/ifconfig.tproj/af_link.c index b855242..ca9444c 100644 --- a/ifconfig.tproj/af_link.c +++ b/ifconfig.tproj/af_link.c @@ -55,11 +55,6 @@ * SUCH DAMAGE. */ -#ifndef lint -static const char rcsid[] = - "$FreeBSD: src/sbin/ifconfig/af_link.c,v 1.4.6.1 2008/11/25 02:59:29 kensmith Exp $"; -#endif /* not lint */ - #include #include #include diff --git a/ifconfig.tproj/ifbridge.c b/ifconfig.tproj/ifbridge.c index 7a3c1b7..0b610ce 100644 --- a/ifconfig.tproj/ifbridge.c +++ b/ifconfig.tproj/ifbridge.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 Apple Inc. All rights reserved. + * Copyright (c) 2009-2014 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -82,6 +82,8 @@ #include #include +#include + #include "ifconfig.h" #define PV2ID(pv, epri, eaddr) do { \ @@ -172,7 +174,7 @@ bridge_interfaces(int s, const char *prefix) char *inbuf = NULL, *ninbuf; char *p, *pad; int i, len = 8192; - + pad = strdup(prefix); if (pad == NULL) err(1, "strdup"); @@ -230,9 +232,36 @@ bridge_interfaces(int s, const char *prefix) req->ifbr_state); } printf("\n"); + + if (verbose) { + struct ifbrhostfilter ifbrfh; + struct in_addr in; + struct ether_addr ea; + + bzero(&ifbrfh, sizeof(struct ifbrhostfilter)); + strlcpy(ifbrfh.ifbrhf_ifsname, req->ifbr_ifsname, sizeof(ifbrfh.ifbrhf_ifsname)); + if (do_cmd(s, BRDGGHOSTFILTER, &ifbrfh, sizeof(ifbrfh), 0) < 0) + err(1, "unable to get host filter settings for %s", + ifbrfh.ifbrhf_ifsname); + + if (ifbrfh.ifbrhf_flags & IFBRHF_ENABLED) { + in.s_addr = ifbrfh.ifbrhf_ipsrc; + bcopy(ifbrfh.ifbrhf_hwsrca, ea.octet, ETHER_ADDR_LEN); + } else { + in.s_addr = INADDR_ANY; + bzero(ea.octet, ETHER_ADDR_LEN); + } + printf("%s", pad); + printf("hostfilter %d hw: %s ip: %s", + ifbrfh.ifbrhf_flags & IFBRHF_ENABLED ? 1 : 0, + ether_ntoa(&ea), inet_ntoa(in)); + + printf("\n"); + } } free(inbuf); + free(pad); } static void @@ -745,6 +774,46 @@ unsetbridge_private(const char *val, int d, int s, const struct afswtch *afp) } #endif + +static void +setbridge_hostfilter(const char *ifn, const char *addr, int s, + const struct afswtch *afp) +{ + struct ifbrhostfilter req; + struct ether_addr *ea; + struct in_addr in; + + memset(&req, 0, sizeof(req)); + req.ifbrhf_flags = IFBRHF_ENABLED; + + strlcpy(req.ifbrhf_ifsname, ifn, sizeof(req.ifbrhf_ifsname)); + + ea = ether_aton(addr); + if (ea != NULL) { + req.ifbrhf_flags |= IFBRHF_HWSRC; + bcopy(ea, req.ifbrhf_hwsrca, sizeof(req.ifbrhf_hwsrca)); + } else if (inet_aton(addr, &in) != 0) { + req.ifbrhf_flags |= IFBRHF_IPSRC; + req.ifbrhf_ipsrc = in.s_addr; + } else + errx(1, "invalid address: %s", addr); + + if (do_cmd(s, BRDGSHOSTFILTER, &req, sizeof(req), 1) < 0) + err(1, "BRDGSHOSTFILTER %s %s", ifn, addr); +} + +static void +unsetbridge_hostfilter(const char *ifn, int d, int s, const struct afswtch *afp) +{ + struct ifbrhostfilter req; + + memset(&req, 0, sizeof(req)); + strlcpy(req.ifbrhf_ifsname, ifn, sizeof(req.ifbrhf_ifsname)); + + if (do_cmd(s, BRDGSHOSTFILTER, &req, sizeof(req), 1) < 0) + err(1, "BRDGSHOSTFILTER"); +} + static struct cmd bridge_cmds[] = { DEF_CMD_ARG("addm", setbridge_add), DEF_CMD_ARG("deletem", setbridge_delete), @@ -794,6 +863,8 @@ static struct cmd bridge_cmds[] = { DEF_CMD_ARG("private", setbridge_private), DEF_CMD_ARG("-private", unsetbridge_private), #endif + DEF_CMD_ARG2("hostfilter", setbridge_hostfilter), + DEF_CMD_ARG("-hostfilter", unsetbridge_hostfilter), }; static struct afswtch af_bridge = { .af_name = "af_bridge", diff --git a/ifconfig.tproj/ifclone.c b/ifconfig.tproj/ifclone.c index 16c6643..f6b8c07 100644 --- a/ifconfig.tproj/ifclone.c +++ b/ifconfig.tproj/ifclone.c @@ -27,11 +27,6 @@ * SUCH DAMAGE. */ -#ifndef lint -static const char rcsid[] = - "$FreeBSD: src/sbin/ifconfig/ifclone.c,v 1.3.2.1.2.1 2008/11/25 02:59:29 kensmith Exp $"; -#endif /* not lint */ - #include #include #include diff --git a/ifconfig.tproj/ifconfig.8 b/ifconfig.tproj/ifconfig.8 index 91a2926..6a7ea05 100644 --- a/ifconfig.tproj/ifconfig.8 +++ b/ifconfig.tproj/ifconfig.8 @@ -864,6 +864,13 @@ Set the maximum number of hosts allowed from an interface, packets with unknown source addresses are dropped until an existing host cache entry expires or is removed. Set to 0 to disable. +.It Cm hostfilter Ar interface Ar address +Configure the bridge to accept incoming packet on the interface +only if they match the given MAC address and IP address +-- use the command twice to set both type of addresses. +Other filtering restrictions apply. +.It Cm -hostfilter Ar interface +Allow traffic from any host on that interface. .El .Pp The following parameters are specific to vlan interfaces: diff --git a/ifconfig.tproj/ifconfig.c b/ifconfig.tproj/ifconfig.c index ecc5fd4..98ae666 100644 --- a/ifconfig.tproj/ifconfig.c +++ b/ifconfig.tproj/ifconfig.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2013 Apple Inc. All rights reserved. + * Copyright (c) 2009-2014 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -55,20 +55,14 @@ * SUCH DAMAGE. */ +#include + #ifndef lint -static const char copyright[] = +__unused static const char copyright[] = "@(#) Copyright (c) 1983, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ -#ifndef lint -#if 0 -static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94"; -#endif -static const char rcsid[] = - "$FreeBSD: src/sbin/ifconfig/ifconfig.c,v 1.134.2.2.2.1 2008/11/25 02:59:29 kensmith Exp $"; -#endif /* not lint */ - #include #include #include @@ -257,13 +251,9 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; - /* -l cannot be used with -a or -q or -r or -m or -b */ + /* -l cannot be used with -a or -q or -m or -b */ if (namesonly && -#ifdef TARGET_OS_EMBEDDED - (all || supmedia || bond_details)) -#else /* TARGET_OS_EMBEDDED */ - (all || supmedia || showrtref || bond_details)) -#endif /* !TARGET_OS_EMBEDDED */ + (all || supmedia || bond_details)) usage(); /* nonsense.. */ @@ -971,6 +961,16 @@ setlog(const char *val, int dummy __unused, int s, warn("ioctl (set logging parameters)"); } +void +setcl2k(const char *vname, int value, int s, const struct afswtch *afp) +{ + strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); + ifr.ifr_ifru.ifru_2kcl = value; + + if (ioctl(s, SIOCSIF2KCL, (caddr_t)&ifr) < 0) + Perror(vname); +} + #define IFFBITS \ "\020\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5POINTOPOINT\6SMART\7RUNNING" \ "\10NOARP\11PROMISC\12ALLMULTI\13OACTIVE\14SIMPLEX\15LINK0\16LINK1\17LINK2" \ @@ -978,9 +978,9 @@ setlog(const char *val, int dummy __unused, int s, #define IFEFBITS \ "\020\1AUTOCONFIGURING\6IPV6_DISABLED\7ACCEPT_RTADV\10TXSTART\11RXPOLL" \ -"\12VLAN\13BOND\14ARPLL\15NOWINDOWSCALE\16NOAUTOIPV6LL\20ROUTER4\21ROUTER6" \ -"\22LOCALNET_PRIVATE\23ND6ALT\24RESTRICTED_RECV\25AWDL\26NOACKPRI\35SENDLIST" \ -"\36DIRECTLINK" +"\12VLAN\13BOND\14ARPLL\15NOWINDOWSCALE\16NOAUTOIPV6LL\17EXPENSIVE\20ROUTER4" \ +"\21ROUTER6\22LOCALNET_PRIVATE\23ND6ALT\24RESTRICTED_RECV\25AWDL\26NOACKPRI" \ +"\27AWDL_RESTRICTED\30CL2K\35SENDLIST\36DIRECTLINK\40UPDOWNCHANGE" #define IFCAPBITS \ "\020\1RXCSUM\2TXCSUM\3VLAN_MTU\4VLAN_HWTAGGING\5JUMBO_MTU" \ @@ -1576,6 +1576,8 @@ static struct cmd basic_cmds[] = { DEF_CMD_ARG("tbr", settbr), DEF_CMD_ARG("throttle", setthrottle), DEF_CMD_ARG("log", setlog), + DEF_CMD("cl2k", 1, setcl2k), + DEF_CMD("-cl2k", 0, setcl2k), }; static __constructor void diff --git a/ifconfig.tproj/ifvlan.c b/ifconfig.tproj/ifvlan.c index 8e78ccb..9ec0a0a 100644 --- a/ifconfig.tproj/ifvlan.c +++ b/ifconfig.tproj/ifvlan.c @@ -54,10 +54,7 @@ #include "ifconfig.h" -#ifndef lint -static const char rcsid[] = - "$FreeBSD: src/sbin/ifconfig/ifvlan.c,v 1.12.2.1.2.1 2008/11/25 02:59:29 kensmith Exp $"; -#endif +#include #define NOTAG ((u_short) -1) diff --git a/kdumpd.tproj/com.apple.kdumpd.plist b/kdumpd.tproj/com.apple.kdumpd.plist index a6ed8b2..2a3dd90 100644 --- a/kdumpd.tproj/com.apple.kdumpd.plist +++ b/kdumpd.tproj/com.apple.kdumpd.plist @@ -25,6 +25,8 @@ UserName nobody + Umask + 7 inetdCompatibility Wait diff --git a/kdumpd.tproj/kdumpd.c b/kdumpd.tproj/kdumpd.c index 5f06353..040def3 100644 --- a/kdumpd.tproj/kdumpd.c +++ b/kdumpd.tproj/kdumpd.c @@ -31,8 +31,10 @@ * SUCH DAMAGE. */ +#include + #ifndef lint -static const char copyright[] = +__unused static const char copyright[] = "@(#) Copyright (c) 1983, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ @@ -433,7 +435,7 @@ validate_access(char **filep, int mode) return (errno); - fd = open(filename, O_RDWR|O_CREAT|O_TRUNC , S_IRUSR | S_IWUSR); + fd = open(filename, O_RDWR|O_CREAT|O_TRUNC , S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); if (fd < 0) return (errno + 100); @@ -442,8 +444,6 @@ validate_access(char **filep, int mode) if (file == NULL) { return errno+100; } - if (fchmod(fd, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) < 0) - return errno+100; return (0); } diff --git a/mptcp_client/conn_lib.c b/mptcp_client/conn_lib.c new file mode 100644 index 0000000..56bfd46 --- /dev/null +++ b/mptcp_client/conn_lib.c @@ -0,0 +1,233 @@ +/* + * Copyright (c) 2012-2014 Apple Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ + +// +// Created by Anumita Biswas on 10/30/12. +// + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include "conn_lib.h" + +int +copyassocids(int s, associd_t **aidpp, uint32_t *cnt) +{ + struct so_aidreq aidr; + associd_t *buf; + int err; + + if (aidpp == NULL || cnt == NULL) { + errno = EINVAL; + return (-1); + } + *aidpp = NULL; + *cnt = 0; + + bzero(&aidr, sizeof (aidr)); + + err = ioctl(s, SIOCGASSOCIDS, &aidr); + if (err != 0) + return (-1); + + /* none, just return */ + if (aidr.sar_cnt == 0) + return (0); + + buf = calloc(aidr.sar_cnt, sizeof (associd_t)); + if (buf == NULL) + return (-1); + + aidr.sar_aidp = buf; + err = ioctl(s, SIOCGASSOCIDS, &aidr); + if (err != 0) { + free(buf); + return (-1); + } + + *aidpp = buf; + *cnt = aidr.sar_cnt; + + return (0); +} + +void +freeassocids(associd_t *aidp) +{ + free(aidp); +} + +int +copyconnids(int s, associd_t aid, connid_t **cidp, uint32_t *cnt) +{ + struct so_cidreq cidr; + connid_t *buf; + int err; + + if (cidp == NULL || cnt == NULL) { + errno = EINVAL; + return (-1); + } + *cidp = NULL; + *cnt = 0; + + bzero(&cidr, sizeof (cidr)); + + cidr.scr_aid = aid; + err = ioctl(s, SIOCGCONNIDS, &cidr); + if (err != 0) + return (-1); + + /* none, just return */ + if (cidr.scr_cnt == 0) + return (0); + + buf = calloc(cidr.scr_cnt, sizeof (connid_t)); + if (buf == NULL) + return (-1); + + cidr.scr_cidp = buf; + err = ioctl(s, SIOCGCONNIDS, &cidr); + if (err != 0) { + free(buf); + return (-1); + } + + *cidp = buf; + *cnt = cidr.scr_cnt; + + return (0); +} + +void +freeconnids(connid_t *cidp) +{ + free(cidp); +} + +int +copyconninfo(int s, connid_t cid, conninfo_t **cfop) +{ + struct sockaddr *src = NULL, *dst = NULL, *aux = NULL; + struct so_cinforeq scir; + conninfo_t *buf = NULL; + + if (cfop == NULL) { + errno = EINVAL; + goto error; + } + *cfop = NULL; + + bzero(&scir, sizeof (scir)); + + scir.scir_cid = cid; + if (ioctl(s, SIOCGCONNINFO, &scir) != 0) + goto error; + + if (scir.scir_src_len != 0) { + src = calloc(1, scir.scir_src_len); + if (src == NULL) + goto error; + scir.scir_src = src; + } + if (scir.scir_dst_len != 0) { + dst = calloc(1, scir.scir_dst_len); + if (dst == NULL) + goto error; + scir.scir_dst = dst; + } + if (scir.scir_aux_len != 0) { + aux = calloc(1, scir.scir_aux_len); + if (aux == NULL) + goto error; + scir.scir_aux_data = aux; + } + + if (ioctl(s, SIOCGCONNINFO, &scir) != 0) + goto error; + + buf = calloc(1, sizeof (*buf)); + if (buf == NULL) + goto error; + + // When we query for the length using the first ioctl call above, the kernel + // tells us the length of the aux structure so we know how much to allocate + // memory. There may not be any aux data, which will be indicated by the aux + // data length using the second ioctl call. + if (scir.scir_aux_len == 0 && aux != NULL) { + free(aux); + aux = NULL; + scir.scir_aux_data = NULL; + } + + buf->ci_flags = scir.scir_flags; + buf->ci_ifindex = scir.scir_ifindex; + buf->ci_src = src; + buf->ci_dst = dst; + buf->ci_error = scir.scir_error; + buf->ci_aux_type = scir.scir_aux_type; + buf->ci_aux_data = aux; + *cfop = buf; + + return (0); + +error: + if (src != NULL) + free(src); + if (dst != NULL) + free(dst); + if (aux != NULL) + free(aux); + if (buf != NULL) + free(buf); + + return (-1); +} + +void +freeconninfo(conninfo_t *cfo) +{ + if (cfo->ci_src != NULL) + free(cfo->ci_src); + + if (cfo->ci_dst != NULL) + free(cfo->ci_dst); + + if (cfo->ci_aux_data != NULL) + free(cfo->ci_aux_data); + + free(cfo); +} diff --git a/mptcp_client/conn_lib.h b/mptcp_client/conn_lib.h new file mode 100644 index 0000000..b9c54a3 --- /dev/null +++ b/mptcp_client/conn_lib.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2012-2014 Apple Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ + +// +// Created by Anumita Biswas on 10/30/12. +// + +#ifndef mptcp_client_conn_lib_h +#define mptcp_client_conn_lib_h + +typedef struct conninfo { + __uint32_t ci_flags; /* see flags in sys/socket.h (CIF_CONNECTING, etc...) */ + __uint32_t ci_ifindex; /* outbound interface */ + struct sockaddr *ci_src; /* source address */ + struct sockaddr *ci_dst; /* destination address */ + int ci_error; /* saved error */ + __uint32_t ci_aux_type; /* auxiliary data type */ + void *ci_aux_data; /* auxiliary data */ +} conninfo_t; + +extern int copyassocids(int, associd_t **, uint32_t *); +extern void freeassocids(associd_t *); +extern int copyconnids(int, associd_t, connid_t **, uint32_t *); +extern void freeconnids(connid_t *); +extern int copyconninfo(int, connid_t, conninfo_t **); +extern void freeconninfo(conninfo_t *); + +#endif \ No newline at end of file diff --git a/mptcp_client/mptcp_client.1 b/mptcp_client/mptcp_client.1 new file mode 100644 index 0000000..eb9f15c --- /dev/null +++ b/mptcp_client/mptcp_client.1 @@ -0,0 +1,23 @@ +.Dd 6/12/14 +.Dt mptcp_client 1 +.Os Darwin +.Sh NAME +.Nm mptcp_client +.Nd Tool to exercise MPTCP. +.Sh SYNOPSIS +.Nm +.Ar hostname +.Ar port +.Ar reqlen +.Ar rsplen +.Ar times +.Ar alt_addr +.Ar 0 +.Ar connorder +.Ar longlived +.Ar fastjoin +.Sh DESCRIPTION +.Nm +is as an MPTCP client test tool that use the +.Xr socket 2 +API. diff --git a/mptcp_client/mptcp_client.c b/mptcp_client/mptcp_client.c new file mode 100644 index 0000000..b432a1d --- /dev/null +++ b/mptcp_client/mptcp_client.c @@ -0,0 +1,832 @@ +/* + * Copyright (c) 2012-2014 Apple Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ +/* + * Copyright (c) 1997 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that: (1) source code distributions + * retain the above copyright notice and this paragraph in its entirety, (2) + * distributions including binary code include the above copyright notice and + * this paragraph in its entirety in the documentation or other materials + * provided with the distribution, and (3) all advertising materials mentioning + * features or use of this software display the following acknowledgement: + * ``This product includes software developed by the University of California, + * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of + * the University nor the names of its contributors may be used to endorse + * or promote products derived from this software without specific prior + * written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +// +// Created by Anumita Biswas on 7/17/12. +// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "conn_lib.h" + +struct so_cordreq socorder; +static void showmpinfo(int s); + +#define MSG_HDR "Message Header" +#define RESPONSE "I got your message" + +static int verbose = 0; + +static int32_t thiszone = 0; /* time difference with gmt */ + +char* setup_buffer1(int bufsz) +{ + int i = 0, j = 1; + char *buf = malloc(bufsz); + if (buf) { + bzero(buf, bufsz); + strlcpy(buf, MSG_HDR, sizeof(MSG_HDR)); + } + for (i = sizeof(MSG_HDR); i < bufsz; i++) { + buf[i] = j; + j++; + if (j >= 255) + j = 1; + } + return buf; +} + +char* setup_buffer2(int bufsz) +{ + int i = 0; + char j = 'A'; + char *buf = malloc(bufsz); + if (buf) { + bzero(buf, bufsz); + strlcpy(buf, MSG_HDR, sizeof(MSG_HDR)); + } + for (i = sizeof(MSG_HDR); i < bufsz; i++) { + buf[i] = j; + j++; + if (j >= 'z') + j = 'A'; + } + return buf; +} + +char *setup_buffer3(int bufsz) +{ + char *buf = malloc(bufsz); + if (buf) { + bzero(buf, bufsz); + } + return buf; +} + +/* + * Returns the difference between gmt and local time in seconds. + * Use gmtime() and localtime() to keep things simple. + * from tcpdump/gmt2local.c + */ +static int32_t +gmt2local(time_t t) +{ + int dt, dir; + struct tm *gmt, *loc; + struct tm sgmt; + + if (t == 0) + t = time(NULL); + gmt = &sgmt; + *gmt = *gmtime(&t); + loc = localtime(&t); + dt = (loc->tm_hour - gmt->tm_hour) * 60 * 60 + + (loc->tm_min - gmt->tm_min) * 60; + + /* + * If the year or julian day is different, we span 00:00 GMT + * and must add or subtract a day. Check the year first to + * avoid problems when the julian day wraps. + */ + dir = loc->tm_year - gmt->tm_year; + if (dir == 0) + dir = loc->tm_yday - gmt->tm_yday; + dt += dir * 24 * 60 * 60; + + return (dt); +} + +/* + * Print the timestamp + * from tcpdump/util.c + */ +static void +ts_print(void) +{ + int s; + struct timeval tv; + + gettimeofday(&tv, NULL); + + /* Default */ + s = (tv.tv_sec + thiszone) % 86400; + printf("%02d:%02d:%02d.%06u ", s / 3600, (s % 3600) / 60, s % 60, + (u_int32_t)tv.tv_usec); +} + +static const char * +basename(const char * str) +{ + const char *last_slash = strrchr(str, '/'); + + if (last_slash == NULL) + return (str); + else + return (last_slash + 1); +} + +struct option_desc { + const char *option; + const char *description; + int required; +}; + +struct option_desc option_desc_list[] = { + { "--host addr", "address of server to connect to", 1 }, + { "--port n", "port of server to connect to", 1 }, + { "--reqlen n", "length of request (256 by default)", 0 }, + { "--rsplen n", "length of response (256 by default)", 0 }, + { "--ntimes n", "number of time to send request (1 by default)", 0 }, + { "--alt_addr addr", "alternate server to connect to", 0 }, + { "--connorder add", "alternate server to connect to", 0 }, + { "--longlived n", "number of reconnection for long lived (default 0)", 0 }, + { "--fastjoin (0|1)", "use fast join (default 0)", 0 }, + { "--nowaitforjoin (0|1)", "do not wait for join (default 0 -- i.e. wait)", 0 }, + { "--verbose", "increase verbosity", 0 }, + { "--help", "display this help", 0 }, + + { NULL, NULL, 0 } /* Mark end of list */ +}; + +static void +usage(const char *cmd) +{ + struct option_desc *option_desc; + char *usage_str = malloc(LINE_MAX); + size_t usage_len; + + if (usage_str == NULL) + err(1, "%s: malloc(%d)", __func__, LINE_MAX); + + usage_len = snprintf(usage_str, LINE_MAX, "# usage: %s ", basename(cmd)); + + for (option_desc = option_desc_list; option_desc->option != NULL; option_desc++) { + int len; + + if (option_desc->required) + len = snprintf(usage_str + usage_len, LINE_MAX - usage_len, "%s ", option_desc->option); + else + len = snprintf(usage_str + usage_len, LINE_MAX - usage_len, "[%s] ", option_desc->option); + if (len < 0) + err(1, "%s: snprintf(", __func__); + + usage_len += len; + if (usage_len > LINE_MAX) + break; + } + printf("%s\n", usage_str); + printf("options:\n"); + + for (option_desc = option_desc_list; option_desc->option != NULL; option_desc++) { + printf(" %-24s # %s\n", option_desc->option, option_desc->description); + } + printf("\n"); + printf("# legacy usage: "); + printf("%s hostname port reqlen rsplen ntimes alt_addr 0 connorder longlived fastjoin nowaitforjoin\n", + basename(cmd)); +} + +static struct option longopts[] = { + { "host", required_argument, NULL, 'c' }, + { "port", required_argument, NULL, 'p' }, + { "reqlen", required_argument, NULL, 'r' }, + { "rsplen", required_argument, NULL, 'R' }, + { "ntimes", required_argument, NULL, 'n' }, + { "alt_addr", required_argument, NULL, 'a' }, + { "connorder", required_argument, NULL, 'o' }, + { "longlived", required_argument, NULL, 'l' }, + { "fastjoin", required_argument, NULL, 'f' }, + { "nowaitforjoin", required_argument, NULL, 'w' }, + { "help", no_argument, NULL, 'h' }, + { "verbose", no_argument, NULL, 'v' }, + { "quiet", no_argument, NULL, 'q' }, + { NULL, 0, NULL, 0 } + +}; + +static int +sprint_sockaddr(char *str, socklen_t strlen, struct sockaddr *sa) +{ + int retval = 0; + + if (sa->sa_family == AF_INET) { + struct sockaddr_in *sin = (struct sockaddr_in*)sa; + char str4[INET_ADDRSTRLEN]; + + inet_ntop(AF_INET, &sin->sin_addr, str4, sizeof(str4)); + + retval = snprintf(str, strlen, "%s:%u", str4, ntohs(sin->sin_port)); + } else if (sa->sa_family == AF_INET6) { + struct sockaddr_in6 *sin6 = (struct sockaddr_in6*)sa; + char str6[INET6_ADDRSTRLEN]; + char ifname[IF_NAMESIZE]; + char scopestr[2 + IF_NAMESIZE]; + + inet_ntop(AF_INET6, &sin6->sin6_addr, str6, sizeof(str6)); + + if (sin6->sin6_scope_id == 0) + *scopestr = '\0'; + else { + if_indextoname(sin6->sin6_scope_id, ifname); + snprintf(scopestr, sizeof(scopestr), "%%%s", ifname); + } + + retval = snprintf(str, strlen, "%s%s:%u", + str6, + scopestr, + ntohs(sin6->sin6_port)); + } + return (retval); +} + +int main(int argc, char * const *argv) +{ + int sockfd, ps, portno; + ssize_t n; + int reqlen = 256; + int rsplen = 256; + int ntimes = 1; + int connordrtest = 0; + int longlived = 0; + int fastjoin = 0; + char *buffer = NULL; + char *buffer1; + char *buffer2; + char *buffer3; + struct addrinfo *ares = NULL, ahints; + struct addrinfo *altres = NULL; + int retval = 0; + int which_buf = 0; + connid_t cid1, cid2; + int iter; + int bytes_to_rdwr; + int peeled_off = 0; + int nowaitforjoin = 0; + int ch; + const char *host_arg = NULL; + const char *port_arg = NULL; + const char *reqlen_arg = "256"; + const char *rsplen_arg = "256"; + const char *ntimes_arg = "1"; + const char *alt_addr_arg = NULL; + const char *alt_port_arg = "0"; + const char *connorder_arg = NULL; + const char *longlived_arg = NULL; + const char *fastjoin_arg = NULL; + const char *nowaitforjoin_arg = NULL; + int gotopt = 0; + + thiszone = gmt2local(0); + + while ((ch = getopt_long(argc, argv, "a:c:f:hl:n:o:p:qr:R:vw:", longopts, NULL)) != -1) { + gotopt = 1; + switch (ch) { + case 'a': + alt_addr_arg = optarg; + break; + case 'c': + host_arg = optarg; + break; + case 'f': + fastjoin_arg = optarg; + break; + case 'l': + longlived_arg = optarg; + break; + case 'n': + ntimes_arg = optarg; + break; + case 'o': + connorder_arg = optarg; + break; + case 'p': + port_arg = optarg; + break; + case 'q': + verbose--; + break; + case 'r': + reqlen_arg = optarg; + break; + case 'R': + rsplen_arg = optarg; + break; + case 'v': + verbose++; + break; + case 'w': + nowaitforjoin_arg = optarg; + break; + + default: + usage(argv[0]); + exit(EX_USAGE); + + } + } + + if (gotopt == 0) { + if (argc == 12) { + host_arg = argv[1]; + port_arg = argv[2]; + reqlen_arg = argv[3]; + rsplen_arg = argv[4]; + ntimes_arg = argv[5]; + alt_addr_arg = argv[6]; + connorder_arg = argv[8]; + longlived_arg = argv[9]; + fastjoin_arg = argv[10]; + nowaitforjoin_arg = argv[11]; + } else { + usage(argv[0]); + exit(EX_USAGE); + } + } + + if (host_arg == NULL) + errx(EX_USAGE, "missing required host option\n"); + + if (port_arg == NULL) + errx(EX_USAGE, "missing required port option\n"); + portno = atoi(port_arg); + if (portno < 0 || portno > 65535) + errx(EX_USAGE, "invalid port %s\n", port_arg); + + if (reqlen_arg != NULL) { + reqlen = atoi(reqlen_arg); + if (reqlen < 0) + errx(EX_USAGE, "invalid request length %s\n", reqlen_arg); + } + + if (rsplen_arg != NULL) { + rsplen = atoi(rsplen_arg); + if (rsplen < 0) + errx(EX_USAGE, "invalid response length %s\n", rsplen_arg); + } + + if (ntimes_arg != NULL) { + ntimes = atoi(ntimes_arg); + if (ntimes < 1) + errx(EX_USAGE, "invalid ntimes option %s\n", ntimes_arg); + } + + if (connorder_arg != NULL) { + connordrtest = atoi(connorder_arg); + if (connordrtest != 0 && connordrtest != 1) + errx(EX_USAGE, "invalid connorder count %s\n", connorder_arg); + } + + if (longlived_arg != NULL) { + longlived = atoi(longlived_arg); + if (longlived < 0) + errx(EX_USAGE, "invalid longlived count %s\n", longlived_arg); + } + + if (fastjoin_arg != NULL) { + fastjoin = atoi(fastjoin_arg); + if (fastjoin != 0 && fastjoin != 1) + errx(EX_USAGE, "invalid fastjoin option %s\n", fastjoin_arg); + } + + if (nowaitforjoin_arg != NULL) { + nowaitforjoin = atoi(nowaitforjoin_arg); + if (nowaitforjoin != 0 && nowaitforjoin != 1) + errx(EX_USAGE, "invalid nowaitforjoin option %s\n", nowaitforjoin_arg); + } + + buffer1 = setup_buffer1(reqlen); + if (!buffer1) { + printf("client: failed to alloc buffer space \n"); + return -1; + } + + buffer2 = setup_buffer2(reqlen); + if (!buffer2) { + printf("client: failed to alloc buffer space \n"); + return -1; + } + + buffer3 = setup_buffer3(rsplen); + if (!buffer3) { + printf("client: failed to alloc buffer space \n"); + return -1; + } + + if (verbose > 0) + printf("host: %s port: %s reqlen: %d rsplen: %d ntimes: %d alt_addr: %s connorder: %d longlived: %d fasjoin: %d nowaitforjoin: %d\n", + host_arg, port_arg, reqlen, rsplen, ntimes, alt_addr_arg, connordrtest, longlived, fastjoin, nowaitforjoin); + + sockfd = socket(AF_MULTIPATH, SOCK_STREAM, 0); + if (sockfd < 0) + err(EX_OSERR, "ERROR opening socket"); +#define SO_MPTCP_FASTJOIN 0x1111 + opterr = setsockopt(sockfd, SOL_SOCKET, SO_MPTCP_FASTJOIN, &fastjoin, sizeof(fastjoin)); + if (opterr != 0) + warn("setsockopt(SO_MPTCP_FASTJOIN, %d)", fastjoin); + + memset(&ahints, 0, sizeof(struct addrinfo)); + ahints.ai_family = AF_INET; + ahints.ai_socktype = SOCK_STREAM; + ahints.ai_protocol = IPPROTO_TCP; + + retval = getaddrinfo(host_arg, port_arg, &ahints, &ares); + if (retval != 0) + printf("getaddrinfo(%s, %s) failed %d\n", host_arg, port_arg, retval); + + bytes_to_rdwr = reqlen; +connect_again: + + cid1 = cid2 = CONNID_ANY; + int ifscope = 0; + int error = 0; + + if (verbose > 0) { + char str[2 * INET6_ADDRSTRLEN]; + + ts_print(); + + sprint_sockaddr(str, sizeof(str), ares->ai_addr); + printf("connectx(%s, %d, %d)\n", str, ifscope, cid1); + } + + error = connectx(sockfd, NULL, 0, ares->ai_addr, + ares->ai_addrlen, ifscope, ASSOCID_ANY, &cid1); + if ((error != 0) && (errno != EPROTO)) { + err(EX_OSERR, "ERROR connecting"); + } else if ((error != 0) && (errno == EPROTO)) { + ps = peeloff(sockfd, ASSOCID_ANY); + + if (ps != -1) { + close(sockfd); + sockfd = ps; + } + peeled_off = 1; + ts_print(); + printf("%s: peeled off\n", __func__); + } + + + iter = 0; + + while (ntimes) { + + if ((iter == 0) && (peeled_off == 0)) { + /* Add alternate path if available */ + + if (alt_addr_arg && alt_addr_arg[0] != 0) { + retval = getaddrinfo(alt_addr_arg, alt_port_arg, &ahints, &altres); + + if (retval != 0) + printf("client: alternate address resolution failed. \n"); + else { + printf("client: connecting to alternate address (ifscope %d)\n", ifscope); + + if (verbose > 0) { + char str[2 * INET6_ADDRSTRLEN]; + + ts_print(); + + sprint_sockaddr(str, sizeof(str), altres->ai_addr); + printf("connectx(%s, %d, %d)\n", str, ifscope, cid1); + } + + error = connectx(sockfd, altres->ai_addr, altres->ai_addrlen, + ares->ai_addr, ares->ai_addrlen, + ifscope, ASSOCID_ANY, &cid2); + if (error < 0) { + err(EX_OSERR, "ERROR setting up alternate path"); + } + } + } + + } + + if ((iter == 10) && (connordrtest == 1)) { + int retval = 0; + + socorder.sco_cid = cid2; + socorder.sco_rank = 1; + retval = ioctl(sockfd, SIOCSCONNORDER, &socorder); + if (retval != 0) + warn("Error in changing priority"); + + bzero(&socorder, sizeof(socorder)); + socorder.sco_cid = cid2; + retval = ioctl(sockfd, SIOCGCONNORDER, &socorder); + printf("cid %d rank %d", socorder.sco_cid, socorder.sco_rank); + + socorder.sco_cid = cid1; + socorder.sco_rank = 0; + retval = ioctl(sockfd, SIOCSCONNORDER, &socorder); + if (retval != 0) + warn("Error in changing priority"); + + bzero(&socorder, sizeof(socorder)); + socorder.sco_cid = cid1; + retval = ioctl(sockfd, SIOCGCONNORDER, &socorder); + printf("cid %d rank %d \n", socorder.sco_cid, socorder.sco_rank); + } + + if (which_buf == 0) { + buffer = buffer1; + which_buf = 1; + } else { + buffer = buffer2; + which_buf = 0; + } + + while (bytes_to_rdwr) { + if (verbose) { + ts_print(); + printf("writing %d bytes\n", bytes_to_rdwr); + } + n = write(sockfd, buffer, bytes_to_rdwr); + if (n <= 0) { + err(EX_OSERR, "ERROR writing to socket"); + } + if (n <= bytes_to_rdwr) + bytes_to_rdwr -= n; + else { + errx(EX_DATAERR, "ERROR extra data write %zd %d\n", n, bytes_to_rdwr); + } + } + bytes_to_rdwr = rsplen; + while (bytes_to_rdwr) { + if (verbose) { + ts_print(); + printf("reading %d bytes\n", rsplen); + } + n = read(sockfd, buffer3, rsplen); + + if (n <= 0) { + err(EX_OSERR, "ERROR reading from socket"); + } + if (n <= bytes_to_rdwr) + bytes_to_rdwr -= n; + else { + errx(EX_DATAERR, "ERROR extra bytes read n:%zd expected:%d\n", n, bytes_to_rdwr); + } + } + bytes_to_rdwr = reqlen; + ntimes--; + iter++; + } + + printf("client: Req size %d Rsp size %d Read/Write %d times \n", reqlen, rsplen, iter); + + showmpinfo(sockfd); + + if ((!longlived) || (peeled_off == 1)) { + if (verbose) { + ts_print(); + printf("close(%d)\n", sockfd); + } + close(sockfd); + } else { + printf("Longlived countdown # %d. \n", longlived); + if (verbose) { + ts_print(); + printf("disconnectx(%d, %d)\n", sockfd, cid1); + } + disconnectx(sockfd, ASSOCID_ANY, cid1); + if (cid2 != CONNID_ANY) { + if (verbose) { + ts_print(); + printf("disconnectx(%d, %d)\n", sockfd, cid2); + } + disconnectx(sockfd, ASSOCID_ANY, cid2); + } + if (!nowaitforjoin) { + if (verbose) { + ts_print(); + printf("sleep(10)\n"); + } + sleep(10); + } + longlived--; + + ntimes = atoi(ntimes_arg); + + /* If fastjoin must be tested, write some data before doing the next connectx() */ + bytes_to_rdwr = reqlen / 2; + if (verbose) { + ts_print(); + printf("fastjoin writing %d bytes\n", bytes_to_rdwr); + } + n = write(sockfd, buffer, bytes_to_rdwr); + if (n <= 0) { + warnx("Fastjoin: Error writing to socket. \n"); + } else { + bytes_to_rdwr = reqlen - (int)n; + printf("FastJoin: Wrote %zd bytes, remaining %d of %d \n", n, bytes_to_rdwr, reqlen); + } + + goto connect_again; + } + if (ares) + freeaddrinfo(ares); + if (altres) + freeaddrinfo(altres); + return 0; +} + +#define CIF_BITS \ +"\020\1CONNECTING\2CONNECTED\3DISCONNECTING\4DISCONNECTED\5BOUND_IF"\ +"\6BOUND_IP\7BOUND_PORT\10PREFERRED\11MP_CAPABLE\12MP_READY" \ +"\13MP_DEGRADED" + +/* + * Print a value a la the %b format of the kernel's printf + */ +static void +printb(const char *s, unsigned v, const char *bits) +{ + int i, any = 0; + char c; + + if (bits && *bits == 8) + printf("%s=%o", s, v); + else + printf("%s=%x", s, v); + bits++; + if (bits) { + putchar('<'); + while ((i = *bits++) != '\0') { + if (v & (1 << (i-1))) { + if (any) + putchar(','); + any = 1; + for (; (c = *bits) > 32; bits++) + putchar(c); + } else { + for (; *bits > 32; bits++) + ; + } + } + putchar('>'); + } +} + +static int +showconninfo(int s, connid_t cid) +{ + char buf[INET6_ADDRSTRLEN]; + conninfo_t *cfo = NULL; + int err; + + err = copyconninfo(s, cid, &cfo); + if (err != 0) { + printf("getconninfo failed for cid %d\n", cid); + goto out; + } + + printf("%6d:\t", cid); + printb("flags", cfo->ci_flags, CIF_BITS); + printf("\n"); + //printf("\toutif %s\n", if_indextoname(cfo->ci_ifindex, buf)); +#if 1 + if (cfo->ci_src != NULL) { + printf("\tsrc %s port %d\n", inet_ntop(cfo->ci_src->sa_family, + (cfo->ci_src->sa_family == AF_INET) ? + (void *)&((struct sockaddr_in *)cfo->ci_src)-> + sin_addr.s_addr : + (void *)&((struct sockaddr_in6 *)cfo->ci_src)->sin6_addr, + buf, sizeof (buf)), + (cfo->ci_src->sa_family == AF_INET) ? + ntohs(((struct sockaddr_in *)cfo->ci_src)->sin_port) : + ntohs(((struct sockaddr_in6 *)cfo->ci_src)->sin6_port)); + } + if (cfo->ci_dst != NULL) { + printf("\tdst %s port %d\n", inet_ntop(cfo->ci_dst->sa_family, + (cfo->ci_dst->sa_family == AF_INET) ? + (void *)&((struct sockaddr_in *)cfo->ci_dst)-> + sin_addr.s_addr : + (void *)&((struct sockaddr_in6 *)cfo->ci_dst)->sin6_addr, + buf, sizeof (buf)), + (cfo->ci_dst->sa_family == AF_INET) ? + ntohs(((struct sockaddr_in *)cfo->ci_dst)->sin_port) : + ntohs(((struct sockaddr_in6 *)cfo->ci_dst)->sin6_port)); + } + if (cfo->ci_aux_data != NULL) { + switch (cfo->ci_aux_type) { + case CIAUX_TCP: + printf("\tTCP aux info available\n"); + break; + default: + printf("\tUnknown aux type %d\n", cfo->ci_aux_type); + break; + } + } +#endif +out: + if (cfo != NULL) + freeconninfo(cfo); + + return (err); +} + +static void +showmpinfo(int s) +{ + uint32_t aid_cnt, cid_cnt; + associd_t *aid = NULL; + connid_t *cid = NULL; + int i, error; + + error = copyassocids(s, &aid, &aid_cnt); + if (error != 0) { + printf("copyassocids failed\n"); + goto done; + } else { + printf("found %d associations", aid_cnt); + if (aid_cnt > 0) { + printf(" with IDs:"); + for (i = 0; i < aid_cnt; i++) + printf(" %d\n", aid[i]); + } + printf("\n"); + } + + /* just do an association for now */ + error = copyconnids(s, ASSOCID_ANY, &cid, &cid_cnt); + if (error != 0) { + warn("getconnids failed\n"); + goto done; + } else { + printf("found %d connections", cid_cnt); + if (cid_cnt > 0) { + printf(":\n"); + for (i = 0; i < cid_cnt; i++) { + if (showconninfo(s, cid[i]) != 0) + break; + } + } + printf("\n"); + } + +done: + if (aid != NULL) + freeassocids(aid); + if (cid != NULL) + freeconnids(cid); +} diff --git a/mtest.tproj/mtest.c b/mtest.tproj/mtest.c index 12eb891..e5a7442 100644 --- a/mtest.tproj/mtest.c +++ b/mtest.tproj/mtest.c @@ -347,19 +347,6 @@ af2sock(const int af, int s, int s6) return (-1); } -static __inline int -af2socklen(const int af) -{ - - if (af == AF_INET) - return (sizeof(struct sockaddr_in)); -#ifdef INET6 - if (af == AF_INET6) - return (sizeof(struct sockaddr_in6)); -#endif - return (-1); -} - static void process_cmd(char *cmd, int s, int s6 __unused, FILE *fp __unused) { diff --git a/netstat.tproj/if.c b/netstat.tproj/if.c index 6428d96..1fc4c3a 100644 --- a/netstat.tproj/if.c +++ b/netstat.tproj/if.c @@ -58,14 +58,6 @@ * SUCH DAMAGE. */ -#ifndef lint -/* -static char sccsid[] = "@(#)if.c 8.3 (Berkeley) 4/28/95"; -*/ -static const char rcsid[] = - "$Id: if.c,v 1.7 2006/01/16 04:53:59 lindak Exp $"; -#endif /* not lint */ - #include #include #include @@ -1710,6 +1702,10 @@ print_sfbstats(struct sfb_stats *sfb) int i, j, cur = sfb->current; printf("\n"); + printf(" [target delay: %14s ", + nsec_to_str(sfb->target_qdelay)); + printf("update interval: %14s]\n", + nsec_to_str(sfb->update_interval)); printf(" [ early drop: %12llu rlimit drop: %11llu " "marked: %11llu ]\n", sp->drop_early, sp->drop_pbox, sp->marked_packets); @@ -1723,6 +1719,10 @@ print_sfbstats(struct sfb_stats *sfb) sfb->allocation, sfb->dropthresh); printf(" [ flow controlled: %7llu adv feedback: %10llu ]\n", sp->flow_controlled, sp->flow_feedback); + printf(" [ min queue delay: %10s delay_fcthreshold: %12llu]\n " + " [stalls: %12lu]\n", + nsec_to_str(sfb->min_estdelay), sfb->delay_fcthreshold, + sp->dequeue_stall); printf("\n\t\t\t\tCurrent bins (set %d)", cur); for (i = 0; i < SFB_LEVELS; ++i) { diff --git a/netstat.tproj/inet.c b/netstat.tproj/inet.c index fe69a54..cbfc035 100644 --- a/netstat.tproj/inet.c +++ b/netstat.tproj/inet.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2012 Apple Inc. All rights reserved. + * Copyright (c) 2008-2014 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -57,14 +57,6 @@ * SUCH DAMAGE. */ -#ifndef lint -/* -static char sccsid[] = "@(#)inet.c 8.5 (Berkeley) 5/24/95"; -*/ -static const char rcsid[] = - "$Id: inet.c,v 1.9 2006/04/04 04:36:27 lindak Exp $"; -#endif /* not lint */ - #include #include #include @@ -311,8 +303,8 @@ protopr(uint32_t proto, /* for sysctl version we pass proto # */ break; } } else { - if (vflag) - printf("got %d twice\n", xgn->xgn_kind); + if (vflag) + printf("got %d twice\n", xgn->xgn_kind); } if ((istcp && which != ALL_XGN_KIND_TCP) || (!istcp && which != ALL_XGN_KIND_INP)) @@ -382,6 +374,9 @@ protopr(uint32_t proto, /* for sysctl version we pass proto # */ printf(" %10.10s %10.10s", "rxbytes", "txbytes"); if (prioflag >= 0) printf(" %7.7s[%1d] %7.7s[%1d]", "rxbytes", prioflag, "txbytes", prioflag); + if (vflag > 0) + printf(" %6.6s %6.6s %6.6s %6.6s", + "rhiwat", "shiwat", "pid", "epid"); printf("\n"); } first = 0; @@ -512,6 +507,13 @@ protopr(uint32_t proto, /* for sysctl version we pass proto # */ prioflag < SO_TC_STATS_MAX ? so_stat->xst_tc_stats[prioflag].rxbytes : 0, prioflag < SO_TC_STATS_MAX ? so_stat->xst_tc_stats[prioflag].txbytes : 0); } + if (vflag > 0) { + printf(" %6u %6u %6u %6u", + so_rcv->sb_hiwat, + so_snd->sb_hiwat, + so->so_last_pid, + so->so_e_pid); + } putchar('\n'); } if (xig != oxig && xig->xig_gen != oxig->xig_gen) { @@ -553,8 +555,8 @@ tcp_stats(uint32_t off , char *name, int af) tcp_done = 1; #endif - if (interval && vflag > 0) - print_time(); + if (interval && vflag > 0) + print_time(); printf ("%s:\n", name); #define TCPDIFF(f) (tcpstat.f - ptcpstat.f) @@ -600,6 +602,7 @@ tcp_stats(uint32_t off , char *name, int af) p2(tcps_rcvduppack, tcps_rcvdupbyte, "\t\t%u completely duplicate packet%s (%u byte%s)\n"); p(tcps_pawsdrop, "\t\t%u old duplicate packet%s\n"); + p(tcps_rcvmemdrop, "\t\t%u received packet%s dropped due to low memory\n"); p2(tcps_rcvpartduppack, tcps_rcvpartdupbyte, "\t\t%u packet%s with some dup. data (%u byte%s duped)\n"); p2(tcps_rcvoopack, tcps_rcvoobyte, @@ -671,6 +674,19 @@ tcp_stats(uint32_t off , char *name, int af) p(tcps_limited_txt, "\t%u limited transmit%s done\n"); p(tcps_early_rexmt, "\t%u early retransmit%s done\n"); p(tcps_sack_ackadv, "\t%u time%s cumulative ack advanced along with SACK\n"); + p(tcps_pto, "\t%u probe timeout%s\n"); + p(tcps_rto_after_pto, "\t\t%u time%s retransmit timeout triggered after probe\n"); + p(tcps_tlp_recovery, "\t\t%u time%s fast recovery after tail loss\n"); + p(tcps_tlp_recoverlastpkt, "\t\t%u time%s recovered last packet \n"); + p(tcps_ecn_setup, "\t%u connection%s negotiated ECN\n"); + p(tcps_sent_ece, "\t\t%u time%s congestion notification was sent using ECE\n"); + p(tcps_sent_cwr, "\t\t%u time%s CWR was sent in response to ECE\n"); + + p(tcps_detect_reordering, "\t%u time%s packet reordering was detected on a connection\n"); + p(tcps_reordered_pkts, "\t\t%u time%s transmitted packets were reordered\n"); + p(tcps_delay_recovery, "\t\t%u time%s fast recovery was delayed to handle reordering\n"); + p(tcps_avoid_rxmt, "\t\t%u time%s retransmission was avoided by delaying recovery\n"); + p(tcps_unnecessary_rxmt, "\t\t%u retransmission%s not needed \n"); if (interval > 0) { bcopy(&tcpstat, &ptcpstat, len); @@ -686,7 +702,6 @@ tcp_stats(uint32_t off , char *name, int af) #undef p3 } -#if TARGET_OS_EMBEDDED /* * Dump MPTCP statistics */ @@ -754,7 +769,6 @@ mptcp_stats(uint32_t off , char *name, int af) #undef p2a #undef p3 } -#endif /* TARGET_OS_EMBEDDED */ /* * Dump UDP statistics structure. @@ -781,8 +795,8 @@ udp_stats(uint32_t off , char *name, int af ) udp_done = 1; #endif - if (interval && vflag > 0) - print_time(); + if (interval && vflag > 0) + print_time(); printf("%s:\n", name); #define UDPDIFF(f) (udpstat.f - pudpstat.f) @@ -861,8 +875,8 @@ ip_stats(uint32_t off , char *name, int af ) return; } - if (interval && vflag > 0) - print_time(); + if (interval && vflag > 0) + print_time(); printf("%s:\n", name); #define IPDIFF(f) (ipstat.f - pipstat.f) @@ -941,8 +955,8 @@ arp_stats(uint32_t off, char *name, int af) return; } - if (interval && vflag > 0) - print_time(); + if (interval && vflag > 0) + print_time(); printf("%s:\n", name); #define ARPDIFF(f) (arpstat.f - parpstat.f) @@ -1017,8 +1031,8 @@ icmp_stats(uint32_t off , char *name, int af ) if (sysctl(mib, 4, &icmpstat, &len, (void *)0, 0) < 0) return; /* XXX should complain, but not traditional */ - if (interval && vflag > 0) - print_time(); + if (interval && vflag > 0) + print_time(); printf("%s:\n", name); #define ICMPDIFF(f) (icmpstat.f - picmpstat.f) @@ -1094,8 +1108,8 @@ igmp_stats(uint32_t off , char *name, int af ) igmpstat.igps_len, IGPS_VERSION3_LEN); } - if (interval && vflag > 0) - print_time(); + if (interval && vflag > 0) + print_time(); printf("%s:\n", name); #define IGMPDIFF(f) ((uintmax_t)(igmpstat.f - pigmpstat.f)) diff --git a/netstat.tproj/inet6.c b/netstat.tproj/inet6.c index b4f6867..e148393 100644 --- a/netstat.tproj/inet6.c +++ b/netstat.tproj/inet6.c @@ -62,12 +62,6 @@ * $FreeBSD: src/usr.bin/netstat/inet6.c,v 1.3.2.9 2001/08/10 09:07:09 ru Exp $ */ -#ifndef lint -/* -static char sccsid[] = "@(#)inet6.c 8.4 (Berkeley) 4/20/94"; -*/ -#endif /* not lint */ - #ifdef INET6 #include #include @@ -85,7 +79,6 @@ static char sccsid[] = "@(#)inet6.c 8.4 (Berkeley) 4/20/94"; #include #include #include -#include #include #include @@ -1013,42 +1006,6 @@ icmp6_ifstats(char *ifname) #undef p } -/* - * Dump PIM statistics structure. - */ -#ifdef notyet -void -pim6_stats(void) -{ - static struct pim6stat ppim6stat; - struct pim6stat pim6stat; - size_t len = sizeof(struct pim6stat); - - if (sysctlbyname("net.inet6.ip6.pim6stat", &pim6stat, &len, 0, 0) == -1) - return; - if (interval && vflag > 0) - print_time(); - printf("%s:\n", name); - -#define PIM6DIFF(f) (pim6stat.f - ppim6stat.f) -#define p(f, m) if (PIM6DIFF(f) || sflag <= 1) \ - printf(m, (unsigned long long)PIM6DIFF(f), plural(PIM6DIFF(f))) - p(pim6s_rcv_total, "\t%llu message%s received\n"); - p(pim6s_rcv_tooshort, "\t%llu message%s received with too few bytes\n"); - p(pim6s_rcv_badsum, "\t%llu message%s received with bad checksum\n"); - p(pim6s_rcv_badversion, "\t%llu message%s received with bad version\n"); - p(pim6s_rcv_registers, "\t%llu register%s received\n"); - p(pim6s_rcv_badregisters, "\t%llu bad register%s received\n"); - p(pim6s_snd_registers, "\t%llu register%s sent\n"); - - if (interval > 0) - bcopy(&pim6stat, &ppim6stat, len); - -#undef PIM6DIFF -#undef p -} -#endif - /* * Dump raw ip6 statistics structure. */ diff --git a/netstat.tproj/ipsec.c b/netstat.tproj/ipsec.c index 62ece4b..0eab162 100644 --- a/netstat.tproj/ipsec.c +++ b/netstat.tproj/ipsec.c @@ -91,15 +91,6 @@ * SUCH DAMAGE. */ -#include -#ifndef lint -/* -static char sccsid[] = "@(#)inet.c 8.5 (Berkeley) 5/24/95"; -*/ -static const char rcsid[] = - "$FreeBSD: src/usr.bin/netstat/ipsec.c,v 1.1.2.3 2001/08/10 09:07:09 ru Exp $"; -#endif /* not lint */ - #include #include #include diff --git a/netstat.tproj/main.c b/netstat.tproj/main.c index e097bc6..0e40e34 100644 --- a/netstat.tproj/main.c +++ b/netstat.tproj/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2013 Apple Inc. All rights reserved. + * Copyright (c) 2008-2014 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -67,6 +67,7 @@ char const copyright[] = #include #include #include +#include #include #include @@ -121,9 +122,7 @@ struct protox { { NULL, ipsec_stats, NULL, "ipsec", IPPROTO_ESP}, #endif { NULL, arp_stats, NULL, "arp", 0 }, -#if TARGET_OS_EMBEDDED { mptcppr, mptcp_stats, NULL, "mptcp", IPPROTO_TCP }, -#endif { NULL, NULL, NULL, NULL, 0 } }; @@ -135,14 +134,9 @@ struct protox ip6protox[] = { { protopr, icmp6_stats, icmp6_ifstats, "icmp6",IPPROTO_ICMPV6 }, #ifdef IPSEC { NULL, ipsec_stats, NULL, "ipsec6", IPPROTO_ESP }, -#endif -#ifdef notyet - { NULL, pim6_stats, NULL, "pim6", 0 }, #endif { NULL, rip6_stats, NULL, "rip6", IPPROTO_RAW }, -#if TARGET_OS_EMBEDDED { mptcppr, mptcp_stats, NULL, "mptcp", IPPROTO_TCP }, -#endif { NULL, NULL, NULL, NULL, 0 } }; #endif /*INET6*/ @@ -154,6 +148,14 @@ struct protox pfkeyprotox[] = { }; #endif + +struct protox systmprotox[] = { + { systmpr, NULL, NULL, "reg", 0 }, + { systmpr, kevt_stats, NULL, "kevt", SYSPROTO_EVENT }, + { systmpr, kctl_stats, NULL, "kctl", SYSPROTO_CONTROL }, + { NULL, NULL, NULL, NULL, 0 } +}; + struct protox *protoprotox[] = { protox, #ifdef INET6 @@ -162,6 +164,7 @@ struct protox *protoprotox[] = { #ifdef IPSEC pfkeyprotox, #endif + systmprotox, NULL }; @@ -251,8 +254,10 @@ main(argc, argv) else if (strcmp(optarg, "pfkey") == 0) af = PF_KEY; #endif /*INET6*/ - else if (strcmp(optarg, "unix") == 0) - af = AF_UNIX; + else if (strcmp(optarg, "unix") == 0) + af = AF_UNIX; + else if (strcmp(optarg, "systm") == 0) + af = AF_SYSTEM; else { errx(1, "%s: unknown address family", optarg); } @@ -385,23 +390,6 @@ main(argc, argv) #if defined(__APPLE__) if (gflag) { -#if !TARGET_OS_EMBEDDED - if (sflag) { - if (af == AF_INET || af == AF_UNSPEC) - mrt_stats(); -#ifdef INET6 - if (af == AF_INET6 || af == AF_UNSPEC) - mrt6_stats(); -#endif - } else { - if (af == AF_INET || af == AF_UNSPEC) - mroutepr(); -#ifdef INET6 - if (af == AF_INET6 || af == AF_UNSPEC) - mroute6pr(); -#endif - } -#endif /* !TARGET_OS_EMBEDDED */ ifmalist_dump(); exit(0); } @@ -426,6 +414,11 @@ main(argc, argv) #endif /*IPSEC*/ if ((af == AF_UNIX || af == AF_UNSPEC) && !Lflag && !sflag) unixpr(); + + if ((af == AF_SYSTEM || af == AF_UNSPEC) && !Lflag) + for (tp = systmprotox; tp->pr_name; tp++) + printproto(tp, tp->pr_name); + #ifdef SRVCACHE _serv_cache_close(); #endif diff --git a/netstat.tproj/mbuf.c b/netstat.tproj/mbuf.c index e130ef5..38645e9 100644 --- a/netstat.tproj/mbuf.c +++ b/netstat.tproj/mbuf.c @@ -139,7 +139,7 @@ static int mbpr_getdata(void); void mbpr(void) { - unsigned long totmem = 0, totfree = 0, totmbufs, totused; + unsigned long totmem = 0, totfree = 0, totmbufs, totused, totreturned = 0; double totpct; u_int32_t m_msize, m_mbufs = 0, m_clfree = 0, m_bigclfree = 0; u_int32_t m_mbufclfree = 0, m_mbufbigclfree = 0; @@ -183,6 +183,7 @@ mbpr(void) mem = cp->mbcl_ctotal * cp->mbcl_size; totmem += mem; + totreturned += cp->mbcl_release_cnt; totfree += (cp->mbcl_mc_cached + cp->mbcl_infree) * cp->mbcl_size; if (mflag > 1) { @@ -270,6 +271,7 @@ mbpr(void) } printf("%lu KB allocated to network (%.1f%% in use)\n", totmem / 1024, totpct); + printf("%lu KB returned to the system\n", totreturned / 1024); printf("%u requests for memory denied\n", (unsigned int)mbstat.m_drops); printf("%u requests for memory delayed\n", (unsigned int)mbstat.m_wait); diff --git a/netstat.tproj/mptcp.c b/netstat.tproj/mptcp.c index 5aca9b6..26e82dd 100644 --- a/netstat.tproj/mptcp.c +++ b/netstat.tproj/mptcp.c @@ -30,7 +30,6 @@ #include #endif -#if TARGET_OS_EMBEDDED #include #include #include @@ -154,4 +153,3 @@ mptcppr(uint32_t off, char *name, int af) } free(buf); } -#endif /* TARGET_OS_EMBEDDED */ diff --git a/netstat.tproj/mroute.c b/netstat.tproj/mroute.c deleted file mode 100644 index 04a9fe5..0000000 --- a/netstat.tproj/mroute.c +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright (c) 2008-2009 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -/* - * Copyright (c) 1989 Stephen Deering - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Stephen Deering of Stanford University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)mroute.c 8.2 (Berkeley) 4/28/95 - */ - -/* - * Print DVMRP multicast routing structures and statistics. - * - * MROUTING 1.0 - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include "netstat.h" - -void -mroutepr(void) -{ - struct mfc **mfctable = 0; - struct vif viftable[CONFIG_MAXVIFS]; - struct mfc *m; - register struct vif *v; - register vifi_t vifi; - register int i; - register int banner_printed; - register int saved_nflag; - vifi_t maxvif = 0; - size_t len; - - saved_nflag = nflag; - nflag = 1; - - len = CONFIG_MAXVIFS * sizeof(struct vif); - if (sysctlbyname("net.inet.ip.viftable", viftable, &len, 0, 0) == -1) { - //printf("No IPv4 multicast routing compiled into this system.\n"); - return; - } - - banner_printed = 0; - for (vifi = 0, v = viftable; vifi < CONFIG_MAXVIFS; ++vifi, ++v) { - if (v->v_lcl_addr.s_addr == 0) - continue; - - maxvif = vifi; - if (!banner_printed) { - printf("\nVirtual Interface Table\n" - " Vif Thresh Rate Local-Address " - "Remote-Address Pkts-In Pkts-Out\n"); - banner_printed = 1; - } - - printf(" %2u %6u %4d %-15.15s", - /* opposite math of add_vif() */ - vifi, v->v_threshold, v->v_rate_limit * 1000 / 1024, - routename(v->v_lcl_addr.s_addr)); - printf(" %-15.15s", (v->v_flags & VIFF_TUNNEL) ? - routename(v->v_rmt_addr.s_addr) : ""); - - printf(" %9u %9u\n", v->v_pkt_in, v->v_pkt_out); - } - if (!banner_printed) - printf("\nVirtual Interface Table is empty\n"); - - if (sysctlbyname("net.inet.ip.mfctable", 0, &len, 0, 0) == -1) { - //printf("No IPv4 multicast routing compiled into this system.\n"); - return; - } - mfctable = malloc(len); - if (mfctable == 0) - return; - if (sysctlbyname("net.inet.ip.mfctable", mfctable, &len, 0, 0) == -1) { - //printf("No IPv4 multicast routing compiled into this system.\n"); - return; - } - banner_printed = 0; - for (i = 0; i < CONFIG_MFCTBLSIZ; ++i) { - m = mfctable[i]; - while(m) { - if (!banner_printed) { - printf("\nIPv4 Multicast Forwarding Cache\n" - " Origin Group " - " Packets In-Vif Out-Vifs:Ttls\n"); - banner_printed = 1; - } - - printf(" %-15.15s", routename(m->mfc_origin.s_addr)); - printf(" %-15.15s", routename(m->mfc_mcastgrp.s_addr)); - printf(" %9u", m->mfc_pkt_cnt); - printf(" %3d ", m->mfc_parent); - for (vifi = 0; vifi <= maxvif; vifi++) { - if (m->mfc_ttls[vifi] > 0) - printf(" %u:%u", vifi, - m->mfc_ttls[vifi]); - } - printf("\n"); - m = m->mfc_next; - } - } - if (!banner_printed) - printf("\nMulticast Routing Table is empty\n"); - - printf("\n"); - nflag = saved_nflag; - - free(mfctable); -} - - -void -mrt_stats() -{ - struct mrtstat mrtstat; - size_t len = sizeof(struct mrtstat); - - if(sysctlbyname("net.inet.ip.mrtstat", &mrtstat, &len, 0, 0) == -1) { - //printf("No IPv4 multicast routing compiled into this system.\n"); - return; - } - - printf("IPv4 multicast forwarding:\n"); - printf(" %10u multicast forwarding cache lookup%s\n", - mrtstat.mrts_mfc_lookups, plural(mrtstat.mrts_mfc_lookups)); - printf(" %10u multicast forwarding cache miss%s\n", - mrtstat.mrts_mfc_misses, plurales(mrtstat.mrts_mfc_misses)); - printf(" %10u upcall%s to mrouted\n", - mrtstat.mrts_upcalls, plural(mrtstat.mrts_upcalls)); - printf(" %10u upcall queue overflow%s\n", - mrtstat.mrts_upq_ovflw, plural(mrtstat.mrts_upq_ovflw)); - printf(" %10u upcall%s dropped due to full socket buffer\n", - mrtstat.mrts_upq_sockfull, plural(mrtstat.mrts_upq_sockfull)); - printf(" %10u cache cleanup%s\n", - mrtstat.mrts_cache_cleanups, plural(mrtstat.mrts_cache_cleanups)); - printf(" %10u datagram%s with no route for origin\n", - mrtstat.mrts_no_route, plural(mrtstat.mrts_no_route)); - printf(" %10u datagram%s arrived with bad tunneling\n", - mrtstat.mrts_bad_tunnel, plural(mrtstat.mrts_bad_tunnel)); - printf(" %10u datagram%s could not be tunneled\n", - mrtstat.mrts_cant_tunnel, plural(mrtstat.mrts_cant_tunnel)); - printf(" %10u datagram%s arrived on wrong interface\n", - mrtstat.mrts_wrong_if, plural(mrtstat.mrts_wrong_if)); - printf(" %10u datagram%s selectively dropped\n", - mrtstat.mrts_drop_sel, plural(mrtstat.mrts_drop_sel)); - printf(" %10u datagram%s dropped due to queue overflow\n", - mrtstat.mrts_q_overflow, plural(mrtstat.mrts_q_overflow)); - printf(" %10u datagram%s dropped for being too large\n", - mrtstat.mrts_pkt2large, plural(mrtstat.mrts_pkt2large)); -} diff --git a/netstat.tproj/mroute6.c b/netstat.tproj/mroute6.c deleted file mode 100644 index 549740f..0000000 --- a/netstat.tproj/mroute6.c +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Copyright (c) 2008-2009 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -/* - * Copyright (C) 1998 WIDE Project. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Copyright (c) 1989 Stephen Deering - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Stephen Deering of Stanford University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)mroute.c 8.2 (Berkeley) 4/28/95 - * $FreeBSD: src/usr.bin/netstat/mroute6.c,v 1.1.2.5 2001/08/10 09:07:09 ru Exp $ - */ - -#ifdef INET6 -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include -#include - -#define KERNEL 1 -#include -#undef KERNEL - -#include "netstat.h" - -#define WID_ORG (lflag ? 39 : (nflag ? 29 : 18)) /* width of origin column */ -#define WID_GRP (lflag ? 18 : (nflag ? 16 : 18)) /* width of group column */ - -void -mroute6pr(void) -{ -#if 0 - struct mf6c **mf6ctable = 0, *mfcp; - struct mif6 mif6table[MAXMIFS]; - struct mf6c mfc; - struct rtdetq *rtep; - register struct mif6 *mifp; - register mifi_t mifi; - register int i; - register int banner_printed; - register int saved_nflag; - mifi_t maxmif = 0; - long waitings; - size_t len; - - len = sizeof(mif6table); - if (sysctlbyname("net.inet6.ip6.mif6table", mif6table, &len, 0, 9) == -1) { - //printf("No IPv6 multicast routing compiled into this system.\n"); - return; - } - - saved_nflag = nflag; - nflag = 1; - - banner_printed = 0; - for (mifi = 0, mifp = mif6table; mifi < MAXMIFS; ++mifi, ++mifp) { - struct ifnet ifnet = { 0 } ; - char ifname[IFNAMSIZ]; - - if (mifp->m6_ifp == NULL) - continue; - - /* - * m6_ifp should be ifindex instead of ifnet pointer - * - * kread((u_long)mifp->m6_ifp, (char *)&ifnet, sizeof(ifnet)); - */ - maxmif = mifi; - if (!banner_printed) { - printf("\nIPv6 Multicast Interface Table\n" - " Mif Rate PhyIF " - "Pkts-In Pkts-Out\n"); - banner_printed = 1; - } - - printf(" %2u %4d", - mifi, mifp->m6_rate_limit); - printf(" %5s", (mifp->m6_flags & MIFF_REGISTER) ? - "reg0" : if_indextoname(ifnet.if_index, ifname)); - - printf(" %9llu %9llu\n", (unsigned long long)mifp->m6_pkt_in, - (unsigned long long)mifp->m6_pkt_out); - } - if (!banner_printed) - printf("\nIPv6 Multicast Interface Table is empty\n"); - - len = sizeof(MF6CTBLSIZ * sizeof(struct mf6c)); - mf6ctable = malloc(len); - if (mf6ctable == 0) - return; - if (sysctlbyname("net.inet6.ip6.mf6ctable", mf6ctable, &len, 0, 0) == -1) { - //printf("No IPv6 multicast routing compiled into this system.\n"); - free(mf6ctable); - return; - } - banner_printed = 0; - for (i = 0; i < MF6CTBLSIZ; ++i) { - mfcp = mf6ctable[i]; - while(mfcp) { - if (!banner_printed) { - printf ("\nIPv6 Multicast Forwarding Cache\n"); - printf(" %-*.*s %-*.*s %s", - WID_ORG, WID_ORG, "Origin", - WID_GRP, WID_GRP, "Group", - " Packets Waits In-Mif Out-Mifs\n"); - banner_printed = 1; - } - - printf(" %-*.*s", WID_ORG, WID_ORG, - routename6(&mfc.mf6c_origin)); - printf(" %-*.*s", WID_GRP, WID_GRP, - routename6(&mfc.mf6c_mcastgrp)); - printf(" %9llu", (unsigned long long)mfc.mf6c_pkt_cnt); - - for (waitings = 0, rtep = mfc.mf6c_stall; rtep; ) { - /* The sysctl should return the number of packet waiting - * struct rtdetq rte; - * kread((u_long)rtep, (char *)&rte, sizeof(rte)); - * rtep = rte.next; - */ - waitings++; - } - printf(" %3ld", waitings); - - if (mfc.mf6c_parent == MF6C_INCOMPLETE_PARENT) - printf(" --- "); - else - printf(" %3d ", mfc.mf6c_parent); - for (mifi = 0; mifi <= maxmif; mifi++) { - if (IF_ISSET(mifi, &mfc.mf6c_ifset)) - printf(" %u", mifi); - } - printf("\n"); - - mfcp = mfc.mf6c_next; - } - } - if (!banner_printed) - printf("\nIPv6 Multicast Routing Table is empty\n"); - - printf("\n"); - nflag = saved_nflag; - - free(mf6ctable); -#endif -} - -void -mrt6_stats(void) -{ - struct mrt6stat mrtstat; - size_t len; - - len = sizeof(mrtstat); - if (sysctlbyname("net.inet6.ip6.mrt6stat", &mrtstat, &len, 0, 0) == -1) { - //printf("No IPv6 multicast routing compiled into this system\n"); - return; - } - printf("IPv6 multicast forwarding:\n"); - printf(" %10llu multicast forwarding cache lookup%s\n", - (unsigned long long)mrtstat.mrt6s_mfc_lookups, - plural(mrtstat.mrt6s_mfc_lookups)); - printf(" %10llu multicast forwarding cache miss%s\n", - (unsigned long long)mrtstat.mrt6s_mfc_misses, - plurales(mrtstat.mrt6s_mfc_misses)); - printf(" %10llu upcall%s to mrouted\n", - (unsigned long long)mrtstat.mrt6s_upcalls, - plural(mrtstat.mrt6s_upcalls)); - printf(" %10llu upcall queue overflow%s\n", - (unsigned long long)mrtstat.mrt6s_upq_ovflw, - plural(mrtstat.mrt6s_upq_ovflw)); - printf(" %10llu upcall%s dropped due to full socket buffer\n", - (unsigned long long)mrtstat.mrt6s_upq_sockfull, - plural(mrtstat.mrt6s_upq_sockfull)); - printf(" %10llu cache cleanup%s\n", - (unsigned long long)mrtstat.mrt6s_cache_cleanups, - plural(mrtstat.mrt6s_cache_cleanups)); - printf(" %10llu datagram%s with no route for origin\n", - (unsigned long long)mrtstat.mrt6s_no_route, - plural(mrtstat.mrt6s_no_route)); - printf(" %10llu datagram%s arrived with bad tunneling\n", - (unsigned long long)mrtstat.mrt6s_bad_tunnel, - plural(mrtstat.mrt6s_bad_tunnel)); - printf(" %10llu datagram%s could not be tunneled\n", - (unsigned long long)mrtstat.mrt6s_cant_tunnel, - plural(mrtstat.mrt6s_cant_tunnel)); - printf(" %10llu datagram%s arrived on wrong interface\n", - (unsigned long long)mrtstat.mrt6s_wrong_if, - plural(mrtstat.mrt6s_wrong_if)); - printf(" %10llu datagram%s selectively dropped\n", - (unsigned long long)mrtstat.mrt6s_drop_sel, - plural(mrtstat.mrt6s_drop_sel)); - printf(" %10llu datagram%s dropped due to queue overflow\n", - (unsigned long long)mrtstat.mrt6s_q_overflow, - plural(mrtstat.mrt6s_q_overflow)); - printf(" %10llu datagram%s dropped for being too large\n", - (unsigned long long)mrtstat.mrt6s_pkt2large, - plural(mrtstat.mrt6s_pkt2large)); -} -#endif /*INET6*/ diff --git a/netstat.tproj/netstat.h b/netstat.tproj/netstat.h index 86aec50..e64776f 100644 --- a/netstat.tproj/netstat.h +++ b/netstat.tproj/netstat.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2013 Apple Inc. All rights reserved. + * Copyright (c) 2008-2014 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -121,14 +121,7 @@ extern void ip6_stats(uint32_t, char *, int); extern void ip6_ifstats(char *); extern void icmp6_stats(uint32_t, char *, int); extern void icmp6_ifstats(char *); -#ifdef notyet -extern void pim6_stats(uint32_t, char *, int); -#endif extern void rip6_stats(uint32_t, char *, int); -#if defined(__APPLE__) && !TARGET_OS_EMBEDDED -extern void mroute6pr(void); -extern void mrt6_stats(void); -#endif /* forward references */ struct sockaddr_in6; @@ -143,6 +136,10 @@ extern char *netname6(struct sockaddr_in6 *, struct sockaddr *); extern void pfkey_stats(uint32_t, char *, int); #endif +extern void systmpr(uint32_t, char *, int); +extern void kctl_stats(uint32_t, char *, int); +extern void kevt_stats(uint32_t, char *, int); + extern void mbpr(void); extern void intpr(void (*)(char *)); @@ -162,11 +159,6 @@ extern void unixpr(void); extern void aqstatpr(void); extern void rxpollstatpr(void); -#if defined(__APPLE__) && !TARGET_OS_EMBEDDED -extern void mroutepr(void); -extern void mrt_stats(void); -#endif - extern void ifmalist_dump(void); extern int print_time(void); diff --git a/netstat.tproj/systm.c b/netstat.tproj/systm.c new file mode 100644 index 0000000..7c23476 --- /dev/null +++ b/netstat.tproj/systm.c @@ -0,0 +1,406 @@ +/* + * Copyright (c) 2014 Apple Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ +/*- + * Copyright (c) 1983, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "netstat.h" + +#define ROUNDUP64(a) \ +((a) > 0 ? (1 + (((a) - 1) | (sizeof(uint64_t) - 1))) : sizeof(uint64_t)) +#define ADVANCE64(x, n) (((char *)x) += ROUNDUP64(n)) + +struct xgen_n { + u_int32_t xgn_len; /* length of this structure */ + u_int32_t xgn_kind; /* number of PCBs at this time */ +}; + +#define ALL_XGN_KIND_KCREG (XSO_KCREG) +#define ALL_XGN_KIND_EVT (XSO_SOCKET | XSO_RCVBUF | XSO_SNDBUF | XSO_STATS | XSO_EVT) +#define ALL_XGN_KIND_KCB (XSO_SOCKET | XSO_RCVBUF | XSO_SNDBUF | XSO_STATS | XSO_KCB) + +void +systmpr(uint32_t proto, + char *name, int af) +{ + const char *mibvar; + size_t len; + char *buf, *next; + struct xsystmgen *xig, *oxig; + struct xgen_n *xgn; + int which = 0; + struct xsocket_n *so = NULL; + struct xsockbuf_n *so_rcv = NULL; + struct xsockbuf_n *so_snd = NULL; + struct xsockstat_n *so_stat = NULL; + struct xkctl_reg *kctl = NULL; + struct xkctlpcb *kcb = NULL; + struct xkevtpcb *kevb = NULL; + int first = 1; + + switch (proto) { + case SYSPROTO_EVENT: + mibvar = "net.systm.kevt.pcblist"; + break; + case SYSPROTO_CONTROL: + mibvar = "net.systm.kctl.pcblist"; + break; + case 0: + mibvar = "net.systm.kctl.reg_list"; + break; + default: + mibvar = NULL; + break; + } + if (mibvar == NULL) + return; + len = 0; + if (sysctlbyname(mibvar, 0, &len, 0, 0) < 0) { + if (errno != ENOENT) + warn("sysctl: %s", mibvar); + return; + } + if ((buf = malloc(len)) == 0) { + warn("malloc %lu bytes", (u_long)len); + return; + } + if (sysctlbyname(mibvar, buf, &len, 0, 0) < 0) { + warn("sysctl: %s", mibvar); + free(buf); + return; + } + /* + * Bail-out to avoid logic error in the loop below when + * there is in fact no more control block to process + */ + if (len <= sizeof(struct xsystmgen)) { + free(buf); + return; + } + oxig = xig = (struct xsystmgen *)buf; + for (next = buf + ROUNDUP64(xig->xg_len); next < buf + len; + next += ROUNDUP64(xgn->xgn_len)) { + xgn = (struct xgen_n*)next; + if (xgn->xgn_len <= sizeof(struct xsystmgen)) + break; + + if ((which & xgn->xgn_kind) == 0) { + which |= xgn->xgn_kind; + switch (xgn->xgn_kind) { + case XSO_SOCKET: + so = (struct xsocket_n *)xgn; + break; + case XSO_RCVBUF: + so_rcv = (struct xsockbuf_n *)xgn; + break; + case XSO_SNDBUF: + so_snd = (struct xsockbuf_n *)xgn; + break; + case XSO_STATS: + so_stat = (struct xsockstat_n *)xgn; + break; + case XSO_KCREG: + kctl = (struct xkctl_reg *)xgn; + break; + case XSO_KCB: + kcb = (struct xkctlpcb *)xgn; + break; + case XSO_EVT: + kevb = (struct xkevtpcb *)xgn; + break; + default: + printf("unexpected kind %d\n", xgn->xgn_kind); + break; + } + } else { + if (vflag) + printf("got %d twice\n", xgn->xgn_kind); + } + + if (which == ALL_XGN_KIND_KCREG) { + which = 0; + + if (first) { + printf("Registered kernel control modules\n"); + if (Aflag) + printf("%-16.16s ", "kctlref"); + printf("%-8.8s ", "id"); + if (Aflag) + printf("%-8.8s ", "unit"); + printf("%-8.8s ", "flags"); + printf("%-8.8s ", "pcbcount"); + printf("%-8.8s ", "rcvbuf"); + printf("%-8.8s ", "sndbuf"); + printf("%s ", "name"); + printf("\n"); + first = 0; + } + if (Aflag) + printf("%16llx ", kctl->xkr_kctlref); + printf("%8x ", kctl->xkr_id); + if (Aflag) + printf("%8d ", kctl->xkr_reg_unit); + printf("%8x ", kctl->xkr_flags); + printf("%8d ", kctl->xkr_pcbcount); + printf("%8d ", kctl->xkr_recvbufsize); + printf("%8d ", kctl->xkr_sendbufsize); + printf("%s ", kctl->xkr_name); + printf("\n"); + } else if (which == ALL_XGN_KIND_KCB) { + which = 0; + + if (first) { + printf("Active kernel control sockets\n"); + if (Aflag) + printf("%16.16s ", "pcb"); + printf("%-5.5s %-6.6s %-6.6s ", + "Proto", "Recv-Q", "Send-Q"); + if (bflag > 0) + printf("%10.10s %10.10s ", + "rxbytes", "txbytes"); + if (vflag > 0) + printf("%6.6s %6.6s %6.6s %6.6s ", + "rhiwat", "shiwat", "pid", "epid"); + printf("%6.6s ", "unit"); + printf("%6.6s ", "id"); + printf("%s", "name"); + printf("\n"); + first = 0; + } + if (Aflag) + printf("%16llx ", kcb->xkp_kctpcb); + printf("%-5.5s %6u %6u ", name, + so_rcv->sb_cc, + so_snd->sb_cc); + if (bflag > 0) { + int i; + u_int64_t rxbytes = 0; + u_int64_t txbytes = 0; + + for (i = 0; i < SO_TC_STATS_MAX; i++) { + rxbytes += so_stat->xst_tc_stats[i].rxbytes; + txbytes += so_stat->xst_tc_stats[i].txbytes; + } + printf("%10llu %10llu ", rxbytes, txbytes); + } + if (vflag > 0) { + printf("%6u %6u %6u %6u ", + so_rcv->sb_hiwat, + so_snd->sb_hiwat, + so->so_last_pid, + so->so_e_pid); + } + printf("%6d ", kcb->xkp_unit); + printf("%6d ", kcb->xkp_kctlid); + printf("%s", kcb->xkp_kctlname); + printf("\n"); + + } else if (which == ALL_XGN_KIND_EVT) { + which = 0; + if (first) { + printf("Active kernel event sockets\n"); + if (Aflag) + printf("%16.16s ", "pcb"); + printf("%-5.5s %-6.6s %-6.6s ", + "Proto", "Recv-Q", "Send-Q"); + printf("%6.6s ", "vendor"); + printf("%6.6s ", "class"); + printf("%6.6s", "subclass"); + if (bflag > 0) + printf("%10.10s %10.10s ", + "rxbytes", "txbytes"); + if (vflag > 0) + printf("%6.6s %6.6s %6.6s %6.6s", + "rhiwat", "shiwat", "pid", "epid"); + printf("\n"); + first = 0; + } + if (Aflag) + printf("%16llx ", kevb->kep_evtpcb); + printf("%-5.5s %6u %6u ", name, + so_rcv->sb_cc, + so_snd->sb_cc); + printf("%6d ", kevb->kep_vendor_code_filter); + printf("%6d ", kevb->kep_class_filter); + printf("%6d", kevb->kep_subclass_filter); + if (bflag > 0) { + int i; + u_int64_t rxbytes = 0; + u_int64_t txbytes = 0; + + for (i = 0; i < SO_TC_STATS_MAX; i++) { + rxbytes += so_stat->xst_tc_stats[i].rxbytes; + txbytes += so_stat->xst_tc_stats[i].txbytes; + } + printf("%10llu %10llu ", rxbytes, txbytes); + } + if (vflag > 0) { + printf("%6u %6u %6u %6u", + so_rcv->sb_hiwat, + so_snd->sb_hiwat, + so->so_last_pid, + so->so_e_pid); + } + printf("\n"); + } + + } + if (xig != oxig && xig->xg_gen != oxig->xg_gen) { + if (oxig->xg_count > xig->xg_count) { + printf("Some %s sockets may have been deleted.\n", + name); + } else if (oxig->xg_count < xig->xg_count) { + printf("Some %s sockets may have been created.\n", + name); + } else { + printf("Some %s sockets may have been created or deleted", + name); + } + } + free(buf); +} + +void +kctl_stats(uint32_t off __unused, char *name, int af __unused) +{ + static struct kctlstat pkctlstat; + struct kctlstat kctlstat; + size_t len = sizeof(struct kctlstat); + const char *mibvar = "net.systm.kctl.stats"; + + if (sysctlbyname(mibvar, &kctlstat, &len, 0, 0) < 0) { + warn("sysctl: %s", mibvar); + return; + } + if (interval && vflag > 0) + print_time(); + printf ("%s:\n", name); + +#define STATDIFF(f) (kctlstat.f - pkctlstat.f) +#define p(f, m) if (STATDIFF(f) || sflag <= 1) \ + printf(m, STATDIFF(f), plural(STATDIFF(f))) +#define p1a(f, m) if (STATDIFF(f) || sflag <= 1) \ + printf(m, STATDIFF(f)) + + p(kcs_reg_total, "\t%llu total kernel control module%s registered\n"); + p(kcs_reg_count, "\t%llu current kernel control module%s registered\n"); + p(kcs_pcbcount, "\t%llu current kernel control socket%s\n"); + p1a(kcs_gencnt, "\t%llu kernel control generation count\n"); + p(kcs_connections, "\t%llu connection attempt%s\n"); + p(kcs_conn_fail, "\t%llu connection failure%s\n"); + p(kcs_send_fail, "\t%llu send failure%s\n"); + p(kcs_send_list_fail, "\t%llu send list failure%s\n"); + p(kcs_enqueue_fail, "\t%llu enqueus failure%s\n"); + p(kcs_enqueue_fullsock, "\t%llu packet%s dropped due to full socket buffers\n"); + +#undef STATDIFF +#undef p +#undef p1a + + if (interval > 0) + bcopy(&kctlstat, &pkctlstat, len); +} + +void +kevt_stats(uint32_t off __unused, char *name, int af __unused) +{ + static struct kevtstat pkevtstat; + struct kevtstat kevtstat; + size_t len = sizeof(struct kctlstat); + const char *mibvar = "net.systm.kevt.stats"; + + if (sysctlbyname(mibvar, &kevtstat, &len, 0, 0) < 0) { + warn("sysctl: %s", mibvar); + return; + } + if (interval && vflag > 0) + print_time(); + printf ("%s:\n", name); + +#define STATDIFF(f) (kevtstat.f - pkevtstat.f) +#define p(f, m) if (STATDIFF(f) || sflag <= 1) \ + printf(m, STATDIFF(f), plural(STATDIFF(f))) +#define p1a(f, m) if (STATDIFF(f) || sflag <= 1) \ + printf(m, STATDIFF(f)) + + p(kes_pcbcount, "\t%llu current kernel control socket%s\n"); + p1a(kes_gencnt, "\t%llu kernel control generation count\n"); + p(kes_badvendor, "\t%llu bad vendor failure%s\n"); + p(kes_toobig, "\t%llu message too big failure%s\n"); + p(kes_nomem, "\t%llu out of memeory failure%s\n"); + p(kes_fullsock, "\t%llu message%s dropped due to full socket buffers\n"); + p(kes_posted, "\t%llu message posted%s\n"); + + if (interval > 0) + bcopy(&kevtstat, &pkevtstat, len); +} diff --git a/netstat.tproj/unix.c b/netstat.tproj/unix.c index 0e49608..2154809 100644 --- a/netstat.tproj/unix.c +++ b/netstat.tproj/unix.c @@ -58,11 +58,6 @@ * SUCH DAMAGE. */ -#ifndef lint -static const char rcsid[] = - "$Id: unix.c,v 1.4 2006/02/07 06:22:20 lindak Exp $"; -#endif /* not lint */ - /* * Display protocol blocks in the unix domain. */ diff --git a/network-client-server-entitlements.plist b/network-client-server-entitlements.plist new file mode 100644 index 0000000..c326c83 --- /dev/null +++ b/network-client-server-entitlements.plist @@ -0,0 +1,10 @@ + + + + + com.apple.security.network.client + + com.apple.security.network.server + + + diff --git a/network_cmds.xcodeproj/project.pbxproj b/network_cmds.xcodeproj/project.pbxproj index 962376f..f9c2212 100644 --- a/network_cmds.xcodeproj/project.pbxproj +++ b/network_cmds.xcodeproj/project.pbxproj @@ -14,13 +14,16 @@ ); dependencies = ( 034E4464100BDCA3009CA3DC /* PBXTargetDependency */, + 72B732EB1899B19A0060E6D4 /* PBXTargetDependency */, 72179EAE146233390098FB3E /* PBXTargetDependency */, 034E4469100BDD00009CA3DC /* PBXTargetDependency */, 565825AF13392239003E5FA5 /* PBXTargetDependency */, + 72311F4D194A34F500EB4788 /* PBXTargetDependency */, 690D97BC12DE7151004323A7 /* PBXTargetDependency */, 03B2DBD1100BE626005349BC /* PBXTargetDependency */, 034E4475100BDEC6009CA3DC /* PBXTargetDependency */, 7250E1491616642900A11A76 /* PBXTargetDependency */, + 7200F3051958A4FA0033E22C /* PBXTargetDependency */, 034E447B100BDF0D009CA3DC /* PBXTargetDependency */, 03B2DBD3100BE645005349BC /* PBXTargetDependency */, 18515B85133D1DBF000148A4 /* PBXTargetDependency */, @@ -39,18 +42,18 @@ ); dependencies = ( 726121490EE8717B00AFED1B /* PBXTargetDependency */, + 72B732E91899B18F0060E6D4 /* PBXTargetDependency */, 723C7074142BB003007C87E9 /* PBXTargetDependency */, 7261217D0EE8896800AFED1B /* PBXTargetDependency */, 4D2B05141208C6BB0004A3F3 /* PBXTargetDependency */, - 724DAB9A0EE88F5D008900D0 /* PBXTargetDependency */, - 724DAB790EE88EA6008900D0 /* PBXTargetDependency */, 724DABC30EE890A6008900D0 /* PBXTargetDependency */, 565825AD13392232003E5FA5 /* PBXTargetDependency */, + 72311F4B194A34EB00EB4788 /* PBXTargetDependency */, 690D97BE12DE7166004323A7 /* PBXTargetDependency */, - 724DABEC0EE891DF008900D0 /* PBXTargetDependency */, 724DAC240EE89525008900D0 /* PBXTargetDependency */, 7216D2670EE8978F00AE70E4 /* PBXTargetDependency */, 7250E1471616642000A11A76 /* PBXTargetDependency */, + 7200F3031958A4F10033E22C /* PBXTargetDependency */, 7216D2C00EE89ADF00AE70E4 /* PBXTargetDependency */, 7216D2C20EE89ADF00AE70E4 /* PBXTargetDependency */, 7216D2DA0EE89BE900AE70E4 /* PBXTargetDependency */, @@ -72,11 +75,13 @@ dependencies = ( 72ABD0A41083D818008C721C /* PBXTargetDependency */, 72ABD0881083D750008C721C /* PBXTargetDependency */, - 690D97BA12DE7130004323A7 /* PBXTargetDependency */, 565825B113392242003E5FA5 /* PBXTargetDependency */, + 72311F4F194A34FE00EB4788 /* PBXTargetDependency */, + 690D97BA12DE7130004323A7 /* PBXTargetDependency */, 72ABD08C1083D75D008C721C /* PBXTargetDependency */, 72ABD08E1083D75F008C721C /* PBXTargetDependency */, 7250E14B1616643000A11A76 /* PBXTargetDependency */, + 7200F3071958A5040033E22C /* PBXTargetDependency */, 72ABD0901083D762008C721C /* PBXTargetDependency */, 72ABD0921083D764008C721C /* PBXTargetDependency */, 72ABD0941083D767008C721C /* PBXTargetDependency */, @@ -104,7 +109,6 @@ /* Begin PBXBuildFile section */ 03EB2F9A120A1DDA0007C1A0 /* ip6addrctl.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4D2B04E41208C12F0004A3F3 /* ip6addrctl.8 */; }; - 03EB2F9D120A1E690007C1A0 /* ip6addrctl.conf in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4D2B04E61208C12F0004A3F3 /* ip6addrctl.conf */; }; 4D2B04F81208C21B0004A3F3 /* ip6addrctl.c in Sources */ = {isa = PBXBuildFile; fileRef = 4D2B04E51208C12F0004A3F3 /* ip6addrctl.c */; }; 565825A4133921A3003E5FA5 /* mnc_error.c in Sources */ = {isa = PBXBuildFile; fileRef = 565825961339217B003E5FA5 /* mnc_error.c */; }; 565825A5133921A3003E5FA5 /* mnc_main.c in Sources */ = {isa = PBXBuildFile; fileRef = 565825971339217B003E5FA5 /* mnc_main.c */; }; @@ -114,6 +118,7 @@ 56B6B66816F79A1C00D8A7A9 /* mptcp.c in Sources */ = {isa = PBXBuildFile; fileRef = 56B6B66716F79A1C00D8A7A9 /* mptcp.c */; }; 690D97A612DE6F96004323A7 /* mtest.c in Sources */ = {isa = PBXBuildFile; fileRef = 690D979412DE6E6B004323A7 /* mtest.c */; }; 690D97AE12DE70AE004323A7 /* mtest.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 690D979512DE6E76004323A7 /* mtest.8 */; }; + 7200F2FD1958A34D0033E22C /* packet_mangler.c in Sources */ = {isa = PBXBuildFile; fileRef = 7200F2FC1958A34D0033E22C /* packet_mangler.c */; }; 7216D24C0EE896F300AE70E4 /* data.c in Sources */ = {isa = PBXBuildFile; fileRef = 7261208B0EE86F4800AFED1B /* data.c */; }; 7216D24D0EE896F300AE70E4 /* if.c in Sources */ = {isa = PBXBuildFile; fileRef = 7261208D0EE86F4800AFED1B /* if.c */; }; 7216D24E0EE896F300AE70E4 /* inet.c in Sources */ = {isa = PBXBuildFile; fileRef = 7261208E0EE86F4800AFED1B /* inet.c */; }; @@ -122,8 +127,6 @@ 7216D2510EE896F300AE70E4 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120910EE86F4800AFED1B /* main.c */; }; 7216D2520EE896F300AE70E4 /* mbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120930EE86F4800AFED1B /* mbuf.c */; }; 7216D2530EE896F300AE70E4 /* mcast.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120940EE86F4800AFED1B /* mcast.c */; }; - 7216D2540EE896F300AE70E4 /* mroute.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120950EE86F4800AFED1B /* mroute.c */; }; - 7216D2550EE896F300AE70E4 /* mroute6.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120960EE86F4800AFED1B /* mroute6.c */; }; 7216D2560EE896F300AE70E4 /* route.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120990EE86F4800AFED1B /* route.c */; }; 7216D2570EE896F300AE70E4 /* tp_astring.c in Sources */ = {isa = PBXBuildFile; fileRef = 7261209A0EE86F4800AFED1B /* tp_astring.c */; }; 7216D2580EE896F300AE70E4 /* unix.c in Sources */ = {isa = PBXBuildFile; fileRef = 7261209B0EE86F4800AFED1B /* unix.c */; }; @@ -156,6 +159,10 @@ 7216D3700EE8A05B00AE70E4 /* rtsol.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 726120D70EE86F9100AFED1B /* rtsol.8 */; }; 7216D3AB0EE8A3C400AE70E4 /* spray.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120E00EE86F9D00AFED1B /* spray.c */; }; 7216D3AF0EE8A3D800AE70E4 /* spray.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 726120DF0EE86F9D00AFED1B /* spray.8 */; }; + 7218B54A191D4202001B7B52 /* systm.c in Sources */ = {isa = PBXBuildFile; fileRef = 7218B549191D4202001B7B52 /* systm.c */; }; + 72311F54194A354F00EB4788 /* conn_lib.c in Sources */ = {isa = PBXBuildFile; fileRef = 72311F50194A354F00EB4788 /* conn_lib.c */; }; + 72311F55194A354F00EB4788 /* mptcp_client.c in Sources */ = {isa = PBXBuildFile; fileRef = 72311F53194A354F00EB4788 /* mptcp_client.c */; }; + 72311F56194A76DA00EB4788 /* mptcp_client.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 72311F52194A354F00EB4788 /* mptcp_client.1 */; }; 724753E7144905E300F6A941 /* dnctl.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 724753E61448E1EF00F6A941 /* dnctl.8 */; }; 7247B83616165EDC00873B3C /* pktapctl.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7247B83516165EDC00873B3C /* pktapctl.8 */; }; 7247B83C16165F0100873B3C /* pktapctl.c in Sources */ = {isa = PBXBuildFile; fileRef = 7247B83B16165F0100873B3C /* pktapctl.c */; }; @@ -200,6 +207,9 @@ 7294F1080EE8BBB10052EC88 /* traceroute.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 726120F00EE86FA700AFED1B /* traceroute.8 */; }; 7294F12E0EE8BD2F0052EC88 /* traceroute6.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120FB0EE86FB500AFED1B /* traceroute6.c */; }; 7294F1320EE8BD430052EC88 /* traceroute6.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 726120FA0EE86FB500AFED1B /* traceroute6.8 */; }; + 72B732DF1899B0380060E6D4 /* cfilutil.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 72B732DE1899B0380060E6D4 /* cfilutil.1 */; }; + 72B732EF1899B23A0060E6D4 /* cfilutil.c in Sources */ = {isa = PBXBuildFile; fileRef = 72B732EE1899B23A0060E6D4 /* cfilutil.c */; }; + 72B732F11899B2430060E6D4 /* cfilstat.c in Sources */ = {isa = PBXBuildFile; fileRef = 72B732F01899B2430060E6D4 /* cfilstat.c */; }; 72B894EC0EEDB17C00C218D6 /* libipsec.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 72CD1DB50EE8C619005F825D /* libipsec.dylib */; }; 72D000C4142BB11100151981 /* dnctl.c in Sources */ = {isa = PBXBuildFile; fileRef = 72D000C3142BB11100151981 /* dnctl.c */; }; 72E42BA314B7CF3D003AAE28 /* network_cmds.plist in Install OSS Plist */ = {isa = PBXBuildFile; fileRef = 72E42BA214B7CF37003AAE28 /* network_cmds.plist */; }; @@ -353,6 +363,27 @@ remoteGlobalIDString = 690D978012DE6034004323A7; remoteInfo = mtest; }; + 7200F3021958A4F10033E22C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7200F2F91958A34D0033E22C; + remoteInfo = pktmnglr; + }; + 7200F3041958A4FA0033E22C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7200F2F91958A34D0033E22C; + remoteInfo = pktmnglr; + }; + 7200F3061958A5040033E22C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7200F2F91958A34D0033E22C; + remoteInfo = pktmnglr; + }; 7216D2660EE8978F00AE70E4 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; @@ -409,40 +440,40 @@ remoteGlobalIDString = 723C7067142BAFEA007C87E9; remoteInfo = dnctl; }; - 723C7073142BB003007C87E9 /* PBXContainerItemProxy */ = { + 72311F4A194A34EB00EB4788 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; proxyType = 1; - remoteGlobalIDString = 723C7067142BAFEA007C87E9; - remoteInfo = dnctl; + remoteGlobalIDString = 72311F41194A349000EB4788; + remoteInfo = mptcp_client; }; - 724DAB780EE88EA6008900D0 /* PBXContainerItemProxy */ = { + 72311F4C194A34F500EB4788 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; proxyType = 1; - remoteGlobalIDString = 724DAB5E0EE88E2A008900D0; - remoteInfo = ipfw; + remoteGlobalIDString = 72311F41194A349000EB4788; + remoteInfo = mptcp_client; }; - 724DAB990EE88F5D008900D0 /* PBXContainerItemProxy */ = { + 72311F4E194A34FE00EB4788 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; proxyType = 1; - remoteGlobalIDString = 724DAB810EE88EFA008900D0; - remoteInfo = ip6fw; + remoteGlobalIDString = 72311F41194A349000EB4788; + remoteInfo = mptcp_client; }; - 724DABC20EE890A6008900D0 /* PBXContainerItemProxy */ = { + 723C7073142BB003007C87E9 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; proxyType = 1; - remoteGlobalIDString = 724DABA10EE88FE3008900D0; - remoteInfo = kdumpd; + remoteGlobalIDString = 723C7067142BAFEA007C87E9; + remoteInfo = dnctl; }; - 724DABEB0EE891DF008900D0 /* PBXContainerItemProxy */ = { + 724DABC20EE890A6008900D0 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; proxyType = 1; - remoteGlobalIDString = 724DABDA0EE8912D008900D0; - remoteInfo = natd; + remoteGlobalIDString = 724DABA10EE88FE3008900D0; + remoteInfo = kdumpd; }; 724DAC230EE89525008900D0 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; @@ -584,6 +615,20 @@ remoteGlobalIDString = 7261212C0EE8710B00AFED1B; remoteInfo = arp; }; + 72B732E81899B18F0060E6D4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 72B732D91899B0380060E6D4; + remoteInfo = cfilutil; + }; + 72B732EA1899B19A0060E6D4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 72B732D91899B0380060E6D4; + remoteInfo = cfilutil; + }; 72C77D3C1484199C002D2577 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; @@ -601,20 +646,10 @@ /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ - 03EB2FB6120A1E740007C1A0 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 8; - dstPath = /private/etc; - dstSubfolderSpec = 0; - files = ( - 03EB2F9D120A1E690007C1A0 /* ip6addrctl.conf in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 1; - }; 4D2B05221208CB410004A3F3 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 8; - dstPath = /usr/share/man/man8; + dstPath = /usr/local/share/man/man8; dstSubfolderSpec = 0; files = ( 03EB2F9A120A1DDA0007C1A0 /* ip6addrctl.8 in CopyFiles */, @@ -652,6 +687,15 @@ name = "Install OSS Plist"; runOnlyForDeploymentPostprocessing = 1; }; + 7200F2F81958A34D0033E22C /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 1; + }; 7216D2750EE8979500AE70E4 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 8; @@ -752,10 +796,20 @@ ); runOnlyForDeploymentPostprocessing = 1; }; + 72311F40194A349000EB4788 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 72311F56194A76DA00EB4788 /* mptcp_client.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; 723C7066142BAFEA007C87E9 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; - dstPath = /usr/local/share/man/man8/; + dstPath = /usr/share/man/man8; dstSubfolderSpec = 0; files = ( 724753E7144905E300F6A941 /* dnctl.8 in CopyFiles */, @@ -872,6 +926,16 @@ ); runOnlyForDeploymentPostprocessing = 1; }; + 72B732D81899B0380060E6D4 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 72B732DF1899B0380060E6D4 /* cfilutil.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ @@ -893,6 +957,9 @@ 690D979412DE6E6B004323A7 /* mtest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mtest.c; sourceTree = ""; }; 690D979512DE6E76004323A7 /* mtest.8 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mtest.8; sourceTree = ""; }; 69C10A7912DF80F200BCDF4C /* COPYING */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = COPYING; sourceTree = ""; }; + 7200F2FA1958A34D0033E22C /* pktmnglr */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = pktmnglr; sourceTree = BUILT_PRODUCTS_DIR; }; + 7200F2FC1958A34D0033E22C /* packet_mangler.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = packet_mangler.c; sourceTree = ""; }; + 7211D9B2190713A60086EF20 /* network-client-server-entitlements.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "network-client-server-entitlements.plist"; sourceTree = ""; }; 7216D2460EE896C000AE70E4 /* netstat */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = netstat; sourceTree = BUILT_PRODUCTS_DIR; }; 7216D27C0EE8980A00AE70E4 /* ping */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ping; sourceTree = BUILT_PRODUCTS_DIR; }; 7216D29A0EE898BD00AE70E4 /* ping6 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ping6; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -901,6 +968,12 @@ 7216D3140EE89E9E00AE70E4 /* rtadvd */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = rtadvd; sourceTree = BUILT_PRODUCTS_DIR; }; 7216D3590EE8A02200AE70E4 /* rtsol */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = rtsol; sourceTree = BUILT_PRODUCTS_DIR; }; 7216D3A70EE8A3BB00AE70E4 /* spray */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = spray; sourceTree = BUILT_PRODUCTS_DIR; }; + 7218B549191D4202001B7B52 /* systm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = systm.c; sourceTree = ""; }; + 72311F42194A349000EB4788 /* mptcp_client */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = mptcp_client; sourceTree = BUILT_PRODUCTS_DIR; }; + 72311F50194A354F00EB4788 /* conn_lib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = conn_lib.c; sourceTree = ""; }; + 72311F51194A354F00EB4788 /* conn_lib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = conn_lib.h; sourceTree = ""; }; + 72311F52194A354F00EB4788 /* mptcp_client.1 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.man; path = mptcp_client.1; sourceTree = ""; }; + 72311F53194A354F00EB4788 /* mptcp_client.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mptcp_client.c; sourceTree = ""; }; 723C7068142BAFEA007C87E9 /* dnctl */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = dnctl; sourceTree = BUILT_PRODUCTS_DIR; }; 724753E61448E1EF00F6A941 /* dnctl.8 */ = {isa = PBXFileReference; lastKnownFileType = text; path = dnctl.8; sourceTree = ""; }; 7247B83116165EDC00873B3C /* pktapctl */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = pktapctl; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -958,8 +1031,6 @@ 726120910EE86F4800AFED1B /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; 726120930EE86F4800AFED1B /* mbuf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mbuf.c; sourceTree = ""; }; 726120940EE86F4800AFED1B /* mcast.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mcast.c; sourceTree = ""; }; - 726120950EE86F4800AFED1B /* mroute.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mroute.c; sourceTree = ""; }; - 726120960EE86F4800AFED1B /* mroute6.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mroute6.c; sourceTree = ""; }; 726120970EE86F4800AFED1B /* netstat.1 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.man; path = netstat.1; sourceTree = ""; }; 726120980EE86F4800AFED1B /* netstat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = netstat.h; sourceTree = ""; }; 726120990EE86F4800AFED1B /* route.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = route.c; sourceTree = ""; }; @@ -1035,6 +1106,10 @@ 726121540EE8881700AFED1B /* ifconfig */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ifconfig; sourceTree = BUILT_PRODUCTS_DIR; }; 7294F0F90EE8BB460052EC88 /* traceroute */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = traceroute; sourceTree = BUILT_PRODUCTS_DIR; }; 7294F12A0EE8BD280052EC88 /* traceroute6 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = traceroute6; sourceTree = BUILT_PRODUCTS_DIR; }; + 72B732DA1899B0380060E6D4 /* cfilutil */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = cfilutil; sourceTree = BUILT_PRODUCTS_DIR; }; + 72B732DE1899B0380060E6D4 /* cfilutil.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = cfilutil.1; sourceTree = ""; }; + 72B732EE1899B23A0060E6D4 /* cfilutil.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cfilutil.c; sourceTree = ""; }; + 72B732F01899B2430060E6D4 /* cfilstat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cfilstat.c; sourceTree = ""; }; 72CD1DB50EE8C619005F825D /* libipsec.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libipsec.dylib; path = /usr/lib/libipsec.dylib; sourceTree = ""; }; 72D000C3142BB11100151981 /* dnctl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dnctl.c; sourceTree = ""; }; 72E42BA214B7CF37003AAE28 /* network_cmds.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = network_cmds.plist; sourceTree = ""; }; @@ -1061,6 +1136,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 7200F2F71958A34D0033E22C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 7216D2440EE896C000AE70E4 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -1119,6 +1201,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 72311F3F194A349000EB4788 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 723C7065142BAFEA007C87E9 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -1205,6 +1294,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 72B732D71899B0380060E6D4 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -1243,6 +1339,25 @@ path = mtest.tproj; sourceTree = ""; }; + 7200F2FB1958A34D0033E22C /* pktmnglr */ = { + isa = PBXGroup; + children = ( + 7200F2FC1958A34D0033E22C /* packet_mangler.c */, + ); + path = pktmnglr; + sourceTree = ""; + }; + 72311F43194A349100EB4788 /* mptcp_client */ = { + isa = PBXGroup; + children = ( + 72311F53194A354F00EB4788 /* mptcp_client.c */, + 72311F50194A354F00EB4788 /* conn_lib.c */, + 72311F51194A354F00EB4788 /* conn_lib.h */, + 72311F52194A354F00EB4788 /* mptcp_client.1 */, + ); + path = mptcp_client; + sourceTree = ""; + }; 723C706A142BAFEA007C87E9 /* dnctl */ = { isa = PBXGroup; children = ( @@ -1265,9 +1380,11 @@ isa = PBXGroup; children = ( 72E42BA214B7CF37003AAE28 /* network_cmds.plist */, + 7211D9B2190713A60086EF20 /* network-client-server-entitlements.plist */, E01AB08F1368880F008C66FF /* libutil.dylib */, 726120380EE86EEB00AFED1B /* alias */, 7261204C0EE86EF900AFED1B /* arp.tproj */, + 72B732DB1899B0380060E6D4 /* cfilutil */, 723C706A142BAFEA007C87E9 /* dnctl */, 726120540EE86F0900AFED1B /* ifconfig.tproj */, 4D2B04E31208C12F0004A3F3 /* ip6addrctl.tproj */, @@ -1275,11 +1392,13 @@ 726120FE0EE8701100AFED1B /* ipfw.tproj */, 7261206D0EE86F2D00AFED1B /* kdumpd.tproj */, 56582591133920B5003E5FA5 /* mnc.tproj */, + 72311F43194A349100EB4788 /* mptcp_client */, 690D973F12DE5A21004323A7 /* mtest.tproj */, 726120770EE86F3600AFED1B /* natd.tproj */, 726120830EE86F4000AFED1B /* ndp.tproj */, 7261208A0EE86F4800AFED1B /* netstat.tproj */, 7247B83216165EDC00873B3C /* pktapctl */, + 7200F2FB1958A34D0033E22C /* pktmnglr */, 7261209E0EE86F5000AFED1B /* ping.tproj */, 726120A40EE86F5C00AFED1B /* ping6.tproj */, 726120AC0EE86F6700AFED1B /* rarpd.tproj */, @@ -1402,13 +1521,12 @@ 726120930EE86F4800AFED1B /* mbuf.c */, 726120940EE86F4800AFED1B /* mcast.c */, 56B6B66716F79A1C00D8A7A9 /* mptcp.c */, - 726120950EE86F4800AFED1B /* mroute.c */, - 726120960EE86F4800AFED1B /* mroute6.c */, 726120970EE86F4800AFED1B /* netstat.1 */, 726120980EE86F4800AFED1B /* netstat.h */, 726120990EE86F4800AFED1B /* route.c */, 7261209A0EE86F4800AFED1B /* tp_astring.c */, 7261209B0EE86F4800AFED1B /* unix.c */, + 7218B549191D4202001B7B52 /* systm.c */, ); path = netstat.tproj; sourceTree = ""; @@ -1571,10 +1689,23 @@ 5658259F1339218F003E5FA5 /* mnc */, 723C7068142BAFEA007C87E9 /* dnctl */, 7247B83116165EDC00873B3C /* pktapctl */, + 72B732DA1899B0380060E6D4 /* cfilutil */, + 72311F42194A349000EB4788 /* mptcp_client */, + 7200F2FA1958A34D0033E22C /* pktmnglr */, ); name = Products; sourceTree = ""; }; + 72B732DB1899B0380060E6D4 /* cfilutil */ = { + isa = PBXGroup; + children = ( + 72B732EE1899B23A0060E6D4 /* cfilutil.c */, + 72B732F01899B2430060E6D4 /* cfilstat.c */, + 72B732DE1899B0380060E6D4 /* cfilutil.1 */, + ); + path = cfilutil; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -1594,7 +1725,6 @@ buildPhases = ( 4D2B04F01208C2040004A3F3 /* Sources */, 4D2B05221208CB410004A3F3 /* CopyFiles */, - 03EB2FB6120A1E740007C1A0 /* CopyFiles */, 039D6A11120A2CF60006B8C8 /* ShellScript */, ); buildRules = ( @@ -1643,6 +1773,23 @@ productReference = 690D978112DE6034004323A7 /* mtest */; productType = "com.apple.product-type.tool"; }; + 7200F2F91958A34D0033E22C /* pktmnglr */ = { + isa = PBXNativeTarget; + buildConfigurationList = 7200F3011958A34E0033E22C /* Build configuration list for PBXNativeTarget "pktmnglr" */; + buildPhases = ( + 7200F2F61958A34D0033E22C /* Sources */, + 7200F2F71958A34D0033E22C /* Frameworks */, + 7200F2F81958A34D0033E22C /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = pktmnglr; + productName = pktmnglr; + productReference = 7200F2FA1958A34D0033E22C /* pktmnglr */; + productType = "com.apple.product-type.tool"; + }; 7216D2450EE896C000AE70E4 /* netstat */ = { isa = PBXNativeTarget; buildConfigurationList = 7216D24B0EE896EC00AE70E4 /* Build configuration list for PBXNativeTarget "netstat" */; @@ -1790,6 +1937,23 @@ productReference = 7216D3A70EE8A3BB00AE70E4 /* spray */; productType = "com.apple.product-type.tool"; }; + 72311F41194A349000EB4788 /* mptcp_client */ = { + isa = PBXNativeTarget; + buildConfigurationList = 72311F46194A349100EB4788 /* Build configuration list for PBXNativeTarget "mptcp_client" */; + buildPhases = ( + 72311F3E194A349000EB4788 /* Sources */, + 72311F3F194A349000EB4788 /* Frameworks */, + 72311F40194A349000EB4788 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = mptcp_client; + productName = mptcp_client; + productReference = 72311F42194A349000EB4788 /* mptcp_client */; + productType = "com.apple.product-type.tool"; + }; 723C7067142BAFEA007C87E9 /* dnctl */ = { isa = PBXNativeTarget; buildConfigurationList = 723C706F142BAFEA007C87E9 /* Build configuration list for PBXNativeTarget "dnctl" */; @@ -2005,6 +2169,23 @@ productReference = 7294F12A0EE8BD280052EC88 /* traceroute6 */; productType = "com.apple.product-type.tool"; }; + 72B732D91899B0380060E6D4 /* cfilutil */ = { + isa = PBXNativeTarget; + buildConfigurationList = 72B732E31899B0380060E6D4 /* Build configuration list for PBXNativeTarget "cfilutil" */; + buildPhases = ( + 72B732D61899B0380060E6D4 /* Sources */, + 72B732D71899B0380060E6D4 /* Frameworks */, + 72B732D81899B0380060E6D4 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = cfilutil; + productName = cfilutil; + productReference = 72B732DA1899B0380060E6D4 /* cfilutil */; + productType = "com.apple.product-type.tool"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -2012,6 +2193,14 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 0500; + TargetAttributes = { + 7200F2F91958A34D0033E22C = { + CreatedOnToolsVersion = 6.0; + }; + 72311F41194A349000EB4788 = { + CreatedOnToolsVersion = 6.0; + }; + }; }; buildConfigurationList = 724862340EE86EB7001D0DE9 /* Build configuration list for PBXProject "network_cmds" */; compatibilityVersion = "Xcode 3.2"; @@ -2035,17 +2224,20 @@ 7261210B0EE8707500AFED1B /* alias */, 7261212C0EE8710B00AFED1B /* arp */, 723C7067142BAFEA007C87E9 /* dnctl */, + 72B732D91899B0380060E6D4 /* cfilutil */, 726121530EE8881700AFED1B /* ifconfig */, 4D2B04F21208C2040004A3F3 /* ip6addrctl */, 724DAB810EE88EFA008900D0 /* ip6fw */, 724DAB5E0EE88E2A008900D0 /* ipfw */, 724DABA10EE88FE3008900D0 /* kdumpd */, 5658259E1339218F003E5FA5 /* mnc */, + 72311F41194A349000EB4788 /* mptcp_client */, 690D978012DE6034004323A7 /* mtest */, 724DABDA0EE8912D008900D0 /* natd */, 724DAC0C0EE8940D008900D0 /* ndp */, 7216D2450EE896C000AE70E4 /* netstat */, 7247B83016165EDC00873B3C /* pktapctl */, + 7200F2F91958A34D0033E22C /* pktmnglr */, 7216D27B0EE8980A00AE70E4 /* ping */, 7216D2990EE898BD00AE70E4 /* ping6 */, 7216D2CC0EE89B7900AE70E4 /* rarpd */, @@ -2071,7 +2263,7 @@ ); runOnlyForDeploymentPostprocessing = 1; shellPath = /bin/sh; - shellScript = "/bin/chmod 0444 $DSTROOT/usr/share/man/man8/ip6addrctl.8\n/bin/chmod 0644 $DSTROOT/private/etc/ip6addrctl.conf"; + shellScript = "/bin/chmod 0444 $DSTROOT/usr/local/share/man/man8/ip6addrctl.8"; }; 690D97C212DE71CF004323A7 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -2366,6 +2558,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 7200F2F61958A34D0033E22C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7200F2FD1958A34D0033E22C /* packet_mangler.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 7216D2430EE896C000AE70E4 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -2378,8 +2578,7 @@ 7216D2510EE896F300AE70E4 /* main.c in Sources */, 7216D2520EE896F300AE70E4 /* mbuf.c in Sources */, 7216D2530EE896F300AE70E4 /* mcast.c in Sources */, - 7216D2540EE896F300AE70E4 /* mroute.c in Sources */, - 7216D2550EE896F300AE70E4 /* mroute6.c in Sources */, + 7218B54A191D4202001B7B52 /* systm.c in Sources */, 7216D2560EE896F300AE70E4 /* route.c in Sources */, 7216D2570EE896F300AE70E4 /* tp_astring.c in Sources */, 56B6B66816F79A1C00D8A7A9 /* mptcp.c in Sources */, @@ -2456,6 +2655,15 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 72311F3E194A349000EB4788 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 72311F54194A354F00EB4788 /* conn_lib.c in Sources */, + 72311F55194A354F00EB4788 /* mptcp_client.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 723C7064142BAFEA007C87E9 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -2575,6 +2783,15 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 72B732D61899B0380060E6D4 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 72B732EF1899B23A0060E6D4 /* cfilutil.c in Sources */, + 72B732F11899B2430060E6D4 /* cfilstat.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ @@ -2668,6 +2885,21 @@ target = 690D978012DE6034004323A7 /* mtest */; targetProxy = 690D97BD12DE7166004323A7 /* PBXContainerItemProxy */; }; + 7200F3031958A4F10033E22C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7200F2F91958A34D0033E22C /* pktmnglr */; + targetProxy = 7200F3021958A4F10033E22C /* PBXContainerItemProxy */; + }; + 7200F3051958A4FA0033E22C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7200F2F91958A34D0033E22C /* pktmnglr */; + targetProxy = 7200F3041958A4FA0033E22C /* PBXContainerItemProxy */; + }; + 7200F3071958A5040033E22C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7200F2F91958A34D0033E22C /* pktmnglr */; + targetProxy = 7200F3061958A5040033E22C /* PBXContainerItemProxy */; + }; 7216D2670EE8978F00AE70E4 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 7216D2450EE896C000AE70E4 /* netstat */; @@ -2708,31 +2940,31 @@ target = 723C7067142BAFEA007C87E9 /* dnctl */; targetProxy = 72179EAD146233390098FB3E /* PBXContainerItemProxy */; }; - 723C7074142BB003007C87E9 /* PBXTargetDependency */ = { + 72311F4B194A34EB00EB4788 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 723C7067142BAFEA007C87E9 /* dnctl */; - targetProxy = 723C7073142BB003007C87E9 /* PBXContainerItemProxy */; + target = 72311F41194A349000EB4788 /* mptcp_client */; + targetProxy = 72311F4A194A34EB00EB4788 /* PBXContainerItemProxy */; }; - 724DAB790EE88EA6008900D0 /* PBXTargetDependency */ = { + 72311F4D194A34F500EB4788 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 724DAB5E0EE88E2A008900D0 /* ipfw */; - targetProxy = 724DAB780EE88EA6008900D0 /* PBXContainerItemProxy */; + target = 72311F41194A349000EB4788 /* mptcp_client */; + targetProxy = 72311F4C194A34F500EB4788 /* PBXContainerItemProxy */; }; - 724DAB9A0EE88F5D008900D0 /* PBXTargetDependency */ = { + 72311F4F194A34FE00EB4788 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 724DAB810EE88EFA008900D0 /* ip6fw */; - targetProxy = 724DAB990EE88F5D008900D0 /* PBXContainerItemProxy */; + target = 72311F41194A349000EB4788 /* mptcp_client */; + targetProxy = 72311F4E194A34FE00EB4788 /* PBXContainerItemProxy */; + }; + 723C7074142BB003007C87E9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 723C7067142BAFEA007C87E9 /* dnctl */; + targetProxy = 723C7073142BB003007C87E9 /* PBXContainerItemProxy */; }; 724DABC30EE890A6008900D0 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 724DABA10EE88FE3008900D0 /* kdumpd */; targetProxy = 724DABC20EE890A6008900D0 /* PBXContainerItemProxy */; }; - 724DABEC0EE891DF008900D0 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 724DABDA0EE8912D008900D0 /* natd */; - targetProxy = 724DABEB0EE891DF008900D0 /* PBXContainerItemProxy */; - }; 724DAC240EE89525008900D0 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 724DAC0C0EE8940D008900D0 /* ndp */; @@ -2833,6 +3065,16 @@ target = 7261212C0EE8710B00AFED1B /* arp */; targetProxy = 72ABD0A31083D818008C721C /* PBXContainerItemProxy */; }; + 72B732E91899B18F0060E6D4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 72B732D91899B0380060E6D4 /* cfilutil */; + targetProxy = 72B732E81899B18F0060E6D4 /* PBXContainerItemProxy */; + }; + 72B732EB1899B19A0060E6D4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 72B732D91899B0380060E6D4 /* cfilutil */; + targetProxy = 72B732EA1899B19A0060E6D4 /* PBXContainerItemProxy */; + }; 72C77D3B1484199C002D2577 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 7261210B0EE8707500AFED1B /* alias */; @@ -2850,7 +3092,6 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(NATIVE_ARCH_ACTUAL)"; COPY_PHASE_STRIP = YES; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; @@ -2898,6 +3139,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; DEAD_CODE_STRIPPING = YES; DYLIB_CURRENT_VERSION = 1; @@ -2987,6 +3229,8 @@ 03B2DBEB100BE71D005349BC /* Ignore Me */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; @@ -3050,6 +3294,8 @@ 03B2DBEF100BE71D005349BC /* Ignore Me */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; @@ -3062,6 +3308,8 @@ 03B2DBF0100BE71D005349BC /* Ignore Me */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; @@ -3075,6 +3323,8 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = YES; + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", "TFTP_DIR=\\\"/tftpboot\\\"", @@ -3107,6 +3357,8 @@ 03B2DBF3100BE71D005349BC /* Ignore Me */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", INET6, @@ -3128,6 +3380,9 @@ 03B2DBF4100BE71D005349BC /* Ignore Me */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", INET6, @@ -3161,6 +3416,8 @@ isa = XCBuildConfiguration; buildSettings = { ALTERNATE_MODE = 04555; + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", HAVE_SOCKADDR_SA_LEN, @@ -3177,6 +3434,8 @@ 03B2DBF7100BE71D005349BC /* Ignore Me */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", INET6, @@ -3243,6 +3502,8 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; @@ -3258,6 +3519,8 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_ENABLE_FIX_AND_CONTINUE = NO; @@ -3273,6 +3536,8 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; INSTALL_PATH = /usr/local/bin; @@ -3285,6 +3550,8 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; "DEBUG_INFORMATION_FORMAT[sdk=iphoneos*][arch=*]" = dwarf; GCC_DYNAMIC_NO_PIC = NO; @@ -3304,6 +3571,8 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; "DEBUG_INFORMATION_FORMAT[sdk=iphoneos*][arch=*]" = dwarf; @@ -3323,6 +3592,8 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; "DEBUG_INFORMATION_FORMAT[sdk=iphoneos*][arch=*]" = dwarf; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; @@ -3335,6 +3606,110 @@ }; name = "Ignore Me"; }; + 7200F2FE1958A34D0033E22C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = NO; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; + MACOSX_DEPLOYMENT_TARGET = 10.10; + METAL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx.internal; + }; + name = Debug; + }; + 7200F2FF1958A34D0033E22C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = NO; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; + MACOSX_DEPLOYMENT_TARGET = 10.10; + METAL_ENABLE_DEBUG_INFO = NO; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx.internal; + }; + name = Release; + }; + 7200F3001958A34D0033E22C /* Ignore Me */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = NO; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; + MACOSX_DEPLOYMENT_TARGET = 10.10; + METAL_ENABLE_DEBUG_INFO = NO; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx.internal; + }; + name = "Ignore Me"; + }; 7216D2480EE896C100AE70E4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -3372,6 +3747,8 @@ 7216D27E0EE8980B00AE70E4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; @@ -3384,6 +3761,8 @@ 7216D27F0EE8980B00AE70E4 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; @@ -3396,6 +3775,8 @@ 7216D29C0EE898BE00AE70E4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; @@ -3408,6 +3789,8 @@ 7216D29D0EE898BE00AE70E4 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; @@ -3421,6 +3804,8 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = YES; + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", "TFTP_DIR=\\\"/tftpboot\\\"", @@ -3437,6 +3822,8 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = YES; + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", "TFTP_DIR=\\\"/tftpboot\\\"", @@ -3486,6 +3873,8 @@ 7216D3160EE89E9F00AE70E4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", INET6, @@ -3507,6 +3896,8 @@ 7216D3170EE89E9F00AE70E4 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", INET6, @@ -3528,6 +3919,9 @@ 7216D35B0EE8A02300AE70E4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", INET6, @@ -3549,6 +3943,9 @@ 7216D35C0EE8A02300AE70E4 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", INET6, @@ -3589,6 +3986,116 @@ }; name = Release; }; + 72311F47194A349100EB4788 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = NO; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; + MACOSX_DEPLOYMENT_TARGET = 10.10; + METAL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + }; + name = Debug; + }; + 72311F48194A349100EB4788 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = NO; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; + MACOSX_DEPLOYMENT_TARGET = 10.10; + METAL_ENABLE_DEBUG_INFO = NO; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + }; + name = Release; + }; + 72311F49194A349100EB4788 /* Ignore Me */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = NO; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; + MACOSX_DEPLOYMENT_TARGET = 10.10; + METAL_ENABLE_DEBUG_INFO = NO; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + }; + name = "Ignore Me"; + }; 723C7070142BAFEA007C87E9 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -3604,7 +4111,7 @@ INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; - INSTALL_PATH = /usr/local/bin; + INSTALL_PATH = /usr/sbin; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; @@ -3620,7 +4127,7 @@ INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; - INSTALL_PATH = /usr/local/bin; + INSTALL_PATH = /usr/sbin; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; @@ -3636,7 +4143,7 @@ INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; - INSTALL_PATH = /usr/local/bin; + INSTALL_PATH = /usr/sbin; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = "Ignore Me"; @@ -3678,7 +4185,6 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(NATIVE_ARCH_ACTUAL)"; COPY_PHASE_STRIP = NO; DEAD_CODE_STRIPPING = YES; GCC_DYNAMIC_NO_PIC = NO; @@ -3696,6 +4202,7 @@ ); GCC_TREAT_WARNINGS_AS_ERRORS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = NO; + ONLY_ACTIVE_ARCH = YES; PREBINDING = NO; SDKROOT = ""; WARNING_CFLAGS = "-Wall"; @@ -3706,7 +4213,6 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(NATIVE_ARCH_ACTUAL)"; COPY_PHASE_STRIP = YES; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; @@ -3722,7 +4228,7 @@ "$(inherited)", "TARGET_OS_EMBEDDED=1", ); - GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_TREAT_WARNINGS_AS_ERRORS = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = NO; PREBINDING = NO; SDKROOT = ""; @@ -3799,6 +4305,8 @@ 724DABA40EE88FE3008900D0 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; @@ -3810,6 +4318,8 @@ 724DABA50EE88FE3008900D0 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; @@ -3906,6 +4416,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; DEAD_CODE_STRIPPING = YES; DYLIB_CURRENT_VERSION = 1; @@ -3928,6 +4439,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; DEAD_CODE_STRIPPING = YES; DYLIB_CURRENT_VERSION = 1; @@ -4042,6 +4554,8 @@ isa = XCBuildConfiguration; buildSettings = { ALTERNATE_MODE = 04555; + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", HAVE_SOCKADDR_SA_LEN, @@ -4059,6 +4573,8 @@ isa = XCBuildConfiguration; buildSettings = { ALTERNATE_MODE = 04555; + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", HAVE_SOCKADDR_SA_LEN, @@ -4075,6 +4591,8 @@ 7294F12C0EE8BD290052EC88 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", INET6, @@ -4092,6 +4610,8 @@ 7294F12D0EE8BD290052EC88 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_ENTITLEMENTS = "$(SRCROOT)/network-client-server-entitlements.plist"; + CODE_SIGN_IDENTITY = "-"; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", INET6, @@ -4138,6 +4658,106 @@ }; name = "Ignore Me"; }; + 72B732E01899B0380060E6D4 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; + INSTALL_GROUP = wheel; + INSTALL_MODE_FLAG = 0555; + INSTALL_OWNER = root; + MACOSX_DEPLOYMENT_TARGET = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 72B732E11899B0380060E6D4 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; + INSTALL_GROUP = wheel; + INSTALL_MODE_FLAG = 0555; + INSTALL_OWNER = root; + MACOSX_DEPLOYMENT_TARGET = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 72B732E21899B0380060E6D4 /* Ignore Me */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; + INSTALL_GROUP = wheel; + INSTALL_MODE_FLAG = 0555; + INSTALL_OWNER = root; + MACOSX_DEPLOYMENT_TARGET = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = "Ignore Me"; + }; 72C77D681484199C002D2577 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -4203,6 +4823,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 7200F3011958A34E0033E22C /* Build configuration list for PBXNativeTarget "pktmnglr" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7200F2FE1958A34D0033E22C /* Debug */, + 7200F2FF1958A34D0033E22C /* Release */, + 7200F3001958A34D0033E22C /* Ignore Me */, + ); + defaultConfigurationIsVisible = 0; + }; 7216D24B0EE896EC00AE70E4 /* Build configuration list for PBXNativeTarget "netstat" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -4283,6 +4912,16 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 72311F46194A349100EB4788 /* Build configuration list for PBXNativeTarget "mptcp_client" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 72311F47194A349100EB4788 /* Debug */, + 72311F48194A349100EB4788 /* Release */, + 72311F49194A349100EB4788 /* Ignore Me */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 723C706F142BAFEA007C87E9 /* Build configuration list for PBXNativeTarget "dnctl" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -4443,6 +5082,16 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 72B732E31899B0380060E6D4 /* Build configuration list for PBXNativeTarget "cfilutil" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 72B732E01899B0380060E6D4 /* Debug */, + 72B732E11899B0380060E6D4 /* Release */, + 72B732E21899B0380060E6D4 /* Ignore Me */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 72C77D671484199C002D2577 /* Build configuration list for PBXAggregateTarget "network_cmds_libs" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/ping.tproj/ping.8 b/ping.tproj/ping.8 index 9bf8c1b..6c60dee 100644 --- a/ping.tproj/ping.8 +++ b/ping.tproj/ping.8 @@ -70,6 +70,7 @@ packets to network hosts .Op Fl g Ar sweepminsize .Op Fl h Ar sweepincrsize .Op Fl i Ar wait +.Op Fl k Ar trafficclass .Op Fl l Ar preload .Op Fl M Cm mask | time .Op Fl m Ar ttl @@ -87,6 +88,7 @@ packets to network hosts .Op Fl c Ar count .Op Fl I Ar iface .Op Fl i Ar wait +.Op Fl k Ar trafficclass .Op Fl l Ar preload .Op Fl M Cm mask | time .Op Fl m Ar ttl @@ -210,6 +212,13 @@ values less than 0.1 second. This option is incompatible with the .Fl f option. +.It Fl k Ar trafficlass +Specifies the traffic class to use for sending ICMP packets. +The supported traffic classes are +BK_SYS, BK, BE, RD, OAM, AV, RV, VI, VO and CTL. +By default +.Nm +uses the control traffic class (CTL). .It Fl L Suppress loopback of multicast packets. This flag only applies if the ping destination is a multicast address. diff --git a/ping.tproj/ping.c b/ping.tproj/ping.c index 4480408..7701b7b 100644 --- a/ping.tproj/ping.c +++ b/ping.tproj/ping.c @@ -57,19 +57,14 @@ * SUCH DAMAGE. */ -#if 0 +#include + #ifndef lint -static const char copyright[] = +__unused static const char copyright[] = "@(#) Copyright (c) 1989, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ -#ifndef lint -static char sccsid[] = "@(#)ping.c 8.1 (Berkeley) 6/5/93"; -#endif /* not lint */ -#endif -#include - /* * P I N G . C * @@ -248,6 +243,7 @@ static void pr_retip(struct ip *); static void status(int); static void stopit(int); static void tvsub(struct timeval *, const struct timeval *); +static uint32_t str2svc(const char *); static void usage(void) __dead2; int @@ -425,7 +421,10 @@ main(int argc, char *const *argv) break; case 'k': how_traffic_class++; - traffic_class = atoi(optarg); + traffic_class = str2svc(optarg); + if (traffic_class == UINT32_MAX) + errx(EX_USAGE, "bad traffic class: `%s'", + optarg); break; case 'L': options |= F_NOLOOP; @@ -1849,6 +1848,42 @@ fill(char *bp, char *patp) } } +uint32_t +str2svc(const char *str) +{ + uint32_t svc; + char *endptr; + + if (str == NULL || *str == '\0') + svc = UINT32_MAX; + else if (strcasecmp(str, "BK_SYS") == 0) + return SO_TC_BK_SYS; + else if (strcasecmp(str, "BK") == 0) + return SO_TC_BK; + else if (strcasecmp(str, "BE") == 0) + return SO_TC_BE; + else if (strcasecmp(str, "RD") == 0) + return SO_TC_RD; + else if (strcasecmp(str, "OAM") == 0) + return SO_TC_OAM; + else if (strcasecmp(str, "AV") == 0) + return SO_TC_AV; + else if (strcasecmp(str, "RV") == 0) + return SO_TC_RV; + else if (strcasecmp(str, "VI") == 0) + return SO_TC_VI; + else if (strcasecmp(str, "VO") == 0) + return SO_TC_VO; + else if (strcasecmp(str, "CTL") == 0) + return SO_TC_CTL; + else { + svc = strtoul(str, &endptr, 0); + if (*endptr != '\0') + svc = UINT32_MAX; + } + return (svc); +} + #if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC) #define SECOPT " [-P policy]" #else @@ -1858,13 +1893,14 @@ static void usage(void) { - (void)fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n", -"usage: ping [-AaDdfnoQqRrv] [-b boundif] [-c count] [-G sweepmaxsize] [-g sweepminsize]", -" [-h sweepincrsize] [-i wait] [-l preload] [-M mask | time] [-m ttl]", -" " SECOPT " [-p pattern] [-S src_addr] [-s packetsize] [-t timeout]", -" [-W waittime] [-z tos] host", -" ping [-AaDdfLnoQqRrv] [-c count] [-I iface] [-i wait] [-l preload]", -" [-M mask | time] [-m ttl]" SECOPT " [-p pattern] [-S src_addr]", + (void)fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n", +"usage: ping [-AaDdfnoQqRrv] [-b boundif] [-c count] [-G sweepmaxsize]", +" [-g sweepminsize] [-h sweepincrsize] [-i wait] [−k trafficclass]", +" [-l preload] [-M mask | time] [-m ttl]" SECOPT " [-p pattern]", +" [-S src_addr] [-s packetsize] [-t timeout][-W waittime] [-z tos]", +" host", +" ping [-AaDdfLnoQqRrv] [-b boundif] [-c count] [-I iface] [-i wait]", +" [−k trafficclass] [-l preload] [-M mask | time] [-m ttl]" SECOPT " [-p pattern] [-S src_addr]", " [-s packetsize] [-T ttl] [-t timeout] [-W waittime]", " [-z tos] mcast-group"); exit(EX_USAGE); diff --git a/ping6.tproj/ping6.8 b/ping6.tproj/ping6.8 index f4c18bb..716668c 100644 --- a/ping6.tproj/ping6.8 +++ b/ping6.tproj/ping6.8 @@ -91,6 +91,9 @@ packets to network hosts .Op Fl i Ar wait .Ek .Bk -words +.Op Fl k Ar trafficclass +.Ek +.Bk -words .Op Fl l Ar preload .Ek .Bk -words @@ -228,6 +231,13 @@ values less than 0.1 second. This option is incompatible with the .Fl f option. +.It Fl k Ar trafficlass +Specifies the traffic class to use for sending ICMPv6 packets. +The supported traffic classes are +BK_SYS, BK, BE, RD, OAM, AV, RV, VI, VO and CTL. +By default +.Nm +uses the control traffic class (CTL). .It Fl l Ar preload If .Ar preload diff --git a/ping6.tproj/ping6.c b/ping6.tproj/ping6.c index 419552b..90da21a 100644 --- a/ping6.tproj/ping6.c +++ b/ping6.tproj/ping6.c @@ -91,8 +91,10 @@ * SUCH DAMAGE. */ +#include + #ifndef lint -static const char copyright[] = +__unused static const char copyright[] = "@(#) Copyright (c) 1989, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ @@ -148,6 +150,7 @@ static const char copyright[] = #ifdef HAVE_POLL_H #include #endif +#include #ifdef IPSEC #include @@ -319,6 +322,7 @@ void summary(void); void tvsub(struct timeval *, struct timeval *); int setpolicy(int, char *); char *nigroup(char *); +static uint32_t str2svc(const char *); void usage(void); int @@ -507,7 +511,10 @@ main(int argc, char *argv[]) break; case 'k': how_so_traffic_class++; - so_traffic_class = atoi(optarg); + so_traffic_class = str2svc(optarg); + if (so_traffic_class == UINT32_MAX) + errx(EX_USAGE, "bad traffic class: `%s'", + optarg); break; case 'l': @@ -2988,6 +2995,42 @@ nigroup(char *name) return strdup(hbuf); } +uint32_t +str2svc(const char *str) +{ + uint32_t svc; + char *endptr; + + if (str == NULL || *str == '\0') + svc = UINT32_MAX; + else if (strcasecmp(str, "BK_SYS") == 0) + return SO_TC_BK_SYS; + else if (strcasecmp(str, "BK") == 0) + return SO_TC_BK; + else if (strcasecmp(str, "BE") == 0) + return SO_TC_BE; + else if (strcasecmp(str, "RD") == 0) + return SO_TC_RD; + else if (strcasecmp(str, "OAM") == 0) + return SO_TC_OAM; + else if (strcasecmp(str, "AV") == 0) + return SO_TC_AV; + else if (strcasecmp(str, "RV") == 0) + return SO_TC_RV; + else if (strcasecmp(str, "VI") == 0) + return SO_TC_VI; + else if (strcasecmp(str, "VO") == 0) + return SO_TC_VO; + else if (strcasecmp(str, "CTL") == 0) + return SO_TC_CTL; + else { + svc = strtoul(str, &endptr, 0); + if (*endptr != '\0') + svc = UINT32_MAX; + } + return (svc); +} + void usage(void) { diff --git a/pktmnglr/packet_mangler.c b/pktmnglr/packet_mangler.c new file mode 100644 index 0000000..fab5ce9 --- /dev/null +++ b/pktmnglr/packet_mangler.c @@ -0,0 +1,329 @@ +/* + * Copyright (c) 2014 Apple Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ + +// +// Created by Prabhakar Lakhera on 06/23/14. +// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define BUF_MAX 1000 +int doit(); + +Pkt_Mnglr_Flow dir = INOUT; +struct addrinfo * p_localaddr = NULL; +struct addrinfo * p_remoteaddr = NULL; +struct sockaddr_storage l_saddr = {0}; +struct sockaddr_storage r_saddr = {0}; + +int sf = -1; +uint32_t duration = 0; +uint32_t protocol = 0; +uint32_t proto_act_mask = 0; +uint32_t ip_act_mask = 0; +uint16_t local_port = 0; +uint16_t remote_port = 0; +uint8_t activate = 1; + +static const char * +basename(const char * str) +{ + const char *last_slash = strrchr(str, '/'); + + if (last_slash == NULL) + return (str); + else + return (last_slash + 1); +} + +struct option_desc { + const char *option; + const char *description; + int required; +}; + +struct option_desc option_desc_list[] = { + { "-h ", "Help", 0 }, + { "-f flow", "flow direction to apply mangler on. Values can be: in/out/inout. default is inout", 0 }, + { "-l IP address ", "Local IP we are interested in ", 0 }, + { "-r IP address ", "Remote IP we are interested in", 0 }, + { "-m IP action mask ", "IP action mask", 0 }, + { "-t time", "Run duration for which packet mangler will run. A value of 0 means forever (till program is killed).", 0 }, + { "-p IP Protocol ", "IP protocol i.e. one of tcp, udp, icmp, icmpv6", 0 }, + { "-L Local port ", "Local port", 0 }, + { "-R Remote port ", "Remote port", 0 }, + { "-M Protocol action mask ", "Protocol action mask", 0 }, + { NULL, NULL, 0 } /* Mark end of list */ +}; + + +static void +usage(const char *cmd) +{ + struct option_desc *option_desc; + char * usage_str = (char *)malloc(BUF_MAX); + size_t usage_len; + + if (usage_str == NULL) + err(1, "%s: malloc(%d)", __func__, BUF_MAX); + + usage_len = snprintf(usage_str, BUF_MAX, "# usage: %s ", basename(cmd)); + + for (option_desc = option_desc_list; option_desc->option != NULL; option_desc++) { + int len; + + if (option_desc->required) + len = snprintf(usage_str + usage_len, BUF_MAX - usage_len, "%s ", option_desc->option); + else + len = snprintf(usage_str + usage_len, BUF_MAX - usage_len, "[%s] ", option_desc->option); + if (len < 0) + err(1, "%s: snprintf(", __func__); + + usage_len += len; + if (usage_len > BUF_MAX) + break; + } + printf("%s\n", usage_str); + printf("options:\n"); + + for (option_desc = option_desc_list; option_desc->option != NULL; option_desc++) { + printf(" %-20s # %s\n", option_desc->option, option_desc->description); + } + +} + +int +main(int argc, char * const argv[]) { + int ch; + int error; + + if (argc == 1) { + usage(argv[0]); + exit(0); + } + + while ((ch = getopt(argc, argv, "hf:l:r:t:p:m:M:L:R")) != -1) { + switch (ch) { + case 'h': + usage(argv[0]); + exit(0); + break; + case 'f': { + if (strcasecmp(optarg, "in") == 0) { + dir = IN; + } else if (strcasecmp(optarg, "out") == 0) { + dir = OUT; + } else if (strcasecmp(optarg, "inout") == 0) { + dir = INOUT; + } else { + usage(argv[0]); + errx(1, "syntax error"); + } + } + break; + case 'l': + if ((error = getaddrinfo(optarg, NULL, NULL, &p_localaddr))) + errx(1, "getaddrinfo returned error: %s", gai_strerror(error)); + + break; + case 'r': + if ((error = getaddrinfo(optarg, NULL, NULL, &p_remoteaddr))) + errx(1, "getaddrinfo returned error: %s", gai_strerror(error)); + + break; + case 'm': + ip_act_mask = (uint32_t)atoi(optarg); + break; + case 't': + duration = (uint32_t)atoi(optarg); + break; + case 'p': + /* Only support tcp for now */ + if (strcasecmp(optarg, "tcp") == 0) { + protocol = IPPROTO_TCP; + } else if (strcasecmp(optarg, "udp") == 0) { + protocol = IPPROTO_UDP; + errx(1, "Protocol not supported."); + } else if (strcasecmp(optarg, "icmp") == 0) { + protocol = IPPROTO_ICMP; + errx(1, "Protocol not supported."); + } else if (strcasecmp(optarg, "icmpv6") == 0) { + protocol = IPPROTO_ICMPV6; + errx(1, "Protocol not supported."); + } else { + errx(1, "Protocol not supported."); + } + break; + + case 'L': + local_port = (uint16_t)atoi(optarg); + break; + case 'R': + remote_port = (uint16_t)atoi(optarg); + break; + case 'M': + proto_act_mask = (uint32_t)atoi(optarg); + break; + + default: + warnx("# syntax error, unknow option '%d'", ch); + usage(argv[0]); + exit(0); + } + } + + if (p_localaddr && p_remoteaddr) { + if (p_localaddr->ai_family!=p_remoteaddr->ai_family) { + errx(1, "The address families for local and remote address" + " when both present, must be equal"); + } + } + + + doit(); + + return (0); +} + + +int +doit() +{ + struct sockaddr_ctl addr; + + sf = socket(PF_SYSTEM, SOCK_DGRAM, SYSPROTO_CONTROL); + if (sf == -1) { + err(1, "socket()"); + } + + /* Connect the socket */ + bzero(&addr, sizeof(addr)); + addr.sc_len = sizeof(addr); + addr.sc_family = AF_SYSTEM; + addr.ss_sysaddr = AF_SYS_CONTROL; + + { + struct ctl_info info; + memset(&info, 0, sizeof(info)); + strncpy(info.ctl_name, PACKET_MANGLER_CONTROL_NAME, sizeof(info.ctl_name)); + if (ioctl(sf, CTLIOCGINFO, &info)) { + perror("Could not get ID for kernel control.\n"); + exit(-1); + } + addr.sc_id = info.ctl_id; + addr.sc_unit = 1; + } + + if (connect(sf, (struct sockaddr *)&addr, sizeof(struct sockaddr_ctl)) == -1) { + err(1, "connect()"); + } + + if (setsockopt(sf, SYSPROTO_CONTROL, PKT_MNGLR_OPT_DIRECTION, + &dir, sizeof(uint32_t)) == -1) { + err(1, "setsockopt could not set direction."); + } + + /* Set the IP addresses for the flow */ + if (p_localaddr) { + l_saddr = *((struct sockaddr_storage *)(p_localaddr->ai_addr)); + + if (setsockopt(sf, SYSPROTO_CONTROL, PKT_MNGLR_OPT_LOCAL_IP, + &l_saddr, sizeof(struct sockaddr_storage)) == -1) { + err(1, "setsockopt could not set local address."); + } + freeaddrinfo(p_localaddr); + p_localaddr = NULL; + } + + if (p_remoteaddr) { + r_saddr = *((struct sockaddr_storage *)(p_remoteaddr->ai_addr)); + + if (setsockopt(sf, SYSPROTO_CONTROL, PKT_MNGLR_OPT_REMOTE_IP, + &r_saddr, sizeof(struct sockaddr_storage)) == -1) { + err(1, "setsockopt could not set remote address."); + } + freeaddrinfo(p_remoteaddr); + p_remoteaddr = NULL; + } + + /* Set ports for the flow */ + if (local_port && (setsockopt(sf, SYSPROTO_CONTROL, PKT_MNGLR_OPT_LOCAL_PORT, + &local_port, sizeof(uint16_t)) == -1)) { + err(1, "setsockopt could not set local port."); + + } + + if (remote_port && (setsockopt(sf, SYSPROTO_CONTROL, PKT_MNGLR_OPT_REMOTE_PORT, + &remote_port, sizeof(uint16_t)) == -1)) { + err(1, "setsockopt could not set remote port."); + + } + + if (protocol && setsockopt(sf, SYSPROTO_CONTROL, PKT_MNGLR_OPT_PROTOCOL, + &protocol, sizeof(uint32_t)) == -1) { + err(1, "setsockopt could not set protocol."); + } + + if (proto_act_mask && + (setsockopt(sf, SYSPROTO_CONTROL, PKT_MNGLR_OPT_PROTO_ACT_MASK, + &proto_act_mask, sizeof(uint32_t))==-1)) { + err(1, "setsockopt could not set protocol action mask."); + } + + if (setsockopt(sf, SYSPROTO_CONTROL, PKT_MNGLR_OPT_ACTIVATE, + &activate, sizeof(uint8_t))== -1) { + err(1, "setsockopt could not activate packet mangler."); + } + + if (!duration) { + pause(); + } else { + sleep(duration); + } + + close(sf); + return 0; +} diff --git a/rarpd.tproj/rarpd.c b/rarpd.tproj/rarpd.c index fcea9bc..6c42b6c 100644 --- a/rarpd.tproj/rarpd.c +++ b/rarpd.tproj/rarpd.c @@ -41,19 +41,15 @@ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ + #include + #ifndef lint __unused char copyright[] = "@(#) Copyright (c) 1990 The Regents of the University of California.\n\ All rights reserved.\n"; #endif /* not lint */ -#ifndef lint -__unused static char rcsid[] = -"@(#) $Id: rarpd.c,v 1.3 2006/04/05 03:13:14 lindak Exp $"; -#endif - - /* * rarpd - Reverse ARP Daemon * diff --git a/route.tproj/route.c b/route.tproj/route.c index 8a60ed8..c2508bd 100644 --- a/route.tproj/route.c +++ b/route.tproj/route.c @@ -59,20 +59,13 @@ */ #include + #ifndef lint __unused static const char copyright[] = "@(#) Copyright (c) 1983, 1989, 1991, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ -#ifndef lint -#if 0 -static char sccsid[] = "@(#)route.c 8.3 (Berkeley) 3/19/94"; -#endif -__unused static const char rcsid[] = - "$Id: route.c,v 1.4 2006/02/07 06:22:29 lindak Exp $"; -#endif /* not lint */ - #include #include #include diff --git a/traceroute.tproj/findsaddr-socket.c b/traceroute.tproj/findsaddr-socket.c index 88ca8bf..01dcef1 100644 --- a/traceroute.tproj/findsaddr-socket.c +++ b/traceroute.tproj/findsaddr-socket.c @@ -63,11 +63,6 @@ /* XXX Yes this is WAY too complicated */ -#ifndef lint -static const char rcsid[] = - "@(#) $Id: findsaddr-socket.c,v 1.3 2005/02/12 00:04:09 lindak Exp $ (LBL)"; -#endif - #include #include #include diff --git a/traceroute.tproj/ifaddrlist.c b/traceroute.tproj/ifaddrlist.c index ed45494..2d19c78 100644 --- a/traceroute.tproj/ifaddrlist.c +++ b/traceroute.tproj/ifaddrlist.c @@ -59,11 +59,6 @@ * SUCH DAMAGE. */ -#ifndef lint -static const char rcsid[] = - "@(#) $Id: ifaddrlist.c,v 1.3 2006/02/07 06:22:57 lindak Exp $ (LBL)"; -#endif - #include #include #include diff --git a/traceroute.tproj/traceroute.c b/traceroute.tproj/traceroute.c index d556fb4..38e6cef 100644 --- a/traceroute.tproj/traceroute.c +++ b/traceroute.tproj/traceroute.c @@ -47,16 +47,12 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ +#include + #ifndef lint -static const char copyright[] = +__unused static const char copyright[] = "@(#) Copyright (c) 1988, 1989, 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000\n\ The Regents of the University of California. All rights reserved.\n"; -#if 0 -static const char rcsid[] = - "@(#)$Id: traceroute.c,v 1.4 2006/02/07 06:22:57 lindak Exp $ (LBL)"; -#endif -static const char rcsid[] = - "$FreeBSD: src/contrib/traceroute/traceroute.c,v 1.35 2008/02/20 23:29:52 rpaulo Exp $"; #endif /* diff --git a/traceroute6.tproj/traceroute6.c b/traceroute6.tproj/traceroute6.c index 373b7c5..1de7809 100644 --- a/traceroute6.tproj/traceroute6.c +++ b/traceroute6.tproj/traceroute6.c @@ -66,20 +66,13 @@ */ #include + #ifndef lint __unused static char copyright[] = "@(#) Copyright (c) 1990, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ -#ifndef lint -#if 0 -static char sccsid[] = "@(#)traceroute.c 8.1 (Berkeley) 6/6/93"; -#endif -__unused static const char rcsid[] = - "$FreeBSD: src/usr.sbin/traceroute6/traceroute6.c,v 1.22 2008/02/10 21:06:38 dwmalone Exp $"; -#endif /* not lint */ - /* * traceroute host - trace the route ip packets follow going to "host". * -- 2.45.2