}
#define MAX_IPv6_STR_LEN INET6_ADDRSTRLEN
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 135000
static void
bridge_mac_nat(int s, const char *prefix)
{
}
free(buf);
}
+#endif
static void
bridge_status(int s)
if (!all || verbose > 1) {
printf("\tAddress cache:\n");
bridge_addresses(s, "\t\t");
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 135000
bridge_mac_nat(s, "\t\t");
+#endif
}
return;
err(1, "BRDGSHOSTFILTER");
}
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 135000
static void
setbridge_macnat(const char *val, int d, int s, const struct afswtch *afp)
{
do_bridgeflag(s, val, IFBIF_MAC_NAT, 0);
}
+#endif
static struct cmd bridge_cmds[] = {
DEF_CMD_ARG("addm", setbridge_add),
#endif
DEF_CMD_ARG2("hostfilter", setbridge_hostfilter),
DEF_CMD_ARG("-hostfilter", unsetbridge_hostfilter),
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 135000
DEF_CMD_ARG("macnat", setbridge_macnat),
DEF_CMD_ARG("-macnat", unsetbridge_macnat),
+#endif
};
static struct afswtch af_bridge = {
.af_name = "af_bridge",
#include <TargetConditionals.h>
#endif
+#ifndef IF_NETEM_PARAMS_PSCALE
+#define IF_NETEM_PARAMS_PSCALE 100000
+#endif
+
/*
* Since "struct ifreq" is composed of various union members, callers
* should pay special attention to interprete the value.
}
}
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 135000
static int
get_int64(uint64_t *i, char const *s)
{
"\t\tnetem\n\n");
return (-1);
}
+#endif
static void
setthrottle(const char *val, int dummy __unused, int s,
}
#endif
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 135000
static void
setifmpklog(const char *vname, int value, int s, const struct afswtch *afp)
{
if (ioctl(s, SIOCSIFMPKLOG, (caddr_t)&ifr) < 0)
Perror(vname);
}
+#endif
void
settimestamp(const char *vname, int value, int s, const struct afswtch *afp)
if (strcmp(arg, "fastlane") == 0)
ifr.ifr_qosmarking_mode = IFRTYPE_QOSMARKING_FASTLANE;
+#if defined(IFRTYPE_QOSMARKING_RFC4594)
else if (strcmp(arg, "rfc4594") == 0)
ifr.ifr_qosmarking_mode = IFRTYPE_QOSMARKING_RFC4594;
+#endif
else if (strcasecmp(arg, "none") == 0 || strcasecmp(arg, "off") == 0)
ifr.ifr_qosmarking_mode = IFRTYPE_QOSMARKING_MODE_NONE;
else
Perror(vname);
}
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 135000
struct str2num {
const char *str;
uint32_t num;
if (ioctl(s, SIOCSIFINTERFACESTATE, (caddr_t)&ifr) < 0)
warn("ioctl(SIOCSIFINTERFACESTATE)");
}
+#endif
static void
show_routermode(int s)
putchar('\n');
}
+#if defined(SIOCGIFXFLAGS)
if (verbose && ioctl(s, SIOCGIFXFLAGS, (caddr_t)&ifr) != -1 &&
(xflags = ifr.ifr_xflags) != 0) {
printb("\txflags", xflags, IFXFBITS);
putchar('\n');
}
+#endif
if (ioctl(s, SIOCGIFCAP, (caddr_t)&ifr) == 0) {
if (ifr.ifr_curcap != 0) {
case IFRTYPE_QOSMARKING_FASTLANE:
printf("fastlane\n");
break;
+#if defined(IFRTYPE_QOSMARKING_RFC4594)
case IFRTYPE_QOSMARKING_RFC4594:
printf("RFC4594\n");
break;
+#endif
case IFRTYPE_QOSMARKING_MODE_NONE:
printf("none\n");
break;
printf("\tlow power mode: %s\n",
(ifr.ifr_low_power_mode != 0) ? "enabled" : "disabled");
}
+#if defined(SIOCGIFMPKLOG)
if (ioctl(s, SIOCGIFMPKLOG, &ifr) != -1) {
printf("\tmulti layer packet logging (mpklog): %s\n",
(ifr.ifr_mpk_log != 0) ? "enabled" : "disabled");
}
+#endif
show_routermode(s);
show_routermode6();
DEF_CMD("monitor", IFF_MONITOR:, setifflags),
DEF_CMD("-monitor", -IFF_MONITOR, setifflags),
#endif /* IFF_MONITOR */
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 135000
DEF_CMD("mpklog", 1, setifmpklog),
DEF_CMD("-mpklog", 0, setifmpklog),
+#endif
#ifdef IFF_STATICARP
DEF_CMD("staticarp", IFF_STATICARP, setifflags),
DEF_CMD("-staticarp", -IFF_STATICARP, setifflags),
DEF_CMD_VA("routermode", routermode),
DEF_CMD_ARG("desc", setifdesc),
DEF_CMD_ARG("tbr", settbr),
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 135000
DEF_CMD_VA("netem", setnetem),
+#endif
DEF_CMD_ARG("throttle", setthrottle),
DEF_CMD_ARG("log", setlog),
DEF_CMD("cl2k", 1, setcl2k),
DEF_CMD("-probe_connectivity", 0, setprobeconnectivity),
DEF_CMD("lowpowermode", 1, setlowpowermode),
DEF_CMD("-lowpowermode", 0, setlowpowermode),
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 135000
DEF_CMD_ARG("subfamily", setifsubfamily),
+#endif
+#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 135000
DEF_CMD("available", 1, setifavailability),
DEF_CMD("-available", 0, setifavailability),
DEF_CMD("unavailable", 0, setifavailability),
+#endif
};
static __constructor void
c = "Cellular";
break;
+#if defined(APPLE_IF_FAM_IPSEC)
case IFT_OTHER:
if (ifr.ifr_type.ift_family == APPLE_IF_FAM_IPSEC) {
if (ifr.ifr_type.ift_subfamily == IFRTYPE_SUBFAMILY_BLUETOOTH) {
}
}
break;
+#endif
case IFT_BRIDGE:
case IFT_PFLOG:
case IFRTYPE_FUNCTIONAL_INTCOPROC:
break;
+#if defined(IFRTYPE_FUNCTIONAL_COMPANIONLINK)
case IFRTYPE_FUNCTIONAL_COMPANIONLINK:
str = "companionlink";
break;
+#endif
default:
break;