From: Apple Date: Wed, 11 Dec 2019 20:30:43 +0000 (+0000) Subject: network_cmds-596.100.2.tar.gz X-Git-Tag: macos-10154^0 X-Git-Url: https://git.saurik.com/apple/network_cmds.git/commitdiff_plain/f1dee6ae4f09d06db1e14c8be5091eb1b0d7347b?hp=e0b07f2d5ba2222268f5d1293221b413eb7c2655 network_cmds-596.100.2.tar.gz --- diff --git a/ecnprobe/capture.c b/ecnprobe/capture.c index 83cbf78..32a8e0b 100644 --- a/ecnprobe/capture.c +++ b/ecnprobe/capture.c @@ -82,7 +82,17 @@ void CaptureInit(u_int32_t sourceIP, u_int16_t sourcePort, if (dev != NULL) { device = dev; } else { - device = pcap_lookupdev(errbuf); + pcap_if_t *devlist; + /* + * Find the list of interfaces, and pick + * the first interface. + */ + if (pcap_findalldevs(&devlist, errbuf) >= 0 && + devlist != NULL) { + device = strdup(devlist->name); + pcap_freealldevs(devlist); + } + if (device == NULL) { fprintf(stderr, "Can't find capture device: %s\n", errbuf); exit(-1); diff --git a/ifconfig.tproj/ifbridge.c b/ifconfig.tproj/ifbridge.c index 0b610ce..951c56b 100644 --- a/ifconfig.tproj/ifbridge.c +++ b/ifconfig.tproj/ifbridge.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2014 Apple Inc. All rights reserved. + * Copyright (c) 2009-2019 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -299,6 +299,56 @@ bridge_addresses(int s, const char *prefix) free(inbuf); } +#define MAX_IPv6_STR_LEN INET6_ADDRSTRLEN +static void +bridge_mac_nat(int s, const char *prefix) +{ + char *buf; + unsigned int count; + struct ether_addr ea; + unsigned int i; + struct ifbrmnelist mnl; + char *scan; + + bzero(&mnl, sizeof(mnl)); + if (do_cmd(s, BRDGGMACNATLIST, &mnl, sizeof(mnl), 0) < 0) { + /* err(1, "unable to get mac nat list"); */ + return; + } + if (mnl.ifbml_len == 0) { + return; + } + printf("\tMAC NAT list:\n"); + if (mnl.ifbml_elsize == 0) { + err(1, "kernel reported zero length element size"); + } + if (mnl.ifbml_elsize < sizeof(struct ifbrmne)) { + err(1, "struct element size too small, kernel mismatch"); + } + buf = malloc(mnl.ifbml_len); + if (buf == NULL) { + err(1, "unable to allocate mac nat list buffer"); + } + mnl.ifbml_buf = buf; + if (do_cmd(s, BRDGGMACNATLIST, &mnl, sizeof(mnl), 0) < 0) { + err(1, "unable to get mac nat list"); + } + count = mnl.ifbml_len / mnl.ifbml_elsize; + for (i = 0, scan = buf; i < count; i++, scan += mnl.ifbml_elsize) { + struct ifbrmne *ifbmne = (struct ifbrmne *)scan; + char ntopbuf[INET6_ADDRSTRLEN]; + + memcpy(ea.octet, ifbmne->ifbmne_mac, + sizeof(ea.octet)); + inet_ntop(ifbmne->ifbmne_af, &ifbmne->ifbmne_ip, + ntopbuf, sizeof(ntopbuf)); + printf("%s%s %s %s %lu\n", + prefix, ifbmne->ifbmne_ifname, ntopbuf, ether_ntoa(&ea), + (unsigned long)ifbmne->ifbmne_expire); + } + free(buf); +} + static void bridge_status(int s) { @@ -349,6 +399,7 @@ bridge_status(int s) if (!all || verbose > 1) { printf("\tAddress cache:\n"); bridge_addresses(s, "\t\t"); + bridge_mac_nat(s, "\t\t"); } return; @@ -814,6 +865,20 @@ unsetbridge_hostfilter(const char *ifn, int d, int s, const struct afswtch *afp) err(1, "BRDGSHOSTFILTER"); } +static void +setbridge_macnat(const char *val, int d, int s, const struct afswtch *afp) +{ + + do_bridgeflag(s, val, IFBIF_MAC_NAT, 1); +} + +static void +unsetbridge_macnat(const char *val, int d, int s, const struct afswtch *afp) +{ + + do_bridgeflag(s, val, IFBIF_MAC_NAT, 0); +} + static struct cmd bridge_cmds[] = { DEF_CMD_ARG("addm", setbridge_add), DEF_CMD_ARG("deletem", setbridge_delete), @@ -865,6 +930,8 @@ static struct cmd bridge_cmds[] = { #endif DEF_CMD_ARG2("hostfilter", setbridge_hostfilter), DEF_CMD_ARG("-hostfilter", unsetbridge_hostfilter), + DEF_CMD_ARG("macnat", setbridge_macnat), + DEF_CMD_ARG("-macnat", unsetbridge_macnat), }; static struct afswtch af_bridge = { .af_name = "af_bridge", diff --git a/netstat.tproj/if.c b/netstat.tproj/if.c index 0704c32..7339bde 100644 --- a/netstat.tproj/if.c +++ b/netstat.tproj/if.c @@ -2052,7 +2052,7 @@ loop: interface, sp->ifi_poll_on_req, sp->ifi_poll_on_err); printf(" [ poll off requests: %15u errors: %27u ]\n", sp->ifi_poll_off_req, sp->ifi_poll_off_err); - printf(" [ polled packets: %18llu per poll limit: %19lu ]\n", + printf(" [ polled packets: %18llu per poll limit: %19u ]\n", sp->ifi_poll_packets, sp->ifi_poll_packets_limit); printf(" [ polled bytes: %20llu ]\n", sp->ifi_poll_bytes); printf(" [ poll interval: %14llu nsec ]\n", @@ -2079,7 +2079,7 @@ loop: np->ifn_rx_mit_cfg_packets_lowat, np->ifn_rx_mit_cfg_packets_hiwat); printf(" [ cfg bytes lo/hi threshold: %12u / %12u ]\n", np->ifn_rx_mit_cfg_bytes_lowat, np->ifn_rx_mit_cfg_bytes_hiwat); - printf(" [ cfg interval: %15llu nsec ]\n", + printf(" [ cfg interval: %15u nsec ]\n", np->ifn_rx_mit_cfg_interval); printf(" [ mit interval: %15llu nsec ]\n", np->ifn_rx_mit_interval); diff --git a/network_cmds.xcodeproj/project.pbxproj b/network_cmds.xcodeproj/project.pbxproj index 17a6ae5..567ed52 100755 --- a/network_cmds.xcodeproj/project.pbxproj +++ b/network_cmds.xcodeproj/project.pbxproj @@ -254,8 +254,6 @@ 724DABBC0EE8908A008900D0 /* com.apple.kdumpd.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7261206E0EE86F2D00AFED1B /* com.apple.kdumpd.plist */; }; 724DAC120EE89423008900D0 /* ndp.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120870EE86F4000AFED1B /* ndp.c */; }; 724DAC3B0EE89555008900D0 /* ndp.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 726120860EE86F4000AFED1B /* ndp.8 */; }; - 7255D4311E44036D008F4A32 /* libcrypto.35.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 7255D4301E44036D008F4A32 /* libcrypto.35.dylib */; }; - 7255D4331E44037F008F4A32 /* libssl.35.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 7255D4321E44037F008F4A32 /* libssl.35.dylib */; }; 726121310EE8711E00AFED1B /* arp.c in Sources */ = {isa = PBXBuildFile; fileRef = 7261204E0EE86EF900AFED1B /* arp.c */; }; 726121350EE8713800AFED1B /* arp.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7261204D0EE86EF900AFED1B /* arp.8 */; }; 7261215A0EE8883900AFED1B /* ifbond.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120550EE86F0900AFED1B /* ifbond.c */; }; @@ -307,6 +305,8 @@ compilerSpec = com.apple.compilers.proxy.script; filePatterns = "$(PROJECT_DIR)/spray.tproj/spray.x"; fileType = pattern.proxy; + inputFiles = ( + ); isEditable = 1; outputFiles = ( "$(DERIVED_FILES_DIR)/$(INPUT_FILE_BASE).h", @@ -1426,8 +1426,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 7255D4331E44037F008F4A32 /* libssl.35.dylib in Frameworks */, - 7255D4311E44036D008F4A32 /* libcrypto.35.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -4062,9 +4060,15 @@ GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNUSED_FUNCTION = YES; + HEADER_SEARCH_PATHS = /usr/local/libressl/include; INSTALL_MODE_FLAG = 0555; INSTALL_PATH = /usr/libexec; + LIBRARY_SEARCH_PATHS = /usr/local/libressl/lib; MTL_ENABLE_DEBUG_INFO = YES; + OTHER_LDFLAGS = ( + "-lssl", + "-lcrypto", + ); PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx.internal; SUPPORTED_PLATFORMS = macosx; @@ -4092,9 +4096,15 @@ GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNUSED_FUNCTION = YES; + HEADER_SEARCH_PATHS = /usr/local/libressl/include; INSTALL_MODE_FLAG = 0555; INSTALL_PATH = /usr/libexec; + LIBRARY_SEARCH_PATHS = /usr/local/libressl/lib; MTL_ENABLE_DEBUG_INFO = NO; + OTHER_LDFLAGS = ( + "-lssl", + "-lcrypto", + ); PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx.internal; SUPPORTED_PLATFORMS = macosx; @@ -4122,9 +4132,15 @@ GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNUSED_FUNCTION = YES; + HEADER_SEARCH_PATHS = /usr/local/libressl/include; INSTALL_MODE_FLAG = 0555; INSTALL_PATH = /usr/libexec; + LIBRARY_SEARCH_PATHS = /usr/local/libressl/lib; MTL_ENABLE_DEBUG_INFO = NO; + OTHER_LDFLAGS = ( + "-lssl", + "-lcrypto", + ); PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx.internal; SUPPORTED_PLATFORMS = macosx;