From: Apple Date: Fri, 30 Oct 2009 00:38:57 +0000 (+0000) Subject: network_cmds-328.tar.gz X-Git-Tag: mac-os-x-1063^0 X-Git-Url: https://git.saurik.com/apple/network_cmds.git/commitdiff_plain/8d01c3442b975fe0fe2e3fb87b8c8b61d637f8eb network_cmds-328.tar.gz --- diff --git a/ifconfig.tproj/af_inet.c b/ifconfig.tproj/af_inet.c new file mode 100644 index 0000000..028951c --- /dev/null +++ b/ifconfig.tproj/af_inet.c @@ -0,0 +1,200 @@ +/* + * Copyright (c) 1983, 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. + * 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. + */ + +#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 +#include + +#include +#include +#include +#include +#include +#include + +#include +#include /* for struct ifaddr */ +#include +#include +#include + +#include "ifconfig.h" + +static struct ifaliasreq in_addreq; +static struct ifreq in_ridreq; + +static void +in_status(int s __unused, const struct ifaddrs *ifa) +{ + struct sockaddr_in *sin, null_sin; + + memset(&null_sin, 0, sizeof(null_sin)); + + sin = (struct sockaddr_in *)ifa->ifa_addr; + if (sin == NULL) + return; + + printf("\tinet %s ", inet_ntoa(sin->sin_addr)); + + if (ifa->ifa_flags & IFF_POINTOPOINT) { + sin = (struct sockaddr_in *)ifa->ifa_dstaddr; + if (sin == NULL) + sin = &null_sin; + printf("--> %s ", inet_ntoa(sin->sin_addr)); + } + + sin = (struct sockaddr_in *)ifa->ifa_netmask; + if (sin == NULL) + sin = &null_sin; + printf("netmask 0x%lx ", (unsigned long)ntohl(sin->sin_addr.s_addr)); + + if (ifa->ifa_flags & IFF_BROADCAST) { + sin = (struct sockaddr_in *)ifa->ifa_broadaddr; + if (sin != NULL && sin->sin_addr.s_addr != 0) + printf("broadcast %s", inet_ntoa(sin->sin_addr)); + } + putchar('\n'); +} + +#define SIN(x) ((struct sockaddr_in *) &(x)) +static struct sockaddr_in *sintab[] = { + SIN(in_ridreq.ifr_addr), SIN(in_addreq.ifra_addr), + SIN(in_addreq.ifra_mask), SIN(in_addreq.ifra_broadaddr) +}; + +static void +in_getaddr(const char *s, int which) +{ +#define MIN(a,b) ((a)<(b)?(a):(b)) + struct sockaddr_in *sin = sintab[which]; + struct hostent *hp; + struct netent *np; + + sin->sin_len = sizeof(*sin); + if (which != MASK) + sin->sin_family = AF_INET; + + if (which == ADDR) { + char *p = NULL; + + if((p = strrchr(s, '/')) != NULL) { + /* address is `name/masklen' */ + int masklen; + int ret; + struct sockaddr_in *min = sintab[MASK]; + *p = '\0'; + ret = sscanf(p+1, "%u", &masklen); + if(ret != 1 || (masklen < 0 || masklen > 32)) { + *p = '/'; + errx(1, "%s: bad value", s); + } + min->sin_len = sizeof(*min); + min->sin_addr.s_addr = htonl(~((1LL << (32 - masklen)) - 1) & + 0xffffffff); + } + } + + if (inet_aton(s, &sin->sin_addr)) + return; + if ((hp = gethostbyname(s)) != 0) + bcopy(hp->h_addr, (char *)&sin->sin_addr, + MIN(hp->h_length, sizeof(sin->sin_addr))); + else if ((np = getnetbyname(s)) != 0) + sin->sin_addr = inet_makeaddr(np->n_net, INADDR_ANY); + else + errx(1, "%s: bad value", s); +#undef MIN +} + +static void +in_status_tunnel(int s) +{ + char src[NI_MAXHOST]; + char dst[NI_MAXHOST]; + struct ifreq ifr; + const struct sockaddr *sa = (const struct sockaddr *) &ifr.ifr_addr; + + memset(&ifr, 0, sizeof(ifr)); + strncpy(ifr.ifr_name, name, IFNAMSIZ); + + if (ioctl(s, SIOCGIFPSRCADDR, (caddr_t)&ifr) < 0) + return; + if (sa->sa_family != AF_INET) + return; + if (getnameinfo(sa, sa->sa_len, src, sizeof(src), 0, 0, NI_NUMERICHOST) != 0) + src[0] = '\0'; + + if (ioctl(s, SIOCGIFPDSTADDR, (caddr_t)&ifr) < 0) + return; + if (sa->sa_family != AF_INET) + return; + if (getnameinfo(sa, sa->sa_len, dst, sizeof(dst), 0, 0, NI_NUMERICHOST) != 0) + dst[0] = '\0'; + + printf("\ttunnel inet %s --> %s\n", src, dst); +} + +static void +in_set_tunnel(int s, struct addrinfo *srcres, struct addrinfo *dstres) +{ + struct ifaliasreq addreq; + + memset(&addreq, 0, sizeof(addreq)); + strncpy(addreq.ifra_name, name, IFNAMSIZ); + memcpy(&addreq.ifra_addr, srcres->ai_addr, srcres->ai_addr->sa_len); + memcpy(&addreq.ifra_dstaddr, dstres->ai_addr, dstres->ai_addr->sa_len); + + if (ioctl(s, SIOCSIFPHYADDR, &addreq) < 0) + warn("SIOCSIFPHYADDR"); +} + +static struct afswtch af_inet = { + .af_name = "inet", + .af_af = AF_INET, + .af_status = in_status, + .af_getaddr = in_getaddr, + .af_status_tunnel = in_status_tunnel, + .af_settunnel = in_set_tunnel, + .af_difaddr = SIOCDIFADDR, + .af_aifaddr = SIOCAIFADDR, + .af_ridreq = &in_ridreq, + .af_addreq = &in_addreq, +}; + +static __constructor void +inet_ctor(void) +{ + af_register(&af_inet); +} diff --git a/ifconfig.tproj/af_inet6.c b/ifconfig.tproj/af_inet6.c new file mode 100644 index 0000000..54d039a --- /dev/null +++ b/ifconfig.tproj/af_inet6.c @@ -0,0 +1,538 @@ +/* + * Copyright (c) 1983, 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. + * 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. + */ + +#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 +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include /* for struct ifaddr */ +#include +#include +#include + +#include /* Define ND6_INFINITE_LIFETIME */ + +#include "ifconfig.h" + +static struct in6_ifreq in6_ridreq; +static struct in6_aliasreq in6_addreq = + { { 0 }, + { 0 }, + { 0 }, + { 0 }, + 0, + { 0, 0, ND6_INFINITE_LIFETIME, ND6_INFINITE_LIFETIME } }; +static int ip6lifetime; + +static void in6_fillscopeid(struct sockaddr_in6 *sin6); +static int prefix(void *, int); +static char *sec2str(time_t); +static int explicit_prefix = 0; + +static char addr_buf[MAXHOSTNAMELEN *2 + 1]; /*for getnameinfo()*/ + +static void +setifprefixlen(const char *addr, int dummy __unused, int s, + const struct afswtch *afp) +{ + if (afp->af_getprefix != NULL) + afp->af_getprefix(addr, MASK); + explicit_prefix = 1; +} + +static void +setip6flags(const char *dummyaddr __unused, int flag, int dummysoc __unused, + const struct afswtch *afp) +{ + if (afp->af_af != AF_INET6) + err(1, "address flags can be set only for inet6 addresses"); + + if (flag < 0) + in6_addreq.ifra_flags &= ~(-flag); + else + in6_addreq.ifra_flags |= flag; +} + +static void +setip6lifetime(const char *cmd, const char *val, int s, + const struct afswtch *afp) +{ + time_t newval, t; + char *ep; + + t = time(NULL); + newval = (time_t)strtoul(val, &ep, 0); + if (val == ep) + errx(1, "invalid %s", cmd); + if (afp->af_af != AF_INET6) + errx(1, "%s not allowed for the AF", cmd); + if (strcmp(cmd, "vltime") == 0) { + in6_addreq.ifra_lifetime.ia6t_expire = t + newval; + in6_addreq.ifra_lifetime.ia6t_vltime = newval; + } else if (strcmp(cmd, "pltime") == 0) { + in6_addreq.ifra_lifetime.ia6t_preferred = t + newval; + in6_addreq.ifra_lifetime.ia6t_pltime = newval; + } +} + +static void +setip6pltime(const char *seconds, int dummy __unused, int s, + const struct afswtch *afp) +{ + setip6lifetime("pltime", seconds, s, afp); +} + +static void +setip6vltime(const char *seconds, int dummy __unused, int s, + const struct afswtch *afp) +{ + setip6lifetime("vltime", seconds, s, afp); +} + +static void +setip6eui64(const char *cmd, int dummy __unused, int s, + const struct afswtch *afp) +{ + struct ifaddrs *ifap, *ifa; + const struct sockaddr_in6 *sin6 = NULL; + const struct in6_addr *lladdr = NULL; + struct in6_addr *in6; + + if (afp->af_af != AF_INET6) + errx(EXIT_FAILURE, "%s not allowed for the AF", cmd); + in6 = (struct in6_addr *)&in6_addreq.ifra_addr.sin6_addr; + if (memcmp(&in6addr_any.s6_addr[8], &in6->s6_addr[8], 8) != 0) + errx(EXIT_FAILURE, "interface index is already filled"); + if (getifaddrs(&ifap) != 0) + err(EXIT_FAILURE, "getifaddrs"); + for (ifa = ifap; ifa; ifa = ifa->ifa_next) { + if (ifa->ifa_addr->sa_family == AF_INET6 && + strcmp(ifa->ifa_name, name) == 0) { + sin6 = (const struct sockaddr_in6 *)ifa->ifa_addr; + if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { + lladdr = &sin6->sin6_addr; + break; + } + } + } + if (!lladdr) + errx(EXIT_FAILURE, "could not determine link local address"); + + memcpy(&in6->s6_addr[8], &lladdr->s6_addr[8], 8); + + freeifaddrs(ifap); +} + +static void +in6_fillscopeid(struct sockaddr_in6 *sin6) +{ +#if defined(__KAME__) && defined(KAME_SCOPEID) + if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { + sin6->sin6_scope_id = + ntohs(*(u_int16_t *)&sin6->sin6_addr.s6_addr[2]); + sin6->sin6_addr.s6_addr[2] = sin6->sin6_addr.s6_addr[3] = 0; + } +#endif +} + +static void +in6_status(int s __unused, const struct ifaddrs *ifa) +{ + struct sockaddr_in6 *sin, null_sin; + struct in6_ifreq ifr6; + int s6; + u_int32_t flags6; + struct in6_addrlifetime lifetime; + time_t t = time(NULL); + int error; + u_int32_t scopeid; + + memset(&null_sin, 0, sizeof(null_sin)); + + sin = (struct sockaddr_in6 *)ifa->ifa_addr; + if (sin == NULL) + return; + + strncpy(ifr6.ifr_name, ifr.ifr_name, sizeof(ifr.ifr_name)); + if ((s6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { + warn("socket(AF_INET6,SOCK_DGRAM)"); + return; + } + ifr6.ifr_addr = *sin; + if (ioctl(s6, SIOCGIFAFLAG_IN6, &ifr6) < 0) { + warn("ioctl(SIOCGIFAFLAG_IN6)"); + close(s6); + return; + } + flags6 = ifr6.ifr_ifru.ifru_flags6; + memset(&lifetime, 0, sizeof(lifetime)); + ifr6.ifr_addr = *sin; + if (ioctl(s6, SIOCGIFALIFETIME_IN6, &ifr6) < 0) { + warn("ioctl(SIOCGIFALIFETIME_IN6)"); + close(s6); + return; + } + lifetime = ifr6.ifr_ifru.ifru_lifetime; + close(s6); + + /* XXX: embedded link local addr check */ + if (IN6_IS_ADDR_LINKLOCAL(&sin->sin6_addr) && + *(u_short *)&sin->sin6_addr.s6_addr[2] != 0) { + u_short index; + + index = *(u_short *)&sin->sin6_addr.s6_addr[2]; + *(u_short *)&sin->sin6_addr.s6_addr[2] = 0; + if (sin->sin6_scope_id == 0) + sin->sin6_scope_id = ntohs(index); + } + scopeid = sin->sin6_scope_id; + + error = getnameinfo((struct sockaddr *)sin, sin->sin6_len, addr_buf, + sizeof(addr_buf), NULL, 0, NI_NUMERICHOST); + if (error != 0) + inet_ntop(AF_INET6, &sin->sin6_addr, addr_buf, + sizeof(addr_buf)); + printf("\tinet6 %s ", addr_buf); + + if (ifa->ifa_flags & IFF_POINTOPOINT) { + sin = (struct sockaddr_in6 *)ifa->ifa_dstaddr; + /* + * some of the interfaces do not have valid destination + * address. + */ + if (sin != NULL && sin->sin6_family == AF_INET6) { + int error; + + /* XXX: embedded link local addr check */ + if (IN6_IS_ADDR_LINKLOCAL(&sin->sin6_addr) && + *(u_short *)&sin->sin6_addr.s6_addr[2] != 0) { + u_short index; + + index = *(u_short *)&sin->sin6_addr.s6_addr[2]; + *(u_short *)&sin->sin6_addr.s6_addr[2] = 0; + if (sin->sin6_scope_id == 0) + sin->sin6_scope_id = ntohs(index); + } + + error = getnameinfo((struct sockaddr *)sin, + sin->sin6_len, addr_buf, + sizeof(addr_buf), NULL, 0, + NI_NUMERICHOST); + if (error != 0) + inet_ntop(AF_INET6, &sin->sin6_addr, addr_buf, + sizeof(addr_buf)); + printf("--> %s ", addr_buf); + } + } + + sin = (struct sockaddr_in6 *)ifa->ifa_netmask; + if (sin == NULL) + sin = &null_sin; + printf("prefixlen %d ", prefix(&sin->sin6_addr, + sizeof(struct in6_addr))); + + if ((flags6 & IN6_IFF_ANYCAST) != 0) + printf("anycast "); + if ((flags6 & IN6_IFF_TENTATIVE) != 0) + printf("tentative "); + if ((flags6 & IN6_IFF_DUPLICATED) != 0) + printf("duplicated "); + if ((flags6 & IN6_IFF_DETACHED) != 0) + printf("detached "); + if ((flags6 & IN6_IFF_DEPRECATED) != 0) + printf("deprecated "); + if ((flags6 & IN6_IFF_AUTOCONF) != 0) + printf("autoconf "); + if ((flags6 & IN6_IFF_TEMPORARY) != 0) + printf("temporary "); + + if (scopeid) + printf("scopeid 0x%x ", scopeid); + + if (ip6lifetime && (lifetime.ia6t_preferred || lifetime.ia6t_expire)) { + printf("pltime "); + if (lifetime.ia6t_preferred) { + printf("%s ", lifetime.ia6t_preferred < t + ? "0" : sec2str(lifetime.ia6t_preferred - t)); + } else + printf("infty "); + + printf("vltime "); + if (lifetime.ia6t_expire) { + printf("%s ", lifetime.ia6t_expire < t + ? "0" : sec2str(lifetime.ia6t_expire - t)); + } else + printf("infty "); + } + + putchar('\n'); +} + +#define SIN6(x) ((struct sockaddr_in6 *) &(x)) +static struct sockaddr_in6 *sin6tab[] = { + SIN6(in6_ridreq.ifr_addr), SIN6(in6_addreq.ifra_addr), + SIN6(in6_addreq.ifra_prefixmask), SIN6(in6_addreq.ifra_dstaddr) +}; + +static void +in6_getprefix(const char *plen, int which) +{ + struct sockaddr_in6 *sin = sin6tab[which]; + u_char *cp; + int len = atoi(plen); + + if ((len < 0) || (len > 128)) + errx(1, "%s: bad value", plen); + sin->sin6_len = sizeof(*sin); + if (which != MASK) + sin->sin6_family = AF_INET6; + if ((len == 0) || (len == 128)) { + memset(&sin->sin6_addr, 0xff, sizeof(struct in6_addr)); + return; + } + memset((void *)&sin->sin6_addr, 0x00, sizeof(sin->sin6_addr)); + for (cp = (u_char *)&sin->sin6_addr; len > 7; len -= 8) + *cp++ = 0xff; + *cp = 0xff << (8 - len); +} + +static void +in6_getaddr(const char *s, int which) +{ + struct sockaddr_in6 *sin = sin6tab[which]; + struct addrinfo hints, *res; + int error = -1; + + newaddr &= 1; + + sin->sin6_len = sizeof(*sin); + if (which != MASK) + sin->sin6_family = AF_INET6; + + if (which == ADDR) { + char *p = NULL; + if((p = strrchr(s, '/')) != NULL) { + *p = '\0'; + in6_getprefix(p + 1, MASK); + explicit_prefix = 1; + } + } + + if (sin->sin6_family == AF_INET6) { + bzero(&hints, sizeof(struct addrinfo)); + hints.ai_family = AF_INET6; + error = getaddrinfo(s, NULL, &hints, &res); + } + if (error != 0) { + if (inet_pton(AF_INET6, s, &sin->sin6_addr) != 1) + errx(1, "%s: bad value", s); + } else + bcopy(res->ai_addr, sin, res->ai_addrlen); +} + +static int +prefix(void *val, int size) +{ + u_char *name = (u_char *)val; + int byte, bit, plen = 0; + + for (byte = 0; byte < size; byte++, plen += 8) + if (name[byte] != 0xff) + break; + if (byte == size) + return (plen); + for (bit = 7; bit != 0; bit--, plen++) + if (!(name[byte] & (1 << bit))) + break; + for (; bit != 0; bit--) + if (name[byte] & (1 << bit)) + return(0); + byte++; + for (; byte < size; byte++) + if (name[byte]) + return(0); + return (plen); +} + +static char * +sec2str(time_t total) +{ + static char result[256]; + int days, hours, mins, secs; + int first = 1; + char *p = result; + + if (0) { + days = total / 3600 / 24; + hours = (total / 3600) % 24; + mins = (total / 60) % 60; + secs = total % 60; + + if (days) { + first = 0; + p += sprintf(p, "%dd", days); + } + if (!first || hours) { + first = 0; + p += sprintf(p, "%dh", hours); + } + if (!first || mins) { + first = 0; + p += sprintf(p, "%dm", mins); + } + sprintf(p, "%ds", secs); + } else + sprintf(result, "%lu", (unsigned long)total); + + return(result); +} + +static void +in6_postproc(int s, const struct afswtch *afp) +{ + if (explicit_prefix == 0) { + /* Aggregatable address architecture defines all prefixes + are 64. So, it is convenient to set prefixlen to 64 if + it is not specified. */ + setifprefixlen("64", 0, s, afp); + /* in6_getprefix("64", MASK) if MASK is available here... */ + } +} + +static void +in6_status_tunnel(int s) +{ + char src[NI_MAXHOST]; + char dst[NI_MAXHOST]; + struct in6_ifreq in6_ifr; + const struct sockaddr *sa = (const struct sockaddr *) &in6_ifr.ifr_addr; + + memset(&in6_ifr, 0, sizeof(in6_ifr)); + strncpy(in6_ifr.ifr_name, name, IFNAMSIZ); + + if (ioctl(s, SIOCGIFPSRCADDR_IN6, (caddr_t)&in6_ifr) < 0) + return; + if (sa->sa_family != AF_INET6) + return; + in6_fillscopeid(&in6_ifr.ifr_addr); + if (getnameinfo(sa, sa->sa_len, src, sizeof(src), 0, 0, + NI_NUMERICHOST) != 0) + src[0] = '\0'; + + if (ioctl(s, SIOCGIFPDSTADDR_IN6, (caddr_t)&in6_ifr) < 0) + return; + if (sa->sa_family != AF_INET6) + return; + in6_fillscopeid(&in6_ifr.ifr_addr); + if (getnameinfo(sa, sa->sa_len, dst, sizeof(dst), 0, 0, + NI_NUMERICHOST) != 0) + dst[0] = '\0'; + + printf("\ttunnel inet6 %s --> %s\n", src, dst); +} + +static void +in6_set_tunnel(int s, struct addrinfo *srcres, struct addrinfo *dstres) +{ + struct in6_aliasreq in6_addreq; + + memset(&in6_addreq, 0, sizeof(in6_addreq)); + strncpy(in6_addreq.ifra_name, name, IFNAMSIZ); + memcpy(&in6_addreq.ifra_addr, srcres->ai_addr, srcres->ai_addr->sa_len); + memcpy(&in6_addreq.ifra_dstaddr, dstres->ai_addr, + dstres->ai_addr->sa_len); + + if (ioctl(s, SIOCSIFPHYADDR_IN6, &in6_addreq) < 0) + warn("SIOCSIFPHYADDR_IN6"); +} + +static struct cmd inet6_cmds[] = { + DEF_CMD_ARG("prefixlen", setifprefixlen), + DEF_CMD("anycast", IN6_IFF_ANYCAST, setip6flags), + DEF_CMD("tentative", IN6_IFF_TENTATIVE, setip6flags), + DEF_CMD("-tentative", -IN6_IFF_TENTATIVE, setip6flags), + DEF_CMD("deprecated", IN6_IFF_DEPRECATED, setip6flags), + DEF_CMD("-deprecated", -IN6_IFF_DEPRECATED, setip6flags), + DEF_CMD("autoconf", IN6_IFF_AUTOCONF, setip6flags), + DEF_CMD("-autoconf", -IN6_IFF_AUTOCONF, setip6flags), + DEF_CMD_ARG("pltime", setip6pltime), + DEF_CMD_ARG("vltime", setip6vltime), + DEF_CMD("eui64", 0, setip6eui64), +}; + +static struct afswtch af_inet6 = { + .af_name = "inet6", + .af_af = AF_INET6, + .af_status = in6_status, + .af_getaddr = in6_getaddr, + .af_getprefix = in6_getprefix, + .af_postproc = in6_postproc, + .af_status_tunnel = in6_status_tunnel, + .af_settunnel = in6_set_tunnel, + .af_difaddr = SIOCDIFADDR_IN6, + .af_aifaddr = SIOCAIFADDR_IN6, + .af_ridreq = &in6_addreq, + .af_addreq = &in6_addreq, +}; + +static void +in6_Lopt_cb(const char *optarg __unused) +{ + ip6lifetime++; /* print IPv6 address lifetime */ +} +static struct option in6_Lopt = { "L", "[-L]", in6_Lopt_cb }; + +static __constructor void +inet6_ctor(void) +{ +#define N(a) (sizeof(a) / sizeof(a[0])) + int i; + + for (i = 0; i < N(inet6_cmds); i++) + cmd_register(&inet6_cmds[i]); + af_register(&af_inet6); + opt_register(&in6_Lopt); +#undef N +} diff --git a/ifconfig.tproj/af_link.c b/ifconfig.tproj/af_link.c new file mode 100644 index 0000000..ea42ff4 --- /dev/null +++ b/ifconfig.tproj/af_link.c @@ -0,0 +1,140 @@ +/* + * Copyright (c) 1983, 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. + * 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. + */ + +#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 +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "ifconfig.h" + +static struct ifreq link_ridreq; + +static void +link_status(int s __unused, const struct ifaddrs *ifa) +{ + /* XXX no const 'cuz LLADDR is defined wrong */ + struct sockaddr_dl *sdl = (struct sockaddr_dl *) ifa->ifa_addr; + + if (sdl != NULL && sdl->sdl_alen > 0) { +#ifdef notyet + if (sdl->sdl_type == IFT_ETHER && + sdl->sdl_alen == ETHER_ADDR_LEN) + printf("\tether %s\n", + ether_ntoa((struct ether_addr *)LLADDR(sdl))); + else { + int n = sdl->sdl_nlen > 0 ? sdl->sdl_nlen + 1 : 0; + + printf("\tlladdr %s\n", link_ntoa(sdl) + n); + } +#else + char *cp = (char *)LLADDR(sdl); + int n = sdl->sdl_alen; + + if (sdl->sdl_type == IFT_ETHER) + printf ("\tether "); + else + printf ("\tlladdr "); + while (--n >= 0) + printf("%02x%c",*cp++ & 0xff, n>0? ':' : ' '); + putchar('\n'); +#endif + } +} + +static void +link_getaddr(const char *addr, int which) +{ + char *temp; + struct sockaddr_dl sdl; + struct sockaddr *sa = &link_ridreq.ifr_addr; + + if (which != ADDR) + errx(1, "can't set link-level netmask or broadcast"); + if ((temp = malloc(strlen(addr) + 2)) == NULL) + errx(1, "malloc failed"); + temp[0] = ':'; + strcpy(temp + 1, addr); + sdl.sdl_len = sizeof(sdl); + link_addr(temp, &sdl); + free(temp); + if (sdl.sdl_alen > sizeof(sa->sa_data)) + errx(1, "malformed link-level address"); + sa->sa_family = AF_LINK; + sa->sa_len = sdl.sdl_alen; + bcopy(LLADDR(&sdl), sa->sa_data, sdl.sdl_alen); +} + +static struct afswtch af_link = { + .af_name = "link", + .af_af = AF_LINK, + .af_status = link_status, + .af_getaddr = link_getaddr, + .af_aifaddr = SIOCSIFLLADDR, + .af_addreq = &link_ridreq, +}; +static struct afswtch af_ether = { + .af_name = "ether", + .af_af = AF_LINK, + .af_status = link_status, + .af_getaddr = link_getaddr, + .af_aifaddr = SIOCSIFLLADDR, + .af_addreq = &link_ridreq, +}; +static struct afswtch af_lladdr = { + .af_name = "lladdr", + .af_af = AF_LINK, + .af_status = link_status, + .af_getaddr = link_getaddr, + .af_aifaddr = SIOCSIFLLADDR, + .af_addreq = &link_ridreq, +}; + +static __constructor void +link_ctor(void) +{ + af_register(&af_link); + af_register(&af_ether); + af_register(&af_lladdr); +} diff --git a/ifconfig.tproj/ifbond.c b/ifconfig.tproj/ifbond.c index 21858a6..b8bcdfe 100644 --- a/ifconfig.tproj/ifbond.c +++ b/ifconfig.tproj/ifbond.c @@ -97,7 +97,7 @@ bond_print_details(struct if_bond_status * ibs_p, int count) } void -bond_status(int s, struct rt_addrinfo * info __unused) +bond_status(int s) { int i; struct if_bond_req ibr; @@ -186,8 +186,8 @@ bond_status(int s, struct rt_addrinfo * info __unused) return; } -void -setbonddev(const char *val, int d, int s, const struct afswtch * afp) +static +DECL_CMD_FUNC(setbonddev, val, d) { struct if_bond_req ibr; @@ -205,8 +205,8 @@ setbonddev(const char *val, int d, int s, const struct afswtch * afp) return; } -void -unsetbonddev(const char *val, int d, int s, const struct afswtch * afp) +static +DECL_CMD_FUNC(unsetbonddev, val, d) { struct if_bond_req ibr; @@ -224,8 +224,8 @@ unsetbonddev(const char *val, int d, int s, const struct afswtch * afp) return; } -void -setbondmode(const char *val, int d, int s, const struct afswtch * afp) +static +DECL_CMD_FUNC(setbondmode, val, d) { struct if_bond_req ibr; int mode; @@ -259,4 +259,26 @@ setbondmode(const char *val, int d, int s, const struct afswtch * afp) return; } +static struct cmd bond_cmds[] = { + DEF_CLONE_CMD_ARG("bonddev", setbonddev), + DEF_CLONE_CMD_ARG("-bonddev", unsetbonddev), + DEF_CMD_ARG("bondmode", setbondmode), +}; +static struct afswtch af_bond = { + .af_name = "af_bond", + .af_af = AF_UNSPEC, + .af_other_status = bond_status, +}; + +static __constructor void +bond_ctor(void) +{ +#define N(a) (sizeof(a) / sizeof(a[0])) + int i; + + for (i = 0; i < N(bond_cmds); i++) + cmd_register(&bond_cmds[i]); + af_register(&af_bond); +#undef N +} diff --git a/ifconfig.tproj/ifbridge.c b/ifconfig.tproj/ifbridge.c new file mode 100644 index 0000000..53c98af --- /dev/null +++ b/ifconfig.tproj/ifbridge.c @@ -0,0 +1,833 @@ +/*- + * Copyright 2001 Wasabi Systems, Inc. + * All rights reserved. + * + * Written by Jason R. Thorpe for Wasabi Systems, Inc. + * + * 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 for the NetBSD Project by + * Wasabi Systems, Inc. + * 4. The name of Wasabi Systems, Inc. may not be used to endorse + * or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC + * 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. + */ + +#ifndef lint +static const char rcsid[] = + "$FreeBSD: src/sbin/ifconfig/ifbridge.c,v 1.11.2.1.2.1 2008/11/25 02:59:29 kensmith Exp $"; +#endif /* not lint */ + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "ifconfig.h" + +#define PV2ID(pv, epri, eaddr) do { \ + epri = pv >> 48; \ + eaddr[0] = pv >> 40; \ + eaddr[1] = pv >> 32; \ + eaddr[2] = pv >> 24; \ + eaddr[3] = pv >> 16; \ + eaddr[4] = pv >> 8; \ + eaddr[5] = pv >> 0; \ +} while (0) + +static const char *stpstates[] = { + "disabled", + "listening", + "learning", + "forwarding", + "blocking", + "discarding" +}; +#ifdef notdef +static const char *stpproto[] = { + "stp", + "-", + "rstp" +}; +static const char *stproles[] = { + "disabled", + "root", + "designated", + "alternate", + "backup" +}; +#endif + +static int +get_val(const char *cp, u_long *valp) +{ + char *endptr; + u_long val; + + errno = 0; + val = strtoul(cp, &endptr, 0); + if (cp[0] == '\0' || endptr[0] != '\0' || errno == ERANGE) + return (-1); + + *valp = val; + return (0); +} + +static int +do_cmd(int sock, u_long op, void *arg, size_t argsize, int set) +{ + struct ifdrv ifd; + + memset(&ifd, 0, sizeof(ifd)); + + strlcpy(ifd.ifd_name, ifr.ifr_name, sizeof(ifd.ifd_name)); + ifd.ifd_cmd = op; + ifd.ifd_len = argsize; + ifd.ifd_data = arg; + + return (ioctl(sock, set ? SIOCSDRVSPEC : SIOCGDRVSPEC, &ifd)); +} + +static void +do_bridgeflag(int sock, const char *ifs, int flag, int set) +{ + struct ifbreq req; + + strlcpy(req.ifbr_ifsname, ifs, sizeof(req.ifbr_ifsname)); + + if (do_cmd(sock, BRDGGIFFLGS, &req, sizeof(req), 0) < 0) + err(1, "unable to get bridge flags"); + + if (set) + req.ifbr_ifsflags |= flag; + else + req.ifbr_ifsflags &= ~flag; + + if (do_cmd(sock, BRDGSIFFLGS, &req, sizeof(req), 1) < 0) + err(1, "unable to set bridge flags"); +} + +static void +bridge_interfaces(int s, const char *prefix) +{ + struct ifbifconf bifc; + struct ifbreq *req; + char *inbuf = NULL, *ninbuf; + char *p, *pad; + int i, len = 8192; + + pad = strdup(prefix); + if (pad == NULL) + err(1, "strdup"); + /* replace the prefix with whitespace */ + for (p = pad; *p != '\0'; p++) { + if(isprint(*p)) + *p = ' '; + } + + for (;;) { + ninbuf = realloc(inbuf, len); + if (ninbuf == NULL) + err(1, "unable to allocate interface buffer"); + bifc.ifbic_len = len; + bifc.ifbic_buf = inbuf = ninbuf; + if (do_cmd(s, BRDGGIFS, &bifc, sizeof(bifc), 0) < 0) + err(1, "unable to get interface list"); + if ((bifc.ifbic_len + sizeof(*req)) < len) + break; + len *= 2; + } + + for (i = 0; i < bifc.ifbic_len / sizeof(*req); i++) { + req = bifc.ifbic_req + i; + printf("%s%s ", prefix, req->ifbr_ifsname); + printb("flags", req->ifbr_ifsflags, IFBIFBITS); + printf("\n"); + + printf("%s", pad); +#ifdef notdef + printf("ifmaxaddr %u", req->ifbr_addrmax); +#endif + printf(" port %u priority %u", req->ifbr_portno, + req->ifbr_priority); + printf(" path cost %u", req->ifbr_path_cost); + + if (req->ifbr_ifsflags & IFBIF_STP) { +#ifdef notdef + if (req->ifbr_proto < + sizeof(stpproto) / sizeof(stpproto[0])) + printf(" proto %s", stpproto[req->ifbr_proto]); + else + printf(" ", + req->ifbr_proto); + + printf("\n%s", pad); + if (req->ifbr_role < + sizeof(stproles) / sizeof(stproles[0])) + printf("role %s", stproles[req->ifbr_role]); + else + printf("", + req->ifbr_role); +#endif + if (req->ifbr_state < + sizeof(stpstates) / sizeof(stpstates[0])) + printf(" state %s", stpstates[req->ifbr_state]); + else + printf(" ", + req->ifbr_state); + } + printf("\n"); + } + + free(inbuf); +} + +static void +bridge_addresses(int s, const char *prefix) +{ + struct ifbaconf ifbac; + struct ifbareq *ifba; + char *inbuf = NULL, *ninbuf; + int i, len = 8192; + struct ether_addr ea; + + for (;;) { + ninbuf = realloc(inbuf, len); + if (ninbuf == NULL) + err(1, "unable to allocate address buffer"); + ifbac.ifbac_len = len; + ifbac.ifbac_buf = inbuf = ninbuf; + if (do_cmd(s, BRDGRTS, &ifbac, sizeof(ifbac), 0) < 0) + err(1, "unable to get address cache"); + if ((ifbac.ifbac_len + sizeof(*ifba)) < len) + break; + len *= 2; + } + + for (i = 0; i < ifbac.ifbac_len / sizeof(*ifba); i++) { + ifba = ifbac.ifbac_req + i; + memcpy(ea.octet, ifba->ifba_dst, + sizeof(ea.octet)); +#ifdef notdef + printf("%s%s Vlan%d %s %lu ", prefix, ether_ntoa(&ea), + ifba->ifba_vlan, ifba->ifba_ifsname, ifba->ifba_expire); +#else + printf("%s%s %s %lu ", prefix, ether_ntoa(&ea), + ifba->ifba_ifsname, ifba->ifba_expire); +#endif + printb("flags", ifba->ifba_flags, IFBAFBITS); + printf("\n"); + } + + free(inbuf); +} + +void +show_config(int sock, const char *prefix) +{ + struct ifbrparam param; + u_int32_t ipfflags; + u_int16_t pri; + u_int8_t ht, fd, ma; + + if (do_cmd(sock, BRDGGPRI, ¶m, sizeof(param), 0) < 0) + err(1, "unable to get bridge priority"); + pri = param.ifbrp_prio; + + if (do_cmd(sock, BRDGGHT, ¶m, sizeof(param), 0) < 0) + err(1, "unable to get hellotime"); + ht = param.ifbrp_hellotime; + + if (do_cmd(sock, BRDGGFD, ¶m, sizeof(param), 0) < 0) + err(1, "unable to get forward delay"); + fd = param.ifbrp_fwddelay; + + if (do_cmd(sock, BRDGGMA, ¶m, sizeof(param), 0) < 0) + err(1, "unable to get max age"); + ma = param.ifbrp_maxage; + + printf("%spriority %u hellotime %u fwddelay %u maxage %u\n", + prefix, pri, ht, fd, ma); + + if (do_cmd(sock, BRDGGFILT, ¶m, sizeof(param), 0) < 0) { + /* err(1, "unable to get ipfilter status"); */ + param.ifbrp_filter = 0; + } + + ipfflags = param.ifbrp_filter; + printf("%sipfilter %s flags 0x%x\n", prefix, + (ipfflags & IFBF_FILT_USEIPF) ? "enabled" : "disabled", + ipfflags); +} + +static void +bridge_status(int s) +{ +#ifdef notdef + struct ifbropreq ifbp; +#endif + struct ifbrparam param; +#ifdef notdef + u_int16_t pri; + u_int8_t ht, fd, ma, hc, pro; + u_int8_t lladdr[ETHER_ADDR_LEN]; + u_int16_t bprio; +#endif + u_int32_t csize, ctime; + + if (do_cmd(s, BRDGGCACHE, ¶m, sizeof(param), 0) < 0) + return; + csize = param.ifbrp_csize; + if (do_cmd(s, BRDGGTO, ¶m, sizeof(param), 0) < 0) + return; + ctime = param.ifbrp_ctime; +#ifdef notdef + if (do_cmd(s, BRDGPARAM, &ifbp, sizeof(ifbp), 0) < 0) + return; + pri = ifbp.ifbop_priority; + pro = ifbp.ifbop_protocol; + ht = ifbp.ifbop_hellotime; + fd = ifbp.ifbop_fwddelay; + hc = ifbp.ifbop_holdcount; + ma = ifbp.ifbop_maxage; + + PV2ID(ifbp.ifbop_bridgeid, bprio, lladdr); + printf("\tid %s priority %u hellotime %u fwddelay %u\n", + ether_ntoa((struct ether_addr *)lladdr), pri, ht, fd); + printf("\tmaxage %u holdcnt %u proto %s maxaddr %u timeout %u\n", + ma, hc, stpproto[pro], csize, ctime); + + PV2ID(ifbp.ifbop_designated_root, bprio, lladdr); + printf("\troot id %s priority %d ifcost %u port %u\n", + ether_ntoa((struct ether_addr *)lladdr), bprio, + ifbp.ifbop_root_path_cost, ifbp.ifbop_root_port & 0xfff); +#else + printf("\tConfiguration:\n"); + show_config(s, "\t\t"); +#endif + + bridge_interfaces(s, "\tmember: "); + + if (!all || verbose) { + printf("\tAddress cache (max cache: %u, timeout: %u):\n", + csize, ctime); + bridge_addresses(s, "\t\t"); + } + return; + +} + +static void +setbridge_add(const char *val, int d, int s, const struct afswtch *afp) +{ + struct ifbreq req; + + memset(&req, 0, sizeof(req)); + strlcpy(req.ifbr_ifsname, val, sizeof(req.ifbr_ifsname)); + if (do_cmd(s, BRDGADD, &req, sizeof(req), 1) < 0) + err(1, "BRDGADD %s", val); +} + +static void +setbridge_delete(const char *val, int d, int s, const struct afswtch *afp) +{ + struct ifbreq req; + + memset(&req, 0, sizeof(req)); + strlcpy(req.ifbr_ifsname, val, sizeof(req.ifbr_ifsname)); + if (do_cmd(s, BRDGDEL, &req, sizeof(req), 1) < 0) + err(1, "BRDGDEL %s", val); +} + +static void +setbridge_discover(const char *val, int d, int s, const struct afswtch *afp) +{ + + do_bridgeflag(s, val, IFBIF_DISCOVER, 1); +} + +static void +unsetbridge_discover(const char *val, int d, int s, const struct afswtch *afp) +{ + + do_bridgeflag(s, val, IFBIF_DISCOVER, 0); +} + +static void +setbridge_learn(const char *val, int d, int s, const struct afswtch *afp) +{ + + do_bridgeflag(s, val, IFBIF_LEARNING, 1); +} + +static void +unsetbridge_learn(const char *val, int d, int s, const struct afswtch *afp) +{ + + do_bridgeflag(s, val, IFBIF_LEARNING, 0); +} + +#ifdef notdef +static void +setbridge_sticky(const char *val, int d, int s, const struct afswtch *afp) +{ + + do_bridgeflag(s, val, IFBIF_STICKY, 1); +} + +static void +unsetbridge_sticky(const char *val, int d, int s, const struct afswtch *afp) +{ + + do_bridgeflag(s, val, IFBIF_STICKY, 0); +} + +static void +setbridge_span(const char *val, int d, int s, const struct afswtch *afp) +{ + struct ifbreq req; + + memset(&req, 0, sizeof(req)); + strlcpy(req.ifbr_ifsname, val, sizeof(req.ifbr_ifsname)); + if (do_cmd(s, BRDGADDS, &req, sizeof(req), 1) < 0) + err(1, "BRDGADDS %s", val); +} + +static void +unsetbridge_span(const char *val, int d, int s, const struct afswtch *afp) +{ + struct ifbreq req; + + memset(&req, 0, sizeof(req)); + strlcpy(req.ifbr_ifsname, val, sizeof(req.ifbr_ifsname)); + if (do_cmd(s, BRDGDELS, &req, sizeof(req), 1) < 0) + err(1, "BRDGDELS %s", val); +} +#endif + +static void +setbridge_stp(const char *val, int d, int s, const struct afswtch *afp) +{ + + do_bridgeflag(s, val, IFBIF_STP, 1); +} + +static void +unsetbridge_stp(const char *val, int d, int s, const struct afswtch *afp) +{ + + do_bridgeflag(s, val, IFBIF_STP, 0); +} + +#ifdef notdef +static void +setbridge_edge(const char *val, int d, int s, const struct afswtch *afp) +{ + do_bridgeflag(s, val, IFBIF_BSTP_EDGE, 1); +} + +static void +unsetbridge_edge(const char *val, int d, int s, const struct afswtch *afp) +{ + do_bridgeflag(s, val, IFBIF_BSTP_EDGE, 0); +} + +static void +setbridge_autoedge(const char *val, int d, int s, const struct afswtch *afp) +{ + do_bridgeflag(s, val, IFBIF_BSTP_AUTOEDGE, 1); +} + +static void +unsetbridge_autoedge(const char *val, int d, int s, const struct afswtch *afp) +{ + do_bridgeflag(s, val, IFBIF_BSTP_AUTOEDGE, 0); +} + +static void +setbridge_ptp(const char *val, int d, int s, const struct afswtch *afp) +{ + do_bridgeflag(s, val, IFBIF_BSTP_PTP, 1); +} + +static void +unsetbridge_ptp(const char *val, int d, int s, const struct afswtch *afp) +{ + do_bridgeflag(s, val, IFBIF_BSTP_PTP, 0); +} + +static void +setbridge_autoptp(const char *val, int d, int s, const struct afswtch *afp) +{ + do_bridgeflag(s, val, IFBIF_BSTP_AUTOPTP, 1); +} + +static void +unsetbridge_autoptp(const char *val, int d, int s, const struct afswtch *afp) +{ + do_bridgeflag(s, val, IFBIF_BSTP_AUTOPTP, 0); +} +#endif + +static void +setbridge_flush(const char *val, int d, int s, const struct afswtch *afp) +{ + struct ifbreq req; + + memset(&req, 0, sizeof(req)); + req.ifbr_ifsflags = IFBF_FLUSHDYN; + if (do_cmd(s, BRDGFLUSH, &req, sizeof(req), 1) < 0) + err(1, "BRDGFLUSH"); +} + +static void +setbridge_flushall(const char *val, int d, int s, const struct afswtch *afp) +{ + struct ifbreq req; + + memset(&req, 0, sizeof(req)); + req.ifbr_ifsflags = IFBF_FLUSHALL; + if (do_cmd(s, BRDGFLUSH, &req, sizeof(req), 1) < 0) + err(1, "BRDGFLUSH"); +} + +static void +setbridge_static(const char *val, const char *mac, int s, + const struct afswtch *afp) +{ + struct ifbareq req; + struct ether_addr *ea; + + memset(&req, 0, sizeof(req)); + strlcpy(req.ifba_ifsname, val, sizeof(req.ifba_ifsname)); + + ea = ether_aton(mac); + if (ea == NULL) + errx(1, "%s: invalid address: %s", val, mac); + + memcpy(req.ifba_dst, ea->octet, sizeof(req.ifba_dst)); + req.ifba_flags = IFBAF_STATIC; +#ifdef notdef + req.ifba_vlan = 1; /* XXX allow user to specify */ +#endif + + if (do_cmd(s, BRDGSADDR, &req, sizeof(req), 1) < 0) + err(1, "BRDGSADDR %s", val); +} + +static void +setbridge_deladdr(const char *val, int d, int s, const struct afswtch *afp) +{ + struct ifbareq req; + struct ether_addr *ea; + + memset(&req, 0, sizeof(req)); + + ea = ether_aton(val); + if (ea == NULL) + errx(1, "invalid address: %s", val); + + memcpy(req.ifba_dst, ea->octet, sizeof(req.ifba_dst)); + + if (do_cmd(s, BRDGDADDR, &req, sizeof(req), 1) < 0) + err(1, "BRDGDADDR %s", val); +} + +static void +setbridge_addr(const char *val, int d, int s, const struct afswtch *afp) +{ + + bridge_addresses(s, ""); +} + +static void +setbridge_maxaddr(const char *arg, int d, int s, const struct afswtch *afp) +{ + struct ifbrparam param; + u_long val; + + if (get_val(arg, &val) < 0 || (val & ~0xffffffff) != 0) + errx(1, "invalid value: %s", arg); + + param.ifbrp_csize = val & 0xffffffff; + + if (do_cmd(s, BRDGSCACHE, ¶m, sizeof(param), 1) < 0) + err(1, "BRDGSCACHE %s", arg); +} + +static void +setbridge_hellotime(const char *arg, int d, int s, const struct afswtch *afp) +{ + struct ifbrparam param; + u_long val; + + if (get_val(arg, &val) < 0 || (val & ~0xff) != 0) + errx(1, "invalid value: %s", arg); + + param.ifbrp_hellotime = val & 0xff; + + if (do_cmd(s, BRDGSHT, ¶m, sizeof(param), 1) < 0) + err(1, "BRDGSHT %s", arg); +} + +static void +setbridge_fwddelay(const char *arg, int d, int s, const struct afswtch *afp) +{ + struct ifbrparam param; + u_long val; + + if (get_val(arg, &val) < 0 || (val & ~0xff) != 0) + errx(1, "invalid value: %s", arg); + + param.ifbrp_fwddelay = val & 0xff; + + if (do_cmd(s, BRDGSFD, ¶m, sizeof(param), 1) < 0) + err(1, "BRDGSFD %s", arg); +} + +static void +setbridge_maxage(const char *arg, int d, int s, const struct afswtch *afp) +{ + struct ifbrparam param; + u_long val; + + if (get_val(arg, &val) < 0 || (val & ~0xff) != 0) + errx(1, "invalid value: %s", arg); + + param.ifbrp_maxage = val & 0xff; + + if (do_cmd(s, BRDGSMA, ¶m, sizeof(param), 1) < 0) + err(1, "BRDGSMA %s", arg); +} + +static void +setbridge_priority(const char *arg, int d, int s, const struct afswtch *afp) +{ + struct ifbrparam param; + u_long val; + + if (get_val(arg, &val) < 0 || (val & ~0xffff) != 0) + errx(1, "invalid value: %s", arg); + + param.ifbrp_prio = val & 0xffff; + + if (do_cmd(s, BRDGSPRI, ¶m, sizeof(param), 1) < 0) + err(1, "BRDGSPRI %s", arg); +} + +#ifdef notdef +static void +setbridge_protocol(const char *arg, int d, int s, const struct afswtch *afp) +{ + struct ifbrparam param; + + if (strcasecmp(arg, "stp") == 0) { + param.ifbrp_proto = 0; + } else if (strcasecmp(arg, "rstp") == 0) { + param.ifbrp_proto = 2; + } else { + errx(1, "unknown stp protocol"); + } + + if (do_cmd(s, BRDGSPROTO, ¶m, sizeof(param), 1) < 0) + err(1, "BRDGSPROTO %s", arg); +} +static void +setbridge_holdcount(const char *arg, int d, int s, const struct afswtch *afp) +{ + struct ifbrparam param; + u_long val; + + if (get_val(arg, &val) < 0 || (val & ~0xff) != 0) + errx(1, "invalid value: %s", arg); + + param.ifbrp_txhc = val & 0xff; + + if (do_cmd(s, BRDGSTXHC, ¶m, sizeof(param), 1) < 0) + err(1, "BRDGSTXHC %s", arg); +} +#endif + +static void +setbridge_ifpriority(const char *ifn, const char *pri, int s, + const struct afswtch *afp) +{ + struct ifbreq req; + u_long val; + + memset(&req, 0, sizeof(req)); + + if (get_val(pri, &val) < 0 || (val & ~0xff) != 0) + errx(1, "invalid value: %s", pri); + + strlcpy(req.ifbr_ifsname, ifn, sizeof(req.ifbr_ifsname)); + req.ifbr_priority = val & 0xff; + + if (do_cmd(s, BRDGSIFPRIO, &req, sizeof(req), 1) < 0) + err(1, "BRDGSIFPRIO %s", pri); +} + +static void +setbridge_ifpathcost(const char *ifn, const char *cost, int s, + const struct afswtch *afp) +{ + struct ifbreq req; + u_long val; + + memset(&req, 0, sizeof(req)); + + if (get_val(cost, &val) < 0) + errx(1, "invalid value: %s", cost); + + strlcpy(req.ifbr_ifsname, ifn, sizeof(req.ifbr_ifsname)); + req.ifbr_path_cost = val; + + if (do_cmd(s, BRDGSIFCOST, &req, sizeof(req), 1) < 0) + err(1, "BRDGSIFCOST %s", cost); +} + +#ifdef notdef +static void +setbridge_ifmaxaddr(const char *ifn, const char *arg, int s, + const struct afswtch *afp) +{ + struct ifbreq req; + u_long val; + + memset(&req, 0, sizeof(req)); + + if (get_val(arg, &val) < 0 || (val & ~0xffffffff) != 0) + errx(1, "invalid value: %s", arg); + + strlcpy(req.ifbr_ifsname, ifn, sizeof(req.ifbr_ifsname)); + req.ifbr_addrmax = val & 0xffffffff; + + if (do_cmd(s, BRDGSIFAMAX, &req, sizeof(req), 1) < 0) + err(1, "BRDGSIFAMAX %s", arg); +} +#endif + +static void +setbridge_timeout(const char *arg, int d, int s, const struct afswtch *afp) +{ + struct ifbrparam param; + u_long val; + + if (get_val(arg, &val) < 0 || (val & ~0xffffffff) != 0) + errx(1, "invalid value: %s", arg); + + param.ifbrp_ctime = val & 0xffffffff; + + if (do_cmd(s, BRDGSTO, ¶m, sizeof(param), 1) < 0) + err(1, "BRDGSTO %s", arg); +} + +#ifdef notdef +static void +setbridge_private(const char *val, int d, int s, const struct afswtch *afp) +{ + + do_bridgeflag(s, val, IFBIF_PRIVATE, 1); +} + +static void +unsetbridge_private(const char *val, int d, int s, const struct afswtch *afp) +{ + + do_bridgeflag(s, val, IFBIF_PRIVATE, 0); +} +#endif + +static struct cmd bridge_cmds[] = { + DEF_CMD_ARG("addm", setbridge_add), + DEF_CMD_ARG("deletem", setbridge_delete), + DEF_CMD_ARG("discover", setbridge_discover), + DEF_CMD_ARG("-discover", unsetbridge_discover), + DEF_CMD_ARG("learn", setbridge_learn), + DEF_CMD_ARG("-learn", unsetbridge_learn), + //DEF_CMD_ARG("sticky", setbridge_sticky), + //DEF_CMD_ARG("-sticky", unsetbridge_sticky), + //DEF_CMD_ARG("span", setbridge_span), + //DEF_CMD_ARG("-span", unsetbridge_span), + DEF_CMD_ARG("stp", setbridge_stp), + DEF_CMD_ARG("-stp", unsetbridge_stp), + //DEF_CMD_ARG("edge", setbridge_edge), + //DEF_CMD_ARG("-edge", unsetbridge_edge), + //DEF_CMD_ARG("autoedge", setbridge_autoedge), + //DEF_CMD_ARG("-autoedge", unsetbridge_autoedge), + //DEF_CMD_ARG("ptp", setbridge_ptp), + //DEF_CMD_ARG("-ptp", unsetbridge_ptp), + //DEF_CMD_ARG("autoptp", setbridge_autoptp), + //DEF_CMD_ARG("-autoptp", unsetbridge_autoptp), + DEF_CMD("flush", 0, setbridge_flush), + DEF_CMD("flushall", 0, setbridge_flushall), + DEF_CMD_ARG2("static", setbridge_static), + DEF_CMD_ARG("deladdr", setbridge_deladdr), + DEF_CMD("addr", 1, setbridge_addr), + DEF_CMD_ARG("maxaddr", setbridge_maxaddr), + DEF_CMD_ARG("hellotime", setbridge_hellotime), + DEF_CMD_ARG("fwddelay", setbridge_fwddelay), + DEF_CMD_ARG("maxage", setbridge_maxage), + DEF_CMD_ARG("priority", setbridge_priority), + //DEF_CMD_ARG("proto", setbridge_protocol), + //DEF_CMD_ARG("holdcnt", setbridge_holdcount), + DEF_CMD_ARG2("ifpriority", setbridge_ifpriority), + DEF_CMD_ARG2("ifpathcost", setbridge_ifpathcost), + //DEF_CMD_ARG2("ifmaxaddr", setbridge_ifmaxaddr), + DEF_CMD_ARG("timeout", setbridge_timeout), + //DEF_CMD_ARG("private", setbridge_private), + //DEF_CMD_ARG("-private", unsetbridge_private), +}; +static struct afswtch af_bridge = { + .af_name = "af_bridge", + .af_af = AF_UNSPEC, + .af_other_status = bridge_status, +}; + +static __constructor void +bridge_ctor(void) +{ +#define N(a) (sizeof(a) / sizeof(a[0])) + int i; + + for (i = 0; i < N(bridge_cmds); i++) + cmd_register(&bridge_cmds[i]); + af_register(&af_bridge); +#undef N +} diff --git a/ifconfig.tproj/ifclone.c b/ifconfig.tproj/ifclone.c new file mode 100644 index 0000000..3a782ef --- /dev/null +++ b/ifconfig.tproj/ifclone.c @@ -0,0 +1,177 @@ +/* + * Copyright (c) 1983, 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. + * 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. + */ + +#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 +#include + +#include +#include +#include +#include +#include + +#include "ifconfig.h" + +static void +list_cloners(void) +{ +#ifdef notdef + struct if_clonereq ifcr; + char *cp, *buf; + int idx; + int s; + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s == -1) + err(1, "socket(AF_INET,SOCK_DGRAM)"); + + memset(&ifcr, 0, sizeof(ifcr)); + + if (ioctl(s, SIOCIFGCLONERS, &ifcr) < 0) + err(1, "SIOCIFGCLONERS for count"); + + buf = malloc(ifcr.ifcr_total * IFNAMSIZ); + if (buf == NULL) + err(1, "unable to allocate cloner name buffer"); + + ifcr.ifcr_count = ifcr.ifcr_total; + ifcr.ifcr_buffer = buf; + + if (ioctl(s, SIOCIFGCLONERS, &ifcr) < 0) + err(1, "SIOCIFGCLONERS for names"); + + /* + * In case some disappeared in the mean time, clamp it down. + */ + if (ifcr.ifcr_count > ifcr.ifcr_total) + ifcr.ifcr_count = ifcr.ifcr_total; + + for (cp = buf, idx = 0; idx < ifcr.ifcr_count; idx++, cp += IFNAMSIZ) { + if (idx > 0) + putchar(' '); + printf("%s", cp); + } + + putchar('\n'); + free(buf); +#endif +} + +static clone_callback_func *clone_cb = NULL; + +void +clone_setcallback(clone_callback_func *p) +{ + if (clone_cb != NULL && clone_cb != p) + errx(1, "conflicting device create parameters"); + clone_cb = p; +} + +/* + * Do the actual clone operation. Any parameters must have been + * setup by now. If a callback has been setup to do the work + * then defer to it; otherwise do a simple create operation with + * no parameters. + */ +static void +ifclonecreate(int s, void *arg) +{ + struct ifreq ifr; + + memset(&ifr, 0, sizeof(ifr)); + (void) strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); + if (clone_cb == NULL) { +#ifdef SIOCIFCREATE2 + /* NB: no parameters */ + if (ioctl(s, SIOCIFCREATE2, &ifr) < 0) + err(1, "SIOCIFCREATE2"); +#else + if (ioctl(s, SIOCIFCREATE, &ifr) < 0) + err(1, "SIOCIFCREATE"); +#endif + } else { + clone_cb(s, &ifr); + } + + /* + * If we get a different name back than we put in, print it. + */ + if (strncmp(name, ifr.ifr_name, sizeof(name)) != 0) { + strlcpy(name, ifr.ifr_name, sizeof(name)); + printf("%s\n", name); + } +} + +static +DECL_CMD_FUNC(clone_create, arg, d) +{ + callback_register(ifclonecreate, NULL); +} + +static +DECL_CMD_FUNC(clone_destroy, arg, d) +{ + (void) strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); + if (ioctl(s, SIOCIFDESTROY, &ifr) < 0) + err(1, "SIOCIFDESTROY"); +} + +static struct cmd clone_cmds[] = { + DEF_CLONE_CMD("create", 0, clone_create), + DEF_CMD("destroy", 0, clone_destroy), + DEF_CLONE_CMD("plumb", 0, clone_create), + DEF_CMD("unplumb", 0, clone_destroy), +}; + +static void +clone_Copt_cb(const char *optarg __unused) +{ + list_cloners(); + exit(0); +} +static struct option clone_Copt = { "C", "[-C]", clone_Copt_cb }; + +static __constructor void +clone_ctor(void) +{ +#define N(a) (sizeof(a) / sizeof(a[0])) + int i; + + for (i = 0; i < N(clone_cmds); i++) + cmd_register(&clone_cmds[i]); + opt_register(&clone_Copt); +#undef N +} diff --git a/ifconfig.tproj/ifconfig.8 b/ifconfig.tproj/ifconfig.8 index 63a5292..cba935e 100644 --- a/ifconfig.tproj/ifconfig.8 +++ b/ifconfig.tproj/ifconfig.8 @@ -9,10 +9,6 @@ .\" 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 acknowledgment: -.\" 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. @@ -30,9 +26,9 @@ .\" SUCH DAMAGE. .\" .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 -.\" $FreeBSD: src/sbin/ifconfig/ifconfig.8,v 1.27.2.14 2001/08/23 06:35:38 yar Exp $ +.\" $FreeBSD: src/sbin/ifconfig/ifconfig.8,v 1.142.2.6.2.1 2008/11/25 02:59:29 kensmith Exp $ .\" -.Dd July 15, 2004 +.Dd June 20, 2008 .Dt IFCONFIG 8 .Os .Sh NAME @@ -46,7 +42,7 @@ .Op Cm create .Op Ar address_family .Oo -.Ar address Ns Op Cm / Ns Ar prefixlength +.Ar address .Op Ar dest_address .Oc .Op Ar parameters @@ -59,6 +55,7 @@ .Op Fl d .Op Fl m .Op Fl u +.Op Fl v .Op Ar address_family .Nm .Fl l @@ -67,10 +64,11 @@ .Op Ar address_family .Nm .Op Fl L -.Op Fl b .Op Fl d .Op Fl m .Op Fl u +.Op Fl v +.Op Fl C .Nm .Ar interface .Cm vlan @@ -94,15 +92,11 @@ .Cm bondmode .Ar lacp | static .Sh DESCRIPTION -.Nm Ifconfig -is used to assign an address +The +.Nm +utility is used to assign an address to a network interface and/or configure network interface parameters. -.Nm Ifconfig -must be used at boot time to define the network address -of each interface present on a machine; it may also be used at -a later time to redefine an interface's address -or other operating parameters. .Pp The following options are available: .Bl -tag -width indent @@ -122,6 +116,15 @@ It is also possible to use the CIDR notation (also known as the slash notation) to include the netmask. That is, one can specify an address like .Li 192.168.0.1/16 . +.Pp +For +.Dq inet6 +family, it is also possible to specify the prefix length using the slash +notation, like +.Li ::1/128 . +See the +.Cm prefixlen +parameter below for more information. .\" For the Xerox Network Systems(tm) family, .\" addresses are .\" .Ar net:a.b.c.d.e.f , @@ -144,6 +147,18 @@ That is, one can specify an address like .\" However, two consecutive dots imply a zero .\" byte, and the dots are optional, if the user wishes to (carefully) .\" count out long strings of digits in network byte order. +.Pp +The link-level +.Pq Dq link +address +is specified as a series of colon-separated hex digits. +This can be used to +e.g.\& set a new MAC address on an ethernet interface, though the +mechanism used is not ethernet-specific. +If the interface is already +up when this option is used, it will be briefly brought down and +then brought back up again in order to ensure that the receive +filter in the underlying ethernet hardware is properly reprogrammed. .It Ar address_family Specify the address family @@ -154,8 +169,20 @@ The address or protocol families currently supported are .Dq inet , .Dq inet6 , +.\".Dq atalk , +.\".Dq ipx , +.\" .Dq iso , +and +.Dq link . .\" and .\" .Dq ns . +The default is +.Dq inet . +.Dq ether +and +.Dq lladdr +are synonyms for +.Dq link . .It Ar dest_address Specify the address of the correspondent on the other end of a point to point link. @@ -165,11 +192,7 @@ parameter is a string of the form .Dq name unit , for example, .Dq Li en0 . -.It Ar iface -This parameter has the same encoding as the -.Ar interface -parameter. -.El +\.El .Pp The following parameters may be set with .Nm : @@ -186,9 +209,10 @@ Establish an additional network address for this interface. This is sometimes useful when changing network numbers, and one wishes to accept packets addressed to the old interface. If the address is on the same subnet as the first network address -for this interface, a netmask of +for this interface, a non-conflicting netmask must be given. +Usually .Li 0xffffffff -has to be specified. +is most appropriate. .It Fl alias Remove the network address specified. This would be used if you incorrectly specified an alias, or it @@ -217,81 +241,6 @@ addresses and .It Fl arp Disable the use of the Address Resolution Protocol .Pq Xr arp 4 . -.It Cm bonddev Ar iface -If the interface is a bond pseudo device, associate physical interface -.Ar iface -with it. By default, the bond pseudo device is in LACP -(Link Aggregation Control Protocol) mode (see \fBbondmode\fR below). In -this mode, the device conforms to the IEEE 802.3ad Link Aggregation -specification. -.Pp -If this is the first physical interface to be associated with the bond -interface, the bond interface inherits the ethernet address from the -physical interface. Physical interfaces that are added to the bond have -their ethernet address re-programmed so that all members of the bond have -the same ethernet address. If the physical interface is subsequently -removed from the bond using -.Fl bonddev , -a new ethernet address is chosen from the remaining interfaces, and all -interfaces are re-programmed again with the new ethernet address. If no -remaining interfaces exist, the bond interface's ethernet address is cleared. -.Pp -If the specified physical interface -.Ar iface -is not capable of having its ethernet address re-programmed, the -.Cm bonddev -command will fail. -.Pp -Once the physical interface -.Ar iface -is successfully associated with the bond interface, all received packets -are diverted to the bond interface. The physical interface is no longer -useable on its own, and remains that way until it is removed from the bond using -.Fl bonddev . -.Pp -It is possible that the specified interface -.Ar iface -is not capable of aggregating, and may remain unused until the operating -conditions change. -.Pp -The link status of the bond interface depends on the state of link aggregation. -If no active partner is detected, the link status will remain inactive. -.Pp -To monitor the 802.3ad Link Aggregation state, use the -.Fl b -option. -.Pp -A physical interface that is associated with a vlan pseudo device cannot -at the same time be associated with a bond pseudo device. A physical interface -cannot be associated with more than one bond pseudo device at the same time. -.Pp -It is not possible to associate a bond with pseudo interfaces such as vlan. -Only physical ethernet interfaces may be associated with a bond. -.It Fl bonddev Ar iface -If the interface is a bond pseudo device, disassociate the physical interface -.Ar iface -from it. Before the interface is removed from the bond, the bond device -announces to the link partner that the interface is now individual and -no longer aggregatable. -If the physical -.Ar iface -is the last interface in the bond, the bond interface clears its link address. -.It bondmode Ar lacp | static -If the interface is a bond pseudo device, this option will set the \fImode\fR -on the bond interface. The two currently supported modes are -.Ar lacp -and -.Ar static . -The default mode is -.Ar lacp . -.Pp -To enable static mode (and turn off LACP), specify -.Ar static . -In static mode, a member interface is made an active part of the -link aggregate as long as the link status is active. -.Pp -To re-enable LACP mode, specify -.Ar lacp . .It Cm broadcast (Inet only.) Specify the address to use to represent broadcasts to the @@ -371,27 +320,15 @@ list of available options. .It Fl mediaopt Ar opts If the driver supports the media selection system, disable the specified media options on the interface. -.It Cm tunnel Ar src_addr dest_addr -(IP tunnel devices only.) -Configure the physical source and destination address for IP tunnel -interfaces -.Pq Xr gif 4 . -The arguments -.Ar src_addr -and -.Ar dest_addr -are interpreted as the outer source/destination for the encapsulating -IPv4/IPv6 header. -.It Cm deletetunnel -Unconfigure the physical source and destination address for IP tunnel -interfaces previously configured with -.Cm tunnel . .It Cm create Create the specified network pseudo-device. If the interface is given without a unit number, try to create a new device with an arbitrary unit number. If creation of an arbitrary device is successful, the new device name is -printed to standard output. +printed to standard output unless the interface is renamed or destroyed +in the same +.Nm +invocation. .It Cm destroy Destroy the specified network pseudo-device. .It Cm plumb @@ -415,7 +352,7 @@ default 0. The routing metric is used by the routing protocol .Pq Xr routed 8 . Higher metrics have the effect of making a route -less favorable; metrics are counted as addition hops +less favorable; metrics are counted as additional hops to the destination network or host. .It Cm mtu Ar n Set the maximum transmission unit of the interface to @@ -459,6 +396,11 @@ The must be integer, and for syntactical reason it must be between 0 to 128. It is almost always 64 under the current IPv6 assignment rule. If the parameter is omitted, 64 is used. +.Pp +The prefix can also be specified using the slash notation after the address. +See the +.Ar address +option above for more information. .\" see .\" Xr eon 5 . .\" .It Cm nsellength Ar n @@ -516,73 +458,400 @@ This may be used to enable an interface after an It happens automatically when setting the first address on an interface. If the interface was reset when previously marked down, the hardware will be re-initialized. -.It Cm vlan Ar vlan_tag Cm vlandev Ar iface -If the interface is a vlan pseudo interface, set its vlan tag value -to -.Ar vlan_tag -and associate it with the physical interface -.Ar iface . +.El .Pp -The -.Ar vlan_tag -value is a 16-bit number that is used to create an 802.1Q -vlan header for packets sent from the vlan interface. +The following parameters are specific to link aggregate interfaces: +.Bl -tag -width indent +.It Cm bonddev Ar iface +If the interface is a bond pseudo device, associate physical interface +.Ar iface +with it. By default, the bond pseudo device is in LACP +(Link Aggregation Control Protocol) mode (see \fBbondmode\fR below). In +this mode, the device conforms to the IEEE 802.3ad Link Aggregation +specification. +.Pp +If this is the first physical interface to be associated with the bond +interface, the bond interface inherits the ethernet address from the +physical interface. Physical interfaces that are added to the bond have +their ethernet address re-programmed so that all members of the bond have +the same ethernet address. If the physical interface is subsequently +removed from the bond using +.Fl bonddev , +a new ethernet address is chosen from the remaining interfaces, and all +interfaces are re-programmed again with the new ethernet address. If no +remaining interfaces exist, the bond interface's ethernet address is cleared. .Pp -A packet that is transmitted through the vlan interface is sent -using the specified physical interface +If the specified physical interface .Ar iface -with 802.1Q vlan encapsulation with the specified -.Ar vlan_tag . -A packet with 802.1Q encapsulation received by the physical interface -is directed to the associated vlan interface with the matching -.Ar vlan_tag . -If there is no matching vlan interface, the packet is dropped. +is not capable of having its ethernet address re-programmed, the +.Cm bonddev +command will fail. +.Pp +Once the physical interface +.Ar iface +is successfully associated with the bond interface, all received packets +are diverted to the bond interface. The physical interface is no longer +useable on its own, and remains that way until it is removed from the bond using +.Fl bonddev . +.Pp +It is possible that the specified interface +.Ar iface +is not capable of aggregating, and may remain unused until the operating +conditions change. +.Pp +The link status of the bond interface depends on the state of link aggregation. +If no active partner is detected, the link status will remain inactive. .Pp -The vlan interface is assigned a +To monitor the 802.3ad Link Aggregation state, use the +.Fl b +option. +.Pp +A physical interface that is associated with a vlan pseudo device cannot +at the same time be associated with a bond pseudo device. A physical interface +cannot be associated with more than one bond pseudo device at the same time. +.Pp +It is not possible to associate a bond with pseudo interfaces such as vlan. +Only physical ethernet interfaces may be associated with a bond. +.It Fl bonddev Ar iface +If the interface is a bond pseudo device, disassociate the physical interface +.Ar iface +from it. Before the interface is removed from the bond, the bond device +announces to the link partner that the interface is now individual and +no longer aggregatable. +If the physical +.Ar iface +is the last interface in the bond, the bond interface clears its link address. +.It Cm bondmode Ar lacp | static +If the interface is a bond pseudo device, this option will set the \fImode\fR +on the bond interface. The two currently supported modes are +.Ar lacp +and +.Ar static . +The default mode is +.Ar lacp . +.Pp +To enable static mode (and turn off LACP), specify +.Ar static . +In static mode, a member interface is made an active part of the +link aggregate as long as the link status is active. +.Pp +To re-enable LACP mode, specify +.Ar lacp . +.El +.Pp +The following parameters are specific to IP tunnel interfaces, +.Xr gif 4 : +.Bl -tag -width indent +.It Cm tunnel Ar src_addr dest_addr +Configure the physical source and destination address for IP tunnel +interfaces. +The arguments +.Ar src_addr +and +.Ar dest_addr +are interpreted as the outer source/destination for the encapsulating +IPv4/IPv6 header. +.It Fl tunnel +Unconfigure the physical source and destination address for IP tunnel +interfaces previously configured with +.Cm tunnel . +.It Cm deletetunnel +Another name for the +.Fl tunnel +parameter. +.El +.Pp +The following parameters are specific to bridge interfaces: +.Bl -tag -width indent +.It Cm addm Ar interface +Add the interface named by +.Ar interface +as a member of the bridge. +The interface is put into promiscuous mode +so that it can receive every packet sent on the network. +.It Cm deletem Ar interface +Remove the interface named by +.Ar interface +from the bridge. +Promiscuous mode is disabled on the interface when +it is removed from the bridge. +.It Cm maxaddr Ar size +Set the size of the bridge address cache to +.Ar size . +The default is 100 entries. +.It Cm timeout Ar seconds +Set the timeout of address cache entries to +.Ar seconds +seconds. +If +.Ar seconds +is zero, then address cache entries will not be expired. +The default is 240 seconds. +.It Cm addr +Display the addresses that have been learned by the bridge. +.It Cm static Ar interface-name Ar address +Add a static entry into the address cache pointing to +.Ar interface-name . +Static entries are never aged out of the cache or re-placed, even if the +address is seen on a different interface. +.It Cm deladdr Ar address +Delete +.Ar address +from the address cache. +.It Cm flush +Delete all dynamically-learned addresses from the address cache. +.It Cm flushall +Delete all addresses, including static addresses, from the address cache. +.It Cm discover Ar interface +Mark an interface as a +.Dq discovering +interface. +When the bridge has no address cache entry +(either dynamic or static) +for the destination address of a packet, +the bridge will forward the packet to all +member interfaces marked as +.Dq discovering . +This is the default for all interfaces added to a bridge. +.It Cm -discover Ar interface +Clear the +.Dq discovering +attribute on a member interface. +For packets without the +.Dq discovering +attribute, the only packets forwarded on the interface are broadcast +or multicast packets and packets for which the destination address +is known to be on the interface's segment. +.It Cm learn Ar interface +Mark an interface as a +.Dq learning +interface. +When a packet arrives on such an interface, the source +address of the packet is entered into the address cache as being a +destination address on the interface's segment. +This is the default for all interfaces added to a bridge. +.It Cm -learn Ar interface +Clear the +.Dq learning +attribute on a member interface. +.It Cm sticky Ar interface +Mark an interface as a +.Dq sticky +interface. +Dynamically learned address entries are treated at static once entered into +the cache. +Sticky entries are never aged out of the cache or replaced, even if the +address is seen on a different interface. +.It Cm -sticky Ar interface +Clear the +.Dq sticky +attribute on a member interface. +.It Cm private Ar interface +Mark an interface as a +.Dq private +interface. +A private interface does not forward any traffic to any other port that is also +a private interface. +.It Cm -private Ar interface +Clear the +.Dq private +attribute on a member interface. +.It Cm span Ar interface +Add the interface named by +.Ar interface +as a span port on the bridge. +Span ports transmit a copy of every frame received by the bridge. +This is most useful for snooping a bridged network passively on +another host connected to one of the span ports of the bridge. +.It Cm -span Ar interface +Delete the interface named by +.Ar interface +from the list of span ports of the bridge. +.It Cm stp Ar interface +Enable Spanning Tree protocol on +.Ar interface . +The +.Xr if_bridge 4 +driver has support for the IEEE 802.1D Spanning Tree protocol (STP). +Spanning Tree is used to detect and remove loops in a network topology. +.It Cm -stp Ar interface +Disable Spanning Tree protocol on +.Ar interface . +This is the default for all interfaces added to a bridge. +.It Cm edge Ar interface +Set +.Ar interface +as an edge port. +An edge port connects directly to end stations cannot create bridging +loops in the network, this allows it to transition straight to forwarding. +.It Cm -edge Ar interface +Disable edge status on +.Ar interface . +.It Cm autoedge Ar interface +Allow +.Ar interface +to automatically detect edge status. +This is the default for all interfaces added to a bridge. +.It Cm -autoedge Ar interface +Disable automatic edge status on +.Ar interface . +.It Cm ptp Ar interface +Set the +.Ar interface +as a point to point link. +This is required for straight transitions to forwarding and +should be enabled on a direct link to another RSTP capable switch. +.It Cm -ptp Ar interface +Disable point to point link status on +.Ar interface . +This should be disabled for a half duplex link and for an interface +connected to a shared network segment, +like a hub or a wireless network. +.It Cm autoptp Ar interface +Automatically detect the point to point status on +.Ar interface +by checking the full duplex link status. +This is the default for interfaces added to the bridge. +.It Cm -autoptp Ar interface +Disable automatic point to point link detection on +.Ar interface . +.It Cm maxage Ar seconds +Set the time that a Spanning Tree protocol configuration is valid. +The default is 20 seconds. +The minimum is 6 seconds and the maximum is 40 seconds. +.It Cm fwddelay Ar seconds +Set the time that must pass before an interface begins forwarding +packets when Spanning Tree is enabled. +The default is 15 seconds. +The minimum is 4 seconds and the maximum is 30 seconds. +.It Cm hellotime Ar seconds +Set the time between broadcasting of Spanning Tree protocol +configuration messages. +The hello time may only be changed when operating in legacy stp mode. +The default is 2 seconds. +The minimum is 1 second and the maximum is 2 seconds. +.It Cm priority Ar value +Set the bridge priority for Spanning Tree. +The default is 32768. +The minimum is 0 and the maximum is 61440. +.It Cm proto Ar value +Set the Spanning Tree protocol. +The default is rstp. +The available options are stp and rstp. +.It Cm holdcnt Ar value +Set the transmit hold count for Spanning Tree. +This is the number of packets transmitted before being rate limited. +The default is 6. +The minimum is 1 and the maximum is 10. +.It Cm ifpriority Ar interface Ar value +Set the Spanning Tree priority of +.Ar interface +to +.Ar value . +The default is 128. +The minimum is 0 and the maximum is 240. +.It Cm ifpathcost Ar interface Ar value +Set the Spanning Tree path cost of +.Ar interface +to +.Ar value . +The default is calculated from the link speed. +To change a previously selected path cost back to automatic, set the +cost to 0. +The minimum is 1 and the maximum is 200000000. +.It Cm ifmaxaddr Ar interface Ar size +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. +.El +.Pp +The following parameters are specific to vlan interfaces: +.Bl -tag -width indent +.It Cm vlan Ar vlan_tag +Set the VLAN tag value to +.Ar vlan_tag . +This value is a 16-bit number which is used to create an 802.1Q +VLAN header for packets sent from the +.Xr vlan 4 +interface. +Note that +.Cm vlan +and +.Cm vlandev +must both be set at the same time. +.It Cm vlandev Ar iface +Associate the physical interface +.Ar iface +with a +.Xr vlan 4 +interface. +Packets transmitted through the +.Xr vlan 4 +interface will be +diverted to the specified physical interface +.Ar iface +with 802.1Q VLAN encapsulation. +Packets with 802.1Q encapsulation received +by the parent interface with the correct VLAN tag will be diverted to +the associated +.Xr vlan 4 +pseudo-interface. +The +.Xr vlan 4 +interface is assigned a copy of the parent interface's flags and the parent's ethernet address. -If the vlan interface already has +The +.Cm vlandev +and +.Cm vlan +must both be set at the same time. +If the +.Xr vlan 4 +interface already has a physical interface associated with it, this command will fail. To change the association to another physical interface, the existing -association must be cleared first using -.Fl vlandev . -.Pp -If the physical interface supports 802.1Q VLAN tagging in hardware, -the vlan pseudo interface does not itself insert or remove the 802.1Q -encapsulation header. Instead, the -.Ar vlan_tag -is passed out of band from the packet data. -.Pp -A physical interface that is associated with a bond pseudo device cannot -at the same time be associated with a vlan interface. However, a physical -interface can be associated with multiple vlan interfaces at the same time, -as long as each of the -.Ar vlan_tag -values are unique. -.It Fl vlandev Ar iface -If the driver is a vlan pseudo device, disassociate the physical interface +association must be cleared first. +.Pp +Note: if the hardware tagging capability +is set on the parent interface, the +.Xr vlan 4 +pseudo +interface's behavior changes: +the +.Xr vlan 4 +interface recognizes that the +parent interface supports insertion and extraction of VLAN tags on its +own (usually in firmware) and that it should pass packets to and from +the parent unaltered. +.It Fl vlandev Op Ar iface +If the driver is a +.Xr vlan 4 +pseudo device, disassociate the parent interface from it. +This breaks the link between the +.Xr vlan 4 +interface and its parent, +clears its VLAN tag, flags and its link address and shuts the interface down. +The .Ar iface -from it. -This breaks the link between the vlan interface and its parent, -clears its vlan tag, flags and its link address. +argument is useless and hence deprecated. .El .Pp -.Nm Ifconfig -displays the current configuration for a network interface +The +.Nm +utility displays the current configuration for a network interface when no optional parameters are supplied. If a protocol family is specified, .Nm will report only the details specific to that protocol family. .Pp -If the driver supports the media selection system, the supported -media list will be included in the output, regardless of whether the +If the .Fl m -flag is passed or not. -.Pp -The -.Fl b -option passed before the interface name will print the link aggregation -state for bond pseudo devices. +flag is passed before an interface name, +.Nm +will display the capability list and all +of the supported media for the specified interface. .Pp If .Fl L @@ -616,41 +885,104 @@ and .Fl u (only list interfaces that are up). .Pp +The +.Fl v +flag may be used to get more verbose status for an interface. +.Pp +The +.Fl C +flag may be used to list all of the interface cloners available on +the system, with no additional information. +Use of this flag is mutually exclusive with all other flags and commands. +.Pp +For bridge interfaces, the list of addresses learned by the bridge is not shown when displaying information about +all interfaces except when the +.Fl v +flag is used. +.Pp Only the super-user may modify the configuration of a network interface. .Sh NOTES The media selection system is relatively new and only some drivers support it (or have need for it). +.Sh EXAMPLES +Assign the IPv4 address +.Li 192.0.2.10 , +with a network mask of +.Li 255.255.255.0 , +to the interface +.Li en0 : +.Dl # ifconfig en0 inet 192.0.2.10 netmask 255.255.255.0 .Pp -.Nm ifconfig -does not change the network settings permanently, it should be used only in a test and debug context. -The permanent network settings can be modified using the Network Preferences pane. -In addition on Mac OS X Server the permanent network settings can be changed with the -.Xr networksetup 8 -command. -Otherwise public APIs in the SystemConfiguration framework are currently the only supported -way to access and control the state of network settings. +Add the IPv4 address +.Li 192.0.2.45 , +with the CIDR network prefix +.Li /28 , +to the interface +.Li en0 , +using +.Cm add +as a synonym for the canonical form of the option +.Cm alias : +.Dl # ifconfig en0 inet 192.0.2.45/28 add +.Pp +Remove the IPv4 address +.Li 192.0.2.45 +from the interface +.Li en0 : +.Dl # ifconfig en0 inet 192.0.2.45 -alias +.Pp +Add the IPv6 address +.Li 2001:DB8:DBDB::123/48 +to the interface +.Li en0 : +.Dl # ifconfig en0 inet6 2001:db8:bdbd::123 prefixlen 48 alias +Note that lower case hexadecimal IPv6 addresses are acceptable. +.Pp +Remove the IPv6 address added in the above example, +using the +.Li / +character as shorthand for the network prefix, +and using +.Cm delete +as a synonym for the canonical form of the option +.Fl alias : +.Dl # ifconfig en0 inet6 2001:db8:bdbd::123/48 delete +.Pp +Configure the interface +.Li en1 , +to use 100baseTX, full duplex Ethernet media options: +.Dl # ifconfig en1 media 100baseTX mediaopt full-duplex +.Pp +Create the software network interface +.Li gif1 : +.Dl # ifconfig gif1 create +.Pp +Destroy the software network interface +.Li gif1 : +.Dl # ifconfig gif1 destroy .Sh DIAGNOSTICS Messages indicating the specified interface does not exist, the requested address is unknown, or the user is not privileged and tried to alter an interface's configuration. -.Sh BUGS -IPv6 link-local addresses are required for several basic communication -between IPv6 node. -If they are deleted by -.Nm -manually, the kernel might show very strange behavior. -So, such manual deletions are strongly discouraged. .Sh SEE ALSO .Xr netstat 1 , .Xr netintro 4 , -.\" .Xr eon 5 , -.Xr rc 8 , -.Xr routed 8 -.Pp -.Xr networksetup 8 -on Mac OS X Server +.Xr sysctl 8 .Sh HISTORY The .Nm -command appeared in +utility appeared in .Bx 4.2 . +.Sh BUGS +Basic IPv6 node operation requires a link-local address on each +interface configured for IPv6. +Normally, such an address is automatically configured by the +kernel on each interface added to the system; this behaviour may +be disabled by setting the sysctl MIB variable +.Va net.inet6.ip6.auto_linklocal +to 0. +.Pp +If you delete such an address using +.Nm , +the kernel may act very odd. +Do this at your own risk. diff --git a/ifconfig.tproj/ifconfig.c b/ifconfig.tproj/ifconfig.c index cac0326..a0d823c 100644 --- a/ifconfig.tproj/ifconfig.c +++ b/ifconfig.tproj/ifconfig.c @@ -10,10 +10,6 @@ * 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. @@ -42,17 +38,18 @@ static const char copyright[] = static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94"; #endif static const char rcsid[] = - "$Id: ifconfig.c,v 1.8 2004/08/26 23:55:21 lindak Exp $"; + "$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 -#define KERNEL_PRIVATE #include -#undef KERNEL_PRIVATE #include #include #include +#ifndef __APPLE__ +#include +#include +#endif #include #include @@ -67,11 +64,7 @@ static const char rcsid[] = #include #include -#ifdef INET6 -#include /* Define ND6_INFINITE_LIFETIME */ -#endif - - +#include #include #include #include @@ -81,350 +74,138 @@ static const char rcsid[] = #include #include - #include "ifconfig.h" -/* wrapper for KAME-special getnameinfo() */ -#ifndef NI_WITHSCOPEID -#define NI_WITHSCOPEID 0 -#endif - -struct ifreq ifr, ridreq; -struct ifaliasreq addreq; -#ifdef INET6 -struct in6_ifreq in6_ridreq; -struct in6_aliasreq in6_addreq = - { { 0 }, - { 0 }, - { 0 }, - { 0 }, - 0, - { 0, 0, ND6_INFINITE_LIFETIME, ND6_INFINITE_LIFETIME } }; -#endif -struct sockaddr_in netmask; - +/* + * Since "struct ifreq" is composed of various union members, callers + * should pay special attention to interprete the value. + * (.e.g. little/big endian difference in the structure.) + */ +struct ifreq ifr; -char name[32]; -int flags; -int metric; -int mtu; +char name[IFNAMSIZ]; int setaddr; -int setipdst; int setmask; int doalias; int clearaddr; int newaddr = 1; -#ifdef INET6 -static int ip6lifetime; -#endif - -struct afswtch; +int verbose; +int noload; +int all; int bond_details = 0; -int supmedia = 0; -int listcloners = 0; - -#ifdef INET6 -char addr_buf[MAXHOSTNAMELEN *2 + 1]; /*for getnameinfo()*/ -#endif - -void Perror __P((const char *cmd)); - -int ifconfig __P((int argc, char *const *argv, const struct afswtch *afp)); -void notealias __P((const char *, int, int, const struct afswtch *afp)); -void printb __P((const char *s, unsigned value, const char *bits)); -void rt_xaddrs __P((caddr_t, caddr_t, struct rt_addrinfo *)); -void status __P((const struct afswtch *afp, int addrcount, - struct sockaddr_dl *sdl, struct if_msghdr *ifm, - struct ifa_msghdr *ifam)); -void tunnel_status __P((int s)); -void usage __P((void)); - -#ifdef INET6 -void in6_fillscopeid __P((struct sockaddr_in6 *sin6)); -int prefix __P((void *, int)); -static char *sec2str __P((time_t)); -int explicit_prefix = 0; -#endif - -typedef void c_func __P((const char *cmd, int arg, int s, const struct afswtch *afp)); -typedef void c_func2 __P((const char *arg, const char *arg2, int s, const struct afswtch *afp)); -c_func setifaddr, setifbroadaddr, setifdstaddr, setifnetmask; -c_func2 settunnel; -c_func deletetunnel; -#ifdef INET6 -c_func setifprefixlen; -c_func setip6flags; -c_func setip6pltime; -c_func setip6vltime; -c_func2 setip6lifetime; -#endif -c_func setifipdst; -c_func setifflags, setifmetric, setifmtu, setiflladdr; -c_func clone_destroy; - - -void clone_create(void); -#define NEXTARG 0xffffff -#define NEXTARG2 0xfffffe - -const -struct cmd { - const char *c_name; - int c_parameter; /* NEXTARG means next argv */ - void (*c_func) __P((const char *, int, int, const struct afswtch *afp)); - void (*c_func2) __P((const char *, const char *, int, const struct afswtch *afp)); -} cmds[] = { - { "up", IFF_UP, setifflags } , - { "down", -IFF_UP, setifflags }, - { "arp", -IFF_NOARP, setifflags }, - { "-arp", IFF_NOARP, setifflags }, - { "debug", IFF_DEBUG, setifflags }, - { "-debug", -IFF_DEBUG, setifflags }, - { "add", IFF_UP, notealias }, - { "alias", IFF_UP, notealias }, - { "-alias", -IFF_UP, notealias }, - { "delete", -IFF_UP, notealias }, - { "remove", -IFF_UP, notealias }, -#ifdef notdef -#define EN_SWABIPS 0x1000 - { "swabips", EN_SWABIPS, setifflags }, - { "-swabips", -EN_SWABIPS, setifflags }, -#endif - { "netmask", NEXTARG, setifnetmask }, -#ifdef INET6 - { "prefixlen", NEXTARG, setifprefixlen }, - { "anycast", IN6_IFF_ANYCAST, setip6flags }, - { "tentative", IN6_IFF_TENTATIVE, setip6flags }, - { "-tentative", -IN6_IFF_TENTATIVE, setip6flags }, - { "deprecated", IN6_IFF_DEPRECATED, setip6flags }, - { "-deprecated", -IN6_IFF_DEPRECATED, setip6flags }, - { "autoconf", IN6_IFF_AUTOCONF, setip6flags }, - { "-autoconf", -IN6_IFF_AUTOCONF, setip6flags }, - { "pltime", NEXTARG, setip6pltime }, - { "vltime", NEXTARG, setip6vltime }, -#endif - { "metric", NEXTARG, setifmetric }, - { "broadcast", NEXTARG, setifbroadaddr }, - { "ipdst", NEXTARG, setifipdst }, - { "tunnel", NEXTARG2, NULL, settunnel }, - { "deletetunnel", 0, deletetunnel }, - { "link0", IFF_LINK0, setifflags }, - { "-link0", -IFF_LINK0, setifflags }, - { "link1", IFF_LINK1, setifflags }, - { "-link1", -IFF_LINK1, setifflags }, - { "link2", IFF_LINK2, setifflags }, - { "-link2", -IFF_LINK2, setifflags }, -#if USE_IF_MEDIA - { "media", NEXTARG, setmedia }, - { "mediaopt", NEXTARG, setmediaopt }, - { "-mediaopt", NEXTARG, unsetmediaopt }, -#endif -#ifdef USE_VLANS - { "vlan", NEXTARG, setvlantag }, - { "vlandev", NEXTARG, setvlandev }, - { "-vlandev", NEXTARG, unsetvlandev }, -#endif -#ifdef USE_BONDS - { "bonddev", NEXTARG, setbonddev }, - { "-bonddev", NEXTARG, unsetbonddev }, - { "bondmode", NEXTARG, setbondmode }, -#endif -#if 0 - /* XXX `create' special-cased below */ - {"create", 0, clone_create }, - {"plumb", 0, clone_create }, -#endif - {"destroy", 0, clone_destroy }, - {"unplumb", 0, clone_destroy }, -#ifdef USE_IEEE80211 - { "ssid", NEXTARG, set80211ssid }, - { "nwid", NEXTARG, set80211ssid }, - { "stationname", NEXTARG, set80211stationname }, - { "station", NEXTARG, set80211stationname }, /* BSD/OS */ - { "channel", NEXTARG, set80211channel }, - { "authmode", NEXTARG, set80211authmode }, - { "powersavemode", NEXTARG, set80211powersavemode }, - { "powersave", 1, set80211powersave }, - { "-powersave", 0, set80211powersave }, - { "powersavesleep", NEXTARG, set80211powersavesleep }, - { "wepmode", NEXTARG, set80211wepmode }, - { "wep", 1, set80211wep }, - { "-wep", 0, set80211wep }, - { "weptxkey", NEXTARG, set80211weptxkey }, - { "wepkey", NEXTARG, set80211wepkey }, - { "nwkey", NEXTARG, set80211nwkey }, /* NetBSD */ - { "-nwkey", 0, set80211wep }, /* NetBSD */ -#endif - { "normal", -IFF_LINK0, setifflags }, - { "compress", IFF_LINK0, setifflags }, - { "noicmp", IFF_LINK1, setifflags }, - { "mtu", NEXTARG, setifmtu }, - { "lladdr", NEXTARG, setiflladdr }, - { 0, 0, setifaddr }, - { 0, 0, setifdstaddr }, -}; +int supmedia = 0; +int printkeys = 0; /* Print keying material for interfaces. */ -/* - * XNS support liberally adapted from code written at the University of - * Maryland principally by James O'Toole and Chris Torek. - */ -typedef void af_status __P((int, struct rt_addrinfo *)); -typedef void af_getaddr __P((const char *, int)); -typedef void af_getprefix __P((const char *, int)); - -af_status in_status, at_status, ether_status; -af_getaddr in_getaddr, at_getaddr, ether_getaddr; - - -#ifdef INET6 -af_status in6_status; -af_getaddr in6_getaddr; -af_getprefix in6_getprefix; -#endif /*INET6*/ - -/* Known address families */ -const -struct afswtch { - const char *af_name; - short af_af; - af_status *af_status; - af_getaddr *af_getaddr; - af_getprefix *af_getprefix; - uint32_t af_difaddr; - uint32_t af_aifaddr; - caddr_t af_ridreq; - caddr_t af_addreq; -} afs[] = { -#define C(x) ((caddr_t) &x) - { "inet", AF_INET, in_status, in_getaddr, NULL, - SIOCDIFADDR, SIOCAIFADDR, C(ridreq), C(addreq) }, -#ifdef INET6 - { "inet6", AF_INET6, in6_status, in6_getaddr, in6_getprefix, - SIOCDIFADDR_IN6, SIOCAIFADDR_IN6, - C(in6_ridreq), C(in6_addreq) }, -#endif /*INET6*/ - { "ether", AF_LINK, ether_status, ether_getaddr, NULL, - 0, SIOCSIFLLADDR, NULL, C(ridreq) }, -#if 0 /* XXX conflicts with the media command */ -#ifdef USE_IF_MEDIA - { "media", AF_UNSPEC, media_status, NULL, NULL, }, /* XXX not real!! */ -#endif -#ifdef USE_VLANS - { "vlan", AF_UNSPEC, vlan_status, NULL, NULL, }, /* XXX not real!! */ -#endif -#ifdef USE_BONDS - { "bond", AF_UNSPEC, bond_status, NULL, NULL, }, /* XXX not real!! */ -#endif -#ifdef USE_IEEE80211 - { "ieee80211", AF_UNSPEC, ieee80211_status, NULL, NULL, }, /* XXX not real!! */ -#endif -#endif - { 0, 0, 0, 0 } -}; +static int ifconfig(int argc, char *const *argv, int iscreate, + const struct afswtch *afp); +static void status(const struct afswtch *afp, const struct sockaddr_dl *sdl, + struct ifaddrs *ifa); +static void tunnel_status(int s); +static void usage(void); -/* - * Expand the compacted form of addresses as returned via the - * configuration read via sysctl(). - */ +static struct afswtch *af_getbyname(const char *name); +static struct afswtch *af_getbyfamily(int af); +static void af_other_status(int); -#define ROUNDUP(a) \ - ((a) > 0 ? (1 + (((a) - 1) | (sizeof(uint32_t) - 1))) : sizeof(uint32_t)) -#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len)) +static struct option *opts = NULL; void -rt_xaddrs(cp, cplim, rtinfo) - caddr_t cp, cplim; - struct rt_addrinfo *rtinfo; +opt_register(struct option *p) { - struct sockaddr *sa; - int i; - - memset(rtinfo->rti_info, 0, sizeof(rtinfo->rti_info)); - for (i = 0; (i < RTAX_MAX) && (cp < cplim); i++) { - if ((rtinfo->rti_addrs & (1 << i)) == 0) - continue; - rtinfo->rti_info[i] = sa = (struct sockaddr *)cp; - ADVANCE(cp, sa); - } + p->next = opts; + opts = p; } - -void -usage() +static void +usage(void) { -#ifndef INET6 - fprintf(stderr, "%s", - "usage: ifconfig interface address_family [address [dest_address]]\n" - " [parameters]\n" - " ifconfig interface create\n" - " ifconfig -a [-d] [-m] [-u] [address_family]\n" - " ifconfig -l [-d] [-u] [address_family]\n" - " ifconfig [-d] [-m] [-u]\n"); -#else - fprintf(stderr, "%s", - "usage: ifconfig [-L] interface address_family [address [dest_address]]\n" + char options[1024]; + struct option *p; + + /* XXX not right but close enough for now */ + options[0] = '\0'; + for (p = opts; p != NULL; p = p->next) { + strlcat(options, p->opt_usage, sizeof(options)); + strlcat(options, " ", sizeof(options)); + } + + fprintf(stderr, + "usage: ifconfig %sinterface address_family [address [dest_address]]\n" " [parameters]\n" " ifconfig interface create\n" - " ifconfig -a [-L] [-d] [-m] [-u] [address_family]\n" + " ifconfig -a %s[-d] [-m] [-u] [-v] [address_family]\n" " ifconfig -l [-d] [-u] [address_family]\n" - " ifconfig [-L] [-d] [-m] [-u]\n"); -#endif + " ifconfig %s[-d] [-m] [-u] [-v]\n", + options, options, options); exit(1); } int -main(argc, argv) - int argc; - char *const *argv; +main(int argc, char *argv[]) { - int c; - int all, namesonly, downonly, uponly; - int foundit = 0, need_nl = 0; - const struct afswtch *afp = 0; - int addrcount; - struct if_msghdr *ifm, *nextifm; - struct ifa_msghdr *ifam; - struct sockaddr_dl *sdl; - char *buf, *lim, *next; - - - size_t needed; - int mib[6]; + int c, namesonly, downonly, uponly; + const struct afswtch *afp = NULL; + int ifindex; + struct ifaddrs *ifap, *ifa; + struct ifreq paifr; + const struct sockaddr_dl *sdl; + char options[1024], *cp; + const char *ifname; + struct option *p; + size_t iflen; + + all = downonly = uponly = namesonly = noload = verbose = 0; /* Parse leading line options */ - all = downonly = uponly = namesonly = 0; - while ((c = getopt(argc, argv, "abdlmu" -#ifdef INET6 - "L" +#ifndef __APPLE__ + strlcpy(options, "adklmnuv", sizeof(options)); +#else + strlcpy(options, "adlmuv", sizeof(options)); #endif - )) != -1) { + for (p = opts; p != NULL; p = p->next) + strlcat(options, p->opt, sizeof(options)); + while ((c = getopt(argc, argv, options)) != -1) { switch (c) { case 'a': /* scan all interfaces */ all++; break; case 'b': /* bond detailed output */ bond_details++; - break; + break; case 'd': /* restrict scan to "down" interfaces */ downonly++; break; - case 'l': /* scan interface names only */ +#ifndef __APPLE__ + case 'k': + printkeys++; + break; +#endif + case 'l': /* scan interface names only */ namesonly++; break; case 'm': /* show media choices in status */ supmedia = 1; break; - case 'u': /* restrict scan to "up" interfaces */ +#ifndef __APPLE__ + case 'n': /* suppress module loading */ + noload++; + break; +#endif + case 'u': /* restrict scan to "up" interfaces */ uponly++; break; -#ifdef INET6 - case 'L': - ip6lifetime++; /* print IPv6 address lifetime */ + case 'v': + verbose++; break; -#endif default: - usage(); + for (p = opts; p != NULL; p = p->next) + if (p->opt[0] == c) { + p->cb(optarg); + break; + } + if (p == NULL) + usage(); break; } } @@ -448,14 +229,14 @@ main(argc, argv) if (argc > 1) usage(); + ifname = NULL; + ifindex = 0; if (argc == 1) { - for (afp = afs; afp->af_name; afp++) - if (strcmp(afp->af_name, *argv) == 0) { - argc--, argv++; - break; - } - if (afp->af_name == NULL) + afp = af_getbyname(*argv); + if (afp == NULL) usage(); + if (afp->af_name != NULL) + argc--, argv++; /* leave with afp non-zero */ } } else { @@ -463,189 +244,304 @@ main(argc, argv) if (argc < 1) usage(); - strncpy(name, *argv, sizeof(name)); + ifname = *argv; argc--, argv++; - /* - * NOTE: We must special-case the `create' command right - * here as we would otherwise fail when trying to find - * the interface. - */ - if (argc > 0 && (strcmp(argv[0], "create") == 0 || - strcmp(argv[0], "plumb") == 0)) { - clone_create(); - argc--, argv++; - if (argc == 0) +#ifdef notdef + /* check and maybe load support for this interface */ + ifmaybeload(ifname); +#endif + ifindex = if_nametoindex(ifname); + if (ifindex == 0) { + /* + * NOTE: We must special-case the `create' command + * right here as we would otherwise fail when trying + * to find the interface. + */ + if (argc > 0 && (strcmp(argv[0], "create") == 0 || + strcmp(argv[0], "plumb") == 0)) { + iflen = strlcpy(name, ifname, sizeof(name)); + if (iflen >= sizeof(name)) + errx(1, "%s: cloning name too long", + ifname); + ifconfig(argc, argv, 1, NULL); exit(0); + } + errx(1, "interface %s does not exist", ifname); } } /* Check for address family */ if (argc > 0) { - for (afp = afs; afp->af_name; afp++) - if (strcmp(afp->af_name, *argv) == 0) { - argc--, argv++; - break; - } - if (afp->af_name == NULL) - afp = NULL; /* not a family, NULL */ + afp = af_getbyname(*argv); + if (afp != NULL) + argc--, argv++; } - mib[0] = CTL_NET; - mib[1] = PF_ROUTE; - mib[2] = 0; - mib[3] = 0; /* address family */ - mib[4] = NET_RT_IFLIST; - mib[5] = 0; - - /* if particular family specified, only ask about it */ - if (afp) - mib[3] = afp->af_af; - - if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) - errx(1, "iflist-sysctl-estimate"); - if ((buf = malloc(needed)) == NULL) - errx(1, "malloc"); - if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) - errx(1, "actual retrieval of interface table"); - lim = buf + needed; - - next = buf; - while (next < lim) { - - ifm = (struct if_msghdr *)next; - - if (ifm->ifm_type == RTM_IFINFO) { - sdl = (struct sockaddr_dl *)(ifm + 1); - flags = ifm->ifm_flags; - } else { - fprintf(stderr, "out of sync parsing NET_RT_IFLIST\n"); - fprintf(stderr, "expected %d, got %d\n", RTM_IFINFO, - ifm->ifm_type); - fprintf(stderr, "msglen = %d\n", ifm->ifm_msglen); - fprintf(stderr, "buf:%p, next:%p, lim:%p\n", buf, next, - lim); - exit (1); + if (getifaddrs(&ifap) != 0) + err(EXIT_FAILURE, "getifaddrs"); + cp = NULL; + ifindex = 0; + for (ifa = ifap; ifa; ifa = ifa->ifa_next) { + memset(&paifr, 0, sizeof(paifr)); + strncpy(paifr.ifr_name, ifa->ifa_name, sizeof(paifr.ifr_name)); + if (sizeof(paifr.ifr_addr) >= ifa->ifa_addr->sa_len) { + memcpy(&paifr.ifr_addr, ifa->ifa_addr, + ifa->ifa_addr->sa_len); } - next += ifm->ifm_msglen; - ifam = NULL; - addrcount = 0; - while (next < lim) { - - nextifm = (struct if_msghdr *)next; - - if (nextifm->ifm_type != RTM_NEWADDR) - break; - - if (ifam == NULL) - ifam = (struct ifa_msghdr *)nextifm; - - addrcount++; - next += nextifm->ifm_msglen; + if (ifname != NULL && strcmp(ifname, ifa->ifa_name) != 0) + continue; + if (ifa->ifa_addr->sa_family == AF_LINK) + sdl = (const struct sockaddr_dl *) ifa->ifa_addr; + else + sdl = NULL; + if (cp != NULL && strcmp(cp, ifa->ifa_name) == 0) + continue; + iflen = strlcpy(name, ifa->ifa_name, sizeof(name)); + if (iflen >= sizeof(name)) { + warnx("%s: interface name too long, skipping", + ifa->ifa_name); + continue; } + cp = ifa->ifa_name; - if (all || namesonly) { - if (uponly) - if ((flags & IFF_UP) == 0) - continue; /* not up */ - if (downonly) - if (flags & IFF_UP) - continue; /* not down */ - strncpy(name, sdl->sdl_data, sdl->sdl_nlen); - name[sdl->sdl_nlen] = '\0'; - if (namesonly) { - if (afp == NULL || - afp->af_status != ether_status || - sdl->sdl_type == IFT_ETHER) { - if (need_nl) - putchar(' '); - fputs(name, stdout); - need_nl++; - } - continue; - } - } else { - if (strlen(name) != sdl->sdl_nlen) - continue; /* not same len */ - if (strncmp(name, sdl->sdl_data, sdl->sdl_nlen) != 0) - continue; /* not same name */ + if (downonly && (ifa->ifa_flags & IFF_UP) != 0) + continue; + if (uponly && (ifa->ifa_flags & IFF_UP) == 0) + continue; + ifindex++; + /* + * Are we just listing the interfaces? + */ + if (namesonly) { + if (ifindex > 1) + printf(" "); + fputs(name, stdout); + continue; } if (argc > 0) - ifconfig(argc, argv, afp); + ifconfig(argc, argv, 0, afp); else - status(afp, addrcount, sdl, ifm, ifam); + status(afp, sdl, ifa); + } + if (namesonly) + printf("\n"); + freeifaddrs(ifap); - if (all == 0 && namesonly == 0) { - foundit++; /* flag it as 'done' */ - break; - } + exit(0); +} + +static struct afswtch *afs = NULL; + +void +af_register(struct afswtch *p) +{ + p->af_next = afs; + afs = p; +} + +static struct afswtch * +af_getbyname(const char *name) +{ + struct afswtch *afp; + + for (afp = afs; afp != NULL; afp = afp->af_next) + if (strcmp(afp->af_name, name) == 0) + return afp; + return NULL; +} + +static struct afswtch * +af_getbyfamily(int af) +{ + struct afswtch *afp; + + for (afp = afs; afp != NULL; afp = afp->af_next) + if (afp->af_af == af) + return afp; + return NULL; +} + +static void +af_other_status(int s) +{ + struct afswtch *afp; + uint8_t afmask[howmany(AF_MAX, NBBY)]; + + memset(afmask, 0, sizeof(afmask)); + for (afp = afs; afp != NULL; afp = afp->af_next) { + if (afp->af_other_status == NULL) + continue; + if (afp->af_af != AF_UNSPEC && isset(afmask, afp->af_af)) + continue; + afp->af_other_status(s); + setbit(afmask, afp->af_af); } - free(buf); +} - if (namesonly && need_nl > 0) - putchar('\n'); +static void +af_all_tunnel_status(int s) +{ + struct afswtch *afp; + uint8_t afmask[howmany(AF_MAX, NBBY)]; - if (all == 0 && namesonly == 0 && foundit == 0) - errx(1, "interface %s does not exist", name); + memset(afmask, 0, sizeof(afmask)); + for (afp = afs; afp != NULL; afp = afp->af_next) { + if (afp->af_status_tunnel == NULL) + continue; + if (afp->af_af != AF_UNSPEC && isset(afmask, afp->af_af)) + continue; + afp->af_status_tunnel(s); + setbit(afmask, afp->af_af); + } +} +static struct cmd *cmds = NULL; - exit (0); +void +cmd_register(struct cmd *p) +{ + p->c_next = cmds; + cmds = p; +} + +static const struct cmd * +cmd_lookup(const char *name) +{ +#define N(a) (sizeof(a)/sizeof(a[0])) + const struct cmd *p; + + for (p = cmds; p != NULL; p = p->c_next) + if (strcmp(name, p->c_name) == 0) + return p; + return NULL; +#undef N } +struct callback { + callback_func *cb_func; + void *cb_arg; + struct callback *cb_next; +}; +static struct callback *callbacks = NULL; -int -ifconfig(argc, argv, afp) - int argc; - char *const *argv; - const struct afswtch *afp; +void +callback_register(callback_func *func, void *arg) +{ + struct callback *cb; + + cb = malloc(sizeof(struct callback)); + if (cb == NULL) + errx(1, "unable to allocate memory for callback"); + cb->cb_func = func; + cb->cb_arg = arg; + cb->cb_next = callbacks; + callbacks = cb; +} + +/* specially-handled commands */ +static void setifaddr(const char *, int, int, const struct afswtch *); +static const struct cmd setifaddr_cmd = DEF_CMD("ifaddr", 0, setifaddr); + +static void setifdstaddr(const char *, int, int, const struct afswtch *); +static const struct cmd setifdstaddr_cmd = + DEF_CMD("ifdstaddr", 0, setifdstaddr); + +static int +ifconfig(int argc, char *const *argv, int iscreate, const struct afswtch *afp) { + const struct afswtch *nafp; + struct callback *cb; int s; - if (afp == NULL) - afp = &afs[0]; - ifr.ifr_addr.sa_family = afp->af_af == AF_LINK ? AF_INET : afp->af_af; strncpy(ifr.ifr_name, name, sizeof ifr.ifr_name); +top: + if (afp == NULL) + afp = af_getbyname("inet"); + ifr.ifr_addr.sa_family = + afp->af_af == AF_LINK || afp->af_af == AF_UNSPEC ? + AF_INET : afp->af_af; if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0) - err(1, "socket"); + err(1, "socket(family %u,SOCK_DGRAM", ifr.ifr_addr.sa_family); while (argc > 0) { - register const struct cmd *p; - - for (p = cmds; p->c_name; p++) - if (strcmp(*argv, p->c_name) == 0) - break; - if (p->c_name == 0 && setaddr) - p++; /* got src, do dst */ - if (p->c_func || p->c_func2) { + const struct cmd *p; + + p = cmd_lookup(*argv); + if (p == NULL) { + /* + * Not a recognized command, choose between setting + * the interface address and the dst address. + */ + p = (setaddr ? &setifdstaddr_cmd : &setifaddr_cmd); + } + if (p->c_u.c_func || p->c_u.c_func2) { + if (iscreate && !p->c_iscloneop) { + /* + * Push the clone create callback so the new + * device is created and can be used for any + * remaining arguments. + */ + cb = callbacks; + if (cb == NULL) + errx(1, "internal error, no callback"); + callbacks = cb->cb_next; + cb->cb_func(s, cb->cb_arg); + iscreate = 0; + /* + * Handle any address family spec that + * immediately follows and potentially + * recreate the socket. + */ + nafp = af_getbyname(*argv); + if (nafp != NULL) { + argc--, argv++; + if (nafp != afp) { + close(s); + afp = nafp; + goto top; + } + } + } if (p->c_parameter == NEXTARG) { if (argv[1] == NULL) errx(1, "'%s' requires argument", p->c_name); - (*p->c_func)(argv[1], 0, s, afp); + p->c_u.c_func(argv[1], 0, s, afp); argc--, argv++; + } else if (p->c_parameter == OPTARG) { + p->c_u.c_func(argv[1], 0, s, afp); + if (argv[1] != NULL) + argc--, argv++; } else if (p->c_parameter == NEXTARG2) { if (argc < 3) errx(1, "'%s' requires 2 arguments", p->c_name); - (*p->c_func2)(argv[1], argv[2], s, afp); + p->c_u.c_func2(argv[1], argv[2], s, afp); argc -= 2, argv += 2; } else - (*p->c_func)(*argv, p->c_parameter, s, afp); + p->c_u.c_func(*argv, p->c_parameter, s, afp); } argc--, argv++; } -#ifdef INET6 - if (ifr.ifr_addr.sa_family == AF_INET6 && explicit_prefix == 0) { - /* Aggregatable address architecture defines all prefixes - are 64. So, it is convenient to set prefixlen to 64 if - it is not specified. */ - setifprefixlen("64", 0, s, afp); - /* in6_getprefix("64", MASK) if MASK is available here... */ - } -#endif + + /* + * Do any post argument processing required by the address family. + */ + if (afp->af_postproc != NULL) + afp->af_postproc(s, afp); + /* + * Do deferred callbacks registered while processing + * command-line arguments. + */ + for (cb = callbacks; cb != NULL; cb = cb->cb_next) + cb->cb_func(s, cb->cb_arg); + /* + * Do deferred operations. + */ if (clearaddr) { if (afp->af_ridreq == NULL || afp->af_difaddr == 0) { warnx("interface %s cannot change %s addresses!", @@ -656,7 +552,8 @@ ifconfig(argc, argv, afp) if (clearaddr) { int ret; strncpy(afp->af_ridreq, name, sizeof ifr.ifr_name); - if ((ret = ioctl(s, afp->af_difaddr, afp->af_ridreq)) < 0) { + ret = ioctl(s, afp->af_difaddr, afp->af_ridreq); + if (ret < 0) { if (errno == EADDRNOTAVAIL && (doalias >= 0)) { /* means no previous address for interface */ } else @@ -675,23 +572,16 @@ ifconfig(argc, argv, afp) if (ioctl(s, afp->af_aifaddr, afp->af_addreq) < 0) Perror("ioctl (SIOCAIFADDR)"); } + close(s); return(0); } -#define RIDADDR 0 -#define ADDR 1 -#define NMASK 2 -#define DSTADDR 3 /*ARGSUSED*/ -void -setifaddr(addr, param, s, afp) - const char *addr; - int param; - int s; - const struct afswtch *afp; +static void +setifaddr(const char *addr, int param, int s, const struct afswtch *afp) { - if (*afp->af_getaddr == NULL) + if (afp->af_getaddr == NULL) return; /* * Delay the ioctl to set the interface addr until flags are all set. @@ -701,24 +591,20 @@ setifaddr(addr, param, s, afp) setaddr++; if (doalias == 0 && afp->af_af != AF_LINK) clearaddr = 1; - (*afp->af_getaddr)(addr, (doalias >= 0 ? ADDR : RIDADDR)); + afp->af_getaddr(addr, (doalias >= 0 ? ADDR : RIDADDR)); } -void -settunnel(src, dst, s, afp) - const char *src, *dst; - int s; - const struct afswtch *afp; +static void +settunnel(const char *src, const char *dst, int s, const struct afswtch *afp) { - struct addrinfo hints, *srcres, *dstres; - struct ifaliasreq addreq; + struct addrinfo *srcres, *dstres; int ecode; -#ifdef INET6 - struct in6_aliasreq in6_addreq; -#endif - memset(&hints, 0, sizeof(hints)); - hints.ai_family = afp->af_af; + if (afp->af_settunnel == NULL) { + warn("address family %s does not support tunnel setup", + afp->af_name); + return; + } if ((ecode = getaddrinfo(src, NULL, NULL, &srcres)) != 0) errx(1, "error in parsing address string: %s", @@ -732,197 +618,78 @@ settunnel(src, dst, s, afp) errx(1, "source and destination address families do not match"); - switch (srcres->ai_addr->sa_family) { - case AF_INET: - memset(&addreq, 0, sizeof(addreq)); - strncpy(addreq.ifra_name, name, IFNAMSIZ); - memcpy(&addreq.ifra_addr, srcres->ai_addr, - srcres->ai_addr->sa_len); - memcpy(&addreq.ifra_dstaddr, dstres->ai_addr, - dstres->ai_addr->sa_len); - - if (ioctl(s, SIOCSIFPHYADDR, &addreq) < 0) - warn("SIOCSIFPHYADDR"); - break; - -#ifdef INET6 - case AF_INET6: - memset(&in6_addreq, 0, sizeof(in6_addreq)); - strncpy(in6_addreq.ifra_name, name, IFNAMSIZ); - memcpy(&in6_addreq.ifra_addr, srcres->ai_addr, - srcres->ai_addr->sa_len); - memcpy(&in6_addreq.ifra_dstaddr, dstres->ai_addr, - dstres->ai_addr->sa_len); - - if (ioctl(s, SIOCSIFPHYADDR_IN6, &in6_addreq) < 0) - warn("SIOCSIFPHYADDR_IN6"); - break; -#endif /* INET6 */ - - default: - warn("address family not supported"); - } + afp->af_settunnel(s, srcres, dstres); freeaddrinfo(srcres); freeaddrinfo(dstres); } /* ARGSUSED */ -void -deletetunnel(vname, param, s, afp) - const char *vname; - int param; - int s; - const struct afswtch *afp; +static void +deletetunnel(const char *vname, int param, int s, const struct afswtch *afp) { if (ioctl(s, SIOCDIFPHYADDR, &ifr) < 0) err(1, "SIOCDIFPHYADDR"); } -void -setifnetmask(addr, dummy, s, afp) - const char *addr; - int dummy ; - int s; - const struct afswtch *afp; +static void +setifnetmask(const char *addr, int dummy __unused, int s, + const struct afswtch *afp) { - if (*afp->af_getaddr == NULL) - return; - setmask++; - (*afp->af_getaddr)(addr, NMASK); -} - -#ifdef INET6 -void -setifprefixlen(addr, dummy, s, afp) - const char *addr; - int dummy ; - int s; - const struct afswtch *afp; -{ - if (*afp->af_getprefix) - (*afp->af_getprefix)(addr, NMASK); - explicit_prefix = 1; -} - -void -setip6flags(dummyaddr, flag, dummysoc, afp) - const char *dummyaddr ; - int flag; - int dummysoc ; - const struct afswtch *afp; -{ - if (afp->af_af != AF_INET6) - err(1, "address flags can be set only for inet6 addresses"); - - if (flag < 0) - in6_addreq.ifra_flags &= ~(-flag); - else - in6_addreq.ifra_flags |= flag; -} - -void -setip6pltime(seconds, dummy, s, afp) - const char *seconds; - int dummy ; - int s; - const struct afswtch *afp; -{ - setip6lifetime("pltime", seconds, s, afp); -} - -void -setip6vltime(seconds, dummy, s, afp) - const char *seconds; - int dummy ; - int s; - const struct afswtch *afp; -{ - setip6lifetime("vltime", seconds, s, afp); -} - -void -setip6lifetime(cmd, val, s, afp) - const char *cmd; - const char *val; - int s; - const struct afswtch *afp; -{ - time_t newval, t; - char *ep; - - t = time(NULL); - newval = (time_t)strtoul(val, &ep, 0); - if (val == ep) - errx(1, "invalid %s", cmd); - if (afp->af_af != AF_INET6) - errx(1, "%s not allowed for the AF", cmd); - if (strcmp(cmd, "vltime") == 0) { - in6_addreq.ifra_lifetime.ia6t_expire = t + newval; - in6_addreq.ifra_lifetime.ia6t_vltime = newval; - } else if (strcmp(cmd, "pltime") == 0) { - in6_addreq.ifra_lifetime.ia6t_preferred = t + newval; - in6_addreq.ifra_lifetime.ia6t_pltime = newval; + if (afp->af_getaddr != NULL) { + setmask++; + afp->af_getaddr(addr, MASK); } } -#endif -void -setifbroadaddr(addr, dummy, s, afp) - const char *addr; - int dummy ; - int s; - const struct afswtch *afp; +static void +setifbroadaddr(const char *addr, int dummy __unused, int s, + const struct afswtch *afp) { - if (afp->af_getaddr) - (*afp->af_getaddr)(addr, DSTADDR); + if (afp->af_getaddr != NULL) + afp->af_getaddr(addr, DSTADDR); } -void -setifipdst(addr, dummy, s, afp) - const char *addr; - int dummy ; - int s; - const struct afswtch *afp; +static void +setifipdst(const char *addr, int dummy __unused, int s, + const struct afswtch *afp) { - in_getaddr(addr, DSTADDR); - setipdst++; + const struct afswtch *inet; + + inet = af_getbyname("inet"); + if (inet == NULL) + return; + inet->af_getaddr(addr, DSTADDR); clearaddr = 0; newaddr = 0; } -#define rqtosa(x) (&(((struct ifreq *)(afp->x))->ifr_addr)) -void -notealias(addr, param, s, afp) - const char *addr; - int param; - int s; - const struct afswtch *afp; +static void +notealias(const char *addr, int param, int s, const struct afswtch *afp) { +#define rqtosa(x) (&(((struct ifreq *)(afp->x))->ifr_addr)) if (setaddr && doalias == 0 && param < 0) - bcopy((caddr_t)rqtosa(af_addreq), - (caddr_t)rqtosa(af_ridreq), - rqtosa(af_addreq)->sa_len); + if (afp->af_addreq != NULL && afp->af_ridreq != NULL) + bcopy((caddr_t)rqtosa(af_addreq), + (caddr_t)rqtosa(af_ridreq), + rqtosa(af_addreq)->sa_len); doalias = param; if (param < 0) { clearaddr = 1; newaddr = 0; } else clearaddr = 0; +#undef rqtosa } /*ARGSUSED*/ -void -setifdstaddr(addr, param, s, afp) - const char *addr; - int param ; - int s; - const struct afswtch *afp; +static void +setifdstaddr(const char *addr, int param __unused, int s, + const struct afswtch *afp) { - if (*afp->af_getaddr == NULL) - return; - (*afp->af_getaddr)(addr, DSTADDR); + if (afp->af_getaddr != NULL) + afp->af_getaddr(addr, DSTADDR); } /* @@ -930,14 +697,11 @@ setifdstaddr(addr, param, s, afp) * of the ifreq structure, which may confuse other parts of ifconfig. * Make a private copy so we can avoid that. */ -void -setifflags(vname, value, s, afp) - const char *vname; - int value; - int s; - const struct afswtch *afp; +static void +setifflags(const char *vname, int value, int s, const struct afswtch *afp) { struct ifreq my_ifr; + int flags; bcopy((char *)&ifr, (char *)&my_ifr, sizeof(struct ifreq)); @@ -946,24 +710,44 @@ setifflags(vname, value, s, afp) exit(1); } strncpy(my_ifr.ifr_name, name, sizeof (my_ifr.ifr_name)); - flags = my_ifr.ifr_flags; - + flags = my_ifr.ifr_flags; + if (value < 0) { value = -value; flags &= ~value; } else flags |= value; - my_ifr.ifr_flags = flags; + my_ifr.ifr_flags = flags & 0xffff; if (ioctl(s, SIOCSIFFLAGS, (caddr_t)&my_ifr) < 0) Perror(vname); } +#ifndef __APPLE__ void -setifmetric(val, dummy, s, afp) - const char *val; - int dummy ; - int s; - const struct afswtch *afp; +setifcap(const char *vname, int value, int s, const struct afswtch *afp) +{ + int flags; + + if (ioctl(s, SIOCGIFCAP, (caddr_t)&ifr) < 0) { + Perror("ioctl (SIOCGIFCAP)"); + exit(1); + } + flags = ifr.ifr_curcap; + if (value < 0) { + value = -value; + flags &= ~value; + } else + flags |= value; + flags &= ifr.ifr_reqcap; + ifr.ifr_reqcap = flags; + if (ioctl(s, SIOCSIFCAP, (caddr_t)&ifr) < 0) + Perror(vname); +} +#endif + +static void +setifmetric(const char *val, int dummy __unused, int s, + const struct afswtch *afp) { strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name)); ifr.ifr_metric = atoi(val); @@ -971,12 +755,9 @@ setifmetric(val, dummy, s, afp) warn("ioctl (set metric)"); } -void -setifmtu(val, dummy, s, afp) - const char *val; - int dummy ; - int s; - const struct afswtch *afp; +static void +setifmtu(const char *val, int dummy __unused, int s, + const struct afswtch *afp) { strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name)); ifr.ifr_mtu = atoi(val); @@ -984,418 +765,138 @@ setifmtu(val, dummy, s, afp) warn("ioctl (set mtu)"); } -void -setiflladdr(val, dummy, s, afp) - const char *val; - int dummy; - int s; - const struct afswtch *afp; +#ifndef __APPLE__ +static void +setifname(const char *val, int dummy __unused, int s, + const struct afswtch *afp) { - struct ether_addr *ea; + char *newname; - ea = ether_aton(val); - if (ea == NULL) { - warn("malformed link-level address"); + newname = strdup(val); + if (newname == NULL) { + warn("no memory to set ifname"); return; } - strncpy(ifr.ifr_name, name, sizeof (ifr.ifr_name)); - ifr.ifr_addr.sa_len = ETHER_ADDR_LEN; - ifr.ifr_addr.sa_family = AF_LINK; - bcopy(ea, ifr.ifr_addr.sa_data, ETHER_ADDR_LEN); - if (ioctl(s, SIOCSIFLLADDR, (caddr_t)&ifr) < 0) - warn("ioctl (set lladdr)"); - - return; + ifr.ifr_data = newname; + if (ioctl(s, SIOCSIFNAME, (caddr_t)&ifr) < 0) { + warn("ioctl (set name)"); + free(newname); + return; + } + strlcpy(name, newname, sizeof(name)); + free(newname); } +#endif #define IFFBITS \ "\020\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5POINTOPOINT\6SMART\7RUNNING" \ "\10NOARP\11PROMISC\12ALLMULTI\13OACTIVE\14SIMPLEX\15LINK0\16LINK1\17LINK2" \ -"\20MULTICAST" +"\20MULTICAST\22PPROMISC\23MONITOR\24STATICARP\25NEEDSGIANT" + +#define IFCAPBITS \ +"\020\1RXCSUM\2TXCSUM\3NETCONS\4VLAN_MTU\5VLAN_HWTAGGING\6JUMBO_MTU\7POLLING" \ +"\10VLAN_HWCSUM\11TSO4\12TSO6\13LRO\14WOL_UCAST\15WOL_MCAST\16WOL_MAGIC" /* * Print the status of the interface. If an address family was - * specified, show it and it only; otherwise, show them all. + * specified, show only it; otherwise, show them all. */ -void -status(afp, addrcount, sdl, ifm, ifam) - const struct afswtch *afp; - int addrcount; - struct sockaddr_dl *sdl; - struct if_msghdr *ifm; - struct ifa_msghdr *ifam; +static void +status(const struct afswtch *afp, const struct sockaddr_dl *sdl, + struct ifaddrs *ifa) { - const struct afswtch *p = NULL; - struct rt_addrinfo info; + struct ifaddrs *ift; int allfamilies, s; struct ifstat ifs; if (afp == NULL) { allfamilies = 1; - afp = &afs[0]; + afp = af_getbyname("inet"); } else allfamilies = 0; ifr.ifr_addr.sa_family = afp->af_af == AF_LINK ? AF_INET : afp->af_af; - strncpy(ifr.ifr_name, name, sizeof ifr.ifr_name); - - if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0) - err(1, "socket"); - - /* - * XXX is it we are doing a SIOCGIFMETRIC etc for one family. - * is it possible that the metric and mtu can be different for - * each family? If so, we have a format problem, because the - * metric and mtu is printed on the global the flags line. - */ - if (ioctl(s, SIOCGIFMETRIC, (caddr_t)&ifr) < 0) - warn("ioctl (SIOCGIFMETRIC)"); - else - metric = ifr.ifr_metric; + strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - if (ioctl(s, SIOCGIFMTU, (caddr_t)&ifr) < 0) - warn("ioctl (SIOCGIFMTU)"); - else - mtu = ifr.ifr_mtu; + s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0); + if (s < 0) + err(1, "socket(family %u,SOCK_DGRAM)", ifr.ifr_addr.sa_family); printf("%s: ", name); - printb("flags", flags, IFFBITS); - if (metric) - printf(" metric %d", metric); - if (mtu) - printf(" mtu %d", mtu); + printb("flags", ifa->ifa_flags, IFFBITS); + if (ioctl(s, SIOCGIFMETRIC, &ifr) != -1) + if (ifr.ifr_metric) + printf(" metric %d", ifr.ifr_metric); + if (ioctl(s, SIOCGIFMTU, &ifr) != -1) + printf(" mtu %d", ifr.ifr_mtu); putchar('\n'); - tunnel_status(s); - - while (addrcount > 0) { - - info.rti_addrs = ifam->ifam_addrs; - - /* Expand the compacted addresses */ - rt_xaddrs((char *)(ifam + 1), ifam->ifam_msglen + (char *)ifam, - &info); - - if (!allfamilies) { - if (afp->af_af == info.rti_info[RTAX_IFA]->sa_family) { - p = afp; - (*p->af_status)(s, &info); - } - } else for (p = afs; p->af_name; p++) { - if (p->af_af == info.rti_info[RTAX_IFA]->sa_family) - (*p->af_status)(s, &info); +#ifndef __APPLE__ + if (ioctl(s, SIOCGIFCAP, (caddr_t)&ifr) == 0) { + if (ifr.ifr_curcap != 0) { + printb("\toptions", ifr.ifr_curcap, IFCAPBITS); + putchar('\n'); + } + if (supmedia && ifr.ifr_reqcap != 0) { + printb("\tcapabilities", ifr.ifr_reqcap, IFCAPBITS); + putchar('\n'); } - addrcount--; - ifam = (struct ifa_msghdr *)((char *)ifam + ifam->ifam_msglen); - } - if (allfamilies || afp->af_status == ether_status) - ether_status(s, (struct rt_addrinfo *)sdl); -#if USE_IF_MEDIA - if (allfamilies || afp->af_status == media_status) - media_status(s, NULL); -#endif -#ifdef USE_VLANS - if (allfamilies || afp->af_status == vlan_status) - vlan_status(s, NULL); -#endif -#ifdef USE_BONDS - if (allfamilies || afp->af_status == bond_status) - bond_status(s, NULL); -#endif -#ifdef USE_IEEE80211 - if (allfamilies || afp->af_status == ieee80211_status) - ieee80211_status(s, NULL); -#endif - strncpy(ifs.ifs_name, name, sizeof ifs.ifs_name); - if (ioctl(s, SIOCGIFSTATUS, &ifs) == 0) - printf("%s", ifs.ascii); - - if (!allfamilies && !p && afp->af_status != media_status && - afp->af_status != ether_status -#ifdef USE_VLANS - && afp->af_status != vlan_status -#endif - ) - warnx("%s has no %s interface address!", name, afp->af_name); - - close(s); - return; -} - -void -tunnel_status(s) - int s; -{ - char psrcaddr[NI_MAXHOST]; - char pdstaddr[NI_MAXHOST]; - uint32_t srccmd, dstcmd; - struct ifreq *ifrp; - const char *ver = ""; -#ifdef NI_WITHSCOPEID - const int niflag = NI_NUMERICHOST | NI_WITHSCOPEID; -#else - const int niflag = NI_NUMERICHOST; -#endif -#ifdef INET6 - struct in6_ifreq in6_ifr; - int s6; -#endif /* INET6 */ - - psrcaddr[0] = pdstaddr[0] = '\0'; - -#ifdef INET6 - memset(&in6_ifr, 0, sizeof(in6_ifr)); - strncpy(in6_ifr.ifr_name, name, IFNAMSIZ); - s6 = socket(AF_INET6, SOCK_DGRAM, 0); - if (s6 < 0) { - srccmd = SIOCGIFPSRCADDR; - dstcmd = SIOCGIFPDSTADDR; - ifrp = 𝔦 - } else { - close(s6); - srccmd = SIOCGIFPSRCADDR_IN6; - dstcmd = SIOCGIFPDSTADDR_IN6; - ifrp = (struct ifreq *)&in6_ifr; } -#else /* INET6 */ - srccmd = SIOCGIFPSRCADDR; - dstcmd = SIOCGIFPDSTADDR; - ifrp = 𝔦 -#endif /* INET6 */ - - if (ioctl(s, srccmd, (caddr_t)ifrp) < 0) - return; -#ifdef INET6 - if (ifrp->ifr_addr.sa_family == AF_INET6) - in6_fillscopeid((struct sockaddr_in6 *)&ifrp->ifr_addr); -#endif - getnameinfo(&ifrp->ifr_addr, ifrp->ifr_addr.sa_len, - psrcaddr, sizeof(psrcaddr), 0, 0, niflag); -#ifdef INET6 - if (ifrp->ifr_addr.sa_family == AF_INET6) - ver = "6"; -#endif - - if (ioctl(s, dstcmd, (caddr_t)ifrp) < 0) - return; -#ifdef INET6 - if (ifrp->ifr_addr.sa_family == AF_INET6) - in6_fillscopeid((struct sockaddr_in6 *)&ifrp->ifr_addr); #endif - getnameinfo(&ifrp->ifr_addr, ifrp->ifr_addr.sa_len, - pdstaddr, sizeof(pdstaddr), 0, 0, niflag); - - printf("\ttunnel inet%s %s --> %s\n", ver, - psrcaddr, pdstaddr); -} - -void -in_status(s, info) - int s ; - struct rt_addrinfo * info; -{ - struct sockaddr_in *sin, null_sin; - memset(&null_sin, 0, sizeof(null_sin)); - - sin = (struct sockaddr_in *)info->rti_info[RTAX_IFA]; - printf("\tinet %s ", inet_ntoa(sin->sin_addr)); - - if (flags & IFF_POINTOPOINT) { - /* note RTAX_BRD overlap with IFF_BROADCAST */ - sin = (struct sockaddr_in *)info->rti_info[RTAX_BRD]; - if (!sin) - sin = &null_sin; - printf("--> %s ", inet_ntoa(sin->sin_addr)); - } - - sin = (struct sockaddr_in *)info->rti_info[RTAX_NETMASK]; - if (!sin) - sin = &null_sin; - printf("netmask 0x%0x ", (uint32_t)ntohl(sin->sin_addr.s_addr)); - - if (flags & IFF_BROADCAST) { - /* note RTAX_BRD overlap with IFF_POINTOPOINT */ - sin = (struct sockaddr_in *)info->rti_info[RTAX_BRD]; - if (sin && sin->sin_addr.s_addr != 0) - printf("broadcast %s", inet_ntoa(sin->sin_addr)); - } - putchar('\n'); -} + tunnel_status(s); -#ifdef INET6 -void -in6_fillscopeid(sin6) - struct sockaddr_in6 *sin6; -{ -#if defined(__KAME__) && defined(KAME_SCOPEID) - if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { - sin6->sin6_scope_id = - ntohs(*(u_int16_t *)&sin6->sin6_addr.s6_addr[2]); - sin6->sin6_addr.s6_addr[2] = sin6->sin6_addr.s6_addr[3] = 0; + for (ift = ifa; ift != NULL; ift = ift->ifa_next) { + if (ift->ifa_addr == NULL) + continue; + if (strcmp(ifa->ifa_name, ift->ifa_name) != 0) + continue; + if (allfamilies) { + const struct afswtch *p; + p = af_getbyfamily(ift->ifa_addr->sa_family); + if (p != NULL && p->af_status != NULL) + p->af_status(s, ift); + } else if (afp->af_af == ift->ifa_addr->sa_family) + afp->af_status(s, ift); } -#endif -} +#if 0 + if (allfamilies || afp->af_af == AF_LINK) { + const struct afswtch *lafp; -void -in6_status(s, info) - int s ; - struct rt_addrinfo * info; -{ - struct sockaddr_in6 *sin, null_sin; - struct in6_ifreq ifr6; - int s6; - u_int32_t flags6; - struct in6_addrlifetime lifetime; - time_t t = time(NULL); - int error; - u_int32_t scopeid; - - memset(&null_sin, 0, sizeof(null_sin)); - - sin = (struct sockaddr_in6 *)info->rti_info[RTAX_IFA]; - strncpy(ifr6.ifr_name, ifr.ifr_name, sizeof(ifr.ifr_name)); - if ((s6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { - perror("ifconfig: socket"); - return; - } - ifr6.ifr_addr = *sin; - if (ioctl(s6, SIOCGIFAFLAG_IN6, &ifr6) < 0) { - perror("ifconfig: ioctl(SIOCGIFAFLAG_IN6)"); - close(s6); - return; - } - flags6 = ifr6.ifr_ifru.ifru_flags6; - memset(&lifetime, 0, sizeof(lifetime)); - ifr6.ifr_addr = *sin; - if (ioctl(s6, SIOCGIFALIFETIME_IN6, &ifr6) < 0) { - perror("ifconfig: ioctl(SIOCGIFALIFETIME_IN6)"); - close(s6); - return; - } - lifetime = ifr6.ifr_ifru.ifru_lifetime; - close(s6); - - /* XXX: embedded link local addr check */ - if (IN6_IS_ADDR_LINKLOCAL(&sin->sin6_addr) && - *(u_short *)&sin->sin6_addr.s6_addr[2] != 0) { - u_short index; - - index = *(u_short *)&sin->sin6_addr.s6_addr[2]; - *(u_short *)&sin->sin6_addr.s6_addr[2] = 0; - if (sin->sin6_scope_id == 0) - sin->sin6_scope_id = ntohs(index); - } - scopeid = sin->sin6_scope_id; - - error = getnameinfo((struct sockaddr *)sin, sin->sin6_len, addr_buf, - sizeof(addr_buf), NULL, 0, - NI_NUMERICHOST|NI_WITHSCOPEID); - if (error != 0) - inet_ntop(AF_INET6, &sin->sin6_addr, addr_buf, - sizeof(addr_buf)); - printf("\tinet6 %s ", addr_buf); - - if (flags & IFF_POINTOPOINT) { - /* note RTAX_BRD overlap with IFF_BROADCAST */ - sin = (struct sockaddr_in6 *)info->rti_info[RTAX_BRD]; /* - * some of the interfaces do not have valid destination - * address. + * Hack; the link level address is received separately + * from the routing information so any address is not + * handled above. Cobble together an entry and invoke + * the status method specially. */ - if (sin && sin->sin6_family == AF_INET6) { - int error; - - /* XXX: embedded link local addr check */ - if (IN6_IS_ADDR_LINKLOCAL(&sin->sin6_addr) && - *(u_short *)&sin->sin6_addr.s6_addr[2] != 0) { - u_short index; - - index = *(u_short *)&sin->sin6_addr.s6_addr[2]; - *(u_short *)&sin->sin6_addr.s6_addr[2] = 0; - if (sin->sin6_scope_id == 0) - sin->sin6_scope_id = ntohs(index); - } - - error = getnameinfo((struct sockaddr *)sin, - sin->sin6_len, addr_buf, - sizeof(addr_buf), NULL, 0, - NI_NUMERICHOST|NI_WITHSCOPEID); - if (error != 0) - inet_ntop(AF_INET6, &sin->sin6_addr, addr_buf, - sizeof(addr_buf)); - printf("--> %s ", addr_buf); + lafp = af_getbyname("lladdr"); + if (lafp != NULL) { + info.rti_info[RTAX_IFA] = (struct sockaddr *)sdl; + lafp->af_status(s, &info); } } +#endif + if (allfamilies) + af_other_status(s); + else if (afp->af_other_status != NULL) + afp->af_other_status(s); - sin = (struct sockaddr_in6 *)info->rti_info[RTAX_NETMASK]; - if (!sin) - sin = &null_sin; - printf("prefixlen %d ", prefix(&sin->sin6_addr, - sizeof(struct in6_addr))); - - if ((flags6 & IN6_IFF_ANYCAST) != 0) - printf("anycast "); - if ((flags6 & IN6_IFF_TENTATIVE) != 0) - printf("tentative "); - if ((flags6 & IN6_IFF_DUPLICATED) != 0) - printf("duplicated "); - if ((flags6 & IN6_IFF_DETACHED) != 0) - printf("detached "); - if ((flags6 & IN6_IFF_DEPRECATED) != 0) - printf("deprecated "); - if ((flags6 & IN6_IFF_AUTOCONF) != 0) - printf("autoconf "); - if ((flags6 & IN6_IFF_TEMPORARY) != 0) - printf("temporary "); - - if (scopeid) - printf("scopeid 0x%x ", scopeid); - - if (ip6lifetime && (lifetime.ia6t_preferred || lifetime.ia6t_expire)) { - printf("pltime "); - if (lifetime.ia6t_preferred) { - printf("%s ", lifetime.ia6t_preferred < t - ? "0" : sec2str(lifetime.ia6t_preferred - t)); - } else - printf("infty "); - - printf("vltime "); - if (lifetime.ia6t_expire) { - printf("%s ", lifetime.ia6t_expire < t - ? "0" : sec2str(lifetime.ia6t_expire - t)); - } else - printf("infty "); - } + strncpy(ifs.ifs_name, name, sizeof ifs.ifs_name); + if (ioctl(s, SIOCGIFSTATUS, &ifs) == 0) + printf("%s", ifs.ascii); - putchar('\n'); + close(s); + return; } -#endif /*INET6*/ -void -ether_status(s, info) - int s ; - struct rt_addrinfo *info; +static void +tunnel_status(int s) { - char *cp; - int n; - struct sockaddr_dl *sdl = (struct sockaddr_dl *)info; - - cp = (char *)LLADDR(sdl); - if ((n = sdl->sdl_alen) > 0) { - if (sdl->sdl_type == IFT_ETHER) - printf ("\tether "); - else - printf ("\tlladdr "); - while (--n >= 0) - printf("%02x%c",*cp++ & 0xff, n>0? ':' : ' '); - putchar('\n'); - } + af_all_tunnel_status(s); } void -Perror(cmd) - const char *cmd; +Perror(const char *cmd) { switch (errno) { @@ -1412,133 +913,14 @@ Perror(cmd) } } -#define SIN(x) ((struct sockaddr_in *) &(x)) -struct sockaddr_in *sintab[] = { -SIN(ridreq.ifr_addr), SIN(addreq.ifra_addr), -SIN(addreq.ifra_mask), SIN(addreq.ifra_broadaddr)}; - -void -in_getaddr(s, which) - const char *s; - int which; -{ - register struct sockaddr_in *sin = sintab[which]; - struct hostent *hp; - struct netent *np; - - sin->sin_len = sizeof(*sin); - if (which != NMASK) - sin->sin_family = AF_INET; - - if (which == ADDR) { - char *p = NULL; - - if((p = strrchr(s, '/')) != NULL) { - /* address is `name/masklen' */ - int masklen; - int ret; - struct sockaddr_in *min = sintab[NMASK]; - *p = '\0'; - ret = sscanf(p+1, "%u", &masklen); - if(ret != 1 || (masklen < 0 || masklen > 32)) { - *p = '/'; - errx(1, "%s: bad value", s); - } - min->sin_len = sizeof(*min); - min->sin_addr.s_addr = htonl(~((1LL << (32 - masklen)) - 1) & - 0xffffffff); - } - } - - if (inet_aton(s, &sin->sin_addr)) - return; - if ((hp = gethostbyname(s)) != 0) - bcopy(hp->h_addr, (char *)&sin->sin_addr, - MIN(hp->h_length, sizeof(sin->sin_addr))); - else if ((np = getnetbyname(s)) != 0) - sin->sin_addr = inet_makeaddr(np->n_net, INADDR_ANY); - else - errx(1, "%s: bad value", s); -} - -#ifdef INET6 -#define SIN6(x) ((struct sockaddr_in6 *) &(x)) -struct sockaddr_in6 *sin6tab[] = { -SIN6(in6_ridreq.ifr_addr), SIN6(in6_addreq.ifra_addr), -SIN6(in6_addreq.ifra_prefixmask), SIN6(in6_addreq.ifra_dstaddr)}; - -void -in6_getaddr(s, which) - const char *s; - int which; -{ - register struct sockaddr_in6 *sin = sin6tab[which]; - struct addrinfo hints, *res; - int error = -1; - - newaddr &= 1; - - sin->sin6_len = sizeof(*sin); - if (which != NMASK) - sin->sin6_family = AF_INET6; - - if (which == ADDR) { - char *p = NULL; - if((p = strrchr(s, '/')) != NULL) { - *p = '\0'; - in6_getprefix(p + 1, NMASK); - explicit_prefix = 1; - } - } - - if (sin->sin6_family == AF_INET6) { - bzero(&hints, sizeof(struct addrinfo)); - hints.ai_family = AF_INET6; - error = getaddrinfo(s, NULL, &hints, &res); - } - if (error != 0) { - if (inet_pton(AF_INET6, s, &sin->sin6_addr) != 1) - errx(1, "%s: bad value", s); - } else - bcopy(res->ai_addr, sin, res->ai_addrlen); -} - -void -in6_getprefix(plen, which) - const char *plen; - int which; -{ - register struct sockaddr_in6 *sin = sin6tab[which]; - register u_char *cp; - int len = atoi(plen); - - if ((len < 0) || (len > 128)) - errx(1, "%s: bad value", plen); - sin->sin6_len = sizeof(*sin); - if (which != NMASK) - sin->sin6_family = AF_INET6; - if ((len == 0) || (len == 128)) { - memset(&sin->sin6_addr, 0xff, sizeof(struct in6_addr)); - return; - } - memset((void *)&sin->sin6_addr, 0x00, sizeof(sin->sin6_addr)); - for (cp = (u_char *)&sin->sin6_addr; len > 7; len -= 8) - *cp++ = 0xff; - *cp = 0xff << (8 - len); -} -#endif - /* * Print a value a la the %b format of the kernel's printf */ void -printb(s, v, bits) - const char *s; - register unsigned v; - register const char *bits; +printb(const char *s, unsigned v, const char *bits) { - register int i, any = 0; - register char c; + int i, any = 0; + char c; if (bits && *bits == 8) printf("%s=%o", s, v); @@ -1562,113 +944,135 @@ printb(s, v, bits) } } -void -ether_getaddr(addr, which) - const char *addr; - int which; -{ - struct ether_addr *ea; - struct sockaddr *sea = &ridreq.ifr_addr; - - ea = ether_aton(addr); - if (ea == NULL) - errx(1, "malformed ether address"); - if (which == NMASK) - errx(1, "Ethernet does not use netmasks"); - sea->sa_family = AF_LINK; - sea->sa_len = ETHER_ADDR_LEN; - bcopy(ea, sea->sa_data, ETHER_ADDR_LEN); -} - -#ifdef INET6 -int -prefix(val, size) - void *val; - int size; +#ifndef __APPLE__ +void +ifmaybeload(const char *name) { - register u_char *name = (u_char *)val; - register int byte, bit, plen = 0; - - for (byte = 0; byte < size; byte++, plen += 8) - if (name[byte] != 0xff) - break; - if (byte == size) - return (plen); - for (bit = 7; bit != 0; bit--, plen++) - if (!(name[byte] & (1 << bit))) - break; - for (; bit != 0; bit--) - if (name[byte] & (1 << bit)) - return(0); - byte++; - for (; byte < size; byte++) - if (name[byte]) - return(0); - return (plen); -} +#define MOD_PREFIX_LEN 3 /* "if_" */ + struct module_stat mstat; + int fileid, modid; + char ifkind[IFNAMSIZ + MOD_PREFIX_LEN], ifname[IFNAMSIZ], *dp; + const char *cp; + + /* loading suppressed by the user */ + if (noload) + return; -static char * -sec2str(total) - time_t total; -{ - static char result[256]; - int days, hours, mins, secs; - int first = 1; - char *p = result; - - if (0) { - days = total / 3600 / 24; - hours = (total / 3600) % 24; - mins = (total / 60) % 60; - secs = total % 60; - - if (days) { - first = 0; - p += sprintf(p, "%dd", days); - } - if (!first || hours) { - first = 0; - p += sprintf(p, "%dh", hours); - } - if (!first || mins) { - first = 0; - p += sprintf(p, "%dm", mins); - } - sprintf(p, "%ds", secs); - } else - sprintf(result, "%lu", (unsigned long)total); - - return(result); -} -#endif /*INET6*/ + /* trim the interface number off the end */ + strlcpy(ifname, name, sizeof(ifname)); + for (dp = ifname; *dp != 0; dp++) + if (isdigit(*dp)) { + *dp = 0; + break; + } -void -clone_create(void) -{ - int s; - - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s == -1) - err(1, "socket"); - - memset(&ifr, 0, sizeof(ifr)); - (void) strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - if (ioctl(s, SIOCIFCREATE, &ifr) < 0) - err(1, "SIOCIFCREATE"); - - if (strcmp(name, ifr.ifr_name) != 0) { - printf("%s\n", ifr.ifr_name); - strlcpy(name, ifr.ifr_name, sizeof(name)); + /* turn interface and unit into module name */ + strcpy(ifkind, "if_"); + strlcpy(ifkind + MOD_PREFIX_LEN, ifname, + sizeof(ifkind) - MOD_PREFIX_LEN); + + /* scan files in kernel */ + mstat.version = sizeof(struct module_stat); + for (fileid = kldnext(0); fileid > 0; fileid = kldnext(fileid)) { + /* scan modules in file */ + for (modid = kldfirstmod(fileid); modid > 0; + modid = modfnext(modid)) { + if (modstat(modid, &mstat) < 0) + continue; + /* strip bus name if present */ + if ((cp = strchr(mstat.name, '/')) != NULL) { + cp++; + } else { + cp = mstat.name; + } + /* already loaded? */ + if (strncmp(ifname, cp, strlen(ifname) + 1) == 0 || + strncmp(ifkind, cp, strlen(ifkind) + 1) == 0) + return; + } } - - close(s); + + /* not present, we should try to load it */ + kldload(ifkind); } +#endif -void -clone_destroy(const char *val, int d, int s, const struct afswtch *rafp) +static struct cmd basic_cmds[] = { + DEF_CMD("up", IFF_UP, setifflags), + DEF_CMD("down", -IFF_UP, setifflags), + DEF_CMD("arp", -IFF_NOARP, setifflags), + DEF_CMD("-arp", IFF_NOARP, setifflags), + DEF_CMD("debug", IFF_DEBUG, setifflags), + DEF_CMD("-debug", -IFF_DEBUG, setifflags), +#ifdef notdef + DEF_CMD("promisc", IFF_PPROMISC, setifflags), + DEF_CMD("-promisc", -IFF_PPROMISC, setifflags), +#endif + DEF_CMD("add", IFF_UP, notealias), + DEF_CMD("alias", IFF_UP, notealias), + DEF_CMD("-alias", -IFF_UP, notealias), + DEF_CMD("delete", -IFF_UP, notealias), + DEF_CMD("remove", -IFF_UP, notealias), +#ifdef notdef +#define EN_SWABIPS 0x1000 + DEF_CMD("swabips", EN_SWABIPS, setifflags), + DEF_CMD("-swabips", -EN_SWABIPS, setifflags), +#endif + DEF_CMD_ARG("netmask", setifnetmask), + DEF_CMD_ARG("metric", setifmetric), + DEF_CMD_ARG("broadcast", setifbroadaddr), + DEF_CMD_ARG("ipdst", setifipdst), + DEF_CMD_ARG2("tunnel", settunnel), + DEF_CMD("-tunnel", 0, deletetunnel), + DEF_CMD("deletetunnel", 0, deletetunnel), + DEF_CMD("link0", IFF_LINK0, setifflags), + DEF_CMD("-link0", -IFF_LINK0, setifflags), + DEF_CMD("link1", IFF_LINK1, setifflags), + DEF_CMD("-link1", -IFF_LINK1, setifflags), + DEF_CMD("link2", IFF_LINK2, setifflags), + DEF_CMD("-link2", -IFF_LINK2, setifflags), +#ifdef notdef + DEF_CMD("monitor", IFF_MONITOR:, setifflags), + DEF_CMD("-monitor", -IFF_MONITOR, setifflags), + DEF_CMD("staticarp", IFF_STATICARP, setifflags), + DEF_CMD("-staticarp", -IFF_STATICARP, setifflags), + DEF_CMD("rxcsum", IFCAP_RXCSUM, setifcap), + DEF_CMD("-rxcsum", -IFCAP_RXCSUM, setifcap), + DEF_CMD("txcsum", IFCAP_TXCSUM, setifcap), + DEF_CMD("-txcsum", -IFCAP_TXCSUM, setifcap), + DEF_CMD("netcons", IFCAP_NETCONS, setifcap), + DEF_CMD("-netcons", -IFCAP_NETCONS, setifcap), + DEF_CMD("polling", IFCAP_POLLING, setifcap), + DEF_CMD("-polling", -IFCAP_POLLING, setifcap), + DEF_CMD("tso", IFCAP_TSO, setifcap), + DEF_CMD("-tso", -IFCAP_TSO, setifcap), + DEF_CMD("lro", IFCAP_LRO, setifcap), + DEF_CMD("-lro", -IFCAP_LRO, setifcap), + DEF_CMD("wol", IFCAP_WOL, setifcap), + DEF_CMD("-wol", -IFCAP_WOL, setifcap), + DEF_CMD("wol_ucast", IFCAP_WOL_UCAST, setifcap), + DEF_CMD("-wol_ucast", -IFCAP_WOL_UCAST, setifcap), + DEF_CMD("wol_mcast", IFCAP_WOL_MCAST, setifcap), + DEF_CMD("-wol_mcast", -IFCAP_WOL_MCAST, setifcap), + DEF_CMD("wol_magic", IFCAP_WOL_MAGIC, setifcap), + DEF_CMD("-wol_magic", -IFCAP_WOL_MAGIC, setifcap), +#endif + DEF_CMD("normal", -IFF_LINK0, setifflags), + DEF_CMD("compress", IFF_LINK0, setifflags), + DEF_CMD("noicmp", IFF_LINK1, setifflags), + DEF_CMD_ARG("mtu", setifmtu), +#ifdef notdef + DEF_CMD_ARG("name", setifname), +#endif +}; + +static __constructor void +ifconfig_ctor(void) { - - (void) strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - if (ioctl(s, SIOCIFDESTROY, &ifr) < 0) - err(1, "SIOCIFDESTROY"); +#define N(a) (sizeof(a) / sizeof(a[0])) + int i; + + for (i = 0; i < N(basic_cmds); i++) + cmd_register(&basic_cmds[i]); +#undef N } diff --git a/ifconfig.tproj/ifconfig.h b/ifconfig.tproj/ifconfig.h index de31ef1..b2501c7 100644 --- a/ifconfig.tproj/ifconfig.h +++ b/ifconfig.tproj/ifconfig.h @@ -31,26 +31,121 @@ * * so there! * - * $Id: ifconfig.h,v 1.3 2004/07/20 05:29:46 lindak Exp $ + * $FreeBSD: src/sbin/ifconfig/ifconfig.h,v 1.21.2.1.2.1 2008/11/25 02:59:29 kensmith Exp $ */ -extern struct ifreq ifr; +#define __constructor __attribute__((constructor)) -extern char name[32]; /* name of interface */ -extern int allmedia; struct afswtch; +struct cmd; -extern void setmedia(const char *, int, int, const struct afswtch *rafp); -extern void setmediaopt(const char *, int, int, const struct afswtch *rafp); -extern void unsetmediaopt(const char *, int, int, const struct afswtch *rafp); -extern void media_status(int s, struct rt_addrinfo *); +typedef void c_func(const char *cmd, int arg, int s, const struct afswtch *afp); +typedef void c_func2(const char *arg1, const char *arg2, int s, const struct afswtch *afp); -extern void setvlantag(const char *, int, int, const struct afswtch *rafp); -extern void setvlandev(const char *, int, int, const struct afswtch *rafp); -extern void unsetvlandev(const char *, int, int, const struct afswtch *rafp); -extern void vlan_status(int s, struct rt_addrinfo *); +struct cmd { + const char *c_name; + int c_parameter; +#define NEXTARG 0xffffff /* has following arg */ +#define NEXTARG2 0xfffffe /* has 2 following args */ +#define OPTARG 0xfffffd /* has optional following arg */ + union { + c_func *c_func; + c_func2 *c_func2; + } c_u; + int c_iscloneop; + struct cmd *c_next; +}; +void cmd_register(struct cmd *); -extern void setbonddev(const char *, int, int, const struct afswtch * rafp); -extern void unsetbonddev(const char *, int, int, const struct afswtch * rafp); -extern void setbondmode(const char *, int, int, const struct afswtch * rafp); -extern void bond_status(int s, struct rt_addrinfo *); +typedef void callback_func(int s, void *); +void callback_register(callback_func *, void *); + +/* + * Macros for declaring command functions and initializing entries. + */ +#define DECL_CMD_FUNC(name, cmd, arg) \ + void name(const char *cmd, int arg, int s, const struct afswtch *afp) +#define DECL_CMD_FUNC2(name, arg1, arg2) \ + void name(const char *arg1, const char *arg2, int s, const struct afswtch *afp) + +#define DEF_CMD(name, param, func) { name, param, { .c_func = func } } +#define DEF_CMD_ARG(name, func) { name, NEXTARG, { .c_func = func } } +#define DEF_CMD_OPTARG(name, func) { name, OPTARG, { .c_func = func } } +#define DEF_CMD_ARG2(name, func) { name, NEXTARG2, { .c_func2 = func } } +#define DEF_CLONE_CMD(name, param, func) { name, param, { .c_func = func }, 1 } +#define DEF_CLONE_CMD_ARG(name, func) { name, NEXTARG, { .c_func = func }, 1 } + +struct ifaddrs; +struct addrinfo; + +enum { + RIDADDR, + ADDR, + MASK, + DSTADDR, +}; + +struct afswtch { + const char *af_name; /* as given on cmd line, e.g. "inet" */ + short af_af; /* AF_* */ + /* + * Status is handled one of two ways; if there is an + * address associated with the interface then the + * associated address family af_status method is invoked + * with the appropriate addressin info. Otherwise, if + * all possible info is to be displayed and af_other_status + * is defined then it is invoked after all address status + * is presented. + */ + void (*af_status)(int, const struct ifaddrs *); + void (*af_other_status)(int); + /* parse address method */ + void (*af_getaddr)(const char *, int); + /* parse prefix method (IPv6) */ + void (*af_getprefix)(const char *, int); + void (*af_postproc)(int s, const struct afswtch *); + u_long af_difaddr; /* set dst if address ioctl */ + u_long af_aifaddr; /* set if address ioctl */ + void *af_ridreq; /* */ + void *af_addreq; /* */ + struct afswtch *af_next; + + /* XXX doesn't fit model */ + void (*af_status_tunnel)(int); + void (*af_settunnel)(int s, struct addrinfo *srcres, + struct addrinfo *dstres); +}; +void af_register(struct afswtch *); + +struct option { + const char *opt; + const char *opt_usage; + void (*cb)(const char *arg); + struct option *next; +}; +void opt_register(struct option *); + +extern struct ifreq ifr; +extern char name[IFNAMSIZ]; /* name of interface */ +extern int allmedia; +extern int supmedia; +extern int printkeys; +extern int newaddr; +extern int verbose; +extern int all; + +void setifcap(const char *, int value, int s, const struct afswtch *); + +void Perror(const char *cmd); +void printb(const char *s, unsigned value, const char *bits); + +void ifmaybeload(const char *name); + +typedef void clone_callback_func(int, struct ifreq *); +void clone_setcallback(clone_callback_func *); + +/* + * XXX expose this so modules that neeed to know of any pending + * operations on ifmedia can avoid cmd line ordering confusion. + */ +struct ifmediareq *ifmedia_getstate(int s); diff --git a/ifconfig.tproj/ifmedia.c b/ifconfig.tproj/ifmedia.c index 2ba7a39..cefaacf 100644 --- a/ifconfig.tproj/ifmedia.c +++ b/ifconfig.tproj/ifmedia.c @@ -1,5 +1,5 @@ /* $NetBSD: ifconfig.c,v 1.34 1997/04/21 01:17:58 lukem Exp $ */ -/* $FreeBSD: src/sbin/ifconfig/ifmedia.c,v 1.6 1999/08/28 00:13:08 peter Exp $ */ +/* $FreeBSD: src/sbin/ifconfig/ifmedia.c,v 1.25.6.1 2008/11/25 02:59:29 kensmith Exp $ */ /* * Copyright (c) 1997 Jason R. Thorpe. @@ -89,18 +89,23 @@ #include "ifconfig.h" -static void domediaopt __P((const char *, int, int)); -static int get_media_subtype __P((int, const char *)); -static int get_media_options __P((int, const char *)); -static int lookup_media_word __P((struct ifmedia_description *, const char *)); -static void print_media_word __P((int)); +static void domediaopt(const char *, int, int); +static int get_media_subtype(int, const char *); +#ifdef notdef +static int get_media_mode(int, const char *); +#endif +static int get_media_options(int, const char *); +static int lookup_media_word(struct ifmedia_description *, const char *); +static void print_media_word(int, int); +static void print_media_word_ifconfig(int); + +static struct ifmedia_description *get_toptype_desc(int); +static struct ifmedia_type_to_subtype *get_toptype_ttos(int); +static struct ifmedia_description *get_subtype_desc(int, + struct ifmedia_type_to_subtype *ttos); -extern int supmedia; - -void -media_status(s, info) - int s; - struct rt_addrinfo *info; +static void +media_status(int s) { struct ifmediareq ifmr; int *media_list, i; @@ -116,24 +121,35 @@ media_status(s, info) } if (ifmr.ifm_count == 0) { - //warnx("%s: no media types?", name); - return; + warnx("%s: no media types?", name); + return; } + media_list = (int *)malloc(ifmr.ifm_count * sizeof(int)); + if (media_list == NULL) + err(1, "malloc"); + ifmr.ifm_ulist = media_list; + + if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) + err(1, "SIOCGIFMEDIA"); + printf("\tmedia: "); - print_media_word(ifmr.ifm_current); + print_media_word(ifmr.ifm_current, 1); if (ifmr.ifm_active != ifmr.ifm_current) { putchar(' '); putchar('('); - print_media_word(ifmr.ifm_active); + print_media_word(ifmr.ifm_active, 0); putchar(')'); } + putchar('\n'); + if (ifmr.ifm_status & IFM_AVALID) { - printf(" status: "); -#if 0 + printf("\tstatus: "); +#ifdef notdef switch (IFM_TYPE(ifmr.ifm_active)) { case IFM_ETHER: + case IFM_ATM: if (ifmr.ifm_status & IFM_ACTIVE) printf("active"); else @@ -147,66 +163,102 @@ media_status(s, info) else printf("no ring"); break; + + case IFM_IEEE80211: + /* XXX: Different value for adhoc? */ + if (ifmr.ifm_status & IFM_ACTIVE) + printf("associated"); + else + printf("no carrier"); + break; } -#endif 0 +#else if (ifmr.ifm_status & IFM_ACTIVE) printf("active"); else - printf("inactive"); - } - putchar('\n'); - -#if 0 - if (supmedia == 0) { - return; + printf("inactive"); +#endif + putchar('\n'); } -#endif 0 - media_list = (int *)malloc(ifmr.ifm_count * sizeof(int)); - if (media_list == NULL) - err(1, "malloc"); - ifmr.ifm_ulist = media_list; - - if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) - err(1, "SIOCGIFMEDIA"); - if (ifmr.ifm_count > 0) { - printf("\tsupported media:"); + if (ifmr.ifm_count > 0 && supmedia) { + printf("\tsupported media:\n"); for (i = 0; i < ifmr.ifm_count; i++) { - putchar(' '); - print_media_word(media_list[i]); + printf("\t\t"); + print_media_word_ifconfig(media_list[i]); + putchar('\n'); } - putchar('\n'); } free(media_list); } -void -setmedia(val, d, s, afp) - const char *val; - int d; - int s; - const struct afswtch *afp; +struct ifmediareq * +ifmedia_getstate(int s) { - struct ifmediareq ifmr; - int first_type, subtype; + static struct ifmediareq *ifmr = NULL; + int *mwords; - (void) memset(&ifmr, 0, sizeof(ifmr)); - (void) strncpy(ifmr.ifm_name, name, sizeof(ifmr.ifm_name)); + if (ifmr == NULL) { + ifmr = (struct ifmediareq *)malloc(sizeof(struct ifmediareq)); + if (ifmr == NULL) + err(1, "malloc"); + + (void) memset(ifmr, 0, sizeof(struct ifmediareq)); + (void) strncpy(ifmr->ifm_name, name, + sizeof(ifmr->ifm_name)); + + ifmr->ifm_count = 0; + ifmr->ifm_ulist = NULL; - ifmr.ifm_count = 1; - ifmr.ifm_ulist = &first_type; - if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) { /* - * If we get E2BIG, the kernel is telling us - * that there are more, so we can ignore it. + * We must go through the motions of reading all + * supported media because we need to know both + * the current media type and the top-level type. */ - if (errno != E2BIG) + + if (ioctl(s, SIOCGIFMEDIA, (caddr_t)ifmr) < 0) { err(1, "SIOCGIFMEDIA"); + } + + if (ifmr->ifm_count == 0) + errx(1, "%s: no media types?", name); + + mwords = (int *)malloc(ifmr->ifm_count * sizeof(int)); + if (mwords == NULL) + err(1, "malloc"); + + ifmr->ifm_ulist = mwords; + if (ioctl(s, SIOCGIFMEDIA, (caddr_t)ifmr) < 0) + err(1, "SIOCGIFMEDIA"); + } + + return ifmr; +} + +static void +setifmediacallback(int s, void *arg) +{ + struct ifmediareq *ifmr = (struct ifmediareq *)arg; + static int did_it = 0; + + if (!did_it) { + ifr.ifr_media = ifmr->ifm_current; + if (ioctl(s, SIOCSIFMEDIA, (caddr_t)&ifr) < 0) + err(1, "SIOCSIFMEDIA (media)"); + free(ifmr->ifm_ulist); + free(ifmr); + did_it = 1; } +} - if (ifmr.ifm_count == 0) - errx(1, "%s: no media types?", name); +static void +setmedia(const char *val, int d, int s, const struct afswtch *afp) +{ + struct ifmediareq *ifmr; + int subtype; + + ifmr = ifmedia_getstate(s); /* * We are primarily concerned with the top-level type. @@ -217,84 +269,96 @@ setmedia(val, d, s, afp) * (I'm assuming that all supported media types for a given * interface will be the same top-level type..) */ - subtype = get_media_subtype(IFM_TYPE(first_type), val); + subtype = get_media_subtype(IFM_TYPE(ifmr->ifm_ulist[0]), val); strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - ifr.ifr_media = (ifmr.ifm_current & ~(IFM_NMASK|IFM_TMASK)) | - IFM_TYPE(first_type) | subtype; + ifr.ifr_media = (ifmr->ifm_current & ~(IFM_NMASK|IFM_TMASK)) | + IFM_TYPE(ifmr->ifm_ulist[0]) | subtype; - if (ioctl(s, SIOCSIFMEDIA, (caddr_t)&ifr) < 0) - err(1, "SIOCSIFMEDIA"); + if ((ifr.ifr_media & IFM_TMASK) == 0) { + ifr.ifr_media &= ~IFM_GMASK; + } + + ifmr->ifm_current = ifr.ifr_media; + callback_register(setifmediacallback, (void *)ifmr); } -void -setmediaopt(val, d, s, afp) - const char *val; - int d; - int s; - const struct afswtch *afp; +static void +setmediaopt(const char *val, int d, int s, const struct afswtch *afp) { domediaopt(val, 0, s); } -void -unsetmediaopt(val, d, s, afp) - const char *val; - int d; - int s; - const struct afswtch *afp; +static void +unsetmediaopt(const char *val, int d, int s, const struct afswtch *afp) { domediaopt(val, 1, s); } static void -domediaopt(val, clear, s) - const char *val; - int clear; - int s; +domediaopt(const char *val, int clear, int s) { - struct ifmediareq ifmr; - int *mwords, options; + struct ifmediareq *ifmr; + int options; - (void) memset(&ifmr, 0, sizeof(ifmr)); - (void) strncpy(ifmr.ifm_name, name, sizeof(ifmr.ifm_name)); + ifmr = ifmedia_getstate(s); - /* - * We must go through the motions of reading all - * supported media because we need to know both - * the current media type and the top-level type. - */ + options = get_media_options(IFM_TYPE(ifmr->ifm_ulist[0]), val); - if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) - err(1, "SIOCGIFMEDIA"); + strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); + ifr.ifr_media = ifmr->ifm_current; + if (clear) + ifr.ifr_media &= ~options; + else { + if (options & IFM_HDX) { + ifr.ifr_media &= ~IFM_FDX; + options &= ~IFM_HDX; + } + ifr.ifr_media |= options; + } + ifmr->ifm_current = ifr.ifr_media; + callback_register(setifmediacallback, (void *)ifmr); +} - if (ifmr.ifm_count == 0) - errx(1, "%s: no media types?", name); +static void +setmediainst(const char *val, int d, int s, const struct afswtch *afp) +{ + struct ifmediareq *ifmr; + int inst; - mwords = (int *)malloc(ifmr.ifm_count * sizeof(int)); - if (mwords == NULL) - err(1, "malloc"); + ifmr = ifmedia_getstate(s); - ifmr.ifm_ulist = mwords; - if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) - err(1, "SIOCGIFMEDIA"); + inst = atoi(val); + if (inst < 0 || inst > IFM_INST_MAX) + errx(1, "invalid media instance: %s", val); - options = get_media_options(IFM_TYPE(mwords[0]), val); + strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); + ifr.ifr_media = (ifmr->ifm_current & ~IFM_IMASK) | inst << IFM_ISHIFT; + + ifmr->ifm_current = ifr.ifr_media; + callback_register(setifmediacallback, (void *)ifmr); +} + +#ifdef notdef +static void +setmediamode(const char *val, int d, int s, const struct afswtch *afp) +{ + struct ifmediareq *ifmr; + int mode; - free(mwords); + ifmr = ifmedia_getstate(s); + + mode = get_media_mode(IFM_TYPE(ifmr->ifm_ulist[0]), val); strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - ifr.ifr_media = ifmr.ifm_current; - if (clear) - ifr.ifr_media &= ~options; - else - ifr.ifr_media |= options; + ifr.ifr_media = (ifmr->ifm_current & ~IFM_MMASK) | mode; - if (ioctl(s, SIOCSIFMEDIA, (caddr_t)&ifr) < 0) - err(1, "SIOCSIFMEDIA"); + ifmr->ifm_current = ifr.ifr_media; + callback_register(setifmediacallback, (void *)ifmr); } +#endif /********************************************************************** * A good chunk of this is duplicated from sys/net/ifmedia.c @@ -330,12 +394,32 @@ static struct ifmedia_description ifm_subtype_fddi_aliases[] = static struct ifmedia_description ifm_subtype_fddi_option_descriptions[] = IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS; +#ifdef notdef static struct ifmedia_description ifm_subtype_ieee80211_descriptions[] = IFM_SUBTYPE_IEEE80211_DESCRIPTIONS; +static struct ifmedia_description ifm_subtype_ieee80211_aliases[] = + IFM_SUBTYPE_IEEE80211_ALIASES; + static struct ifmedia_description ifm_subtype_ieee80211_option_descriptions[] = IFM_SUBTYPE_IEEE80211_OPTION_DESCRIPTIONS; +struct ifmedia_description ifm_subtype_ieee80211_mode_descriptions[] = + IFM_SUBTYPE_IEEE80211_MODE_DESCRIPTIONS; + +struct ifmedia_description ifm_subtype_ieee80211_mode_aliases[] = + IFM_SUBTYPE_IEEE80211_MODE_ALIASES; + +static struct ifmedia_description ifm_subtype_atm_descriptions[] = + IFM_SUBTYPE_ATM_DESCRIPTIONS; + +static struct ifmedia_description ifm_subtype_atm_aliases[] = + IFM_SUBTYPE_ATM_ALIASES; + +static struct ifmedia_description ifm_subtype_atm_option_descriptions[] = + IFM_SUBTYPE_ATM_OPTION_DESCRIPTIONS; +#endif + static struct ifmedia_description ifm_subtype_shared_descriptions[] = IFM_SUBTYPE_SHARED_DESCRIPTIONS; @@ -354,6 +438,10 @@ struct ifmedia_type_to_subtype { struct ifmedia_description *desc; int alias; } options[3]; + struct { + struct ifmedia_description *desc; + int alias; + } modes[3]; }; /* must be in the same order as IFM_TYPE_DESCRIPTIONS */ @@ -368,7 +456,10 @@ static struct ifmedia_type_to_subtype ifmedia_types_to_subtypes[] = { }, { { &ifm_shared_option_descriptions[0], 0 }, - { &ifm_subtype_ethernet_option_descriptions[0], 1 }, + { &ifm_subtype_ethernet_option_descriptions[0], 0 }, + { NULL, 0 }, + }, + { { NULL, 0 }, }, }, @@ -382,7 +473,10 @@ static struct ifmedia_type_to_subtype ifmedia_types_to_subtypes[] = { }, { { &ifm_shared_option_descriptions[0], 0 }, - { &ifm_subtype_tokenring_option_descriptions[0], 1 }, + { &ifm_subtype_tokenring_option_descriptions[0], 0 }, + { NULL, 0 }, + }, + { { NULL, 0 }, }, }, @@ -396,29 +490,55 @@ static struct ifmedia_type_to_subtype ifmedia_types_to_subtypes[] = { }, { { &ifm_shared_option_descriptions[0], 0 }, - { &ifm_subtype_fddi_option_descriptions[0], 1 }, + { &ifm_subtype_fddi_option_descriptions[0], 0 }, + { NULL, 0 }, + }, + { { NULL, 0 }, }, }, +#ifdef notdef { { { &ifm_subtype_shared_descriptions[0], 0 }, { &ifm_subtype_shared_aliases[0], 1 }, { &ifm_subtype_ieee80211_descriptions[0], 0 }, + { &ifm_subtype_ieee80211_aliases[0], 1 }, { NULL, 0 }, }, { { &ifm_shared_option_descriptions[0], 0 }, - { &ifm_subtype_ieee80211_option_descriptions[0], 1 }, + { &ifm_subtype_ieee80211_option_descriptions[0], 0 }, + { NULL, 0 }, + }, + { + { &ifm_subtype_ieee80211_mode_descriptions[0], 0 }, + { &ifm_subtype_ieee80211_mode_aliases[0], 0 }, { NULL, 0 }, }, }, + { + { + { &ifm_subtype_shared_descriptions[0], 0 }, + { &ifm_subtype_shared_aliases[0], 1 }, + { &ifm_subtype_atm_descriptions[0], 0 }, + { &ifm_subtype_atm_aliases[0], 1 }, + { NULL, 0 }, + }, + { + { &ifm_shared_option_descriptions[0], 0 }, + { &ifm_subtype_atm_option_descriptions[0], 0 }, + { NULL, 0 }, + }, + { + { NULL, 0 }, + }, + }, +#endif }; static int -get_media_subtype(type, val) - int type; - const char *val; +get_media_subtype(int type, const char *val) { struct ifmedia_description *desc; struct ifmedia_type_to_subtype *ttos; @@ -438,13 +558,36 @@ get_media_subtype(type, val) return (rval); } errx(1, "unknown media subtype: %s", val); - /* NOTREACHED */ + /*NOTREACHED*/ +} + +#ifdef notdef +static int +get_media_mode(int type, const char *val) +{ + struct ifmedia_description *desc; + struct ifmedia_type_to_subtype *ttos; + int rval, i; + + /* Find the top-level interface type. */ + for (desc = ifm_type_descriptions, ttos = ifmedia_types_to_subtypes; + desc->ifmt_string != NULL; desc++, ttos++) + if (type == desc->ifmt_word) + break; + if (desc->ifmt_string == NULL) + errx(1, "unknown media mode 0x%x", type); + + for (i = 0; ttos->modes[i].desc != NULL; i++) { + rval = lookup_media_word(ttos->modes[i].desc, val); + if (rval != -1) + return (rval); + } + return -1; } +#endif static int -get_media_options(type, val) - int type; - const char *val; +get_media_options(int type, const char *val) { struct ifmedia_description *desc; struct ifmedia_type_to_subtype *ttos; @@ -485,9 +628,7 @@ get_media_options(type, val) } static int -lookup_media_word(desc, val) - struct ifmedia_description *desc; - const char *val; +lookup_media_word(struct ifmedia_description *desc, const char *val) { for (; desc->ifmt_string != NULL; desc++) @@ -497,22 +638,87 @@ lookup_media_word(desc, val) return (-1); } -static void -print_media_word(ifmw) - int ifmw; +static struct ifmedia_description *get_toptype_desc(int ifmw) +{ + struct ifmedia_description *desc; + + for (desc = ifm_type_descriptions; desc->ifmt_string != NULL; desc++) + if (IFM_TYPE(ifmw) == desc->ifmt_word) + break; + + return desc; +} + +static struct ifmedia_type_to_subtype *get_toptype_ttos(int ifmw) { struct ifmedia_description *desc; struct ifmedia_type_to_subtype *ttos; - int seen_option = 0, i; - /* Find the top-level interface type. */ for (desc = ifm_type_descriptions, ttos = ifmedia_types_to_subtypes; desc->ifmt_string != NULL; desc++, ttos++) if (IFM_TYPE(ifmw) == desc->ifmt_word) break; + + return ttos; +} + +static struct ifmedia_description *get_subtype_desc(int ifmw, + struct ifmedia_type_to_subtype *ttos) +{ + int i; + struct ifmedia_description *desc; + + for (i = 0; ttos->subtypes[i].desc != NULL; i++) { + if (ttos->subtypes[i].alias) + continue; + for (desc = ttos->subtypes[i].desc; + desc->ifmt_string != NULL; desc++) { + if (IFM_SUBTYPE(ifmw) == desc->ifmt_word) + return desc; + } + } + + return NULL; +} + +#ifdef notdef +static struct ifmedia_description *get_mode_desc(int ifmw, + struct ifmedia_type_to_subtype *ttos) +{ + int i; + struct ifmedia_description *desc; + + for (i = 0; ttos->modes[i].desc != NULL; i++) { + if (ttos->modes[i].alias) + continue; + for (desc = ttos->modes[i].desc; + desc->ifmt_string != NULL; desc++) { + if (IFM_MODE(ifmw) == desc->ifmt_word) + return desc; + } + } + + return NULL; +} +#endif + +static void +print_media_word(int ifmw, int print_toptype) +{ + struct ifmedia_description *desc; + struct ifmedia_type_to_subtype *ttos; + int seen_option = 0, i; + + /* Find the top-level interface type. */ + desc = get_toptype_desc(ifmw); + ttos = get_toptype_ttos(ifmw); if (desc->ifmt_string == NULL) { printf(""); return; +#ifdef notdef + } else if (print_toptype) { + printf("%s", desc->ifmt_string); +#endif } /* @@ -521,23 +727,26 @@ print_media_word(ifmw) */ /* Find subtype. */ - for (i = 0; ttos->subtypes[i].desc != NULL; i++) { - if (ttos->subtypes[i].alias) - continue; - for (desc = ttos->subtypes[i].desc; - desc->ifmt_string != NULL; desc++) { - if (IFM_SUBTYPE(ifmw) == desc->ifmt_word) - goto got_subtype; - } + desc = get_subtype_desc(ifmw, ttos); + if (desc == NULL) { + printf(""); + return; } - /* Falling to here means unknown subtype. */ - printf(""); - return; - - got_subtype: +#ifdef notdef + if (print_toptype) + putchar(' '); +#endif + printf("%s", desc->ifmt_string); +#ifdef notdef + if (print_toptype) { + desc = get_mode_desc(ifmw, ttos); + if (desc != NULL && strcasecmp("autoselect", desc->ifmt_string)) + printf(" mode %s", desc->ifmt_string); + } +#endif /* Find options. */ for (i = 0; ttos->options[i].desc != NULL; i++) { if (ttos->options[i].alias) @@ -553,8 +762,92 @@ print_media_word(ifmw) } } printf("%s", seen_option ? ">" : ""); + +#ifdef notdef + if (print_toptype && IFM_INST(ifmw) != 0) + printf(" instance %d", IFM_INST(ifmw)); +#endif +} + +static void +print_media_word_ifconfig(int ifmw) +{ + struct ifmedia_description *desc; + struct ifmedia_type_to_subtype *ttos; + int i; + + /* Find the top-level interface type. */ + desc = get_toptype_desc(ifmw); + ttos = get_toptype_ttos(ifmw); + if (desc->ifmt_string == NULL) { + printf(""); + return; + } + + /* + * Don't print the top-level type; it's not like we can + * change it, or anything. + */ + + /* Find subtype. */ + desc = get_subtype_desc(ifmw, ttos); + if (desc == NULL) { + printf(""); + return; + } + + printf("media %s", desc->ifmt_string); + +#ifdef notdef + desc = get_mode_desc(ifmw, ttos); + if (desc != NULL) + printf(" mode %s", desc->ifmt_string); +#endif + + /* Find options. */ + for (i = 0; ttos->options[i].desc != NULL; i++) { + if (ttos->options[i].alias) + continue; + for (desc = ttos->options[i].desc; + desc->ifmt_string != NULL; desc++) { + if (ifmw & desc->ifmt_word) { + printf(" mediaopt %s", desc->ifmt_string); + } + } + } + + if (IFM_INST(ifmw) != 0) + printf(" instance %d", IFM_INST(ifmw)); } /********************************************************************** * ...until here. **********************************************************************/ + +static struct cmd media_cmds[] = { + DEF_CMD_ARG("media", setmedia), +#ifdef notdef + DEF_CMD_ARG("mode", setmediamode), +#endif + DEF_CMD_ARG("mediaopt", setmediaopt), + DEF_CMD_ARG("-mediaopt",unsetmediaopt), + DEF_CMD_ARG("inst", setmediainst), + DEF_CMD_ARG("instance", setmediainst), +}; +static struct afswtch af_media = { + .af_name = "af_media", + .af_af = AF_UNSPEC, + .af_other_status = media_status, +}; + +static __constructor void +ifmedia_ctor(void) +{ +#define N(a) (sizeof(a) / sizeof(a[0])) + int i; + + for (i = 0; i < N(media_cmds); i++) + cmd_register(&media_cmds[i]); + af_register(&af_media); +#undef N +} diff --git a/ifconfig.tproj/ifvlan.c b/ifconfig.tproj/ifvlan.c index 1a547df..aeb8dad 100644 --- a/ifconfig.tproj/ifvlan.c +++ b/ifconfig.tproj/ifvlan.c @@ -31,9 +31,7 @@ */ #include -#define KERNEL_PRIVATE #include -#undef KERNEL_PRIVATE #include #include @@ -56,75 +54,112 @@ #include "ifconfig.h" -static int __tag = 0; -static int __have_tag = 0; +#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 -void -vlan_status(int s, struct rt_addrinfo *info __unused) -{ - struct vlanreq vreq; +#define NOTAG ((u_short) -1) - bzero((char *)&vreq, sizeof(struct vlanreq)); - ifr.ifr_data = (caddr_t)&vreq; +static struct vlanreq params = { + .vlr_tag = NOTAG, +}; - if (ioctl(s, SIOCGETVLAN, (caddr_t)&ifr) == -1) - return; - - printf("\tvlan: %d parent interface: %s\n", - vreq.vlr_tag, vreq.vlr_parent[0] == '\0' ? - "" : vreq.vlr_parent); +static int +getvlan(int s, struct ifreq *ifr, struct vlanreq *vreq) +{ + bzero((char *)vreq, sizeof(*vreq)); + ifr->ifr_data = (caddr_t)vreq; - return; + return ioctl(s, SIOCGETVLAN, (caddr_t)ifr); } -void -setvlantag(const char *val, int d, int s, const struct afswtch *afp) +static void +vlan_status(int s) { - u_int16_t tag; struct vlanreq vreq; - __tag = tag = atoi(val); - __have_tag = 1; - - bzero((char *)&vreq, sizeof(struct vlanreq)); - ifr.ifr_data = (caddr_t)&vreq; - - if (ioctl(s, SIOCGETVLAN, (caddr_t)&ifr) == -1) - err(1, "SIOCGETVLAN"); - - vreq.vlr_tag = tag; - - if (ioctl(s, SIOCSETVLAN, (caddr_t)&ifr) == -1) - err(1, "SIOCSETVLAN"); - - return; + if (getvlan(s, &ifr, &vreq) != -1) + printf("\tvlan: %d parent interface: %s\n", + vreq.vlr_tag, vreq.vlr_parent[0] == '\0' ? + "" : vreq.vlr_parent); } -void -setvlandev(const char *val, int d, int s, const struct afswtch *afp) +static void +vlan_create(int s, struct ifreq *ifr) { - struct vlanreq vreq; + if (params.vlr_tag != NOTAG || params.vlr_parent[0] != '\0') { + /* + * One or both parameters were specified, make sure both. + */ + if (params.vlr_tag == NOTAG) + errx(1, "must specify a tag for vlan create"); + if (params.vlr_parent[0] == '\0') + errx(1, "must specify a parent device for vlan create"); + ifr->ifr_data = (caddr_t) ¶ms; + } +#if SIOCIFCREATE2 + if (ioctl(s, SIOCIFCREATE2, ifr) < 0) + err(1, "SIOCIFCREATE2"); +#else + if (ioctl(s, SIOCIFCREATE, ifr) < 0) + err(1, "SIOCIFCREATE"); +#endif +} - if (!__have_tag) - errx(1, "must specify both vlan tag and device"); +static void +vlan_cb(int s, void *arg) +{ + if ((params.vlr_tag != NOTAG) ^ (params.vlr_parent[0] != '\0')) + errx(1, "both vlan and vlandev must be specified"); +} - bzero((char *)&vreq, sizeof(struct vlanreq)); - ifr.ifr_data = (caddr_t)&vreq; +static void +vlan_set(int s, struct ifreq *ifr) +{ + if (params.vlr_tag != NOTAG && params.vlr_parent[0] != '\0') { + ifr->ifr_data = (caddr_t) ¶ms; + if (ioctl(s, SIOCSETVLAN, (caddr_t)ifr) == -1) + err(1, "SIOCSETVLAN"); + } +} - if (ioctl(s, SIOCGETVLAN, (caddr_t)&ifr) == -1) - err(1, "SIOCGETVLAN"); +static +DECL_CMD_FUNC(setvlantag, val, d) +{ + struct vlanreq vreq; + u_long ul; + char *endp; + + ul = strtoul(val, &endp, 0); + if (*endp != '\0') + errx(1, "invalid value for vlan"); + params.vlr_tag = ul; + /* check if the value can be represented in vlr_tag */ + if (params.vlr_tag != ul) + errx(1, "value for vlan out of range"); + + if (getvlan(s, &ifr, &vreq) != -1) + vlan_set(s, &ifr); + else + clone_setcallback(vlan_create); +} - strncpy(vreq.vlr_parent, val, sizeof(vreq.vlr_parent)); - vreq.vlr_tag = __tag; +static +DECL_CMD_FUNC(setvlandev, val, d) +{ + struct vlanreq vreq; - if (ioctl(s, SIOCSETVLAN, (caddr_t)&ifr) == -1) - err(1, "SIOCSETVLAN"); + strlcpy(params.vlr_parent, val, sizeof(params.vlr_parent)); - return; + if (getvlan(s, &ifr, &vreq) != -1) + vlan_set(s, &ifr); + else + clone_setcallback(vlan_create); } -void -unsetvlandev(const char *val, int d, int s, const struct afswtch *afp) +static +DECL_CMD_FUNC(unsetvlandev, val, d) { struct vlanreq vreq; @@ -139,6 +174,35 @@ unsetvlandev(const char *val, int d, int s, const struct afswtch *afp) if (ioctl(s, SIOCSETVLAN, (caddr_t)&ifr) == -1) err(1, "SIOCSETVLAN"); +} - return; +static struct cmd vlan_cmds[] = { + DEF_CLONE_CMD_ARG("vlan", setvlantag), + DEF_CLONE_CMD_ARG("vlandev", setvlandev), + /* XXX For compatibility. Should become DEF_CMD() some day. */ + DEF_CMD_OPTARG("-vlandev", unsetvlandev), +#ifdef notdef + DEF_CMD("vlanmtu", IFCAP_VLAN_MTU, setifcap), + DEF_CMD("-vlanmtu", -IFCAP_VLAN_MTU, setifcap), + DEF_CMD("vlanhwtag", IFCAP_VLAN_HWTAGGING, setifcap), + DEF_CMD("-vlanhwtag", -IFCAP_VLAN_HWTAGGING, setifcap), +#endif +}; +static struct afswtch af_vlan = { + .af_name = "af_vlan", + .af_af = AF_UNSPEC, + .af_other_status = vlan_status, +}; + +static __constructor void +vlan_ctor(void) +{ +#define N(a) (sizeof(a) / sizeof(a[0])) + int i; + + for (i = 0; i < N(vlan_cmds); i++) + cmd_register(&vlan_cmds[i]); + af_register(&af_vlan); + callback_register(vlan_cb, NULL); +#undef N } diff --git a/network_cmds.xcodeproj/project.pbxproj b/network_cmds.xcodeproj/project.pbxproj index 01d2554..8bd8b93 100644 --- a/network_cmds.xcodeproj/project.pbxproj +++ b/network_cmds.xcodeproj/project.pbxproj @@ -13,12 +13,17 @@ buildPhases = ( ); dependencies = ( - 72570DB60EE8EC46000F4CFB /* PBXTargetDependency */, - 72570E130EE8F517000F4CFB /* PBXTargetDependency */, - 72570E110EE8F517000F4CFB /* PBXTargetDependency */, - 7251B2080EE9D36800F29440 /* PBXTargetDependency */, - 72570E0F0EE8F517000F4CFB /* PBXTargetDependency */, - 72570E0D0EE8F517000F4CFB /* PBXTargetDependency */, + 034E4464100BDCA3009CA3DC /* PBXTargetDependency */, + 03B2DBD1100BE626005349BC /* PBXTargetDependency */, + 034E4469100BDD00009CA3DC /* PBXTargetDependency */, + 03B2DBC5100BE332005349BC /* PBXTargetDependency */, + 034E4475100BDEC6009CA3DC /* PBXTargetDependency */, + 034E447B100BDF0D009CA3DC /* PBXTargetDependency */, + 03B2DBD3100BE645005349BC /* PBXTargetDependency */, + 034E447F100BDF54009CA3DC /* PBXTargetDependency */, + 03B2DBDB100BE6D2005349BC /* PBXTargetDependency */, + 034E4485100BE15F009CA3DC /* PBXTargetDependency */, + 03B2DBDD100BE6D5005349BC /* PBXTargetDependency */, ); name = "All-Embedded"; productName = "All-Embedded"; @@ -52,6 +57,29 @@ name = All; productName = "network_cmds (Aggregate)"; }; + 72ABD0811083D742008C721C /* All-EmbeddedOther */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 72ABD0A11083D792008C721C /* Build configuration list for PBXAggregateTarget "All-EmbeddedOther" */; + buildPhases = ( + ); + dependencies = ( + 72ABD0A41083D818008C721C /* PBXTargetDependency */, + 72ABD0881083D750008C721C /* PBXTargetDependency */, + 72ABD08A1083D753008C721C /* PBXTargetDependency */, + 72ABD08C1083D75D008C721C /* PBXTargetDependency */, + 72ABD08E1083D75F008C721C /* PBXTargetDependency */, + 72ABD0901083D762008C721C /* PBXTargetDependency */, + 72ABD0921083D764008C721C /* PBXTargetDependency */, + 72ABD0941083D767008C721C /* PBXTargetDependency */, + 72ABD0961083D76A008C721C /* PBXTargetDependency */, + 72ABD0981083D76D008C721C /* PBXTargetDependency */, + 72ABD09A1083D76F008C721C /* PBXTargetDependency */, + 72ABD09C1083D772008C721C /* PBXTargetDependency */, + 72ABD09E1083D774008C721C /* PBXTargetDependency */, + ); + name = "All-EmbeddedOther"; + productName = "All-EmbeddedOther"; + }; /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ @@ -111,26 +139,6 @@ 724DABF90EE89269008900D0 /* libalias.A.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 7261210C0EE8707500AFED1B /* libalias.A.dylib */; }; 724DAC120EE89423008900D0 /* ndp.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120870EE86F4000AFED1B /* ndp.c */; }; 724DAC3B0EE89555008900D0 /* ndp.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 726120860EE86F4000AFED1B /* ndp.8 */; }; - 7251B1F80EE9D2AB00F29440 /* ping.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120A10EE86F5000AFED1B /* ping.c */; }; - 72570DAB0EE8EC2E000F4CFB /* arp.c in Sources */ = {isa = PBXBuildFile; fileRef = 7261204E0EE86EF900AFED1B /* arp.c */; }; - 72570DC10EE8F49A000F4CFB /* ifconfig.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120570EE86F0900AFED1B /* ifconfig.c */; }; - 72570DC20EE8F49A000F4CFB /* ifmedia.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120590EE86F0900AFED1B /* ifmedia.c */; }; - 72570DD40EE8F4C4000F4CFB /* data.c in Sources */ = {isa = PBXBuildFile; fileRef = 7261208B0EE86F4800AFED1B /* data.c */; }; - 72570DD50EE8F4C4000F4CFB /* if.c in Sources */ = {isa = PBXBuildFile; fileRef = 7261208D0EE86F4800AFED1B /* if.c */; }; - 72570DD60EE8F4C4000F4CFB /* inet.c in Sources */ = {isa = PBXBuildFile; fileRef = 7261208E0EE86F4800AFED1B /* inet.c */; }; - 72570DD80EE8F4C4000F4CFB /* ipsec.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120900EE86F4800AFED1B /* ipsec.c */; }; - 72570DD90EE8F4C4000F4CFB /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120910EE86F4800AFED1B /* main.c */; }; - 72570DDA0EE8F4C4000F4CFB /* mbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120930EE86F4800AFED1B /* mbuf.c */; }; - 72570DDB0EE8F4C4000F4CFB /* mcast.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120940EE86F4800AFED1B /* mcast.c */; }; - 72570DDE0EE8F4C4000F4CFB /* route.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120990EE86F4800AFED1B /* route.c */; }; - 72570DDF0EE8F4C4000F4CFB /* tp_astring.c in Sources */ = {isa = PBXBuildFile; fileRef = 7261209A0EE86F4800AFED1B /* tp_astring.c */; }; - 72570DE00EE8F4C4000F4CFB /* unix.c in Sources */ = {isa = PBXBuildFile; fileRef = 7261209B0EE86F4800AFED1B /* unix.c */; }; - 72570DF00EE8F4DE000F4CFB /* route.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120B80EE86F7200AFED1B /* route.c */; }; - 72570DFE0EE8F4EA000F4CFB /* as.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120E50EE86FA700AFED1B /* as.c */; }; - 72570DFF0EE8F4EA000F4CFB /* findsaddr-socket.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120E70EE86FA700AFED1B /* findsaddr-socket.c */; }; - 72570E000EE8F4EA000F4CFB /* ifaddrlist.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120EA0EE86FA700AFED1B /* ifaddrlist.c */; }; - 72570E010EE8F4EA000F4CFB /* traceroute.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120F10EE86FA700AFED1B /* traceroute.c */; }; - 72570E020EE8F4EA000F4CFB /* version.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120F30EE86FA700AFED1B /* version.c */; }; 726121110EE870AB00AFED1B /* alias.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120390EE86EEB00AFED1B /* alias.c */; }; 726121130EE870AB00AFED1B /* alias_cuseeme.c in Sources */ = {isa = PBXBuildFile; fileRef = 7261203B0EE86EEB00AFED1B /* alias_cuseeme.c */; }; 726121140EE870AB00AFED1B /* alias_db.c in Sources */ = {isa = PBXBuildFile; fileRef = 7261203C0EE86EEB00AFED1B /* alias_db.c */; }; @@ -164,6 +172,11 @@ 7294F12E0EE8BD2F0052EC88 /* traceroute6.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120FB0EE86FB500AFED1B /* traceroute6.c */; }; 7294F1320EE8BD430052EC88 /* traceroute6.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 726120FA0EE86FB500AFED1B /* traceroute6.8 */; }; 72B894EC0EEDB17C00C218D6 /* libipsec.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 72CD1DB50EE8C619005F825D /* libipsec.dylib */; }; + 72E650A7107BF2F000AAF325 /* af_inet.c in Sources */ = {isa = PBXBuildFile; fileRef = 72E650A2107BF2F000AAF325 /* af_inet.c */; }; + 72E650A8107BF2F000AAF325 /* af_inet6.c in Sources */ = {isa = PBXBuildFile; fileRef = 72E650A3107BF2F000AAF325 /* af_inet6.c */; }; + 72E650A9107BF2F000AAF325 /* af_link.c in Sources */ = {isa = PBXBuildFile; fileRef = 72E650A4107BF2F000AAF325 /* af_link.c */; }; + 72E650AA107BF2F000AAF325 /* ifbridge.c in Sources */ = {isa = PBXBuildFile; fileRef = 72E650A5107BF2F000AAF325 /* ifbridge.c */; }; + 72E650AB107BF2F000AAF325 /* ifclone.c in Sources */ = {isa = PBXBuildFile; fileRef = 72E650A6107BF2F000AAF325 /* ifclone.c */; }; /* End PBXBuildFile section */ /* Begin PBXBuildRule section */ @@ -182,6 +195,83 @@ /* End PBXBuildRule section */ /* Begin PBXContainerItemProxy section */ + 034E4463100BDCA3009CA3DC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7261212C0EE8710B00AFED1B; + remoteInfo = arp; + }; + 034E4468100BDD00009CA3DC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 726121530EE8881700AFED1B; + remoteInfo = ifconfig; + }; + 034E4474100BDEC6009CA3DC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7216D2450EE896C000AE70E4; + remoteInfo = netstat; + }; + 034E447A100BDF0D009CA3DC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7216D27B0EE8980A00AE70E4; + remoteInfo = ping; + }; + 034E447E100BDF54009CA3DC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7216D2EC0EE89CBC00AE70E4; + remoteInfo = route; + }; + 034E4484100BE15F009CA3DC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7294F0F80EE8BB460052EC88; + remoteInfo = traceroute; + }; + 03B2DBC4100BE332005349BC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 726121820EE8897C00AFED1B; + remoteInfo = ip6conf; + }; + 03B2DBD0100BE626005349BC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 724DAC0C0EE8940D008900D0; + remoteInfo = ndp; + }; + 03B2DBD2100BE645005349BC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7216D2990EE898BD00AE70E4; + remoteInfo = ping6; + }; + 03B2DBDA100BE6D2005349BC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7216D3580EE8A02200AE70E4; + remoteInfo = rtsol; + }; + 03B2DBDC100BE6D5005349BC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7294F1290EE8BD280052EC88; + remoteInfo = traceroute6; + }; 7216D2660EE8978F00AE70E4 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; @@ -266,90 +356,139 @@ remoteGlobalIDString = 724DAC0C0EE8940D008900D0; remoteInfo = ndp; }; - 7251B2070EE9D36800F29440 /* PBXContainerItemProxy */ = { + 726121460EE8717B00AFED1B /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; proxyType = 1; - remoteGlobalIDString = 7251B1F60EE9D2AB00F29440; - remoteInfo = "ping embedded"; + remoteGlobalIDString = 7261210B0EE8707500AFED1B; + remoteInfo = alias; }; - 72570DB50EE8EC46000F4CFB /* PBXContainerItemProxy */ = { + 726121480EE8717B00AFED1B /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; proxyType = 1; - remoteGlobalIDString = 72570DA90EE8EC2E000F4CFB; - remoteInfo = "arp-embedded"; + remoteGlobalIDString = 7261212C0EE8710B00AFED1B; + remoteInfo = arp; }; - 72570E0C0EE8F517000F4CFB /* PBXContainerItemProxy */ = { + 7261217C0EE8896800AFED1B /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; proxyType = 1; - remoteGlobalIDString = 72570DFC0EE8F4EA000F4CFB; - remoteInfo = "traceroute embedded"; + remoteGlobalIDString = 726121530EE8881700AFED1B; + remoteInfo = ifconfig; }; - 72570E0E0EE8F517000F4CFB /* PBXContainerItemProxy */ = { + 726121B20EE88B7900AFED1B /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; proxyType = 1; - remoteGlobalIDString = 72570DEE0EE8F4DE000F4CFB; - remoteInfo = "route embedded"; + remoteGlobalIDString = 726121820EE8897C00AFED1B; + remoteInfo = ip6conf; }; - 72570E100EE8F517000F4CFB /* PBXContainerItemProxy */ = { + 7294F0E90EE8BAC80052EC88 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; proxyType = 1; - remoteGlobalIDString = 72570DD20EE8F4C4000F4CFB; - remoteInfo = "netstat embedded"; + remoteGlobalIDString = 7216D3A60EE8A3BA00AE70E4; + remoteInfo = spray; }; - 72570E120EE8F517000F4CFB /* PBXContainerItemProxy */ = { + 7294F1200EE8BCC20052EC88 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; proxyType = 1; - remoteGlobalIDString = 72570DBE0EE8F49A000F4CFB; - remoteInfo = "ifconfig embedded"; + remoteGlobalIDString = 7294F0F80EE8BB460052EC88; + remoteInfo = traceroute; }; - 726121460EE8717B00AFED1B /* PBXContainerItemProxy */ = { + 72ABD0871083D750008C721C /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; proxyType = 1; - remoteGlobalIDString = 7261210B0EE8707500AFED1B; - remoteInfo = alias; + remoteGlobalIDString = 726121530EE8881700AFED1B /* ifconfig */; + remoteInfo = ifconfig; }; - 726121480EE8717B00AFED1B /* PBXContainerItemProxy */ = { + 72ABD0891083D753008C721C /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; proxyType = 1; - remoteGlobalIDString = 7261212C0EE8710B00AFED1B; - remoteInfo = arp; + remoteGlobalIDString = 726121820EE8897C00AFED1B /* ip6conf */; + remoteInfo = ip6conf; }; - 7261217C0EE8896800AFED1B /* PBXContainerItemProxy */ = { + 72ABD08B1083D75D008C721C /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; proxyType = 1; - remoteGlobalIDString = 726121530EE8881700AFED1B; - remoteInfo = ifconfig; + remoteGlobalIDString = 724DAC0C0EE8940D008900D0 /* ndp */; + remoteInfo = ndp; }; - 726121B20EE88B7900AFED1B /* PBXContainerItemProxy */ = { + 72ABD08D1083D75F008C721C /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; proxyType = 1; - remoteGlobalIDString = 726121820EE8897C00AFED1B; - remoteInfo = ip6conf; + remoteGlobalIDString = 7216D2450EE896C000AE70E4 /* netstat */; + remoteInfo = netstat; }; - 7294F0E90EE8BAC80052EC88 /* PBXContainerItemProxy */ = { + 72ABD08F1083D762008C721C /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; proxyType = 1; - remoteGlobalIDString = 7216D3A60EE8A3BA00AE70E4; - remoteInfo = spray; + remoteGlobalIDString = 7216D27B0EE8980A00AE70E4 /* ping */; + remoteInfo = ping; }; - 7294F1200EE8BCC20052EC88 /* PBXContainerItemProxy */ = { + 72ABD0911083D764008C721C /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; proxyType = 1; - remoteGlobalIDString = 7294F0F80EE8BB460052EC88; + remoteGlobalIDString = 7216D2990EE898BD00AE70E4 /* ping6 */; + remoteInfo = ping6; + }; + 72ABD0931083D767008C721C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7216D2CC0EE89B7900AE70E4 /* rarpd */; + remoteInfo = rarpd; + }; + 72ABD0951083D76A008C721C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7216D2EC0EE89CBC00AE70E4 /* route */; + remoteInfo = route; + }; + 72ABD0971083D76D008C721C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7216D3130EE89E9E00AE70E4 /* rtadvd */; + remoteInfo = rtadvd; + }; + 72ABD0991083D76F008C721C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7216D3580EE8A02200AE70E4 /* rtsol */; + remoteInfo = rtsol; + }; + 72ABD09B1083D772008C721C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7294F0F80EE8BB460052EC88 /* traceroute */; remoteInfo = traceroute; }; + 72ABD09D1083D774008C721C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7294F1290EE8BD280052EC88 /* traceroute6 */; + remoteInfo = traceroute6; + }; + 72ABD0A31083D818008C721C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7261212C0EE8710B00AFED1B /* arp */; + remoteInfo = arp; + }; 72CD1D9B0EE8C47C005F825D /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 724862310EE86EB7001D0DE9 /* Project object */; @@ -608,12 +747,6 @@ 724DABA20EE88FE3008900D0 /* kdumpd */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = kdumpd; sourceTree = BUILT_PRODUCTS_DIR; }; 724DABDB0EE8912D008900D0 /* natd */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = natd; sourceTree = BUILT_PRODUCTS_DIR; }; 724DAC0D0EE8940D008900D0 /* ndp */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ndp; sourceTree = BUILT_PRODUCTS_DIR; }; - 7251B2000EE9D2AB00F29440 /* ping */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ping; sourceTree = BUILT_PRODUCTS_DIR; }; - 72570DB30EE8EC2E000F4CFB /* arp */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = arp; sourceTree = BUILT_PRODUCTS_DIR; }; - 72570DCB0EE8F49A000F4CFB /* ifconfig */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ifconfig; sourceTree = BUILT_PRODUCTS_DIR; }; - 72570DE80EE8F4C4000F4CFB /* netstat */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = netstat; sourceTree = BUILT_PRODUCTS_DIR; }; - 72570DF80EE8F4DE000F4CFB /* route */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = route; sourceTree = BUILT_PRODUCTS_DIR; }; - 72570E0A0EE8F4EA000F4CFB /* traceroute */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = traceroute; sourceTree = BUILT_PRODUCTS_DIR; }; 726120390EE86EEB00AFED1B /* alias.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = alias.c; sourceTree = ""; }; 7261203B0EE86EEB00AFED1B /* alias_cuseeme.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = alias_cuseeme.c; sourceTree = ""; }; 7261203C0EE86EEB00AFED1B /* alias_db.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = alias_db.c; sourceTree = ""; }; @@ -745,6 +878,11 @@ 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; }; 72CD1DB50EE8C619005F825D /* libipsec.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libipsec.dylib; path = /usr/lib/libipsec.dylib; sourceTree = ""; }; + 72E650A2107BF2F000AAF325 /* af_inet.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = af_inet.c; sourceTree = ""; }; + 72E650A3107BF2F000AAF325 /* af_inet6.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = af_inet6.c; sourceTree = ""; }; + 72E650A4107BF2F000AAF325 /* af_link.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = af_link.c; sourceTree = ""; }; + 72E650A5107BF2F000AAF325 /* ifbridge.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ifbridge.c; sourceTree = ""; }; + 72E650A6107BF2F000AAF325 /* ifclone.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ifclone.c; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -841,48 +979,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 7251B1F90EE9D2AB00F29440 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 72570DAC0EE8EC2E000F4CFB /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 72570DC40EE8F49A000F4CFB /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 72570DE10EE8F4C4000F4CFB /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 72570DF10EE8F4DE000F4CFB /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 72570E030EE8F4EA000F4CFB /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; 7261210A0EE8707500AFED1B /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -989,6 +1085,11 @@ 726120540EE86F0900AFED1B /* ifconfig.tproj */ = { isa = PBXGroup; children = ( + 72E650A2107BF2F000AAF325 /* af_inet.c */, + 72E650A3107BF2F000AAF325 /* af_inet6.c */, + 72E650A4107BF2F000AAF325 /* af_link.c */, + 72E650A5107BF2F000AAF325 /* ifbridge.c */, + 72E650A6107BF2F000AAF325 /* ifclone.c */, 726120550EE86F0900AFED1B /* ifbond.c */, 726120560EE86F0900AFED1B /* ifconfig.8 */, 726120570EE86F0900AFED1B /* ifconfig.c */, @@ -1235,12 +1336,6 @@ 7216D3A70EE8A3BB00AE70E4 /* spray */, 7294F0F90EE8BB460052EC88 /* traceroute */, 7294F12A0EE8BD280052EC88 /* traceroute6 */, - 72570DB30EE8EC2E000F4CFB /* arp */, - 72570DCB0EE8F49A000F4CFB /* ifconfig */, - 72570DE80EE8F4C4000F4CFB /* netstat */, - 72570DF80EE8F4DE000F4CFB /* route */, - 72570E0A0EE8F4EA000F4CFB /* traceroute */, - 7251B2000EE9D2AB00F29440 /* ping */, ); name = Products; sourceTree = ""; @@ -1496,102 +1591,6 @@ productReference = 724DAC0D0EE8940D008900D0 /* ndp */; productType = "com.apple.product-type.tool"; }; - 7251B1F60EE9D2AB00F29440 /* ping embedded */ = { - isa = PBXNativeTarget; - buildConfigurationList = 7251B1FD0EE9D2AB00F29440 /* Build configuration list for PBXNativeTarget "ping embedded" */; - buildPhases = ( - 7251B1F70EE9D2AB00F29440 /* Sources */, - 7251B1F90EE9D2AB00F29440 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "ping embedded"; - productName = ping; - productReference = 7251B2000EE9D2AB00F29440 /* ping */; - productType = "com.apple.product-type.tool"; - }; - 72570DA90EE8EC2E000F4CFB /* arp embedded */ = { - isa = PBXNativeTarget; - buildConfigurationList = 72570DB00EE8EC2E000F4CFB /* Build configuration list for PBXNativeTarget "arp embedded" */; - buildPhases = ( - 72570DAA0EE8EC2E000F4CFB /* Sources */, - 72570DAC0EE8EC2E000F4CFB /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "arp embedded"; - productName = arp; - productReference = 72570DB30EE8EC2E000F4CFB /* arp */; - productType = "com.apple.product-type.tool"; - }; - 72570DBE0EE8F49A000F4CFB /* ifconfig embedded */ = { - isa = PBXNativeTarget; - buildConfigurationList = 72570DC80EE8F49A000F4CFB /* Build configuration list for PBXNativeTarget "ifconfig embedded" */; - buildPhases = ( - 72570DBF0EE8F49A000F4CFB /* Sources */, - 72570DC40EE8F49A000F4CFB /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "ifconfig embedded"; - productName = ifconfig; - productReference = 72570DCB0EE8F49A000F4CFB /* ifconfig */; - productType = "com.apple.product-type.tool"; - }; - 72570DD20EE8F4C4000F4CFB /* netstat embedded */ = { - isa = PBXNativeTarget; - buildConfigurationList = 72570DE50EE8F4C4000F4CFB /* Build configuration list for PBXNativeTarget "netstat embedded" */; - buildPhases = ( - 72570DD30EE8F4C4000F4CFB /* Sources */, - 72570DE10EE8F4C4000F4CFB /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "netstat embedded"; - productName = netstat; - productReference = 72570DE80EE8F4C4000F4CFB /* netstat */; - productType = "com.apple.product-type.tool"; - }; - 72570DEE0EE8F4DE000F4CFB /* route embedded */ = { - isa = PBXNativeTarget; - buildConfigurationList = 72570DF50EE8F4DE000F4CFB /* Build configuration list for PBXNativeTarget "route embedded" */; - buildPhases = ( - 72570DEF0EE8F4DE000F4CFB /* Sources */, - 72570DF10EE8F4DE000F4CFB /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "route embedded"; - productName = route; - productReference = 72570DF80EE8F4DE000F4CFB /* route */; - productType = "com.apple.product-type.tool"; - }; - 72570DFC0EE8F4EA000F4CFB /* traceroute embedded */ = { - isa = PBXNativeTarget; - buildConfigurationList = 72570E070EE8F4EA000F4CFB /* Build configuration list for PBXNativeTarget "traceroute embedded" */; - buildPhases = ( - 72570DFD0EE8F4EA000F4CFB /* Sources */, - 72570E030EE8F4EA000F4CFB /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "traceroute embedded"; - productName = traceroute; - productReference = 72570E0A0EE8F4EA000F4CFB /* traceroute */; - productType = "com.apple.product-type.tool"; - }; 7261210B0EE8707500AFED1B /* alias */ = { isa = PBXNativeTarget; buildConfigurationList = 726121100EE8707600AFED1B /* Build configuration list for PBXNativeTarget "alias" */; @@ -1716,6 +1715,8 @@ projectRoot = ""; targets = ( 726121430EE8717500AFED1B /* All */, + 72570DA20EE8EBF3000F4CFB /* All-Embedded */, + 72ABD0811083D742008C721C /* All-EmbeddedOther */, 7261210B0EE8707500AFED1B /* alias */, 7261212C0EE8710B00AFED1B /* arp */, 726121530EE8881700AFED1B /* ifconfig */, @@ -1735,13 +1736,6 @@ 7216D3A60EE8A3BA00AE70E4 /* spray */, 7294F0F80EE8BB460052EC88 /* traceroute */, 7294F1290EE8BD280052EC88 /* traceroute6 */, - 72570DA20EE8EBF3000F4CFB /* All-Embedded */, - 72570DA90EE8EC2E000F4CFB /* arp embedded */, - 72570DBE0EE8F49A000F4CFB /* ifconfig embedded */, - 72570DD20EE8F4C4000F4CFB /* netstat embedded */, - 7251B1F60EE9D2AB00F29440 /* ping embedded */, - 72570DEE0EE8F4DE000F4CFB /* route embedded */, - 72570DFC0EE8F4EA000F4CFB /* traceroute embedded */, ); }; /* End PBXProject section */ @@ -2128,86 +2122,24 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 7251B1F70EE9D2AB00F29440 /* Sources */ = { + 726121090EE8707500AFED1B /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 7251B1F80EE9D2AB00F29440 /* ping.c in Sources */, + 726121110EE870AB00AFED1B /* alias.c in Sources */, + 726121130EE870AB00AFED1B /* alias_cuseeme.c in Sources */, + 726121140EE870AB00AFED1B /* alias_db.c in Sources */, + 726121150EE870AB00AFED1B /* alias_ftp.c in Sources */, + 726121160EE870AB00AFED1B /* alias_irc.c in Sources */, + 726121180EE870AB00AFED1B /* alias_nbt.c in Sources */, + 726121190EE870AB00AFED1B /* alias_pptp.c in Sources */, + 7261211A0EE870AB00AFED1B /* alias_proxy.c in Sources */, + 7261211B0EE870AB00AFED1B /* alias_smedia.c in Sources */, + 7261211C0EE870AB00AFED1B /* alias_util.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 72570DAA0EE8EC2E000F4CFB /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 72570DAB0EE8EC2E000F4CFB /* arp.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 72570DBF0EE8F49A000F4CFB /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 72570DC10EE8F49A000F4CFB /* ifconfig.c in Sources */, - 72570DC20EE8F49A000F4CFB /* ifmedia.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 72570DD30EE8F4C4000F4CFB /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 72570DD40EE8F4C4000F4CFB /* data.c in Sources */, - 72570DD50EE8F4C4000F4CFB /* if.c in Sources */, - 72570DD60EE8F4C4000F4CFB /* inet.c in Sources */, - 72570DD80EE8F4C4000F4CFB /* ipsec.c in Sources */, - 72570DD90EE8F4C4000F4CFB /* main.c in Sources */, - 72570DDA0EE8F4C4000F4CFB /* mbuf.c in Sources */, - 72570DDB0EE8F4C4000F4CFB /* mcast.c in Sources */, - 72570DDE0EE8F4C4000F4CFB /* route.c in Sources */, - 72570DDF0EE8F4C4000F4CFB /* tp_astring.c in Sources */, - 72570DE00EE8F4C4000F4CFB /* unix.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 72570DEF0EE8F4DE000F4CFB /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 72570DF00EE8F4DE000F4CFB /* route.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 72570DFD0EE8F4EA000F4CFB /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 72570DFE0EE8F4EA000F4CFB /* as.c in Sources */, - 72570DFF0EE8F4EA000F4CFB /* findsaddr-socket.c in Sources */, - 72570E000EE8F4EA000F4CFB /* ifaddrlist.c in Sources */, - 72570E010EE8F4EA000F4CFB /* traceroute.c in Sources */, - 72570E020EE8F4EA000F4CFB /* version.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 726121090EE8707500AFED1B /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 726121110EE870AB00AFED1B /* alias.c in Sources */, - 726121130EE870AB00AFED1B /* alias_cuseeme.c in Sources */, - 726121140EE870AB00AFED1B /* alias_db.c in Sources */, - 726121150EE870AB00AFED1B /* alias_ftp.c in Sources */, - 726121160EE870AB00AFED1B /* alias_irc.c in Sources */, - 726121180EE870AB00AFED1B /* alias_nbt.c in Sources */, - 726121190EE870AB00AFED1B /* alias_pptp.c in Sources */, - 7261211A0EE870AB00AFED1B /* alias_proxy.c in Sources */, - 7261211B0EE870AB00AFED1B /* alias_smedia.c in Sources */, - 7261211C0EE870AB00AFED1B /* alias_util.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 7261212A0EE8710B00AFED1B /* Sources */ = { + 7261212A0EE8710B00AFED1B /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( @@ -2223,6 +2155,11 @@ 7261215B0EE8883900AFED1B /* ifconfig.c in Sources */, 7261215C0EE8883900AFED1B /* ifmedia.c in Sources */, 7261215D0EE8883900AFED1B /* ifvlan.c in Sources */, + 72E650A7107BF2F000AAF325 /* af_inet.c in Sources */, + 72E650A8107BF2F000AAF325 /* af_inet6.c in Sources */, + 72E650A9107BF2F000AAF325 /* af_link.c in Sources */, + 72E650AA107BF2F000AAF325 /* ifbridge.c in Sources */, + 72E650AB107BF2F000AAF325 /* ifclone.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2257,6 +2194,61 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ + 034E4464100BDCA3009CA3DC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7261212C0EE8710B00AFED1B /* arp */; + targetProxy = 034E4463100BDCA3009CA3DC /* PBXContainerItemProxy */; + }; + 034E4469100BDD00009CA3DC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 726121530EE8881700AFED1B /* ifconfig */; + targetProxy = 034E4468100BDD00009CA3DC /* PBXContainerItemProxy */; + }; + 034E4475100BDEC6009CA3DC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7216D2450EE896C000AE70E4 /* netstat */; + targetProxy = 034E4474100BDEC6009CA3DC /* PBXContainerItemProxy */; + }; + 034E447B100BDF0D009CA3DC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7216D27B0EE8980A00AE70E4 /* ping */; + targetProxy = 034E447A100BDF0D009CA3DC /* PBXContainerItemProxy */; + }; + 034E447F100BDF54009CA3DC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7216D2EC0EE89CBC00AE70E4 /* route */; + targetProxy = 034E447E100BDF54009CA3DC /* PBXContainerItemProxy */; + }; + 034E4485100BE15F009CA3DC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7294F0F80EE8BB460052EC88 /* traceroute */; + targetProxy = 034E4484100BE15F009CA3DC /* PBXContainerItemProxy */; + }; + 03B2DBC5100BE332005349BC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 726121820EE8897C00AFED1B /* ip6conf */; + targetProxy = 03B2DBC4100BE332005349BC /* PBXContainerItemProxy */; + }; + 03B2DBD1100BE626005349BC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 724DAC0C0EE8940D008900D0 /* ndp */; + targetProxy = 03B2DBD0100BE626005349BC /* PBXContainerItemProxy */; + }; + 03B2DBD3100BE645005349BC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7216D2990EE898BD00AE70E4 /* ping6 */; + targetProxy = 03B2DBD2100BE645005349BC /* PBXContainerItemProxy */; + }; + 03B2DBDB100BE6D2005349BC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7216D3580EE8A02200AE70E4 /* rtsol */; + targetProxy = 03B2DBDA100BE6D2005349BC /* PBXContainerItemProxy */; + }; + 03B2DBDD100BE6D5005349BC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7294F1290EE8BD280052EC88 /* traceroute6 */; + targetProxy = 03B2DBDC100BE6D5005349BC /* PBXContainerItemProxy */; + }; 7216D2670EE8978F00AE70E4 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 7216D2450EE896C000AE70E4 /* netstat */; @@ -2317,36 +2309,6 @@ target = 724DAC0C0EE8940D008900D0 /* ndp */; targetProxy = 724DAC230EE89525008900D0 /* PBXContainerItemProxy */; }; - 7251B2080EE9D36800F29440 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 7251B1F60EE9D2AB00F29440 /* ping embedded */; - targetProxy = 7251B2070EE9D36800F29440 /* PBXContainerItemProxy */; - }; - 72570DB60EE8EC46000F4CFB /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 72570DA90EE8EC2E000F4CFB /* arp embedded */; - targetProxy = 72570DB50EE8EC46000F4CFB /* PBXContainerItemProxy */; - }; - 72570E0D0EE8F517000F4CFB /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 72570DFC0EE8F4EA000F4CFB /* traceroute embedded */; - targetProxy = 72570E0C0EE8F517000F4CFB /* PBXContainerItemProxy */; - }; - 72570E0F0EE8F517000F4CFB /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 72570DEE0EE8F4DE000F4CFB /* route embedded */; - targetProxy = 72570E0E0EE8F517000F4CFB /* PBXContainerItemProxy */; - }; - 72570E110EE8F517000F4CFB /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 72570DD20EE8F4C4000F4CFB /* netstat embedded */; - targetProxy = 72570E100EE8F517000F4CFB /* PBXContainerItemProxy */; - }; - 72570E130EE8F517000F4CFB /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 72570DBE0EE8F49A000F4CFB /* ifconfig embedded */; - targetProxy = 72570E120EE8F517000F4CFB /* PBXContainerItemProxy */; - }; 726121470EE8717B00AFED1B /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 7261210B0EE8707500AFED1B /* alias */; @@ -2377,6 +2339,71 @@ target = 7294F0F80EE8BB460052EC88 /* traceroute */; targetProxy = 7294F1200EE8BCC20052EC88 /* PBXContainerItemProxy */; }; + 72ABD0881083D750008C721C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 726121530EE8881700AFED1B /* ifconfig */; + targetProxy = 72ABD0871083D750008C721C /* PBXContainerItemProxy */; + }; + 72ABD08A1083D753008C721C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 726121820EE8897C00AFED1B /* ip6conf */; + targetProxy = 72ABD0891083D753008C721C /* PBXContainerItemProxy */; + }; + 72ABD08C1083D75D008C721C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 724DAC0C0EE8940D008900D0 /* ndp */; + targetProxy = 72ABD08B1083D75D008C721C /* PBXContainerItemProxy */; + }; + 72ABD08E1083D75F008C721C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7216D2450EE896C000AE70E4 /* netstat */; + targetProxy = 72ABD08D1083D75F008C721C /* PBXContainerItemProxy */; + }; + 72ABD0901083D762008C721C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7216D27B0EE8980A00AE70E4 /* ping */; + targetProxy = 72ABD08F1083D762008C721C /* PBXContainerItemProxy */; + }; + 72ABD0921083D764008C721C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7216D2990EE898BD00AE70E4 /* ping6 */; + targetProxy = 72ABD0911083D764008C721C /* PBXContainerItemProxy */; + }; + 72ABD0941083D767008C721C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7216D2CC0EE89B7900AE70E4 /* rarpd */; + targetProxy = 72ABD0931083D767008C721C /* PBXContainerItemProxy */; + }; + 72ABD0961083D76A008C721C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7216D2EC0EE89CBC00AE70E4 /* route */; + targetProxy = 72ABD0951083D76A008C721C /* PBXContainerItemProxy */; + }; + 72ABD0981083D76D008C721C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7216D3130EE89E9E00AE70E4 /* rtadvd */; + targetProxy = 72ABD0971083D76D008C721C /* PBXContainerItemProxy */; + }; + 72ABD09A1083D76F008C721C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7216D3580EE8A02200AE70E4 /* rtsol */; + targetProxy = 72ABD0991083D76F008C721C /* PBXContainerItemProxy */; + }; + 72ABD09C1083D772008C721C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7294F0F80EE8BB460052EC88 /* traceroute */; + targetProxy = 72ABD09B1083D772008C721C /* PBXContainerItemProxy */; + }; + 72ABD09E1083D774008C721C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7294F1290EE8BD280052EC88 /* traceroute6 */; + targetProxy = 72ABD09D1083D774008C721C /* PBXContainerItemProxy */; + }; + 72ABD0A41083D818008C721C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7261212C0EE8710B00AFED1B /* arp */; + targetProxy = 72ABD0A31083D818008C721C /* PBXContainerItemProxy */; + }; 72CD1D9C0EE8C47C005F825D /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 7294F1290EE8BD280052EC88 /* traceroute6 */; @@ -2385,336 +2412,269 @@ /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ - 7216D2480EE896C100AE70E4 /* Debug */ = { + 03B2DBE2100BE71D005349BC /* Ignore Me */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; + COPY_PHASE_STRIP = YES; + DEAD_CODE_STRIPPING = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + "DEBUG_INFORMATION_FORMAT[sdk=iphoneos*][arch=*]" = dwarf; + GCC_DYNAMIC_NO_PIC = YES; GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - INET6, - IPSEC, - ); - HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; - INSTALL_GROUP = wheel; - INSTALL_MODE_FLAG = 0555; - INSTALL_OWNER = root; - INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", + "GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*][arch=*]" = ( + "$(inherited)", + "TARGET_OS_EMBEDDED=1", ); + GCC_TREAT_WARNINGS_AS_ERRORS = YES; PREBINDING = NO; - PRODUCT_NAME = netstat; + SDKROOT = iphoneos3.1; + "STRIPFLAGS[sdk=iphoneos*]" = "-S"; + WARNING_CFLAGS = "-Wall"; + ZERO_LINK = NO; }; - name = Debug; + name = "Ignore Me"; }; - 7216D2490EE896C100AE70E4 /* Release */ = { + 03B2DBE3100BE71D005349BC /* Ignore Me */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; - GCC_PREPROCESSOR_DEFINITIONS = ( - INET6, - IPSEC, - ); - HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; - INSTALL_GROUP = wheel; - INSTALL_MODE_FLAG = 0555; - INSTALL_OWNER = root; - INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; - PRODUCT_NAME = netstat; + PRODUCT_NAME = network_cmds; ZERO_LINK = NO; }; - name = Release; + name = "Ignore Me"; }; - 7216D27E0EE8980B00AE70E4 /* Debug */ = { + 03B2DBE4100BE71D005349BC /* Ignore Me */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; - INSTALL_GROUP = wheel; - INSTALL_MODE_FLAG = 0555; - INSTALL_OWNER = root; - INSTALL_PATH = /sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; - PRODUCT_NAME = ping; + PRODUCT_NAME = network_cmds; }; - name = Debug; + name = "Ignore Me"; }; - 7216D27F0EE8980B00AE70E4 /* Release */ = { + 03B2DBE5100BE71D005349BC /* Ignore Me */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEAD_CODE_STRIPPING = YES; + DYLIB_CURRENT_VERSION = 1; + EXECUTABLE_PREFIX = lib; + GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_MODEL_TUNING = G5; - HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; - INSTALL_PATH = /sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); + INSTALL_PATH = /usr/lib; PREBINDING = NO; - PRODUCT_NAME = ping; + PRODUCT_NAME = alias.A; ZERO_LINK = NO; }; - name = Release; + name = "Ignore Me"; }; - 7216D29C0EE898BE00AE70E4 /* Debug */ = { + 03B2DBE6100BE71D005349BC /* Ignore Me */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; - INSTALL_PATH = /sbin; - PREBINDING = NO; - PRODUCT_NAME = ping6; + INSTALL_PATH = /usr/sbin; + PRODUCT_NAME = arp; }; - name = Debug; + name = "Ignore Me"; }; - 7216D29D0EE898BE00AE70E4 /* Release */ = { + 03B2DBE7100BE71D005349BC /* Ignore Me */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + USE_IF_MEDIA, + NO_IPX, INET6, - IPSEC_DEBUG, - KAME_SCOPEID, - IPSEC, ); + "GCC_PREPROCESSOR_DEFINITIONS[sdk=macosx*][arch=*]" = ( + "$(inherited)", + USE_VLANS, + USE_BONDS, + ); + HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; INSTALL_PATH = /sbin; - PREBINDING = NO; - PRODUCT_NAME = ping6; + PRODUCT_NAME = ifconfig; ZERO_LINK = NO; }; - name = Release; + name = "Ignore Me"; }; - 7216D2CF0EE89B7A00AE70E4 /* Debug */ = { + 03B2DBE8100BE71D005349BC /* Ignore Me */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = YES; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = "TFTP_DIR=\\\"/tftpboot\\\""; + HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; - PRODUCT_NAME = rarpd; + PRODUCT_NAME = ip6; }; - name = Debug; + name = "Ignore Me"; }; - 7216D2D00EE89B7A00AE70E4 /* Release */ = { + 03B2DBE9100BE71D005349BC /* Ignore Me */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = YES; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; - GCC_PREPROCESSOR_DEFINITIONS = "TFTP_DIR=\\\"/tftpboot\\\""; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + IP_FW_PRIVATE, + ); + HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; - INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; - PRODUCT_NAME = rarpd; - ZERO_LINK = NO; + INSTALL_PATH = /sbin; + PRODUCT_NAME = ipfw; }; - name = Release; + name = "Ignore Me"; }; - 7216D2EF0EE89CBC00AE70E4 /* Debug */ = { + 03B2DBEA100BE71D005349BC /* Ignore Me */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( - INET6, - IPSEC, + "$(inherited)", + IP_FW_PRIVATE, ); - HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; INSTALL_PATH = /sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", + PRODUCT_NAME = ip6fw; + }; + name = "Ignore Me"; + }; + 03B2DBEB100BE71D005349BC /* Ignore Me */ = { + isa = XCBuildConfiguration; + buildSettings = { + INSTALL_GROUP = wheel; + INSTALL_MODE_FLAG = 0555; + INSTALL_OWNER = root; + INSTALL_PATH = /usr/libexec; + PRODUCT_NAME = kdumpd; + }; + name = "Ignore Me"; + }; + 03B2DBEC100BE71D005349BC /* Ignore Me */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = YES; + HEADER_SEARCH_PATHS = ../alias; + INSTALL_GROUP = wheel; + INSTALL_MODE_FLAG = 0555; + INSTALL_OWNER = root; + INSTALL_PATH = /usr/sbin; + PRODUCT_NAME = natd; + WARNING_CFLAGS = ( + "$(inherited)", + "-Wno-deprecated-declarations", ); - PREBINDING = NO; - PRODUCT_NAME = route; }; - name = Debug; + name = "Ignore Me"; }; - 7216D2F00EE89CBC00AE70E4 /* Release */ = { + 03B2DBED100BE71D005349BC /* Ignore Me */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", INET6, - IPSEC, + IPSEC_DEBUG, + KAME_SCOPEID, ); - HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; - INSTALL_PATH = /sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; - PRODUCT_NAME = route; - ZERO_LINK = NO; + INSTALL_PATH = /usr/sbin; + PRODUCT_NAME = ndp; }; - name = Release; + name = "Ignore Me"; }; - 7216D3160EE89E9F00AE70E4 /* Debug */ = { + 03B2DBEE100BE71D005349BC /* Ignore Me */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( + $inherited, INET6, - HAVE_GETIFADDRS, + IPSEC, ); HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-Wno-deprecated-declarations", - "-mdynamic-no-pic", - "-dead_strip", + PRODUCT_NAME = netstat; + }; + name = "Ignore Me"; + }; + 03B2DBEF100BE71D005349BC /* Ignore Me */ = { + isa = XCBuildConfiguration; + buildSettings = { + HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; + INSTALL_GROUP = wheel; + INSTALL_MODE_FLAG = 0555; + INSTALL_OWNER = root; + INSTALL_PATH = /sbin; + PRODUCT_NAME = ping; + }; + name = "Ignore Me"; + }; + 03B2DBF0100BE71D005349BC /* Ignore Me */ = { + isa = XCBuildConfiguration; + buildSettings = { + INSTALL_GROUP = wheel; + INSTALL_MODE_FLAG = 0555; + INSTALL_OWNER = root; + INSTALL_PATH = /sbin; + PRODUCT_NAME = ping6; + }; + name = "Ignore Me"; + }; + 03B2DBF1100BE71D005349BC /* Ignore Me */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + "TFTP_DIR=\\\"/tftpboot\\\"", ); - PREBINDING = NO; - PRODUCT_NAME = rtadvd; - WARNING_CFLAGS = ""; + INSTALL_GROUP = wheel; + INSTALL_MODE_FLAG = 0555; + INSTALL_OWNER = root; + INSTALL_PATH = /usr/sbin; + PRODUCT_NAME = rarpd; }; - name = Debug; + name = "Ignore Me"; }; - 7216D3170EE89E9F00AE70E4 /* Release */ = { + 03B2DBF2100BE71D005349BC /* Ignore Me */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", INET6, - HAVE_GETIFADDRS, + IPSEC, ); HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; - INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-Wno-deprecated-declarations", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; - PRODUCT_NAME = rtadvd; - WARNING_CFLAGS = ""; - ZERO_LINK = NO; + INSTALL_PATH = /sbin; + PRODUCT_NAME = route; }; - name = Release; + name = "Ignore Me"; }; - 7216D35B0EE8A02300AE70E4 /* Debug */ = { + 03B2DBF3100BE71D005349BC /* Ignore Me */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", INET6, HAVE_GETIFADDRS, ); @@ -2722,28 +2682,20 @@ INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; - INSTALL_PATH = /sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", + INSTALL_PATH = /usr/sbin; + PRODUCT_NAME = rtadvd; + WARNING_CFLAGS = ( + "$(inherited)", "-Wno-deprecated-declarations", - "-mdynamic-no-pic", - "-dead_strip", ); - PREBINDING = NO; - PRODUCT_NAME = rtsol; }; - name = Debug; + name = "Ignore Me"; }; - 7216D35C0EE8A02300AE70E4 /* Release */ = { + 03B2DBF4100BE71D005349BC /* Ignore Me */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", INET6, HAVE_GETIFADDRS, ); @@ -2752,739 +2704,514 @@ INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; INSTALL_PATH = /sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", + PRODUCT_NAME = rtsol; + WARNING_CFLAGS = ( + "$(inherited)", "-Wno-deprecated-declarations", - "-mdynamic-no-pic", - "-dead_strip", ); - PREBINDING = NO; - PRODUCT_NAME = rtsol; - ZERO_LINK = NO; }; - name = Release; + name = "Ignore Me"; }; - 7216D3A90EE8A3BB00AE70E4 /* Debug */ = { + 03B2DBF5100BE71D005349BC /* Ignore Me */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; PRODUCT_NAME = spray; }; - name = Debug; + name = "Ignore Me"; }; - 7216D3AA0EE8A3BB00AE70E4 /* Release */ = { + 03B2DBF6100BE71D005349BC /* Ignore Me */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; + ALTERNATE_MODE = 04555; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + HAVE_SOCKADDR_SA_LEN, + ); INSTALL_GROUP = wheel; - INSTALL_MODE_FLAG = 0555; + INSTALL_MODE_FLAG = 04555; INSTALL_OWNER = root; INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", + PRODUCT_NAME = traceroute; + }; + name = "Ignore Me"; + }; + 03B2DBF7100BE71D005349BC /* Ignore Me */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + INET6, + IPSEC, ); - PREBINDING = NO; - PRODUCT_NAME = spray; - ZERO_LINK = NO; + INSTALL_GROUP = wheel; + INSTALL_MODE_FLAG = 04555; + INSTALL_OWNER = root; + INSTALL_PATH = /usr/sbin; + PRODUCT_NAME = traceroute6; }; - name = Release; + name = "Ignore Me"; }; - 724862320EE86EB7001D0DE9 /* Debug */ = { + 7216D2480EE896C100AE70E4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - COPY_PHASE_STRIP = NO; + GCC_PREPROCESSOR_DEFINITIONS = ( + $inherited, + INET6, + IPSEC, + ); + HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; + INSTALL_GROUP = wheel; + INSTALL_MODE_FLAG = 0555; + INSTALL_OWNER = root; + INSTALL_PATH = /usr/sbin; + PRODUCT_NAME = netstat; }; name = Debug; }; - 724862330EE86EB7001D0DE9 /* Release */ = { + 7216D2490EE896C100AE70E4 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - COPY_PHASE_STRIP = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + $inherited, + INET6, + IPSEC, + ); + HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; + INSTALL_GROUP = wheel; + INSTALL_MODE_FLAG = 0555; + INSTALL_OWNER = root; + INSTALL_PATH = /usr/sbin; + PRODUCT_NAME = netstat; }; name = Release; }; - 724DAB610EE88E2B008900D0 /* Debug */ = { + 7216D27E0EE8980B00AE70E4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = IP_FW_PRIVATE; HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; INSTALL_PATH = /sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; - PRODUCT_NAME = ipfw; + PRODUCT_NAME = ping; }; name = Debug; }; - 724DAB620EE88E2B008900D0 /* Release */ = { + 7216D27F0EE8980B00AE70E4 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; - GCC_PREPROCESSOR_DEFINITIONS = IP_FW_PRIVATE; HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; INSTALL_PATH = /sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; - PRODUCT_NAME = ipfw; - ZERO_LINK = NO; + PRODUCT_NAME = ping; }; name = Release; }; - 724DAB840EE88EFA008900D0 /* Debug */ = { + 7216D29C0EE898BE00AE70E4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = IP_FW_PRIVATE; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; INSTALL_PATH = /sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; - PRODUCT_NAME = ip6fw; + PRODUCT_NAME = ping6; }; name = Debug; }; - 724DAB850EE88EFA008900D0 /* Release */ = { + 7216D29D0EE898BE00AE70E4 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; - GCC_PREPROCESSOR_DEFINITIONS = IP_FW_PRIVATE; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; INSTALL_PATH = /sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; - PRODUCT_NAME = ip6fw; - ZERO_LINK = NO; + PRODUCT_NAME = ping6; }; name = Release; }; - 724DABA40EE88FE3008900D0 /* Debug */ = { + 7216D2CF0EE89B7A00AE70E4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; + ALWAYS_SEARCH_USER_PATHS = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + "TFTP_DIR=\\\"/tftpboot\\\"", + ); INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; - INSTALL_PATH = /usr/libexec; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; - PRODUCT_NAME = kdumpd; + INSTALL_PATH = /usr/sbin; + PRODUCT_NAME = rarpd; }; name = Debug; }; - 724DABA50EE88FE3008900D0 /* Release */ = { + 7216D2D00EE89B7A00AE70E4 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; + ALWAYS_SEARCH_USER_PATHS = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + "TFTP_DIR=\\\"/tftpboot\\\"", + ); INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; - INSTALL_PATH = /usr/libexec; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; - PRODUCT_NAME = kdumpd; - ZERO_LINK = NO; + INSTALL_PATH = /usr/sbin; + PRODUCT_NAME = rarpd; }; name = Release; }; - 724DABDD0EE8912E008900D0 /* Debug */ = { + 7216D2EF0EE89CBC00AE70E4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = YES; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ""; - HEADER_SEARCH_PATHS = ../alias; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + INET6, + IPSEC, + ); + HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; - INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-Wno-deprecated-declarations", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; - PRODUCT_NAME = natd; + INSTALL_PATH = /sbin; + PRODUCT_NAME = route; }; name = Debug; }; - 724DABDE0EE8912E008900D0 /* Release */ = { + 7216D2F00EE89CBC00AE70E4 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = YES; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; - GCC_PREPROCESSOR_DEFINITIONS = ""; - HEADER_SEARCH_PATHS = ../alias; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + INET6, + IPSEC, + ); + HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; - INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-Wno-deprecated-declarations", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; - PRODUCT_NAME = natd; - ZERO_LINK = NO; + INSTALL_PATH = /sbin; + PRODUCT_NAME = route; }; name = Release; }; - 724DAC0F0EE8940E008900D0 /* Debug */ = { + 7216D3160EE89E9F00AE70E4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", INET6, - IPSEC_DEBUG, - KAME_SCOPEID, + HAVE_GETIFADDRS, ); + HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", + PRODUCT_NAME = rtadvd; + WARNING_CFLAGS = ( + "$(inherited)", + "-Wno-deprecated-declarations", ); - PREBINDING = NO; - PRODUCT_NAME = ndp; }; name = Debug; }; - 724DAC100EE8940E008900D0 /* Release */ = { + 7216D3170EE89E9F00AE70E4 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", INET6, - IPSEC_DEBUG, - KAME_SCOPEID, + HAVE_GETIFADDRS, ); + HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", + PRODUCT_NAME = rtadvd; + WARNING_CFLAGS = ( + "$(inherited)", + "-Wno-deprecated-declarations", ); - PREBINDING = NO; - PRODUCT_NAME = ndp; - ZERO_LINK = NO; }; name = Release; }; - 7251B1FE0EE9D2AB00F29440 /* Debug */ = { + 7216D35B0EE8A02300AE70E4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + INET6, + HAVE_GETIFADDRS, + ); HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; INSTALL_PATH = /sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", + PRODUCT_NAME = rtsol; + WARNING_CFLAGS = ( + "$(inherited)", + "-Wno-deprecated-declarations", ); - PREBINDING = NO; - PRODUCT_NAME = ping; - SDKROOT = iphoneos3.0.internal; }; name = Debug; }; - 7251B1FF0EE9D2AB00F29440 /* Release */ = { + 7216D35C0EE8A02300AE70E4 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + INET6, + HAVE_GETIFADDRS, + ); HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; INSTALL_PATH = /sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", + PRODUCT_NAME = rtsol; + WARNING_CFLAGS = ( + "$(inherited)", + "-Wno-deprecated-declarations", ); - PREBINDING = NO; - PRODUCT_NAME = ping; - SDKROOT = iphoneos3.0.internal; - STRIPFLAGS = "-S"; - ZERO_LINK = NO; }; name = Release; }; - 72570DA30EE8EBF3000F4CFB /* Debug */ = { + 7216D3A90EE8A3BB00AE70E4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - PRODUCT_NAME = network_cmds; + INSTALL_GROUP = wheel; + INSTALL_MODE_FLAG = 0555; + INSTALL_OWNER = root; + INSTALL_PATH = /usr/sbin; + PRODUCT_NAME = spray; }; name = Debug; }; - 72570DA40EE8EBF3000F4CFB /* Release */ = { + 7216D3AA0EE8A3BB00AE70E4 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - PRODUCT_NAME = network_cmds; - ZERO_LINK = NO; + INSTALL_GROUP = wheel; + INSTALL_MODE_FLAG = 0555; + INSTALL_OWNER = root; + INSTALL_PATH = /usr/sbin; + PRODUCT_NAME = spray; }; name = Release; }; - 72570DB10EE8EC2E000F4CFB /* Debug */ = { + 724862320EE86EB7001D0DE9 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; COPY_PHASE_STRIP = NO; DEAD_CODE_STRIPPING = YES; - GCC_DYNAMIC_NO_PIC = NO; + GCC_DYNAMIC_NO_PIC = YES; GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_INCREASE_PRECOMPILED_HEADER_SHARING = NO; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = "TARGET_OS_EMBEDDED=1"; - INSTALL_GROUP = wheel; - INSTALL_MODE_FLAG = 0555; - INSTALL_OWNER = root; - INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", + "GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*][arch=*]" = ( + "$(inherited)", + "TARGET_OS_EMBEDDED=1", ); + GCC_TREAT_WARNINGS_AS_ERRORS = YES; PREBINDING = NO; - PRODUCT_NAME = arp; - SDKROOT = iphoneos3.0.internal; - STRIPFLAGS = ""; + WARNING_CFLAGS = "-Wall"; }; name = Debug; }; - 72570DB20EE8EC2E000F4CFB /* Release */ = { + 724862330EE86EB7001D0DE9 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; COPY_PHASE_STRIP = YES; DEAD_CODE_STRIPPING = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_INCREASE_PRECOMPILED_HEADER_SHARING = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + "DEBUG_INFORMATION_FORMAT[sdk=iphoneos*][arch=*]" = dwarf; + GCC_DYNAMIC_NO_PIC = YES; GCC_MODEL_TUNING = G5; - GCC_PREPROCESSOR_DEFINITIONS = "TARGET_OS_EMBEDDED=1"; - INSTALL_GROUP = wheel; - INSTALL_MODE_FLAG = 0555; - INSTALL_OWNER = root; - INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", + "GCC_PREPROCESSOR_DEFINITIONS[sdk=iphoneos*][arch=*]" = ( + "$(inherited)", + "TARGET_OS_EMBEDDED=1", ); + GCC_TREAT_WARNINGS_AS_ERRORS = YES; PREBINDING = NO; - PRODUCT_NAME = arp; - SDKROOT = iphoneos3.0.internal; - STRIPFLAGS = "-S"; + "STRIPFLAGS[sdk=iphoneos*]" = "-S"; + WARNING_CFLAGS = "-Wall"; ZERO_LINK = NO; }; name = Release; }; - 72570DC90EE8F49A000F4CFB /* Debug */ = { + 724DAB610EE88E2B008900D0 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; - COPY_PHASE_STRIP = NO; - DEAD_CODE_STRIPPING = YES; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( - TARGET_OS_EMBEDDED, - USE_IF_MEDIA, - NO_IPX, + "$(inherited)", + IP_FW_PRIVATE, ); HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; INSTALL_PATH = /sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; - PRODUCT_NAME = ifconfig; - SDKROOT = iphoneos3.0.internal; - STRIPFLAGS = "-S"; + PRODUCT_NAME = ipfw; }; name = Debug; }; - 72570DCA0EE8F49A000F4CFB /* Release */ = { + 724DAB620EE88E2B008900D0 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; - COPY_PHASE_STRIP = YES; - DEAD_CODE_STRIPPING = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; GCC_PREPROCESSOR_DEFINITIONS = ( - TARGET_OS_EMBEDDED, - USE_IF_MEDIA, - NO_IPX, + "$(inherited)", + IP_FW_PRIVATE, ); HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; INSTALL_PATH = /sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; - PRODUCT_NAME = ifconfig; - SDKROOT = iphoneos3.0.internal; - STRIPFLAGS = "-S"; - ZERO_LINK = NO; + PRODUCT_NAME = ipfw; }; name = Release; }; - 72570DE60EE8F4C4000F4CFB /* Debug */ = { + 724DAB840EE88EFA008900D0 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; - COPY_PHASE_STRIP = NO; - DEAD_CODE_STRIPPING = YES; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( - TARGET_OS_EMBEDDED, - IPSEC, + "$(inherited)", + IP_FW_PRIVATE, ); - HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; + INSTALL_GROUP = wheel; + INSTALL_MODE_FLAG = 0555; + INSTALL_OWNER = root; + INSTALL_PATH = /sbin; + PRODUCT_NAME = ip6fw; + }; + name = Debug; + }; + 724DAB850EE88EFA008900D0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + IP_FW_PRIVATE, + ); + INSTALL_GROUP = wheel; + INSTALL_MODE_FLAG = 0555; + INSTALL_OWNER = root; + INSTALL_PATH = /sbin; + PRODUCT_NAME = ip6fw; + }; + name = Release; + }; + 724DABA40EE88FE3008900D0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + INSTALL_GROUP = wheel; + INSTALL_MODE_FLAG = 0555; + INSTALL_OWNER = root; + INSTALL_PATH = /usr/libexec; + PRODUCT_NAME = kdumpd; + }; + name = Debug; + }; + 724DABA50EE88FE3008900D0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + INSTALL_GROUP = wheel; + INSTALL_MODE_FLAG = 0555; + INSTALL_OWNER = root; + INSTALL_PATH = /usr/libexec; + PRODUCT_NAME = kdumpd; + }; + name = Release; + }; + 724DABDD0EE8912E008900D0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = YES; + HEADER_SEARCH_PATHS = ../alias; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", + PRODUCT_NAME = natd; + WARNING_CFLAGS = ( + "$(inherited)", + "-Wno-deprecated-declarations", ); - PREBINDING = NO; - PRODUCT_NAME = netstat; - SDKROOT = iphoneos3.0.internal; }; name = Debug; }; - 72570DE70EE8F4C4000F4CFB /* Release */ = { + 724DABDE0EE8912E008900D0 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; - COPY_PHASE_STRIP = YES; - DEAD_CODE_STRIPPING = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; - GCC_PREPROCESSOR_DEFINITIONS = ( - TARGET_OS_EMBEDDED, - IPSEC, - ); - HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; + ALWAYS_SEARCH_USER_PATHS = YES; + HEADER_SEARCH_PATHS = ../alias; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", + PRODUCT_NAME = natd; + WARNING_CFLAGS = ( + "$(inherited)", + "-Wno-deprecated-declarations", ); - PREBINDING = NO; - PRODUCT_NAME = netstat; - SDKROOT = iphoneos3.0.internal; - STRIPFLAGS = "-S"; - ZERO_LINK = NO; }; name = Release; }; - 72570DF60EE8F4DE000F4CFB /* Debug */ = { + 724DAC0F0EE8940E008900D0 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; - COPY_PHASE_STRIP = NO; - DEAD_CODE_STRIPPING = YES; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( - TARGET_OS_EMBEDDED, - IPSEC, + "$(inherited)", + INET6, + IPSEC_DEBUG, + KAME_SCOPEID, ); - HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; - INSTALL_PATH = /sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; - PRODUCT_NAME = route; - SDKROOT = iphoneos3.0.internal; + INSTALL_PATH = /usr/sbin; + PRODUCT_NAME = ndp; }; name = Debug; }; - 72570DF70EE8F4DE000F4CFB /* Release */ = { + 724DAC100EE8940E008900D0 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; - COPY_PHASE_STRIP = YES; - DEAD_CODE_STRIPPING = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; GCC_PREPROCESSOR_DEFINITIONS = ( - TARGET_OS_EMBEDDED, - IPSEC, + "$(inherited)", + INET6, + IPSEC_DEBUG, + KAME_SCOPEID, ); - HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; - INSTALL_PATH = /sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; - PRODUCT_NAME = route; - SDKROOT = iphoneos3.0.internal; - STRIPFLAGS = "-S"; - ZERO_LINK = NO; + INSTALL_PATH = /usr/sbin; + PRODUCT_NAME = ndp; }; name = Release; }; - 72570E080EE8F4EA000F4CFB /* Debug */ = { + 72570DA30EE8EBF3000F4CFB /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALTERNATE_MODE = 04555; - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; - COPY_PHASE_STRIP = NO; - DEAD_CODE_STRIPPING = YES; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - TARGET_OS_EMBEDDED, - HAVE_SOCKADDR_SA_LEN, - ); - INSTALL_GROUP = wheel; - INSTALL_MODE_FLAG = 04555; - INSTALL_OWNER = root; - INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; - PRODUCT_NAME = traceroute; - SDKROOT = iphoneos3.0.internal; + PRODUCT_NAME = network_cmds; }; name = Debug; }; - 72570E090EE8F4EA000F4CFB /* Release */ = { + 72570DA40EE8EBF3000F4CFB /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALTERNATE_MODE = 04555; - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; - COPY_PHASE_STRIP = YES; - DEAD_CODE_STRIPPING = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; - GCC_PREPROCESSOR_DEFINITIONS = ( - TARGET_OS_EMBEDDED, - HAVE_SOCKADDR_SA_LEN, - ); - INSTALL_GROUP = wheel; - INSTALL_MODE_FLAG = 04555; - INSTALL_OWNER = root; - INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; - PRODUCT_NAME = traceroute; - SDKROOT = iphoneos3.0.internal; - STRIPFLAGS = "-S"; - ZERO_LINK = NO; + PRODUCT_NAME = network_cmds; }; name = Release; }; @@ -3515,9 +3242,9 @@ ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; DEAD_CODE_STRIPPING = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_CURRENT_VERSION = 1; EXECUTABLE_PREFIX = lib; + GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_MODEL_TUNING = G5; INSTALL_GROUP = wheel; @@ -3533,23 +3260,10 @@ 7261212F0EE8710B00AFED1B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; PRODUCT_NAME = arp; }; name = Debug; @@ -3557,24 +3271,11 @@ 726121300EE8710B00AFED1B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; PRODUCT_NAME = arp; - ZERO_LINK = NO; }; name = Release; }; @@ -3602,16 +3303,14 @@ 726121560EE8881800AFED1B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", USE_IF_MEDIA, - INET6, NO_IPX, + INET6, + ); + "GCC_PREPROCESSOR_DEFINITIONS[sdk=macosx*][arch=*]" = ( + $inherited, USE_VLANS, USE_BONDS, ); @@ -3620,13 +3319,6 @@ INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; INSTALL_PATH = /sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; PRODUCT_NAME = ifconfig; }; name = Debug; @@ -3634,15 +3326,14 @@ 726121570EE8881800AFED1B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", USE_IF_MEDIA, - INET6, NO_IPX, + INET6, + ); + "GCC_PREPROCESSOR_DEFINITIONS[sdk=macosx*][arch=*]" = ( + "$(inherited)", USE_VLANS, USE_BONDS, ); @@ -3651,13 +3342,6 @@ INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; INSTALL_PATH = /sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; PRODUCT_NAME = ifconfig; ZERO_LINK = NO; }; @@ -3666,24 +3350,11 @@ 726121850EE8897C00AFED1B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; PRODUCT_NAME = ip6; }; name = Debug; @@ -3691,25 +3362,12 @@ 726121860EE8897C00AFED1B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; HEADER_SEARCH_PATHS = /System/Library/Frameworks/System.framework/PrivateHeaders; INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 0555; INSTALL_OWNER = root; INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; PRODUCT_NAME = ip6; - ZERO_LINK = NO; }; name = Release; }; @@ -3717,24 +3375,14 @@ isa = XCBuildConfiguration; buildSettings = { ALTERNATE_MODE = 04555; - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = HAVE_SOCKADDR_SA_LEN; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + HAVE_SOCKADDR_SA_LEN, + ); INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 04555; INSTALL_OWNER = root; INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; PRODUCT_NAME = traceroute; }; name = Debug; @@ -3743,38 +3391,23 @@ isa = XCBuildConfiguration; buildSettings = { ALTERNATE_MODE = 04555; - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; - GCC_PREPROCESSOR_DEFINITIONS = HAVE_SOCKADDR_SA_LEN; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + HAVE_SOCKADDR_SA_LEN, + ); INSTALL_GROUP = wheel; INSTALL_MODE_FLAG = 04555; INSTALL_OWNER = root; INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; PRODUCT_NAME = traceroute; - ZERO_LINK = NO; }; name = Release; }; 7294F12C0EE8BD290052EC88 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", INET6, IPSEC, ); @@ -3782,13 +3415,6 @@ INSTALL_MODE_FLAG = 04555; INSTALL_OWNER = root; INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; PRODUCT_NAME = traceroute6; }; name = Debug; @@ -3796,12 +3422,8 @@ 7294F12D0EE8BD290052EC88 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", INET6, IPSEC, ); @@ -3809,18 +3431,42 @@ INSTALL_MODE_FLAG = 04555; INSTALL_OWNER = root; INSTALL_PATH = /usr/sbin; - OTHER_CFLAGS = ( - "-Wall", - "-Werror", - "-mdynamic-no-pic", - "-dead_strip", - ); - PREBINDING = NO; PRODUCT_NAME = traceroute6; + }; + name = Release; + }; + 72ABD0821083D743008C721C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + "GCC_PREPROCESSOR_DEFINITIONS[sdk=yola4.0.internal][arch=*]" = ( + "$(inherited)", + "TARGET_OS_EMBEDDED=1", + ); + PRODUCT_NAME = "All-EmbeddedOther"; + }; + name = Debug; + }; + 72ABD0831083D743008C721C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + PRODUCT_NAME = "All-EmbeddedOther"; ZERO_LINK = NO; }; name = Release; }; + 72ABD0841083D743008C721C /* Ignore Me */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "All-EmbeddedOther"; + }; + name = "Ignore Me"; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -3829,6 +3475,7 @@ buildConfigurations = ( 7216D2480EE896C100AE70E4 /* Debug */, 7216D2490EE896C100AE70E4 /* Release */, + 03B2DBEE100BE71D005349BC /* Ignore Me */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -3838,6 +3485,7 @@ buildConfigurations = ( 7216D27E0EE8980B00AE70E4 /* Debug */, 7216D27F0EE8980B00AE70E4 /* Release */, + 03B2DBEF100BE71D005349BC /* Ignore Me */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -3847,6 +3495,7 @@ buildConfigurations = ( 7216D29C0EE898BE00AE70E4 /* Debug */, 7216D29D0EE898BE00AE70E4 /* Release */, + 03B2DBF0100BE71D005349BC /* Ignore Me */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -3856,6 +3505,7 @@ buildConfigurations = ( 7216D2CF0EE89B7A00AE70E4 /* Debug */, 7216D2D00EE89B7A00AE70E4 /* Release */, + 03B2DBF1100BE71D005349BC /* Ignore Me */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -3865,6 +3515,7 @@ buildConfigurations = ( 7216D2EF0EE89CBC00AE70E4 /* Debug */, 7216D2F00EE89CBC00AE70E4 /* Release */, + 03B2DBF2100BE71D005349BC /* Ignore Me */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -3874,6 +3525,7 @@ buildConfigurations = ( 7216D3160EE89E9F00AE70E4 /* Debug */, 7216D3170EE89E9F00AE70E4 /* Release */, + 03B2DBF3100BE71D005349BC /* Ignore Me */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -3883,6 +3535,7 @@ buildConfigurations = ( 7216D35B0EE8A02300AE70E4 /* Debug */, 7216D35C0EE8A02300AE70E4 /* Release */, + 03B2DBF4100BE71D005349BC /* Ignore Me */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -3892,6 +3545,7 @@ buildConfigurations = ( 7216D3A90EE8A3BB00AE70E4 /* Debug */, 7216D3AA0EE8A3BB00AE70E4 /* Release */, + 03B2DBF5100BE71D005349BC /* Ignore Me */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -3901,6 +3555,7 @@ buildConfigurations = ( 724862320EE86EB7001D0DE9 /* Debug */, 724862330EE86EB7001D0DE9 /* Release */, + 03B2DBE2100BE71D005349BC /* Ignore Me */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -3910,6 +3565,7 @@ buildConfigurations = ( 724DAB610EE88E2B008900D0 /* Debug */, 724DAB620EE88E2B008900D0 /* Release */, + 03B2DBE9100BE71D005349BC /* Ignore Me */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -3919,6 +3575,7 @@ buildConfigurations = ( 724DAB840EE88EFA008900D0 /* Debug */, 724DAB850EE88EFA008900D0 /* Release */, + 03B2DBEA100BE71D005349BC /* Ignore Me */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -3928,6 +3585,7 @@ buildConfigurations = ( 724DABA40EE88FE3008900D0 /* Debug */, 724DABA50EE88FE3008900D0 /* Release */, + 03B2DBEB100BE71D005349BC /* Ignore Me */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -3937,6 +3595,7 @@ buildConfigurations = ( 724DABDD0EE8912E008900D0 /* Debug */, 724DABDE0EE8912E008900D0 /* Release */, + 03B2DBEC100BE71D005349BC /* Ignore Me */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -3946,15 +3605,7 @@ buildConfigurations = ( 724DAC0F0EE8940E008900D0 /* Debug */, 724DAC100EE8940E008900D0 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 7251B1FD0EE9D2AB00F29440 /* Build configuration list for PBXNativeTarget "ping embedded" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 7251B1FE0EE9D2AB00F29440 /* Debug */, - 7251B1FF0EE9D2AB00F29440 /* Release */, + 03B2DBED100BE71D005349BC /* Ignore Me */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -3964,51 +3615,7 @@ buildConfigurations = ( 72570DA30EE8EBF3000F4CFB /* Debug */, 72570DA40EE8EBF3000F4CFB /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 72570DB00EE8EC2E000F4CFB /* Build configuration list for PBXNativeTarget "arp embedded" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 72570DB10EE8EC2E000F4CFB /* Debug */, - 72570DB20EE8EC2E000F4CFB /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 72570DC80EE8F49A000F4CFB /* Build configuration list for PBXNativeTarget "ifconfig embedded" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 72570DC90EE8F49A000F4CFB /* Debug */, - 72570DCA0EE8F49A000F4CFB /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 72570DE50EE8F4C4000F4CFB /* Build configuration list for PBXNativeTarget "netstat embedded" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 72570DE60EE8F4C4000F4CFB /* Debug */, - 72570DE70EE8F4C4000F4CFB /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 72570DF50EE8F4DE000F4CFB /* Build configuration list for PBXNativeTarget "route embedded" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 72570DF60EE8F4DE000F4CFB /* Debug */, - 72570DF70EE8F4DE000F4CFB /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 72570E070EE8F4EA000F4CFB /* Build configuration list for PBXNativeTarget "traceroute embedded" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 72570E080EE8F4EA000F4CFB /* Debug */, - 72570E090EE8F4EA000F4CFB /* Release */, + 03B2DBE4100BE71D005349BC /* Ignore Me */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -4018,6 +3625,7 @@ buildConfigurations = ( 7261210E0EE8707600AFED1B /* Debug */, 7261210F0EE8707600AFED1B /* Release */, + 03B2DBE5100BE71D005349BC /* Ignore Me */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -4027,6 +3635,7 @@ buildConfigurations = ( 7261212F0EE8710B00AFED1B /* Debug */, 726121300EE8710B00AFED1B /* Release */, + 03B2DBE6100BE71D005349BC /* Ignore Me */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -4036,6 +3645,7 @@ buildConfigurations = ( 726121440EE8717500AFED1B /* Debug */, 726121450EE8717500AFED1B /* Release */, + 03B2DBE3100BE71D005349BC /* Ignore Me */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -4045,6 +3655,7 @@ buildConfigurations = ( 726121560EE8881800AFED1B /* Debug */, 726121570EE8881800AFED1B /* Release */, + 03B2DBE7100BE71D005349BC /* Ignore Me */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -4054,6 +3665,7 @@ buildConfigurations = ( 726121850EE8897C00AFED1B /* Debug */, 726121860EE8897C00AFED1B /* Release */, + 03B2DBE8100BE71D005349BC /* Ignore Me */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -4063,6 +3675,7 @@ buildConfigurations = ( 7294F0FB0EE8BB460052EC88 /* Debug */, 7294F0FC0EE8BB460052EC88 /* Release */, + 03B2DBF6100BE71D005349BC /* Ignore Me */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -4072,6 +3685,17 @@ buildConfigurations = ( 7294F12C0EE8BD290052EC88 /* Debug */, 7294F12D0EE8BD290052EC88 /* Release */, + 03B2DBF7100BE71D005349BC /* Ignore Me */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 72ABD0A11083D792008C721C /* Build configuration list for PBXAggregateTarget "All-EmbeddedOther" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 72ABD0821083D743008C721C /* Debug */, + 72ABD0831083D743008C721C /* Release */, + 72ABD0841083D743008C721C /* Ignore Me */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release;