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);
/*
- * Copyright (c) 2009-2014 Apple Inc. All rights reserved.
+ * Copyright (c) 2009-2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
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)
{
if (!all || verbose > 1) {
printf("\tAddress cache:\n");
bridge_addresses(s, "\t\t");
+ bridge_mac_nat(s, "\t\t");
}
return;
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),
#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",
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",
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);
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 */; };
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",
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- 7255D4331E44037F008F4A32 /* libssl.35.dylib in Frameworks */,
- 7255D4311E44036D008F4A32 /* libcrypto.35.dylib in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
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;
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;
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;