+++ /dev/null
-Project = network_cmds
-
-Embedded=$(shell tconf --test TARGET_OS_EMBEDDED)
-
-ifeq ($(Embedded),YES)
-SubProjects = arp.tproj \
- alias \
- ifconfig.tproj netstat.tproj\
- ping.tproj\
- route.tproj\
- traceroute.tproj\
- natd.tproj
-else
-SubProjects = arp.tproj \
- alias \
- bootparams \
- ifconfig.tproj netstat.tproj\
- ping.tproj rarpd.tproj\
- route.tproj routed.tproj\
- slattach.tproj spray.tproj\
- traceroute.tproj trpt.tproj\
- natd.tproj ipfw.tproj\
- ping6.tproj traceroute6.tproj rtsol.tproj ndp.tproj rtadvd.tproj\
- ip6conf.tproj ip6fw.tproj kdumpd.tproj
-endif
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
+++ /dev/null
-Project = alias
-ProductType = dylib
-Install_Dir = /usr/lib
-#Install_Headers = alias.h
-
-Library_Version = A
-
-HFILES = alias.h alias_local.h
-CFILES = alias.c alias_cuseeme.c alias_db.c alias_ftp.c alias_irc.c\
- alias_nbt.c alias_pptp.c alias_proxy.c alias_smedia.c alias_util.c
-#MANPAGES = libalias.3
-
-#Extra_CC_Flags = \
- -I$(SDKROOT)/System/Library/Frameworks/Kernel.framework/PrivateHeaders
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
u_char *option = (u_char *) tc + sizeof(*tc);
u_char *optionEnd = option + ((tc->th_off << 2) - sizeof(*tc));
+#define TEST_5618045 0
+#if TEST_5618045
+ if ((ntohs(tc->th_dport) == 8080 || ntohs(tc->th_sport) == 8080) && tc->th_off > 5) {
+ option[0] = 0xF4;
+ option[1] = 0;
+ }
+#endif
+
while (optionEnd > option)
{
/* Bounds checking to avoid infinite loops */
addr_save = GetDefaultAliasAddress();
if (packetAliasMode & PKT_ALIAS_UNREGISTERED_ONLY)
{
- u_long addr;
+ in_addr_t addr;
int iclass;
iclass = 0;
struct ack_data_record /* used to save changes to ACK/sequence numbers */
{
- u_long ack_old;
- u_long ack_new;
+ __uint32_t ack_old;
+ __uint32_t ack_new;
int delta;
int active;
};
static u_int StartPointOut(struct in_addr, struct in_addr,
u_short, u_short, int);
-static int SeqDiff(u_long, u_long);
+static int SeqDiff(__uint32_t, __uint32_t);
+#ifndef DEBUG
static void ShowAliasStats(void);
+#endif
#ifndef NO_FW_PUNCH
/* Firewall control */
static int
-SeqDiff(u_long x, u_long y)
+SeqDiff(__uint32_t x, __uint32_t y)
{
/* Return the difference between two TCP sequence numbers */
}
+#ifndef DEBUG
static void
ShowAliasStats(void)
{
fflush(monitorFile);
}
}
+#endif
snprintf(alias_str, sizeof(alias_str), "%s:%u",
inet_ntoa(link->alias_addr), ntohs(link->alias_port));
- printf(" linkTableOut[%d:%d] src= %s dst= %s alias= %s flags= 0x%x linktype= %d ts= %d exp= %d fd= %d",
+ printf(" linkTableOut[%d:%d] src= %s dst= %s alias= %s flags= 0x%x linktype= %d ts= %d exp= %d fd= %d\n",
i, icount, src_str, dst_str, alias_str,
link->flags, link->link_type, link->timestamp, link->expire_time, link->sockfd);
int i;
struct tcphdr *tc;
int delta, ack_diff_min;
- u_long ack;
+ __uint32_t ack;
tc = (struct tcphdr *) ((char *) pip + (pip->ip_hl << 2));
ack = tc->th_ack;
int i;
struct tcphdr *tc;
int delta, seq_diff_min;
- u_long seq;
+ __uint32_t seq;
tc = (struct tcphdr *) ((char *) pip + (pip->ip_hl << 2));
seq = tc->th_seq;
char newpacket[65536]; /* Estimate of maximum packet size :) */
int copyat = i; /* Same */
int iCopy = 0; /* How much data have we written to copy-back string? */
- unsigned long org_addr; /* Original IP address */
+ in_addr_t org_addr; /* Original IP address */
unsigned short org_port; /* Original source port address */
lCTCP_START:
if( i >= dlen || iCopy >= sizeof(newpacket) )
/* Fetch IP address */
org_addr = 0;
while(i<dlen && isdigit(sptr[i])) {
- if( org_addr > ULONG_MAX/10UL ) { /* Terminate on overflow */
+ if( org_addr > 0xFFFFFFFF/10UL ) { /* Terminate on overflow */
DBprintf(("DCC Address overflow (org_addr == 0x%08lx, next char %c\n", org_addr, sptr[i]));
goto lBAD_CTCP;
}
alias_address = GetAliasAddress(link);
iCopy += snprintf(&newpacket[iCopy],
sizeof(newpacket)-iCopy,
- "%lu ", (u_long)htonl(alias_address.s_addr));
+ "%u ", (in_addr_t)htonl(alias_address.s_addr));
if( iCopy >= sizeof(newpacket) ) { /* Truncated/fit exactly - bad news */
DBprintf(("DCC constructed packet overflow.\n"));
goto lBAD_CTCP;
switch (rcode) {
case FMT_ERR:
- printf("\nFormat Error.");
+ printf("\n Format Error.\n");
+ break;
case SRV_ERR:
- printf("\nSever failure.");
+ printf("\n Server failure.\n");
+ break;
case IMP_ERR:
- printf("\nUnsupported request error.\n");
+ printf("\n Unsupported request error.\n");
+ break;
case RFS_ERR:
- printf("\nRefused error.\n");
+ printf("\n Refused error.\n");
+ break;
case ACT_ERR:
- printf("\nActive error.\n");
+ printf("\n Active error.\n");
+ break;
case CFT_ERR:
- printf("\nName in conflict error.\n");
+ printf("\n Name in conflict error.\n");
+ break;
default:
- printf("\n???=%0x\n", rcode );
-
+ printf("\n \?\?\?=%0x\n", rcode );
+ break;
}
}
#endif
if ((char *)(ndh + 1) > pmax)
return(-1);
#ifdef DEBUG
- printf("\nType=%02x,", ndh->type );
+ printf("Type=%02x,", ndh->type );
#endif
switch ( ndh->type ) {
case DGM_DIRECT_UNIQ:
/* Processing all in_addr array */
#ifdef DEBUG
- printf("NB rec[%s", inet_ntoa(nbtarg->oldaddr));
- printf("->%s, %dbytes] ",inet_ntoa(nbtarg->newaddr ), bcount);
+ printf(" NB rec[%s", inet_ntoa(nbtarg->oldaddr));
+ printf("->%s, %d bytes] ",inet_ntoa(nbtarg->newaddr ), bcount);
#endif
while ( nb != NULL && bcount != 0 ) {
if ((char *)(nb + 1) > pmax) {
if (q == NULL || (char *)(q + 1) > pmax)
break;
#ifdef DEBUG
- printf("type=%02x, count=%d\n", ntohs(q->type), count );
+ printf("\n type=%02x, count=%d\n", ntohs(q->type), count );
#endif
/* Type and Class filed */
ntohs(nsh->ancount),
ntohs(nsh->nscount),
ntohs(nsh->arcount),
- (u_char *)p -(u_char *)nsh
+ (int)((u_char *)p -(u_char *)nsh)
);
#endif
}
#ifdef DEBUG
+ if (nsh->rcode)
PrintRcode(nsh->rcode);
#endif
return ((p == NULL) ? -1 : 0);
+++ /dev/null
-Project = arp
-Install_Dir = /usr/sbin
-
-CFILES = arp.c
-MANPAGES = arp4.4 arp.8
-
-Extra_CC_Flags = -mdynamic-no-pic -dead_strip
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
.\" 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.
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)arp.8 8.2 (Berkeley) 4/27/95
+.\" @(#)arp.8 8.1 (Berkeley) 6/6/93
+.\" $FreeBSD: src/usr.sbin/arp/arp.8,v 1.25.2.1 2008/04/25 16:38:14 sam Exp $
.\"
-.Dd April 27, 1995
+.Dd March 18, 2008
.Dt ARP 8
-.Os BSD 4.3
+.Os
.Sh NAME
.Nm arp
.Nd address resolution display and control
.Sh SYNOPSIS
-.Nm arp
+.Nm
+.Op Fl n
+.Op Fl i Ar interface
.Ar hostname
-.Nm arp
+.Nm
+.Op Fl n
+.Op Fl i Ar interface
.Fl a
-.Nm arp
+.Nm
.Fl d Ar hostname
-.Nm arp
+.Op Cm pub
+.Op Cm ifscope interface
+.Nm
+.Fl d
+.Op Fl i Ar interface
+.Fl a
+.Nm
.Fl s Ar hostname ether_addr
-.Op Ar temp
-.Op Ar pub
-.Nm arp
+.Op Cm temp
+.Op Cm reject
+.Op Cm blackhole
+.Op Cm pub Op Cm only
+.Op Cm ifscope interface
+.Nm
+.Fl S Ar hostname ether_addr
+.Op Cm temp
+.Op Cm reject
+.Op Cm blackhole
+.Op Cm pub Op Cm only
+.Op Cm ifscope interface
+.Nm
.Fl f Ar filename
.Sh DESCRIPTION
The
-.Nm arp
-program displays and modifies the Internet-to-Ethernet address translation
+.Nm
+utility displays and modifies the Internet-to-Ethernet address translation
tables used by the address resolution protocol
.Pq Xr arp 4 .
With no flags, the program displays the current
using Internet dot notation.
.Pp
Available options:
-.Bl -tag -width Ds
+.Bl -tag -width indent
.It Fl a
-The program displays all of the current
+The program displays or deletes all of the current
.Tn ARP
entries.
.It Fl d
with the
.Fl d
flag.
+If the
+.Cm pub
+keyword is specified, only the
+.Dq published
+.Tn ARP
+entry
+for this host will be deleted.
+If the
+.Cm ifscope
+keyword is specified, the entry specific to the interface will be deleted.
+.Pp
+Alternatively, the
+.Fl d
+flag may be combined with the
+.Fl a
+flag to delete all entries.
+.It Fl i Ar interface
+Limit the operation scope to the
+.Tn ARP
+entries on
+.Ar interface .
+Applicable only to the following operations:
+display one, display all, delete all.
+.It Fl n
+Show network addresses as numbers (normally
+.Nm
+attempts to display addresses symbolically).
.It Fl s Ar hostname ether_addr
Create an
.Tn ARP
entry for the host called
.Ar hostname
-with the Ethernet address
+with the Ethernet address
.Ar ether_addr .
The Ethernet address is given as six hex bytes separated by colons.
The entry will be permanent unless the word
-.Ar temp
-is given in the command.
+.Cm temp
+is given in the command.
If the word
-.Ar pub
-is given, the entry will be "published"; i.e., this system will
+.Cm pub
+is given, the entry will be
+.Dq published ;
+i.e., this system will
act as an
.Tn ARP
server,
-responding to requests for
+responding to requests for
.Ar hostname
even though the host address is not its own.
-.It Fl f
-Causes the file
+In this case the
+.Ar ether_addr
+can be given as
+.Cm auto
+in which case the interfaces on this host will be examined,
+and if one of them is found to occupy the same subnet, its
+Ethernet address will be used.
+If the
+.Cm only
+keyword is also specified, this will create a
+.Dq "published (proxy only)"
+entry.
+This type of entry is created automatically if
+.Nm
+detects that a routing table entry for
+.Ar hostname
+already exists.
+.Pp
+If the
+.Cm reject
+keyword is specified the entry will be marked so that traffic to
+the host will be discarded and the sender will be notified the
+host is unreachable.
+The
+.Cm blackhole
+keyword is similar in that traffic is discarded but the sender is
+not notified.
+These can be used to block external traffic to a host without
+using a firewall.
+.Pp
+If the
+.Cm ifscope
+keyword is specified, the entry will set with an additional property that
+strictly associate the entry to the interface. This allows
+for the presence of mutiple entries with the same destination
+on different interfaces.
+.It Fl S Ar hostname ether_addr
+Is just like
+.Fl s
+except any existing
+.Tn ARP
+entry for this host will be deleted first.
+.It Fl f Ar filename
+Cause the file
.Ar filename
to be read and multiple entries to be set in the
.Tn ARP
-tables. Entries
+tables.
+Entries
in the file should be of the form
.Pp
-.Bd -filled -offset indent -compact
+.Bd -ragged -offset indent -compact
.Ar hostname ether_addr
-.Op Ar temp
-.Op Ar pub
+.Op Cm temp
+.Op Cm pub Op Cm only
+.Op Cm ifscope interface
.Ed
.Pp
with argument meanings as given above.
+Leading whitespace and empty lines are ignored.
+A
+.Ql #
+character will mark the rest of the line as a comment.
.El
.Sh SEE ALSO
.Xr inet 3 ,
.Sh HISTORY
The
.Nm
-command appeared in
-.Bx 4.3 .
+utility appeared in
+.Bx 4.3 .
\ No newline at end of file
* 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.
* SUCH DAMAGE.
*/
+#if 0
#ifndef lint
static char const copyright[] =
"@(#) Copyright (c) 1984, 1993\n\
#endif /* not lint */
#ifndef lint
-#if 0
static char const sccsid[] = "@(#)from: arp.c 8.2 (Berkeley) 1/2/94";
-#endif
-static const char rcsid[] =
- "$FreeBSD: src/usr.sbin/arp/arp.c,v 1.22.2.10 2002/06/18 00:16:59 kbyanc Exp $";
#endif /* not lint */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: src/usr.sbin/arp/arp.c,v 1.65.2.1 2008/04/25 16:38:14 sam Exp $");
+#endif
/*
* arp - display, set, and delete arp table entries
#include <net/if_dl.h>
#include <net/if_types.h>
#include <net/route.h>
+#if 0
+#include <net/iso88025.h>
+#endif
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include <arpa/inet.h>
+#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <netdb.h>
#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <strings.h>
#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <net/ethernet.h>
-
-void search(u_long addr, void (*action)(struct sockaddr_dl *sdl,
- struct sockaddr_inarp *sin, struct rt_msghdr *rtm));
-void print_entry(struct sockaddr_dl *sdl,
- struct sockaddr_inarp *addr, struct rt_msghdr *rtm);
-void nuke_entry(struct sockaddr_dl *sdl,
- struct sockaddr_inarp *addr, struct rt_msghdr *rtm);
-int delete(char *host, char *info);
-void usage(void);
-int set(int argc, char **argv);
-int get(char *host);
-int file(char *name);
-void getsocket(void);
-int my_ether_aton(char *a, struct ether_addr *n);
-int rtmsg(int cmd);
-int get_ether_addr(u_int32_t ipaddr, struct ether_addr *hwaddr);
-
-static int pid;
+typedef void (action_fn)(struct sockaddr_dl *sdl,
+ struct sockaddr_inarp *s_in, struct rt_msghdr *rtm);
+
+static int search(in_addr_t addr, action_fn *action);
+static action_fn print_entry;
+static action_fn nuke_entry;
+
+static int delete(char *host, int do_proxy);
+static void usage(void);
+static int set(int argc, char **argv);
+static int get(char *host);
+static int file(char *name);
+static struct rt_msghdr *rtmsg(int cmd,
+ struct sockaddr_inarp *dst, struct sockaddr_dl *sdl);
+static int get_ether_addr(in_addr_t ipaddr, struct ether_addr *hwaddr);
+static struct sockaddr_inarp *getaddr(char *host);
+static int valid_type(int type);
+
static int nflag; /* no reverse dns lookups */
-static int aflag; /* do it for all entries */
-static int s = -1;
-
-struct sockaddr_in so_mask;
-struct sockaddr_inarp blank_sin, sin_m;
-struct sockaddr_dl blank_sdl, sdl_m;
-int expire_time, flags, doing_proxy, proxy_only, found_entry;
-struct {
- struct rt_msghdr m_rtm;
- char m_space[512];
-} m_rtmsg;
+static char *rifname;
+
+static int expire_time, flags, doing_proxy, proxy_only;
+
+static char *boundif = NULL;
+static unsigned int ifscope = 0;
/* which function we're supposed to do */
#define F_GET 1
#define F_REPLACE 4
#define F_DELETE 5
-#define ROUNDUP(a) \
- ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
+#ifndef SA_SIZE
+#define SA_SIZE(sa) \
+ ( (!(sa) || ((struct sockaddr *)(sa))->sa_len == 0) ? \
+ sizeof(uint32_t) : \
+ 1 + ( (((struct sockaddr *)(sa))->sa_len - 1) | (sizeof(uint32_t) - 1) ) )
+#endif
+
#define SETFUNC(f) { if (func) usage(); func = (f); }
+
int
main(int argc, char *argv[])
{
int ch, func = 0;
int rtn = 0;
+ int aflag = 0; /* do it for all entries */
- pid = getpid();
- while ((ch = getopt(argc, argv, "andfsS")) != -1)
+ while ((ch = getopt(argc, argv, "andfsSi:")) != -1)
switch((char)ch) {
case 'a':
aflag = 1;
case 'f' :
SETFUNC(F_FILESET);
break;
+ case 'i':
+ rifname = optarg;
+ break;
case '?':
default:
usage();
argc -= optind;
argv += optind;
- bzero(&so_mask, sizeof(so_mask));
- so_mask.sin_len = 8;
- so_mask.sin_addr.s_addr = 0xffffffff;
- bzero(&blank_sin, sizeof(blank_sin));
- blank_sin.sin_len = sizeof(blank_sin);
- blank_sin.sin_family = AF_INET;
- bzero(&blank_sdl, sizeof(blank_sdl));
- blank_sdl.sdl_len = sizeof(blank_sdl);
- blank_sdl.sdl_family = AF_LINK;
-
if (!func)
func = F_GET;
+ if (rifname) {
+ if (func != F_GET && !(func == F_DELETE && aflag))
+ errx(1, "-i not applicable to this operation");
+ if (if_nametoindex(rifname) == 0) {
+ if (errno == ENXIO)
+ errx(1, "interface %s does not exist", rifname);
+ else
+ err(1, "if_nametoindex(%s)", rifname);
+ }
+ }
switch (func) {
case F_GET:
if (aflag) {
} else {
if (argc != 1)
usage();
- get(argv[0]);
+ rtn = get(argv[0]);
}
break;
case F_SET:
if (argc < 2 || argc > 6)
usage();
if (func == F_REPLACE)
- (void) delete(argv[0], NULL);
+ (void)delete(argv[0], 0);
rtn = set(argc, argv) ? 1 : 0;
break;
case F_DELETE:
usage();
search(0, nuke_entry);
} else {
- if (argc < 1 || argc > 2)
- usage();
- rtn = delete(argv[0], argv[1]);
+ int do_proxy = 0;
+ int i;
+
+ for (i = 1; i < argc; i++) {
+ if (strncmp(argv[i], "pub", sizeof("pub")) == 0) {
+ do_proxy = SIN_PROXY;
+ } else if (strncmp(argv[i], "ifscope", sizeof("ifscope")) == 0) {
+ if (i + 1 >= argc) {
+ printf("ifscope needs an interface parameter\n");
+ return (1);
+ }
+ boundif = argv[++i];
+ if ((ifscope = if_nametoindex(boundif)) == 0)
+ errx(1, "ifscope has bad interface name: %s", boundif);
+ } else {
+ usage();
+ }
+ }
+ rtn = delete(argv[0], do_proxy);
}
break;
case F_FILESET:
break;
}
- return(rtn);
+ return (rtn);
}
/*
* Process a file to set standard arp entries
*/
-int
+static int
file(char *name)
{
FILE *fp;
int i, retval;
- char line[100], arg[5][50], *args[5];
+ char line[128], arg[7][50], *args[7], *p;
if ((fp = fopen(name, "r")) == NULL)
- errx(1, "cannot open %s", name);
+ err(1, "cannot open %s", name);
args[0] = &arg[0][0];
args[1] = &arg[1][0];
args[2] = &arg[2][0];
args[3] = &arg[3][0];
args[4] = &arg[4][0];
+ args[5] = &arg[5][0];
+ args[6] = &arg[6][0];
retval = 0;
- while(fgets(line, 100, fp) != NULL) {
- i = sscanf(line, "%49s %49s %49s %49s %49s", arg[0], arg[1],
- arg[2], arg[3], arg[4]);
+ while(fgets(line, sizeof(line), fp) != NULL) {
+ if ((p = strchr(line, '#')) != NULL)
+ *p = '\0';
+ for (p = line; isblank(*p); p++);
+ if (*p == '\n' || *p == '\0')
+ continue;
+ i = sscanf(p, "%49s %49s %49s %49s %49s %49s %49s", arg[0], arg[1],
+ arg[2], arg[3], arg[4], arg[5], arg[6]);
if (i < 2) {
warnx("bad line: %s", line);
retval = 1;
return (retval);
}
-void
-getsocket(void)
+/*
+ * Given a hostname, fills up a (static) struct sockaddr_inarp with
+ * the address of the host and returns a pointer to the
+ * structure.
+ */
+static struct sockaddr_inarp *
+getaddr(char *host)
{
- if (s < 0) {
- s = socket(PF_ROUTE, SOCK_RAW, 0);
- if (s < 0)
- err(1, "socket");
+ struct hostent *hp;
+ static struct sockaddr_inarp reply;
+
+ bzero(&reply, sizeof(reply));
+ reply.sin_len = sizeof(reply);
+ reply.sin_family = AF_INET;
+ reply.sin_addr.s_addr = inet_addr(host);
+ if (reply.sin_addr.s_addr == INADDR_NONE) {
+ if (!(hp = gethostbyname(host))) {
+ warnx("%s: %s", host, hstrerror(h_errno));
+ return (NULL);
+ }
+ bcopy((char *)hp->h_addr, (char *)&reply.sin_addr,
+ sizeof reply.sin_addr);
+ }
+ return (&reply);
+}
+
+/*
+ * Returns true if the type is a valid one for ARP.
+ */
+static int
+valid_type(int type)
+{
+
+ switch (type) {
+ case IFT_ETHER:
+ case IFT_FDDI:
+ case IFT_ISO88023:
+ case IFT_ISO88024:
+#if 0
+ case IFT_ISO88025:
+#endif
+ case IFT_L2VLAN:
+#ifdef IFT_BRIDGE
+ case IFT_BRIDGE:
+#endif
+ return (1);
+ default:
+ return (0);
}
}
/*
* Set an individual arp entry
*/
-int
+static int
set(int argc, char **argv)
{
- struct hostent *hp;
- register struct sockaddr_inarp *addr = &sin_m;
- register struct sockaddr_dl *sdl;
- register struct rt_msghdr *rtm = &(m_rtmsg.m_rtm);
+ struct sockaddr_inarp *addr;
+ struct sockaddr_inarp *dst; /* what are we looking for */
+ struct sockaddr_dl *sdl;
+ struct rt_msghdr *rtm;
struct ether_addr *ea;
char *host = argv[0], *eaddr = argv[1];
+ struct sockaddr_dl sdl_m;
- getsocket();
argc -= 2;
argv += 2;
- sdl_m = blank_sdl;
- sin_m = blank_sin;
- addr->sin_addr.s_addr = inet_addr(host);
- if (addr->sin_addr.s_addr == INADDR_NONE) {
- if (!(hp = gethostbyname(host))) {
- warnx("%s: %s", host, hstrerror(h_errno));
- return (1);
- }
- bcopy((char *)hp->h_addr, (char *)&addr->sin_addr,
- sizeof addr->sin_addr);
- }
+
+ bzero(&sdl_m, sizeof(sdl_m));
+ sdl_m.sdl_len = sizeof(sdl_m);
+ sdl_m.sdl_family = AF_LINK;
+
+ dst = getaddr(host);
+ if (dst == NULL)
+ return (1);
doing_proxy = flags = proxy_only = expire_time = 0;
+ boundif = NULL;
+ ifscope = 0;
while (argc-- > 0) {
- if (strncmp(argv[0], "temp", 4) == 0) {
+ if (strncmp(argv[0], "temp", sizeof("temp")) == 0) {
struct timeval tv;
gettimeofday(&tv, 0);
expire_time = tv.tv_sec + 20 * 60;
- }
- else if (strncmp(argv[0], "pub", 3) == 0) {
+ } else if (strncmp(argv[0], "pub", sizeof("pub")) == 0) {
flags |= RTF_ANNOUNCE;
doing_proxy = 1;
- if (argc && strncmp(argv[1], "only", 3) == 0) {
+ if (argc && strncmp(argv[1], "only", sizeof("only")) == 0) {
proxy_only = 1;
- sin_m.sin_other = SIN_PROXY;
+ dst->sin_other = SIN_PROXY;
argc--; argv++;
}
- } else if (strncmp(argv[0], "trail", 5) == 0) {
+ } else if (strncmp(argv[0], "blackhole", sizeof("blackhole")) == 0) {
+ flags |= RTF_BLACKHOLE;
+ } else if (strncmp(argv[0], "reject", sizeof("reject")) == 0) {
+ flags |= RTF_REJECT;
+ } else if (strncmp(argv[0], "trail", sizeof("trail")) == 0) {
+ /* XXX deprecated and undocumented feature */
printf("%s: Sending trailers is no longer supported\n",
host);
+ } else if (strncmp(argv[0], "ifscope", sizeof("ifscope")) == 0) {
+ if (argc < 1) {
+ printf("ifscope needs an interface parameter\n");
+ return (1);
+ }
+ boundif = argv[1];
+ if ((ifscope = if_nametoindex(boundif)) == 0)
+ errx(1, "ifscope has bad interface name: %s", boundif);
+ argc--; argv++;
}
argv++;
}
ea = (struct ether_addr *)LLADDR(&sdl_m);
if (doing_proxy && !strcmp(eaddr, "auto")) {
- if (!get_ether_addr(addr->sin_addr.s_addr, ea)) {
+ if (!get_ether_addr(dst->sin_addr.s_addr, ea)) {
printf("no interface found for %s\n",
- inet_ntoa(addr->sin_addr));
+ inet_ntoa(dst->sin_addr));
return (1);
}
sdl_m.sdl_alen = ETHER_ADDR_LEN;
} else {
- if (my_ether_aton(eaddr, ea) == 0)
+ struct ether_addr *ea1 = ether_aton(eaddr);
+
+ if (ea1 == NULL) {
+ warnx("invalid Ethernet address '%s'", eaddr);
+ return (1);
+ } else {
+ *ea = *ea1;
sdl_m.sdl_alen = ETHER_ADDR_LEN;
+ }
}
-tryagain:
- if (rtmsg(RTM_GET) < 0) {
- warn("%s", host);
- return (1);
- }
- addr = (struct sockaddr_inarp *)(rtm + 1);
- sdl = (struct sockaddr_dl *)(ROUNDUP(addr->sin_len) + (char *)addr);
- if (addr->sin_addr.s_addr == sin_m.sin_addr.s_addr) {
+ for (;;) { /* try at most twice */
+ rtm = rtmsg(RTM_GET, dst, &sdl_m);
+ if (rtm == NULL) {
+ warn("%s", host);
+ return (1);
+ }
+ addr = (struct sockaddr_inarp *)(rtm + 1);
+ sdl = (struct sockaddr_dl *)(SA_SIZE(addr) + (char *)addr);
+ if (addr->sin_addr.s_addr != dst->sin_addr.s_addr)
+ break;
if (sdl->sdl_family == AF_LINK &&
(rtm->rtm_flags & RTF_LLINFO) &&
- !(rtm->rtm_flags & RTF_GATEWAY)) switch (sdl->sdl_type) {
- case IFT_ETHER: case IFT_FDDI: case IFT_ISO88023:
- case IFT_ISO88024: case IFT_ISO88025: case IFT_L2VLAN:
- goto overwrite;
- }
+ !(rtm->rtm_flags & RTF_GATEWAY) &&
+ valid_type(sdl->sdl_type) )
+ break;
+ /*
+ * If we asked for a scope entry and did not get one or
+ * did not asked for a scope entry and got one, we can
+ * proceed.
+ */
+ if ((ifscope != 0) != (rtm->rtm_flags & RTF_IFSCOPE))
+ break;
if (doing_proxy == 0) {
printf("set: can only proxy for %s\n", host);
return (1);
}
- if (sin_m.sin_other & SIN_PROXY) {
+ if (dst->sin_other & SIN_PROXY) {
printf("set: proxy entry exists for non 802 device\n");
- return(1);
+ return (1);
}
- sin_m.sin_other = SIN_PROXY;
+ dst->sin_other = SIN_PROXY;
proxy_only = 1;
- goto tryagain;
}
-overwrite:
+
if (sdl->sdl_family != AF_LINK) {
printf("cannot intuit interface index and type for %s\n", host);
return (1);
}
sdl_m.sdl_type = sdl->sdl_type;
sdl_m.sdl_index = sdl->sdl_index;
- return (rtmsg(RTM_ADD));
+ return (rtmsg(RTM_ADD, dst, &sdl_m) == NULL);
}
/*
* Display an individual arp entry
*/
-int
+static int
get(char *host)
{
- struct hostent *hp;
- struct sockaddr_inarp *addr = &sin_m;
-
- sin_m = blank_sin;
- addr->sin_addr.s_addr = inet_addr(host);
- if (addr->sin_addr.s_addr == INADDR_NONE) {
- if (!(hp = gethostbyname(host)))
- errx(1, "%s: %s", host, hstrerror(h_errno));
- bcopy((char *)hp->h_addr, (char *)&addr->sin_addr,
- sizeof addr->sin_addr);
- }
- search(addr->sin_addr.s_addr, print_entry);
- if (found_entry == 0) {
- printf("%s (%s) -- no entry\n",
+ struct sockaddr_inarp *addr;
+
+ addr = getaddr(host);
+ if (addr == NULL)
+ return (1);
+ if (0 == search(addr->sin_addr.s_addr, print_entry)) {
+ printf("%s (%s) -- no entry",
host, inet_ntoa(addr->sin_addr));
- return(1);
+ if (rifname)
+ printf(" on %s", rifname);
+ printf("\n");
+ return (1);
}
- return(0);
+ return (0);
}
/*
* Delete an arp entry
*/
-int
-delete(char *host, char *info)
+static int
+delete(char *host, int do_proxy)
{
- struct hostent *hp;
- register struct sockaddr_inarp *addr = &sin_m;
- register struct rt_msghdr *rtm = &m_rtmsg.m_rtm;
+ struct sockaddr_inarp *addr, *dst;
+ struct rt_msghdr *rtm;
struct sockaddr_dl *sdl;
- getsocket();
- sin_m = blank_sin;
- if (info) {
- if (strncmp(info, "pub", 3) == 0)
- sin_m.sin_other = SIN_PROXY;
- else
- usage();
- }
- addr->sin_addr.s_addr = inet_addr(host);
- if (addr->sin_addr.s_addr == INADDR_NONE) {
- if (!(hp = gethostbyname(host))) {
- warnx("%s: %s", host, hstrerror(h_errno));
+ dst = getaddr(host);
+ if (dst == NULL)
+ return (1);
+ dst->sin_other = do_proxy;
+ for (;;) { /* try twice */
+ rtm = rtmsg(RTM_GET, dst, NULL);
+ if (rtm == NULL) {
+ warn("%s", host);
return (1);
}
- bcopy((char *)hp->h_addr, (char *)&addr->sin_addr,
- sizeof addr->sin_addr);
- }
-tryagain:
- if (rtmsg(RTM_GET) < 0) {
- warn("%s", host);
- return (1);
- }
- addr = (struct sockaddr_inarp *)(rtm + 1);
- sdl = (struct sockaddr_dl *)(ROUNDUP(addr->sin_len) + (char *)addr);
- if (addr->sin_addr.s_addr == sin_m.sin_addr.s_addr) {
- if (sdl->sdl_family == AF_LINK &&
+ addr = (struct sockaddr_inarp *)(rtm + 1);
+ sdl = (struct sockaddr_dl *)(SA_SIZE(addr) + (char *)addr);
+ if (addr->sin_addr.s_addr == dst->sin_addr.s_addr &&
+ sdl->sdl_family == AF_LINK &&
(rtm->rtm_flags & RTF_LLINFO) &&
- !(rtm->rtm_flags & RTF_GATEWAY)) switch (sdl->sdl_type) {
- case IFT_ETHER: case IFT_FDDI: case IFT_ISO88023:
- case IFT_ISO88024: case IFT_ISO88025: case IFT_L2VLAN:
- goto delete;
+ !(rtm->rtm_flags & RTF_GATEWAY) &&
+ valid_type(sdl->sdl_type) )
+ break; /* found it */
+ if (dst->sin_other & SIN_PROXY) {
+ fprintf(stderr, "delete: cannot locate %s\n",host);
+ return (1);
}
+ dst->sin_other = SIN_PROXY;
}
- if (sin_m.sin_other & SIN_PROXY) {
- fprintf(stderr, "delete: can't locate %s\n",host);
- return (1);
- } else {
- sin_m.sin_other = SIN_PROXY;
- goto tryagain;
- }
-delete:
- if (sdl->sdl_family != AF_LINK) {
- printf("cannot locate %s\n", host);
- return (1);
- }
- if (rtmsg(RTM_DELETE) == 0) {
+ if (rtmsg(RTM_DELETE, dst, NULL) != NULL) {
printf("%s (%s) deleted\n", host, inet_ntoa(addr->sin_addr));
return (0);
}
/*
* Search the arp table and do some action on matching entries
*/
-void
-search(u_long addr, void (*action)(struct sockaddr_dl *sdl,
- struct sockaddr_inarp *sin, struct rt_msghdr *rtm))
+static int
+search(in_addr_t addr, action_fn *action)
{
int mib[6];
size_t needed;
- char *lim, *buf, *next;
+ char *lim, *buf, *newbuf, *next;
struct rt_msghdr *rtm;
struct sockaddr_inarp *sin2;
struct sockaddr_dl *sdl;
+ char ifname[IF_NAMESIZE];
+ int st, found_entry = 0;
mib[0] = CTL_NET;
mib[1] = PF_ROUTE;
mib[4] = NET_RT_FLAGS;
mib[5] = RTF_LLINFO;
if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0)
- errx(1, "route-sysctl-estimate");
- if ((buf = malloc(needed)) == NULL)
- errx(1, "malloc");
- if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0)
- errx(1, "actual retrieval of routing table");
+ err(1, "route-sysctl-estimate");
+ if (needed == 0) /* empty table */
+ return 0;
+ buf = NULL;
+ for (;;) {
+ newbuf = realloc(buf, needed);
+ if (newbuf == NULL) {
+ if (buf != NULL)
+ free(buf);
+ errx(1, "could not reallocate memory");
+ }
+ buf = newbuf;
+ st = sysctl(mib, 6, buf, &needed, NULL, 0);
+ if (st == 0 || errno != ENOMEM)
+ break;
+ needed += needed / 8;
+ }
+ if (st == -1)
+ err(1, "actual retrieval of routing table");
lim = buf + needed;
for (next = buf; next < lim; next += rtm->rtm_msglen) {
rtm = (struct rt_msghdr *)next;
sin2 = (struct sockaddr_inarp *)(rtm + 1);
- sdl = (struct sockaddr_dl*)((char*)sin2 + ROUNDUP(sin2->sin_len));
+ sdl = (struct sockaddr_dl *)((char *)sin2 + SA_SIZE(sin2));
+ if (rifname && if_indextoname(sdl->sdl_index, ifname) &&
+ strcmp(ifname, rifname))
+ continue;
if (addr) {
if (addr != sin2->sin_addr.s_addr)
continue;
(*action)(sdl, sin2, rtm);
}
free(buf);
+ return (found_entry);
}
-
/*
* Stolen and adapted from ifconfig
*/
/*
* Display an arp entry
*/
-void
+static void
print_entry(struct sockaddr_dl *sdl,
struct sockaddr_inarp *addr, struct rt_msghdr *rtm)
{
const char *host;
struct hostent *hp;
char ifname[IF_NAMESIZE];
+#if 0
+ struct iso88025_sockaddr_dl_data *trld;
+ int seg;
+#endif
if (nflag == 0)
hp = gethostbyaddr((caddr_t)&(addr->sin_addr),
}
printf("%s (%s) at ", host, inet_ntoa(addr->sin_addr));
if (sdl->sdl_alen) {
+#if 1
print_lladdr(sdl);
- } else
+#else
+ if ((sdl->sdl_type == IFT_ETHER ||
+ sdl->sdl_type == IFT_L2VLAN ||
+ sdl->sdl_type == IFT_BRIDGE) &&
+ sdl->sdl_alen == ETHER_ADDR_LEN)
+ printf("%s", ether_ntoa((struct ether_addr *)LLADDR(sdl)));
+ else {
+ int n = sdl->sdl_nlen > 0 ? sdl->sdl_nlen + 1 : 0;
+
+ printf("%s", link_ntoa(sdl) + n);
+ }
+#endif
+ } else
printf("(incomplete)");
if (if_indextoname(sdl->sdl_index, ifname) != NULL)
printf(" on %s", ifname);
+ if ((rtm->rtm_flags & RTF_IFSCOPE))
+ printf(" ifscope");
if (rtm->rtm_rmx.rmx_expire == 0)
printf(" permanent");
if (addr->sin_other & SIN_PROXY)
printf(" published (proxy only)");
if (rtm->rtm_addrs & RTA_NETMASK) {
addr = (struct sockaddr_inarp *)
- (ROUNDUP(sdl->sdl_len) + (char *)sdl);
+ (SA_SIZE(sdl) + (char *)sdl);
if (addr->sin_addr.s_addr == 0xffffffff)
printf(" published");
if (addr->sin_len != 8)
printf("(weird)");
}
switch(sdl->sdl_type) {
- case IFT_ETHER:
+ case IFT_ETHER:
printf(" [ethernet]");
break;
- case IFT_ISO88025:
-#ifndef __APPLE__
+#if 0
+ case IFT_ISO88025:
printf(" [token-ring]");
trld = SDL_ISO88025(sdl);
if (trld->trld_rcf != 0) {
seg++)
printf(":%x", ntohs(*(trld->trld_route[seg])));
}
+ break;
#endif
+ case IFT_FDDI:
+ printf(" [fddi]");
break;
- case IFT_L2VLAN:
+ case IFT_ATM:
+ printf(" [atm]");
+ break;
+ case IFT_L2VLAN:
printf(" [vlan]");
break;
- case IFT_IEEE1394:
- printf(" [firewire]");
+ case IFT_IEEE1394:
+ printf(" [firewire]");
+ break;
+#ifdef IFT_BRIDGE
+ case IFT_BRIDGE:
+ printf(" [bridge]");
break;
- default:
+#endif
+ default:
break;
}
/*
* Nuke an arp entry
*/
-void
-nuke_entry(struct sockaddr_dl *sdl,
- struct sockaddr_inarp *addr, struct rt_msghdr *rtm )
+static void
+nuke_entry(struct sockaddr_dl *sdl __unused,
+ struct sockaddr_inarp *addr, struct rt_msghdr *rtm __unused)
{
char ip[20];
snprintf(ip, sizeof(ip), "%s", inet_ntoa(addr->sin_addr));
- delete(ip, NULL);
-}
-
-int
-my_ether_aton(char *a, struct ether_addr *n)
-{
- struct ether_addr *ea;
-
- if ((ea = ether_aton(a)) == NULL) {
- warnx("invalid Ethernet address '%s'", a);
- return (1);
- }
- *n = *ea;
- return (0);
+ (void)delete(ip, 0);
}
-void
+static void
usage(void)
{
fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
- "usage: arp [-n] hostname",
- " arp [-n] -a",
- " arp -d hostname [pub]",
- " arp -d -a",
- " arp -s hostname ether_addr [temp] [pub]",
- " arp -S hostname ether_addr [temp] [pub]",
+ "usage: arp [-n] [-i interface] hostname",
+ " arp [-n] [-i interface] -a",
+ " arp -d hostname [pub] [ifscope interface]",
+ " arp -d [-i interface] -a",
+ " arp -s hostname ether_addr [temp] [reject] [blackhole] [pub [only]] [ifscope interface]",
+ " arp -S hostname ether_addr [temp] [reject] [blackhole] [pub [only]] [ifscope interface]",
" arp -f filename");
exit(1);
}
-int
-rtmsg(int cmd)
+static struct rt_msghdr *
+rtmsg(int cmd, struct sockaddr_inarp *dst, struct sockaddr_dl *sdl)
{
static int seq;
int rlen;
- register struct rt_msghdr *rtm = &m_rtmsg.m_rtm;
- register char *cp = m_rtmsg.m_space;
- register int l;
+ int l;
+ struct sockaddr_in so_mask, *so_mask_ptr = &so_mask;
+ static int s = -1;
+ static pid_t pid;
+
+ static struct {
+ struct rt_msghdr m_rtm;
+ char m_space[512];
+ } m_rtmsg;
+
+ struct rt_msghdr *rtm = &m_rtmsg.m_rtm;
+ char *cp = m_rtmsg.m_space;
+
+ if (s < 0) { /* first time: open socket, get pid */
+ s = socket(PF_ROUTE, SOCK_RAW, 0);
+ if (s < 0)
+ err(1, "socket");
+ pid = getpid();
+ }
+ bzero(&so_mask, sizeof(so_mask));
+ so_mask.sin_len = 8;
+ so_mask.sin_addr.s_addr = 0xffffffff;
errno = 0;
+ /*
+ * XXX RTM_DELETE relies on a previous RTM_GET to fill the buffer
+ * appropriately (except for the mask set just above).
+ */
if (cmd == RTM_DELETE)
goto doit;
bzero((char *)&m_rtmsg, sizeof(m_rtmsg));
rtm->rtm_flags = flags;
rtm->rtm_version = RTM_VERSION;
+ /*
+ * Note: On RTM_GET the kernel will return a scoped route when both a scoped route and
+ * a unscoped route exist. That means we cannot delete a unscoped route if there is
+ * also a matching scope route
+ */
+ if (ifscope) {
+ rtm->rtm_index = ifscope;
+ rtm->rtm_flags |= RTF_IFSCOPE;
+ }
+
switch (cmd) {
default:
errx(1, "internal wrong cmd");
rtm->rtm_rmx.rmx_expire = expire_time;
rtm->rtm_inits = RTV_EXPIRE;
rtm->rtm_flags |= (RTF_HOST | RTF_STATIC);
- sin_m.sin_other = 0;
+ dst->sin_other = 0;
if (doing_proxy) {
if (proxy_only)
- sin_m.sin_other = SIN_PROXY;
+ dst->sin_other = SIN_PROXY;
else {
rtm->rtm_addrs |= RTA_NETMASK;
rtm->rtm_flags &= ~RTF_HOST;
rtm->rtm_addrs |= RTA_DST;
}
#define NEXTADDR(w, s) \
- if (rtm->rtm_addrs & (w)) { \
- bcopy((char *)&s, cp, sizeof(s)); cp += ROUNDUP(sizeof(s));}
+ if ((s) != NULL && rtm->rtm_addrs & (w)) { \
+ bcopy((s), cp, sizeof(*(s))); cp += SA_SIZE(s);}
- NEXTADDR(RTA_DST, sin_m);
- NEXTADDR(RTA_GATEWAY, sdl_m);
- NEXTADDR(RTA_NETMASK, so_mask);
+ NEXTADDR(RTA_DST, dst);
+ NEXTADDR(RTA_GATEWAY, sdl);
+ NEXTADDR(RTA_NETMASK, so_mask_ptr);
rtm->rtm_msglen = cp - (char *)&m_rtmsg;
doit:
if ((rlen = write(s, (char *)&m_rtmsg, l)) < 0) {
if (errno != ESRCH || cmd != RTM_DELETE) {
warn("writing to routing socket");
- return (-1);
+ return (NULL);
}
}
do {
} while (l > 0 && (rtm->rtm_seq != seq || rtm->rtm_pid != pid));
if (l < 0)
warn("read from routing socket");
- return (0);
+ return (rtm);
}
/*
*/
#define MAX_IFS 32
-int
-get_ether_addr(u_int32_t ipaddr, struct ether_addr *hwaddr)
+static int
+get_ether_addr(in_addr_t ipaddr, struct ether_addr *hwaddr)
{
struct ifreq *ifr, *ifend, *ifp;
- u_int32_t ina, mask;
+ in_addr_t ina, mask;
struct sockaddr_dl *dla;
struct ifreq ifreq;
struct ifconf ifc;
struct ifreq ifs[MAX_IFS];
int sock;
+ int retval = 0;
sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock < 0)
ifc.ifc_req = ifs;
if (ioctl(sock, SIOCGIFCONF, &ifc) < 0) {
warnx("ioctl(SIOCGIFCONF)");
- close(sock);
- return 0;
+ goto done;
}
+#define NEXTIFR(i) \
+ ((struct ifreq *)((char *)&(i)->ifr_addr \
+ + MAX((i)->ifr_addr.sa_len, sizeof((i)->ifr_addr))) )
+
/*
- * Scan through looking for an interface with an Internet
- * address on the same subnet as `ipaddr'.
- */
- ifend = (struct ifreq *) (ifc.ifc_buf + ifc.ifc_len);
- for (ifr = ifc.ifc_req; ifr < ifend; ) {
- if (ifr->ifr_addr.sa_family == AF_INET) {
- ina = ((struct sockaddr_in *)
- &ifr->ifr_addr)->sin_addr.s_addr;
- strncpy(ifreq.ifr_name, ifr->ifr_name,
- sizeof(ifreq.ifr_name));
- /*
- * Check that the interface is up,
- * and not point-to-point or loopback.
- */
- if (ioctl(sock, SIOCGIFFLAGS, &ifreq) < 0)
- continue;
- if ((ifreq.ifr_flags &
- (IFF_UP|IFF_BROADCAST|IFF_POINTOPOINT|
- IFF_LOOPBACK|IFF_NOARP))
- != (IFF_UP|IFF_BROADCAST))
- goto nextif;
- /*
- * Get its netmask and check that it's on
- * the right subnet.
- */
- if (ioctl(sock, SIOCGIFNETMASK, &ifreq) < 0)
- continue;
- mask = ((struct sockaddr_in *)
- &ifreq.ifr_addr)->sin_addr.s_addr;
- if ((ipaddr & mask) != (ina & mask))
- goto nextif;
- break;
- }
-nextif:
- ifr = (struct ifreq *) ((char *)&ifr->ifr_addr
- + MAX(ifr->ifr_addr.sa_len, sizeof(ifr->ifr_addr)));
+ * Scan through looking for an interface with an Internet
+ * address on the same subnet as `ipaddr'.
+ */
+ ifend = (struct ifreq *)(ifc.ifc_buf + ifc.ifc_len);
+ for (ifr = ifc.ifc_req; ifr < ifend; ifr = NEXTIFR(ifr) ) {
+ if (ifr->ifr_addr.sa_family != AF_INET)
+ continue;
+ strncpy(ifreq.ifr_name, ifr->ifr_name,
+ sizeof(ifreq.ifr_name));
+ ifreq.ifr_addr = ifr->ifr_addr;
+ /*
+ * Check that the interface is up,
+ * and not point-to-point or loopback.
+ */
+ if (ioctl(sock, SIOCGIFFLAGS, &ifreq) < 0)
+ continue;
+ if ((ifreq.ifr_flags &
+ (IFF_UP|IFF_BROADCAST|IFF_POINTOPOINT|
+ IFF_LOOPBACK|IFF_NOARP))
+ != (IFF_UP|IFF_BROADCAST))
+ continue;
+ /*
+ * Get its netmask and check that it's on
+ * the right subnet.
+ */
+ if (ioctl(sock, SIOCGIFNETMASK, &ifreq) < 0)
+ continue;
+ mask = ((struct sockaddr_in *)
+ &ifreq.ifr_addr)->sin_addr.s_addr;
+ ina = ((struct sockaddr_in *)
+ &ifr->ifr_addr)->sin_addr.s_addr;
+ if ((ipaddr & mask) == (ina & mask))
+ break; /* ok, we got it! */
}
- if (ifr >= ifend) {
- close(sock);
- return 0;
- }
+ if (ifr >= ifend)
+ goto done;
/*
- * Now scan through again looking for a link-level address
- * for this interface.
- */
+ * Now scan through again looking for a link-level address
+ * for this interface.
+ */
ifp = ifr;
- for (ifr = ifc.ifc_req; ifr < ifend; ) {
- if (strcmp(ifp->ifr_name, ifr->ifr_name) == 0
- && ifr->ifr_addr.sa_family == AF_LINK) {
- /*
- * Found the link-level address - copy it out
- */
- dla = (struct sockaddr_dl *) &ifr->ifr_addr;
- close (sock);
- printf("using interface %s for proxy with address ",
- ifp->ifr_name);
- print_lladdr(dla);
- printf("\n");
- return dla->sdl_alen;
- }
- ifr = (struct ifreq *) ((char *)&ifr->ifr_addr
- + MAX(ifr->ifr_addr.sa_len, sizeof(ifr->ifr_addr)));
- }
- return 0;
+ for (ifr = ifc.ifc_req; ifr < ifend; ifr = NEXTIFR(ifr))
+ if (strcmp(ifp->ifr_name, ifr->ifr_name) == 0 &&
+ ifr->ifr_addr.sa_family == AF_LINK)
+ break;
+ if (ifr >= ifend)
+ goto done;
+ /*
+ * Found the link-level address - copy it out
+ */
+ dla = (struct sockaddr_dl *) &ifr->ifr_addr;
+ memcpy(hwaddr, LLADDR(dla), dla->sdl_alen);
+ printf("using interface %s for proxy with address ",
+ ifp->ifr_name);
+ printf("%s\n", ether_ntoa(hwaddr));
+ retval = dla->sdl_alen;
+done:
+ close(sock);
+ return (retval);
}
.%B "Trailer Encapsulations
.%T RFC893
.Re
-
+++ /dev/null
-Project = bootparams
-
-SubProjects = bootparamd.tproj bpwhoami.tproj \
- #bootparams
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
+++ /dev/null
-Project = bootparamd
-Install_Dir = /usr/sbin
-
-CFILES = bootparamd.c bootparam_proc.c
-RPCFILES = ../bootparams/bootparam_prot.x
-RPCSVCFILES = ../bootparams/bootparam_prot.x
-MANPAGES = bootparamd.8
-
-Extra_CC_Flags = -mdynamic-no-pic -dead_strip
-#Extra_LD_Flags = -lbootparam
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
+++ /dev/null
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * BOOTPARAMS server
- * Copyright 1998, Apple Computer Inc. Unpublished.
- *
- * Written by Marc Majka
- */
-
-#include <rpc/rpc.h>
-#include "bootparam_prot.h"
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <bootparams.h>
-#include <syslog.h>
-
-extern int debug;
-extern unsigned long route_addr;
-extern char domain_name[];
-
-struct hostent *h;
-static char hostname[MAXHOSTNAMELEN];
-
-bp_whoami_res *
-bootparamproc_whoami_1_svc(whoami, req)
-bp_whoami_arg *whoami;
-struct svc_req *req;
-{
- long haddr;
- static bp_whoami_res res;
- struct bootparamsent *bp;
-
- if (debug)
- {
- fprintf(stderr,"whoami %d.%d.%d.%d\n",
- 255 & whoami->client_address.bp_address_u.ip_addr.net,
- 255 & whoami->client_address.bp_address_u.ip_addr.host,
- 255 & whoami->client_address.bp_address_u.ip_addr.lh,
- 255 & whoami->client_address.bp_address_u.ip_addr.impno);
- }
-
- bcopy((char *)&whoami->client_address.bp_address_u.ip_addr,
- (char *)&haddr, sizeof(haddr));
- h = gethostbyaddr((char *)&haddr, sizeof(haddr), AF_INET);
- if (h == NULL)
- {
- if (debug) fprintf(stderr,"whoami failed: gethostbyaddr\n");
- return NULL;
- }
-
- /* check whether subsequent bpgetfile requests would succeed */
- bp = bootparams_getbyname(h->h_name);
- if (bp == NULL) {
- if (debug)
- fprintf(stderr, "whoami failed: bootparams_getbyname\n");
- return NULL;
- }
-
- sprintf(hostname, "%s", h->h_name);
- res.client_name = hostname;
-
- res.domain_name = domain_name;
-
- res.router_address.address_type = IP_ADDR_TYPE;
- bcopy(&route_addr, &res.router_address.bp_address_u.ip_addr, 4);
-
- if (debug)
- {
- fprintf(stderr, "whoami name=%s domain=%s router=%d.%d.%d.%d\n",
- res.client_name,
- res.domain_name,
- 255 & res.router_address.bp_address_u.ip_addr.net,
- 255 & res.router_address.bp_address_u.ip_addr.host,
- 255 & res.router_address.bp_address_u.ip_addr.lh,
- 255 & res.router_address.bp_address_u.ip_addr.impno);
- }
-
- return (&res);
-}
-
-bp_getfile_res *
-bootparamproc_getfile_1_svc(getfile, req)
-bp_getfile_arg *getfile;
-struct svc_req *req;
-{
- static bp_getfile_res res;
- struct bootparamsent *bp;
- static char s[1024];
- char *p;
- int i, len;
-
- if (debug)
- {
- fprintf(stderr, "getfile %s %s\n",
- getfile->client_name, getfile->file_id);
- }
-
- bp = bootparams_getbyname(getfile->client_name);
- if (bp == NULL)
- {
- if (debug)
- {
- fprintf(stderr, "can't find bootparams for %s\n",
- getfile->client_name);
- fprintf(stderr, "getfile failed\n");
- }
- return NULL;
- }
-
- len = strlen(getfile->file_id) + 1;
- sprintf(s, "%s=", getfile->file_id);
-
- for (i = 0; bp->bp_bootparams[i] != NULL; i++)
- {
- if (!strncmp(s, bp->bp_bootparams[i], len)) break;
- }
-
- if (bp->bp_bootparams[i] == NULL)
- {
- if (debug)
- {
- fprintf(stderr, "can't find bootparam %s\n", getfile->file_id);
- fprintf(stderr, "getfile failed\n");
- }
- return NULL;
- }
-
- sprintf(s, bp->bp_bootparams[i] + len);
- p = strchr(s, ':');
- if ((p == NULL) || (p == s))
- {
- hostname[0] = '\0';
- res.server_name = hostname;
- res.server_address.bp_address_u.ip_addr.net = 0;
- res.server_address.bp_address_u.ip_addr.host = 0;
- res.server_address.bp_address_u.ip_addr.lh = 0;
- res.server_address.bp_address_u.ip_addr.impno = 0;
- res.server_address.address_type = 1;
-
- if (p == NULL) res.server_path = s;
- else res.server_path = s + 1;
-
- if (debug)
- {
- fprintf(stderr, "getfile server=%s (%d.%d.%d.%d) path=%s\n",
- res.server_name,
- 255 & res.server_address.bp_address_u.ip_addr.net,
- 255 & res.server_address.bp_address_u.ip_addr.host,
- 255 & res.server_address.bp_address_u.ip_addr.lh,
- 255 & res.server_address.bp_address_u.ip_addr.impno,
- res.server_path);
- }
- return (&res);
- }
-
- *p = '\0';
- p++;
- h = gethostbyname(s);
- if (h == NULL)
- {
- if (debug)
- {
- fprintf(stderr, "can't find server %s\n", s);
- fprintf(stderr, "getfile failed\n");
- }
- return NULL;
- }
-
- res.server_name = s;
- res.server_path = p;
- bcopy(h->h_addr, &res.server_address.bp_address_u.ip_addr, h->h_length);
- res.server_address.address_type = IP_ADDR_TYPE;
-
- if (debug)
- {
- fprintf(stderr, "getfile server=%s (%d.%d.%d.%d) path=%s\n",
- res.server_name,
- 255 & res.server_address.bp_address_u.ip_addr.net,
- 255 & res.server_address.bp_address_u.ip_addr.host,
- 255 & res.server_address.bp_address_u.ip_addr.lh,
- 255 & res.server_address.bp_address_u.ip_addr.impno,
- res.server_path);
- }
-
- return (&res);
-}
+++ /dev/null
-.Dd Oct 27, 20023
-.Dt bootparamd 8
-.Os "Mac OS X"
-.Sh NAME
-.Nm bootparamd
-.Nd boot parameter server
-.Sh SYNOPSIS
-.Nm
-.Op Fl d
-.Op Fl r Ar router
-.Sh DESCRIPTION
-.Nm
-provides configuration parameters for clients using the bootparams RPC protocol.
-The server is not started by default on Mac OS X systems, nor is it used by
-Mac OS X clients.
-.Pp
-When invoked with the
-.Fl d
-option,
-.Nm
-runs in debug mode.
-It remains attached to the controlling terminal and prints a log of its activity.
-.Pp
-The
-.Fl r Ar router
-option may be used to set the router returned in WHOAMI replies.
-The
-.Ar router
-argument may be a name or a dotted-quad IP address.
-.Sh SEE ALSO
-bootparams(5), lookupd(8)
+++ /dev/null
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * BOOTPARAMS server
- * Copyright 1998, Apple Computer Inc. Unpublished.
- *
- * Written by Marc Majka
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <syslog.h>
-#include <rpc/rpc.h>
-#include <rpc/pmap_clnt.h>
-#include "bootparam_prot.h"
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/param.h>
-#include <netdb.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-int debug = 0;
-char *progname;
-
-unsigned long route_addr;
-char domain_name[MAXHOSTNAMELEN];
-
-int _rpcsvcdirty;
-extern void bootparamprog_1();
-
-extern int getdomainname(char*, int);
-
-void
-usage(void)
-{
- fprintf(stderr, "usage: %s [-d] [-r router]\n", progname);
- exit(1);
-}
-
-int
-main(int argc, char *argv[])
-{
- SVCXPRT *transp;
- int i;
- struct hostent *h;
- char str[256];
- FILE *fp;
-
- progname = strrchr(argv[0],'/');
- if (progname) progname++;
- else progname = argv[0];
-
- route_addr = 0;
-
- for (i = 1; i < argc; i++)
- {
- if (!strcmp(argv[i], "-d"))
- {
- debug = 1;
- }
- else if (!strcmp(argv[i], "-r"))
- {
- i++;
- if (i >= argc) usage();
-
- route_addr = inet_addr(argv[i]);
- if (route_addr == -1)
- {
- h = gethostbyname(argv[i]);
- if (h == NULL)
- {
- fprintf(stderr, "%s: Can't find host %s\n",
- progname, argv[i]);
- exit(1);
- }
-
- bcopy(h->h_addr, (char *)&route_addr, sizeof(route_addr));
- }
- }
- else usage();
- }
-
- if (route_addr == 0)
- {
- fp = popen("/usr/sbin/netstat -r -n", "r");
- while (NULL != fgets(str, 256, fp))
- {
- if (strncmp(str, "default ", 8)) continue;
- if (!strncmp(str + 17, "link", 4)) continue;
- route_addr = inet_addr(str+17);
- break;
- }
- pclose(fp);
- }
-
- domain_name[0] = '\0';
- if (getdomainname(domain_name, sizeof(domain_name)) != 0)
- domain_name[0] = '\0';
-
- if (debug == 0) daemon(0,0);
-
- openlog(progname, 0, LOG_DAEMON);
- pmap_unset(BOOTPARAMPROG, BOOTPARAMVERS);
-
- transp = svcudp_create(RPC_ANYSOCK);
- if (transp == NULL)
- {
- syslog(LOG_ERR, "Can't create udp service.");
- exit(1);
- }
-
- if (!svc_register(transp, BOOTPARAMPROG, BOOTPARAMVERS, bootparamprog_1, IPPROTO_UDP))
- {
- syslog(LOG_ERR, "Can't register service.");
- exit(1);
- }
-
- svc_run();
-
- syslog(LOG_ERR, "svc_run returned");
- exit(1);
-}
-
-
+++ /dev/null
-# The legacy PBWO makefile was producing this as a "project" library and header.
-# We're currently not building it, and instead referencing bootparam_prot.x
-# from both bootparamd.tproj and bpwhoami.tproj.
-# In the event we do wish to create a libbootparam.a again, this will do it.
-
-Project = bootparams
-ProductType = staticlib
-Install_Dir = /usr/local/lib
-
-Library_Version = A
-
-RPCFILES = bootparam_prot.x
-RPCSVCFILES = bootparam_prot.x
-
-Install_Private_Headers = $(OBJROOT)/$(Project)/bootparam_prot.h
-
-Extra_CC_Flags = -fno-common
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
+++ /dev/null
-###############################################################################
-# Makefile.postamble
-# Copyright 1997, Apple Computer, Inc.
-#
-# Use this makefile, which is imported after all other makefiles, to
-# override attributes for a project's Makefile environment. This allows you
-# to take advantage of the environment set up by the other Makefiles.
-# You can also define custom rules at the end of this file.
-#
-###############################################################################
-#
-# These variables are exported by the standard makefiles and can be
-# used in any customizations you make. They are *outputs* of
-# the Makefiles and should be used, not set.
-#
-# PRODUCTS: products to install. All of these products will be placed in
-# the directory $(DSTROOT)$(INSTALLDIR)
-# GLOBAL_RESOURCE_DIR: The directory to which resources are copied.
-# LOCAL_RESOURCE_DIR: The directory to which localized resources are copied.
-# OFILE_DIR: Directory into which .o object files are generated.
-# DERIVED_SRC_DIR: Directory used for all other derived files
-#
-# ALL_CFLAGS: flags to pass when compiling .c files
-# ALL_MFLAGS: flags to pass when compiling .m files
-# ALL_CCFLAGS: flags to pass when compiling .cc, .cxx, and .C files
-# ALL_MMFLAGS: flags to pass when compiling .mm, .mxx, and .M files
-# ALL_PRECOMPFLAGS: flags to pass when precompiling .h files
-# ALL_LDFLAGS: flags to pass when linking object files
-# ALL_LIBTOOL_FLAGS: flags to pass when libtooling object files
-# ALL_PSWFLAGS: flags to pass when processing .psw and .pswm (pswrap) files
-# ALL_RPCFLAGS: flags to pass when processing .rpc (rpcgen) files
-# ALL_YFLAGS: flags to pass when processing .y (yacc) files
-# ALL_LFLAGS: flags to pass when processing .l (lex) files
-#
-# NAME: name of application, bundle, subproject, palette, etc.
-# LANGUAGES: langages in which the project is written (default "English")
-# English_RESOURCES: localized resources (e.g. nib's, images) of project
-# GLOBAL_RESOURCES: non-localized resources of project
-#
-# SRCROOT: base directory in which to place the new source files
-# SRCPATH: relative path from SRCROOT to present subdirectory
-#
-# INSTALLDIR: Directory the product will be installed into by 'install' target
-# PUBLIC_HDR_INSTALLDIR: where to install public headers. Don't forget
-# to prefix this with DSTROOT when you use it.
-# PRIVATE_HDR_INSTALLDIR: where to install private headers. Don't forget
-# to prefix this with DSTROOT when you use it.
-#
-# EXECUTABLE_EXT: Executable extension for the platform (i.e. .exe on Windows)
-#
-###############################################################################
-
-# Some compiler flags can be overridden here for certain build situations.
-#
-# WARNING_CFLAGS: flag used to set warning level (defaults to -Wmost)
-# DEBUG_SYMBOLS_CFLAGS: debug-symbol flag passed to all builds (defaults
-# to -g)
-# DEBUG_BUILD_CFLAGS: flags passed during debug builds (defaults to -DDEBUG)
-# OPTIMIZE_BUILD_CFLAGS: flags passed during optimized builds (defaults
-# to -O)
-# PROFILE_BUILD_CFLAGS: flags passed during profile builds (defaults
-# to -pg -DPROFILE)
-# LOCAL_DIR_INCLUDE_DIRECTIVE: flag used to add current directory to
-# the include path (defaults to -I.)
-# DEBUG_BUILD_LDFLAGS, OPTIMIZE_BUILD_LDFLAGS, PROFILE_BUILD_LDFLAGS: flags
-# passed to ld/libtool (defaults to nothing)
-
-
-# Library and Framework projects only:
-# INSTALL_NAME_DIRECTIVE: This directive ensures that executables linked
-# against the framework will run against the correct version even if
-# the current version of the framework changes. You may override this
-# to "" as an alternative to using the DYLD_LIBRARY_PATH during your
-# development cycle, but be sure to restore it before installing.
-
-
-# Ownership and permissions of files installed by 'install' target
-
-#INSTALL_AS_USER = root
- # User/group ownership
-#INSTALL_AS_GROUP = wheel
- # (probably want to set both of these)
-#INSTALL_PERMISSIONS =
- # If set, 'install' chmod's executable to this
-
-
-# Options to strip. Note: -S strips debugging symbols (executables can be stripped
-# down further with -x or, if they load no bundles, with no options at all).
-
-#STRIPFLAGS = -S
-
-
-#########################################################################
-# Put rules to extend the behavior of the standard Makefiles here. Include them in
-# the dependency tree via cvariables like AFTER_INSTALL in the Makefile.preamble.
-#
-# You should avoid redefining things like "install" or "app", as they are
-# owned by the top-level Makefile API and no context has been set up for where
-# derived files should go.
-#
-# Needed since a .x file in Other Sources will require a corresponding .o
-%_xdr.c: %.x
- $(RPCGEN) $(ALL_RPCFLAGS) -c -o $(SYM_DIR)/$*_xdr.c $*.x
-
-%_svc.c: %.x
- $(RPCGEN) $(ALL_RPCFLAGS) -m -o $(SYM_DIR)/$*_svc.c $*.x
-
-after_install:
- $(RM) -rf $(INSTALLED_PRODUCTS)
+++ /dev/null
-###############################################################################
-# Makefile.preamble
-# Copyright 1997, Apple Computer, Inc.
-#
-# Use this makefile for configuring the standard application makefiles
-# associated with ProjectBuilder. It is included before the main makefile.
-# In Makefile.preamble you set attributes for a project, so they are available
-# to the project's makefiles. In contrast, you typically write additional rules or
-# override built-in behavior in the Makefile.postamble.
-#
-# Each directory in a project tree (main project plus subprojects) should
-# have its own Makefile.preamble and Makefile.postamble.
-###############################################################################
-#
-# Before the main makefile is included for this project, you may set:
-#
-# MAKEFILEDIR: Directory in which to find $(MAKEFILE)
-# MAKEFILE: Top level mechanism Makefile (e.g., app.make, bundle.make)
-
-# Compiler/linker flags added to the defaults: The OTHER_* variables will be
-# inherited by all nested sub-projects, but the LOCAL_ versions of the same
-# variables will not. Put your -I, -D, -U, and -L flags in ProjectBuilder's
-# Build Attributes inspector if at all possible. To override the default flags
-# that get passed to ${CC} (e.g. change -O to -O2), see Makefile.postamble. The
-# variables below are *inputs* to the build process and distinct from the override
-# settings done (less often) in the Makefile.postamble.
-#
-# OTHER_CFLAGS, LOCAL_CFLAGS: additional flags to pass to the compiler
-# Note that $(OTHER_CFLAGS) and $(LOCAL_CFLAGS) are used for .h, ...c, .m,
-# .cc, .cxx, .C, and .M files. There is no need to respecify the
-# flags in OTHER_MFLAGS, etc.
-# OTHER_MFLAGS, LOCAL_MFLAGS: additional flags for .m files
-# OTHER_CCFLAGS, LOCAL_CCFLAGS: additional flags for .cc, .cxx, and ...C files
-# OTHER_MMFLAGS, LOCAL_MMFLAGS: additional flags for .mm and .M files
-# OTHER_PRECOMPFLAGS, LOCAL_PRECOMPFLAGS: additional flags used when
-# precompiling header files
-# OTHER_LDFLAGS, LOCAL_LDFLAGS: additional flags passed to ld and libtool
-# OTHER_PSWFLAGS, LOCAL_PSWFLAGS: additional flags passed to pswrap
-# OTHER_RPCFLAGS, LOCAL_RPCFLAGS: additional flags passed to rpcgen
-# OTHER_YFLAGS, LOCAL_YFLAGS: additional flags passed to yacc
-# OTHER_LFLAGS, LOCAL_LFLAGS: additional flags passed to lex
-
-# These variables provide hooks enabling you to add behavior at almost every
-# stage of the make:
-#
-# BEFORE_PREBUILD: targets to build before installing headers for a subproject
-# AFTER_PREBUILD: targets to build after installing headers for a subproject
-# BEFORE_BUILD_RECURSION: targets to make before building subprojects
-# BEFORE_BUILD: targets to make before a build, but after subprojects
-# AFTER_BUILD: targets to make after a build
-#
-# BEFORE_INSTALL: targets to build before installing the product
-# AFTER_INSTALL: targets to build after installing the product
-# BEFORE_POSTINSTALL: targets to build before postinstalling every subproject
-# AFTER_POSTINSTALL: targts to build after postinstalling every subproject
-#
-# BEFORE_INSTALLHDRS: targets to build before installing headers for a
-# subproject
-# AFTER_INSTALLHDRS: targets to build after installing headers for a subproject
-# BEFORE_INSTALLSRC: targets to build before installing source for a subproject
-# AFTER_INSTALLSRC: targets to build after installing source for a subproject
-#
-# BEFORE_DEPEND: targets to build before building dependencies for a
-# subproject
-# AFTER_DEPEND: targets to build after building dependencies for a
-# subproject
-#
-# AUTOMATIC_DEPENDENCY_INFO: if YES, then the dependency file is
-# updated every time the project is built. If NO, the dependency
-# file is only built when the depend target is invoked.
-AFTER_INSTALL = after_install
-
-# Framework-related variables:
-# FRAMEWORK_DLL_INSTALLDIR: On Windows platforms, this variable indicates
-# where to put the framework's DLL. This variable defaults to
-# $(INSTALLDIR)/../Executables
-
-# Library-related variables:
-# PUBLIC_HEADER_DIR: Determines where public exported header files
-# should be installed. Do not include $(DSTROOT) in this value --
-# it is prefixed automatically. For library projects you should
-# set this to something like /Developer/Headers/$(NAME). Do not set
-# this variable for framework projects unless you do not want the
-# header files included in the framework.
-# PRIVATE_HEADER_DIR: Determines where private exported header files
-# should be installed. Do not include $(DSTROOT) in this value --
-# it is prefixed automatically.
-# LIBRARY_STYLE: This may be either STATIC or DYNAMIC, and determines
-# whether the libraries produced are statically linked when they
-# are used or if they are dynamically loadable. This defaults to
-# DYNAMIC.
-LIBRARY_STYLE = STATIC
-
-# LIBRARY_DLL_INSTALLDIR: On Windows platforms, this variable indicates
-# where to put the library's DLL. This variable defaults to
-# $(INSTALLDIR)/../Executables
-#
-# INSTALL_AS_USER: owner of the intalled products (default root)
-# INSTALL_AS_GROUP: group of the installed products (default wheel)
-# INSTALL_PERMISSIONS: permissions of the installed product (default o+rX)
-#
-# OTHER_RECURSIVE_VARIABLES: The names of variables which you want to be
-# passed on the command line to recursive invocations of make. Note that
-# the values in OTHER_*FLAGS are inherited by subprojects automatically --
-# you do not have to (and shouldn't) add OTHER_*FLAGS to
-# OTHER_RECURSIVE_VARIABLES.
-
-# Additional headers to export beyond those in the PB.project:
-# OTHER_PUBLIC_HEADERS
-# OTHER_PROJECT_HEADERS
-# OTHER_PRIVATE_HEADERS
-
-# Additional files for the project's product: <<path relative to proj?>>
-# OTHER_RESOURCES: (non-localized) resources for this project
-# OTHER_OFILES: relocatables to be linked into this project
-# OTHER_LIBS: more libraries to link against
-# OTHER_PRODUCT_DEPENDS: other dependencies of this project
-# OTHER_SOURCEFILES: other source files maintained by .pre/postamble
-# OTHER_GARBAGE: additional files to be removed by `make clean'
-OTHER_GARBAGE = *~
-OTHER_PROJECT_HEADERS = bootparam_prot.h
-OTHER_OFILES = bootparam_prot_xdr.o bootparam_prot_svc.o
-
-# Set this to YES if you don't want a final libtool call for a library/framework.
-# BUILD_OFILES_LIST_ONLY
-
-# To include a version string, project source must exist in a directory named
-# $(NAME).%d[.%d][.%d] and the following line must be uncommented.
-# OTHER_GENERATED_OFILES = $(VERS_OFILE)
-
-# This definition will suppress stripping of debug symbols when an executable
-# is installed. By default it is YES.
-# STRIP_ON_INSTALL = NO
-
-# Uncomment to suppress generation of a KeyValueCoding index when installing
-# frameworks (This index is used by WOB and IB to determine keys available
-# for an object). Set to YES by default.
-# PREINDEX_FRAMEWORK = NO
-
-# Change this definition to install projects somewhere other than the
-# standard locations. NEXT_ROOT defaults to "C:/Apple" on Windows systems
-# and "" on other systems.
-# DSTROOT = $(HOME)
--include ../../Makefile.include
+++ /dev/null
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-/* @(#)bootparam_prot.x 2.1 88/08/01 4.0 RPCSRC */
-/* @(#)bootparam_prot.x 1.2 87/06/24 Copyr 1987 Sun Micro */
-
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/*
- * RPC for bootparms service.
- * There are two procedures:
- * WHOAMI takes a net address and returns a client name and also a
- * likely net address for routing
- * GETFILE takes a client name and file identifier and returns the
- * server name, server net address and pathname for the file.
- * file identifiers typically include root, swap, pub and dump
- */
-
-#ifdef RPC_HDR
-%#include <rpc/types.h>
-%#include <sys/time.h>
-%#include <sys/errno.h>
-#endif
-
-const MAX_MACHINE_NAME = 255;
-const MAX_PATH_LEN = 1024;
-const MAX_FILEID = 32;
-const IP_ADDR_TYPE = 1;
-
-typedef string bp_machine_name_t<MAX_MACHINE_NAME>;
-typedef string bp_path_t<MAX_PATH_LEN>;
-typedef string bp_fileid_t<MAX_FILEID>;
-
-struct ip_addr_t {
- char net;
- char host;
- char lh;
- char impno;
-};
-
-union bp_address switch (int address_type) {
- case IP_ADDR_TYPE:
- ip_addr_t ip_addr;
-};
-
-struct bp_whoami_arg {
- bp_address client_address;
-};
-
-struct bp_whoami_res {
- bp_machine_name_t client_name;
- bp_machine_name_t domain_name;
- bp_address router_address;
-};
-
-struct bp_getfile_arg {
- bp_machine_name_t client_name;
- bp_fileid_t file_id;
-};
-
-struct bp_getfile_res {
- bp_machine_name_t server_name;
- bp_address server_address;
- bp_path_t server_path;
-};
-
-program BOOTPARAMPROG {
- version BOOTPARAMVERS {
- bp_whoami_res BOOTPARAMPROC_WHOAMI(bp_whoami_arg) = 1;
- bp_getfile_res BOOTPARAMPROC_GETFILE(bp_getfile_arg) = 2;
- } = 1;
-} = 100026;
+++ /dev/null
-Project = bpwhoami
-Install_Dir = /usr/sbin
-
-CFILES = bpwhoami.c
-RPCFILES = ../bootparams/bootparam_prot.x
-MANPAGES = bpwhoami.1
-
-Extra_CC_Flags = -mdynamic-no-pic -dead_strip
-#Extra_LD_Flags = -lbootparam
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
+++ /dev/null
-.\" Copyright (c) 1997, Apple Computer, Inc. All rights reserved.
-.\"
-.Dd August 7, 1997
-.Dt BPWHOAMI 1
-.Os "Mac OS X"
-.Sh NAME
-.Nm bpwhoami
-.Nd print the output of a bootparams whoami call
-.Sh SYNOPSIS
-.Nm bpwhoami
-.Sh DESCRIPTION
-This command makes a bootparams whoami call and echos the results to
-stdout. The output is of the form:
-.Pp
-HOSTNAME=<hostname>
-DOMAIN=<nis domain name>
-ROUTER=<router ip address>
-SERVER=<server ip address>
-.Sh SEE ALSO
-.Xr bootparams 5
-.Xr bootparamd 8
-.Sh DIAGNOSTICS
-.Nm bpwhoami
-exits with one of the following values:
-.Bl -tag -width Ds -compact
-.It 0
-Successfully retrieved information.
-.It 1
-RPC timed out while attempting to retrieve information.
-.It 2
-Unrecoverable error.
-.El
+++ /dev/null
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright (c) 1997 Apple Computer, Inc. All Rights Reserved
- *
- * bpwhoami.c
- * - do a bootparams whoami call and echo the results to stdout
- *
- * The output is of the form:
- * host_name=<hostname>
- * nis_domain=<nis domain name>
- * router=<router ip address>
- * server_name=<server host name>
- * server_ip_address=<server ip address>
- *
- * The program will exit with the following codes:
- * 0 Successfully retrieved info
- * 1 RPC timed out while attempting to retrieve info
- * 2 Unrecoverable error ie. don't bother trying to call again
- *
- * Modification History:
- * Aug 5, 1997 Dieter Siegund (dieter@apple.com)
- * - lifted code from the old hostname -AUTOMATIC- source
- */
-
-
-#include <sys/param.h>
-
-#include <err.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-void usage __P((void));
-
-#include <netdb.h>
-#include <signal.h>
-#include <mach/boolean.h>
-#include <sys/types.h>
-#include <sys/file.h>
-#include <sys/fcntl.h>
-#include <sys/ioctl_compat.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <net/if.h>
-#include <ifaddrs.h>
-#include <rpc/rpc.h>
-#include <arpa/inet.h>
-#include "bootparam_prot.h"
-
-struct in_addr ip_address;
-struct in_addr net_mask;
-
-static __inline__
-u_long iptohl(struct in_addr ip)
-{
- return (ntohl(ip.s_addr));
-}
-
-static __inline__ boolean_t
-in_subnet(struct in_addr netaddr, struct in_addr netmask, struct in_addr ip)
-{
- if ((iptohl(ip) & iptohl(netmask))
- != (iptohl(netaddr) & iptohl(netmask))) {
- return (FALSE);
- }
- return (TRUE);
-}
-
-bool_t
-each_whoresult(result, from)
- bp_whoami_res *result;
- struct sockaddr_in *from;
-{
- if (result) {
- struct hostent * host;
- struct in_addr * router;
-
- /*
- * guard against bogus router replies by making sure
- * that the default router is on the same subnet
- */
- router = (struct in_addr *)
- &result->router_address.bp_address_u.ip_addr;
- if (in_subnet(*router, net_mask, ip_address)) {
- if (result->client_name && result->client_name[0])
- printf("host_name=%s\n", result->client_name);
- if (result->domain_name && result->domain_name[0])
- printf("nis_domain=%s\n", result->domain_name);
- printf("router=%s\n", inet_ntoa(*router));
- host = gethostbyaddr((char *) &from->sin_addr,
- sizeof (from->sin_addr), AF_INET);
- if (host) {
- printf("server_name=%s\n", host->h_name);
- }
- printf("server_ip_address=%s\n", inet_ntoa(from->sin_addr));
- return(TRUE);
- }
- }
- return(FALSE);
-}
-
-
-static boolean_t
-getFirstInterface(struct sockaddr_in *ret_p)
-{
- struct ifaddrs *ifap;
- struct ifaddrs *ifcurrent;
- getifaddrs(&ifap);
-
- for (ifcurrent = ifap; ifcurrent; ifcurrent = ifcurrent->ifa_next) {
- if (ifcurrent->ifa_addr->sa_family == AF_INET) {
- if ((ifcurrent->ifa_flags & IFF_LOOPBACK)
- || !(ifcurrent->ifa_flags & IFF_UP))
- continue;
- net_mask = ((struct sockaddr_in*)(ifcurrent->ifa_netmask))->sin_addr;
- *ret_p = *((struct sockaddr_in*)(ifcurrent->ifa_addr));
- freeifaddrs(ifap);
- return (TRUE);
- }
- }
- if (ifap)
- freeifaddrs(ifap);
- return (FALSE);
-}
-
-
-/*
- * Routine: bp_whoami
- * Function:
- * Do a BOOTPARAMS WHOAMI RPC to find out hostname, domain,
- * bootparams server, default router.
- */
-int
-bp_whoami()
-{
- extern enum clnt_stat clnt_broadcast();
- struct sockaddr_in sockin;
- enum clnt_stat stat;
- struct bp_whoami_arg who_arg;
- struct bp_whoami_res who_res;
-
- if (getFirstInterface(&sockin) == FALSE)
- return (2);
-
- ip_address = sockin.sin_addr;
- who_arg.client_address.bp_address_u.ip_addr =
- *((ip_addr_t *)&sockin.sin_addr);
- who_arg.client_address.address_type = IP_ADDR_TYPE;
- bzero(&who_res, sizeof (who_res));
-
- /*
- * Broadcast the whoami.
- */
- stat = clnt_broadcast(BOOTPARAMPROG, BOOTPARAMVERS,
- BOOTPARAMPROC_WHOAMI, xdr_bp_whoami_arg,
- &who_arg, xdr_bp_whoami_res, &who_res,
- each_whoresult);
-
- if (stat == RPC_SUCCESS) {
- return (0);
- }
- if (stat == RPC_TIMEDOUT)
- return (1);
- fprintf(stderr, "bpwhoami: ");
- clnt_perrno(stat);
- return (2);
-}
-
-int
-main(argc,argv)
- int argc;
- char *argv[];
-{
- exit(bp_whoami());
-}
+++ /dev/null
-Project = ifconfig
-Install_Dir = /sbin
-
-HFILES = ifconfig.h
-CFILES = ifconfig.c ifmedia.c ifvlan.c ifbond.c
-MANPAGES = ifconfig.8
-
-Extra_CC_Flags = -mdynamic-no-pic -dead_strip \
- -I$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders \
- -DUSE_IF_MEDIA -DINET6 -DNO_IPX -DUSE_VLANS -DUSE_BONDS
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
"$Id: ifconfig.c,v 1.8 2004/08/26 23:55:21 lindak Exp $";
#endif /* not lint */
+#include <stdint.h>
#include <sys/param.h>
#define KERNEL_PRIVATE
#include <sys/ioctl.h>
#endif
-/* XNS */
-#ifdef NS
-#define NSIP
-#include <netns/ns.h>
-#include <netns/ns_if.h>
-#endif
-/* OSI */
-
#include <ctype.h>
#include <err.h>
#include <errno.h>
af_getaddr in6_getaddr;
af_getprefix in6_getprefix;
#endif /*INET6*/
-#ifdef NS
-af_status xns_status;
-af_getaddr xns_getaddr;
-#endif
/* Known address families */
const
af_status *af_status;
af_getaddr *af_getaddr;
af_getprefix *af_getprefix;
- u_long af_difaddr;
- u_long af_aifaddr;
+ uint32_t af_difaddr;
+ uint32_t af_aifaddr;
caddr_t af_ridreq;
caddr_t af_addreq;
} afs[] = {
SIOCDIFADDR_IN6, SIOCAIFADDR_IN6,
C(in6_ridreq), C(in6_addreq) },
#endif /*INET6*/
-#ifdef NS
- { "ns", AF_NS, xns_status, xns_getaddr, NULL,
- SIOCDIFADDR, SIOCAIFADDR, C(ridreq), C(addreq) },
-#endif
{ "ether", AF_LINK, ether_status, ether_getaddr, NULL,
0, SIOCSIFLLADDR, NULL, C(ridreq) },
#if 0 /* XXX conflicts with the media command */
*/
#define ROUNDUP(a) \
- ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
+ ((a) > 0 ? (1 + (((a) - 1) | (sizeof(uint32_t) - 1))) : sizeof(uint32_t))
#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
void
setifprefixlen("64", 0, s, afp);
/* in6_getprefix("64", MASK) if MASK is available here... */
}
-#endif
-#ifdef NS
- if (setipdst && ifr.ifr_addr.sa_family == AF_NS) {
- struct nsip_req rq;
- int size = sizeof(rq);
-
- rq.rq_ns = addreq.ifra_addr;
- rq.rq_ip = addreq.ifra_dstaddr;
-
- if (setsockopt(s, 0, SO_NSIP_ROUTE, &rq, size) < 0)
- Perror("Encapsulation Routing");
- }
#endif
if (clearaddr) {
if (afp->af_ridreq == NULL || afp->af_difaddr == 0) {
{
char psrcaddr[NI_MAXHOST];
char pdstaddr[NI_MAXHOST];
- u_long srccmd, dstcmd;
+ uint32_t srccmd, dstcmd;
struct ifreq *ifrp;
const char *ver = "";
#ifdef NI_WITHSCOPEID
sin = (struct sockaddr_in *)info->rti_info[RTAX_NETMASK];
if (!sin)
sin = &null_sin;
- printf("netmask 0x%lx ", (unsigned long)ntohl(sin->sin_addr.s_addr));
+ printf("netmask 0x%0x ", (uint32_t)ntohl(sin->sin_addr.s_addr));
if (flags & IFF_BROADCAST) {
/* note RTAX_BRD overlap with IFF_POINTOPOINT */
}
#endif /*INET6*/
-#ifdef NS
-void
-xns_status(s, info)
- int s ;
- struct rt_addrinfo * info;
-{
- struct sockaddr_ns *sns, null_sns;
-
- memset(&null_sns, 0, sizeof(null_sns));
-
- sns = (struct sockaddr_ns *)info->rti_info[RTAX_IFA];
- printf("\tns %s ", ns_ntoa(sns->sns_addr));
-
- if (flags & IFF_POINTOPOINT) {
- sns = (struct sockaddr_ns *)info->rti_info[RTAX_BRD];
- if (!sns)
- sns = &null_sns;
- printf("--> %s ", ns_ntoa(sns->sns_addr));
- }
-
- putchar('\n');
- close(s);
-}
-#endif
-
-
void
ether_status(s, info)
int s ;
+++ /dev/null
-Project = ip6
-Install_Dir = /usr/sbin
-
-CFILES = ip6tool.c
-MANPAGES = ip6.8 ip6config.8
-OTHERSRCS = Makefile.preamble Makefile Makefile.postamble 6to4.conf \
- ip6config ip6config.8 ip6.8
-
-Extra_CC_Flags = -mdynamic-no-pic -dead_strip \
- -I$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
-
-# 6to4.conf should be root-writable
-Install_File_Mode = 0644
-
-after_install:
- $(INSTALL_DIRECTORY) "$(DSTROOT)"/private/etc
- $(INSTALL_FILE) 6to4.conf "$(DSTROOT)"/private/etc
- $(INSTALL_SCRIPT) ip6config "$(DSTROOT)"/usr/sbin
+++ /dev/null
-Project = ip6fw
-Install_Dir = /sbin
-
-CFILES = ip6fw.c
-MANPAGES = ip6fw.8
-
-Extra_CC_Flags = -mdynamic-no-pic -dead_strip
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
printf("%05u ", chain->fw_number);
if (do_acct)
- printf("%10lu %10lu ",chain->fw_pcnt,chain->fw_bcnt);
+ printf("%10u %10u ",chain->fw_pcnt,chain->fw_bcnt);
if (do_time)
{
if (mb==128 && do_resolv) {
he=gethostbyaddr((char *)&(chain->fw_src),sizeof(chain->fw_src),AF_INET6);
if (he==NULL) {
- printf(inet_ntop(AF_INET6,&chain->fw_src,ntop_buf,sizeof(ntop_buf)));
+ printf("%s", inet_ntop(AF_INET6,&chain->fw_src,ntop_buf,sizeof(ntop_buf)));
} else
printf("%s",he->h_name);
} else {
if (mb == 0) {
printf("any");
} else {
- printf(inet_ntop(AF_INET6,&chain->fw_src,ntop_buf,sizeof(ntop_buf)));
+ printf("%s", inet_ntop(AF_INET6,&chain->fw_src,ntop_buf,sizeof(ntop_buf)));
printf("/%d",mb);
}
} else
- printf(inet_ntop(AF_INET6,&chain->fw_src,ntop_buf,sizeof(ntop_buf)));
+ printf("%s", inet_ntop(AF_INET6,&chain->fw_src,ntop_buf,sizeof(ntop_buf)));
}
if (chain->fw_prot == IPPROTO_TCP || chain->fw_prot == IPPROTO_UDP) {
if (mb==128 && do_resolv) {
he=gethostbyaddr((char *)&(chain->fw_dst),sizeof(chain->fw_dst),AF_INET);
if (he==NULL) {
- printf(inet_ntop(AF_INET6,&chain->fw_dst,ntop_buf,sizeof(ntop_buf)));
+ printf("%s", inet_ntop(AF_INET6,&chain->fw_dst,ntop_buf,sizeof(ntop_buf)));
} else
printf("%s",he->h_name);
} else {
if (mb == 0) {
printf("any");
} else {
- printf(inet_ntop(AF_INET6,&chain->fw_dst,ntop_buf,sizeof(ntop_buf)));
+ printf("%s", inet_ntop(AF_INET6,&chain->fw_dst,ntop_buf,sizeof(ntop_buf)));
printf("/%d",mb);
}
} else
- printf(inet_ntop(AF_INET6,&chain->fw_dst,ntop_buf,sizeof(ntop_buf)));
+ printf("%s", inet_ntop(AF_INET6,&chain->fw_dst,ntop_buf,sizeof(ntop_buf)));
}
if (chain->fw_prot == IPPROTO_TCP || chain->fw_prot == IPPROTO_UDP) {
+++ /dev/null
-Project = ipfw
-Install_Dir = /sbin
-
-CFILES = ipfw2.c
-MANPAGES = ipfw.8
-
-Extra_CC_Flags = -mdynamic-no-pic -dead_strip \
- -I$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
-
}
sep = " ";
for (i = F_LEN((ipfw_insn *)cmd) - 1; i > 0; i--, p += 2) {
- printf(sep);
+ printf("%s", sep);
print_port(proto, p[0]);
if (p[0] != p[1]) {
printf("-");
(cmd->o.opcode == O_IP_SRC || cmd->o.opcode == O_IP_DST) ?
32 : contigmask((uint8_t *)&(a[1]), 32);
if (mb == 32 && do_resolv)
- he = gethostbyaddr((char *)&(a[0]), sizeof(u_long), AF_INET);
+ he = gethostbyaddr((char *)&(a[0]), sizeof(in_addr_t), AF_INET);
if (he != NULL) /* resolved to name */
printf("%s", he->h_name);
else if (mb == 0) /* any */
char buf[30];
char prefix[80];
- if (p->next != (struct dn_pipe *)DN_IS_PIPE)
+ if (p->next.sle_next != (struct dn_pipe *)DN_IS_PIPE)
break; /* done with pipes, now queues */
/*
for (fs = next; nbytes >= sizeof *fs; fs = next) {
char prefix[80];
- if (fs->next != (struct dn_flow_set *)DN_IS_QUEUE)
+ if (fs->next.sle_next != (struct dn_flow_set *)DN_IS_QUEUE)
break;
l = sizeof(*fs) + fs->rq_elements * sizeof(*q);
next = (char *)fs + l;
+++ /dev/null
-Project = kdumpd
-Install_Dir = /usr/libexec
-
-CFILES = kdumpd.c kdumpsubs.c
-HFILES = kdump.h kdumpsubs.h
-MANPAGES = kdumpd.8
-LAUNCHD_PLISTS = com.apple.kdumpd.plist
-
-Extra_CC_Flags = -mdynamic-no-pic -dead_strip \
- -I.
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
#include <string.h>
#include <syslog.h>
#include <unistd.h>
+#include <libkern/OSByteOrder.h>
#include "kdumpsubs.h"
static void nak __P((int));
static char * __P(verifyhost(struct sockaddr_in *));
+#define KDP_FEATURE_MASK_STRING "features"
+enum {KDP_FEATURE_LARGE_CRASHDUMPS = 1};
+uint32_t kdp_crashdump_feature_mask;
+uint32_t kdp_feature_large_crashdumps;
+
int
main(argc, argv)
int argc;
for (cp = mode; *cp; cp++)
if (isupper(*cp))
*cp = tolower(*cp);
+
+ cp++;
+ if (strncmp(KDP_FEATURE_MASK_STRING, cp, sizeof(KDP_FEATURE_MASK_STRING)) == 0) {
+ kdp_crashdump_feature_mask = ntohl(*(uint32_t *) (cp + sizeof(KDP_FEATURE_MASK_STRING)));
+ kdp_feature_large_crashdumps = kdp_crashdump_feature_mask & KDP_FEATURE_LARGE_CRASHDUMPS;
+ syslog(LOG_INFO, "Received feature mask %s:%hx", cp, kdp_crashdump_feature_mask);
+ }
+
for (pf = formats; pf->f_mode; pf++)
if (strcmp(pf->f_mode, mode) == 0)
break;
block = 0;
do {
send_seek_ack: timeout = 0;
- ap->th_opcode = htons((u_short)ACK);
+ if (block == 0)
+ ap->th_opcode = htons((u_short)ACK | (kdp_feature_large_crashdumps << 8));
+ else
+ ap->th_opcode = htons((u_short)ACK);
ap->th_block = htonl((unsigned int)block);
block++;
jmpval = setjmp(timeoutbuf);
{
if (dp->th_block == block)
{
+ off_t crashdump_offset = 0;
unsigned int tempoff = 0;
+
+ if (kdp_feature_large_crashdumps) {
+ crashdump_offset = OSSwapBigToHostInt64((*(uint64_t *)dp->th_data));
+#if DEBUG
+ syslog(LOG_INFO, "Large offset");
+#endif
+ }
+ else {
bcopy (dp->th_data, &tempoff, sizeof(unsigned int));
- lseek (fileno (file), ntohl(tempoff), SEEK_SET);
+ crashdump_offset = ntohl(tempoff);
+ }
+#if DEBUG
+ syslog(LOG_INFO, "Seeking to offset 0x%llx\n", crashdump_offset);
+#endif
+ errno = 0;
+ lseek(fileno (file), crashdump_offset, SEEK_SET);
if (errno)
syslog (LOG_ERR, "lseek: %m");
+++ /dev/null
-Project = natd
-Install_Dir = /usr/sbin
-
-HFILES = natd.h
-CFILES = icmp.c natd.c
-MANPAGES = natd.8
-
-Extra_CC_Flags = -mdynamic-no-pic -dead_strip \
- -I../alias
-Extra_LD_Flags = -L${DSTROOT}/usr/lib -lalias
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
#include <arpa/inet.h>
#include <alias.h>
+void DumpInfo(void);
+
#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>
+#include <fcntl.h>
#include <mach/mach_time.h>
#include <mach/clock_types.h>
* NOTES: - Port values are not stored in network byte order.
*/
-typedef u_long port_range;
+typedef uint32_t port_range;
#define GETLOPORT(x) ((x) >> 0x10)
#define GETNUMPORTS(x) ((x) & 0x0000ffff)
static int StrToAddrAndPortRange (const char* str, struct in_addr* addr, char* proto, port_range *portRange);
static void ParseArgs (int argc, char** argv);
static void FlushPacketBuffer (int fd);
+static void DiscardIncomingPackets (int fd);
static void SetupPunchFW(const char *strValue);
/*
#define NATPORTMAP 1
#ifdef NATPORTMAP
-#define NATPMPORT 5351
+
+/*
+ * Note: more details on NAT-PMP can be found at :
+ * <http://files.dns-sd.org/draft-cheshire-nat-pmp.txt>
+ */
+
+#define NATPMP_ANNOUNCEMENT_PORT 5350
+#define NATPMP_PORT 5351
#define NATPMVERSION 0
#define PUBLICADDRREQ 0
#define MAPTCPREQ 2
#define MAPUDPTCPREQ 3
#define SERVERREPLYOP 128
-#define PUBLICADDRRLY SERVERREPLYOP+PUBLICADDRREQ
#define SUCCESS 0
#define NOTSUPPORTEDVERSION 1
#define NETWORKFAILURE 3
#define OUTOFRESOURCES 4
#define UNSUPPORTEDOPCODE 5
+
#define MAXRETRY 10
#define TIMER_RATE 250000
#define FAILED -1
typedef struct stdportmaprequest {
- char version;
- unsigned char opcode;
- unsigned short result;
- char data[4];
+ uint8_t version;
+ uint8_t opcode;
} stdportmaprequest;
-typedef struct publicaddrreply {
- char version;
- unsigned char opcode;
- unsigned short result;
- unsigned int epoch;
- struct in_addr addr;
- } publicaddrreply;
-
typedef struct publicportreq {
- char version;
- unsigned char opcode;
- unsigned short result;
- unsigned short privateport;
- unsigned short publicport;
- int lifetime; /* in second */
+ uint8_t version;
+ uint8_t opcode;
+ uint16_t reserved;
+ uint16_t privateport;
+ uint16_t publicport;
+ uint32_t lifetime; /* in seconds */
} publicportreq;
+typedef struct publicaddrreply {
+ uint8_t version;
+ uint8_t opcode;
+ uint16_t result;
+ uint32_t epoch;
+ struct in_addr addr;
+} publicaddrreply;
+
typedef struct publicportreply {
- char version;
- unsigned char opcode;
- unsigned short result;
- unsigned int epoch;
- unsigned short privateport;
- unsigned short publicport;
- int lifetime; /* in second */
+ uint8_t version;
+ uint8_t opcode;
+ uint16_t result;
+ uint32_t epoch;
+ uint16_t privateport;
+ uint16_t publicport;
+ uint32_t lifetime; /* in seconds */
} publicportreply;
typedef struct stderrreply {
- char version;
- unsigned char opcode;
- unsigned short result;
- unsigned int epoch;
+ uint8_t version;
+ uint8_t opcode;
+ uint16_t result;
+ uint32_t epoch;
} stderrreply;
static struct in_addr *forwardedinterfaceaddr;
static char **forwardedinterfacename;
static int numofinterfaces = 0; /* has to be at least one */
-static u_short natPMPport;
static int numoftries=MAXRETRY;
static struct itimerval itval;
static int Natdtimerset = 0;
static void NotifyPublicAddress();
static void DoPortMapping( int fd, struct sockaddr_in *clientaddr, int clientaddrlen, publicportreq *req);
static void NatPortMapPInit();
-static u_short get_natportmap_port(void);
extern int FindAliasPortOut(struct in_addr src_addr, struct in_addr dst_addr, u_short src_port, u_short pub_port, u_char proto, int lifetime, char addmapping);
-#endif
+#endif /* NATPORTMAP */
int main (int argc, char** argv)
{
fd_set readMask;
fd_set writeMask;
int fdMax;
+ int fdFlags;
/*
* Initialize packet aliasing software.
* Done already here to be able to alter option bits
if (icmpSock == -1)
Quit ("Unable to create ICMP socket.");
-/*
- * And disable reads for the socket, otherwise it slowly fills
- * up with received icmps which we do not use.
- */
- shutdown(icmpSock, SHUT_RD);
-
+ if ((fdFlags = fcntl(icmpSock, F_GETFL, 0)) == -1)
+ Quit ("fcntl F_GETFL ICMP socket.");
+ fdFlags |= O_NONBLOCK;
+ if (fcntl(icmpSock, F_SETFL, fdFlags) == -1)
+ Quit ("fcntl F_SETFL ICMP socket.");
#if NATPORTMAP
if ( enable_natportmap )
portmapSock = socket( AF_INET, SOCK_DGRAM, 0);
if ( portmapSock != -1 )
{
- natPMPport = htons(get_natportmap_port());
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = INADDR_ANY;
- addr.sin_port = htons(NATPMPORT);
+ addr.sin_port = htons(NATPMP_PORT);
if (bind ( portmapSock,
(struct sockaddr*) &addr,
signal(SIGALRM, Natdtimer);
}
}
-#endif
+#endif /* NATPORTMAP */
+
/*
* Become a daemon unless verbose mode was requested.
*/
if (routeSock > fdMax)
fdMax = routeSock;
+ if (icmpSock > fdMax)
+ fdMax = icmpSock;
+
#ifdef NATPORTMAP
if ( portmapSock > fdMax )
fdMax = portmapSock;
if (divertInOut != -1)
FD_SET (divertInOut, &readMask);
+
+ if (icmpSock != -1)
+ FD_SET(icmpSock, &readMask);
}
/*
* Routing info is processed always.
if (routeSock != -1)
if (FD_ISSET (routeSock, &readMask))
HandleRoutingInfo (routeSock);
+
+ if (icmpSock != -1)
+ if (FD_ISSET (icmpSock, &readMask))
+ DiscardIncomingPackets (icmpSock);
+
#ifdef NATPORTMAP
if ( portmapSock != -1)
if (FD_ISSET (portmapSock, &readMask))
fprintf (pidFile, "%d\n", getpid ());
fclose (pidFile);
}
+
+#ifdef DEBUG
+#include <fcntl.h>
+ {
+ int fd;
+
+ fd = open("/var/run/natd.log", O_WRONLY|O_CREAT|O_TRUNC, 0644);
+ if (fd >= 0) {
+ if (fd != STDOUT_FILENO) {
+ dup2(fd, STDOUT_FILENO);
+ close(fd);
+ }
+ dup2(STDOUT_FILENO, STDERR_FILENO);
+ }
+ }
+#endif
}
static void ParseArgs (int argc, char** argv)
}
}
+static void DiscardIncomingPackets (int fd)
+{
+ struct sockaddr_in sin;
+ char buffer[80];
+ socklen_t slen = sizeof(sin);
+
+ while (recvfrom(fd, buffer, sizeof(buffer), 0, (struct sockaddr *)&sin, &slen) != -1) {
+ ;
+ }
+}
+
#ifdef NATPORTMAP
void getdivisor()
}
-unsigned int getuptime()
+uint32_t getuptime()
{
uint64_t now;
- unsigned long epochtime;
-
- now = mach_absolute_time();
- epochtime = (now / secdivisor) /USEC_PER_SEC;
- return( epochtime );
+ uint32_t epochtime;
-}
+ now = mach_absolute_time();
+ epochtime = (now / secdivisor) / USEC_PER_SEC;
+ return ( epochtime );
-/* return NATPORTMAP port defined in /etc/servcies if there's one, else use NATPMPORT */
-static u_short get_natportmap_port(void)
-{
- struct servent *ent;
-
- ent = getservbyname( "natportmap", "udp" );
- if (ent != NULL){
- return( ent->s_port );
- }
- return( NATPMPORT );
}
/* set up neccessary info for doing NatPortMapP */
bzero(forwardedinterfaceaddr,
numofinterfaces * sizeof(*forwardedinterfaceaddr));
/* interface address hasn't been set up, get interface address */
- getifaddrs(&ifap);
+
+ if (getifaddrs(&ifap) == -1)
+ Quit ("getifaddrs failed.");
+
for ( ifa= ifap; ifa; ifa=ifa->ifa_next)
{
struct sockaddr_in * a;
reply.version = NATPMVERSION;
reply.opcode = origopcode + SERVERREPLYOP;
- reply.result = result;
- reply.epoch = getuptime();
+ reply.result = htons(result);
+ reply.epoch = htonl(getuptime());
bytes = sendto( fd, (void*)&reply, sizeof(reply), 0, (struct sockaddr*)clientaddr, clientaddrlen );
if ( bytes != sizeof(reply) )
printf( "PORTMAP::problem sending portmap reply - opcode %d\n", reply.opcode );
reply.opcode = SERVERREPLYOP + PUBLICADDRREQ;
reply.result = SUCCESS;
reply.addr = lastassignaliasAddr;
- reply.epoch = getuptime();
+ reply.epoch = htonl(getuptime());
bytes = sendto (fd, (void*)&reply, sizeof(reply), 0, (struct sockaddr*)clientaddr, clientaddrlen);
if ( bytes != sizeof(reply) )
reply.opcode = SERVERREPLYOP + req->opcode;
if (result)
/* error in port mapping */
- reply.result = OUTOFRESOURCES;
+ reply.result = htons(OUTOFRESOURCES);
else
reply.result = SUCCESS;
- reply.epoch = getuptime();
+ reply.epoch = htonl(getuptime());
reply.privateport = req->privateport;
memset(&multiaddr,0,sizeof(struct sockaddr_in));
multiaddr.sin_family=AF_INET;
multiaddr.sin_addr.s_addr=inet_addr(LOCALGROUP);
- multiaddr.sin_port=htons(NATPMPORT);
+ multiaddr.sin_port=htons(NATPMP_ANNOUNCEMENT_PORT);
reply.version = NATPMVERSION;
reply.opcode = SERVERREPLYOP + PUBLICADDRREQ;
reply.result = SUCCESS;
if ( req->lifetime == 0)
{
/* remove port mapping */
- if ( !FindAliasPortOut( clientaddr->sin_addr, inany , req->privateport, req->publicport, proto, req->lifetime, 0))
+ if ( !FindAliasPortOut( clientaddr->sin_addr,
+ inany,
+ req->privateport,
+ req->publicport,
+ proto,
+ ntohl(req->lifetime),
+ 0) )
/* FindAliasPortOut returns no error, port successfully removed, return no error response to client */
SendPublicPortResponse( fd, clientaddr, clientaddrlen, req, 0, 0 );
else
{
/* look for port mapping - public port is ignored in this case */
/* create port mapping - map provided public port to private port if public port is not 0 */
- aliasport = FindAliasPortOut( clientaddr->sin_addr,
- inany, /* lastassignaliasAddr */
- req->privateport,
- 0,
- proto,
- req->lifetime,
- 1);
+ aliasport = FindAliasPortOut( clientaddr->sin_addr,
+ inany, /* lastassignaliasAddr */
+ req->privateport,
+ 0,
+ proto,
+ ntohl(req->lifetime),
+ 1);
/* aliasport should be non zero if mapping is successfully, else -1 is returned, alias port shouldn't be zero???? */
SendPublicPortResponse( fd, clientaddr, clientaddrlen, req, aliasport, 0 );
printf( "Read NATPM port error\n");
return;
}
+ else if ( bytes < sizeof(stdportmaprequest) )
+ {
+ /* drop any requests that are too short */
+ return;
+ }
+
req = (struct stdportmaprequest*)buffer;
#ifdef DEBUG
printf("\n");
}
#endif
+
+ /* drop any reply packets that we receive on the floor */
+ if ( req->opcode >= SERVERREPLYOP )
+ {
+ return;
+ }
+
/* check client version */
if ( req->version > NATPMVERSION )
result = NOTSUPPORTEDVERSION;
{
case PUBLICADDRREQ:
{
- SendPublicAddress(fd, &clientaddr, clientaddrlen);
+ if ( bytes == sizeof(stdportmaprequest) )
+ SendPublicAddress(fd, &clientaddr, clientaddrlen);
break;
}
case MAPTCPREQ:
case MAPUDPTCPREQ:
{
- DoPortMapping( fd, &clientaddr, clientaddrlen, (publicportreq*)req);
+ if ( bytes == sizeof(publicportreq) )
+ DoPortMapping( fd, &clientaddr, clientaddrlen, (publicportreq*)req);
break;
}
}
-
-#endif
+#endif /* NATPORTMAP */
static void PrintPacket (struct ip* ip)
{
char *cp = (char *)(ifam + 1);
#define ROUNDUP(a) \
- ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
+ ((a) > 0 ? (1 + (((a) - 1) | (sizeof(uint32_t) - 1))) : sizeof(uint32_t))
#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
for (i = 1; i < RTA_IFA; i <<= 1)
+++ /dev/null
-Project = ndp
-Install_Dir = /usr/sbin
-
-CFILES = ndp.c
-HFILES = gnuc.h
-MANPAGES = ndp.8
-
-Extra_CC_Flags = -mdynamic-no-pic -dead_strip \
- -DINET6 -DIPSEC_DEBUG -DKAME_SCOPEID
-Extra_LD_Flags = -lipsec
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
-
* ndp - display, set, delete and flush neighbor cache
*/
-
+#include <stdint.h>
#include <sys/param.h>
#include <sys/file.h>
#include <sys/ioctl.h>
/* packing rule for routing socket */
#define ROUNDUP(a) \
- ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
+ ((a) > 0 ? (1 + (((a) - 1) | (sizeof(uint32_t) - 1))) : sizeof(uint32_t))
#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
static int pid;
memset(nullbuf, 0, sizeof(nullbuf));
if (memcmp(nullbuf, ND.randomid, sizeof(nullbuf)) != 0) {
int j;
- u_int8_t *rbuf;
+ u_int8_t *rbuf = NULL;
for (i = 0; i < 3; i++) {
switch(i) {
+++ /dev/null
-Project = netstat
-Install_Dir = /usr/sbin
-
-Embedded=$(shell tconf --test TARGET_OS_EMBEDDED)
-
-HFILES = netstat.h
-CFILES = data.c if.c inet.c inet6.c ipsec.c main.c mcast.c mbuf.c\
- route.c tp_astring.c unix.c
-ifneq ($(Embedded),YES)
-CFILES += mroute.c mroute6.c
-endif
-
-MANPAGES = netstat.1
-
-Extra_CC_Flags = -mdynamic-no-pic -dead_strip \
- -DINET6 -DIPSEC \
- -I$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
-
-Install_Program_Mode = 04555
+/*
+ * Copyright (c) 2008 Apple Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
/*
* Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
#include <netinet/in.h>
#include <netinet/in_var.h>
-#ifdef IPX
-#include <netipx/ipx.h>
-#include <netipx/ipx_if.h>
-#endif
-
-#ifdef NS
-#include <netns/ns.h>
-#include <netns/ns_if.h>
-#endif
#include <arpa/inet.h>
#include <signal.h>
#define ROUNDUP(a, size) (((a) & ((size) - 1)) ? (1 + ((a)|(size - 1))) : (a))
#define NEXT_SA(p) (struct sockaddr *) \
- ((caddr_t)p + (p->sa_len ? ROUNDUP(p->sa_len, sizeof(u_long)) : \
- sizeof(u_long)))
+ ((caddr_t)p + (p->sa_len ? ROUNDUP(p->sa_len, sizeof(uint32_t)) : \
+ sizeof(uint32_t)))
static void sidewaysintpr ();
static void catchalarm (int);
static char ntop_buf[INET6_ADDRSTRLEN]; /* for inet_ntop() */
#endif
-#if 0
-#ifdef INET6
-static int bdg_done;
-#endif
-
-/* print bridge statistics */
-void
-bdg_stats(u_long dummy , char *name, int af )
-{
- int i;
- size_t slen ;
- struct bdg_stats s ;
- int mib[4] ;
-
- slen = sizeof(s);
-
- mib[0] = CTL_NET ;
- mib[1] = PF_LINK ;
- mib[2] = IFT_ETHER ;
- if (sysctl(mib,4, &s,&slen,NULL,0)==-1)
- return ; /* no bridging */
-#ifdef INET6
- if (bdg_done != 0)
- return;
- else
- bdg_done = 1;
-#endif
- printf("-- Bridging statistics (%s) --\n", name) ;
- printf(
-"Name In Out Forward Drop Bcast Mcast Local Unknown\n");
- for (i = 0 ; i < 16 ; i++) {
- if (s.s[i].name[0])
- printf("%-6s %9ld%9ld%9ld%9ld%9ld%9ld%9ld%9ld\n",
- s.s[i].name,
- s.s[i].p_in[(int)BDG_IN],
- s.s[i].p_in[(int)BDG_OUT],
- s.s[i].p_in[(int)BDG_FORWARD],
- s.s[i].p_in[(int)BDG_DROP],
- s.s[i].p_in[(int)BDG_BCAST],
- s.s[i].p_in[(int)BDG_MCAST],
- s.s[i].p_in[(int)BDG_LOCAL],
- s.s[i].p_in[(int)BDG_UNKNOWN] );
- }
-}
-
-#endif
-
-
/*
* Display a formatted value, or a '-' in the same space.
*/
if (IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr) ||
IN6_IS_ADDR_MC_LINKLOCAL(&sin6.sin6_addr)) {
- sin6.sin6_scope_id =
- ntohs(*(u_int16_t *)&sin6.sin6_addr.s6_addr[2]);
+ sin6.sin6_scope_id = ntohs(*(u_int16_t *)&sin6.sin6_addr.s6_addr[2]);
sin6.sin6_addr.s6_addr[2] = 0;
sin6.sin6_addr.s6_addr[3] = 0;
}
printf("%23s %-19.19s(refs: %d)\n", "",
- inet_ntop(AF_INET6,
- &sin6.sin6_addr,
- ntop_buf,
- sizeof(ntop_buf)),
+ inet_ntop(AF_INET6, &sin6.sin6_addr,
+ ntop_buf, sizeof(ntop_buf)),
ifmam->ifmam_refcount);
break;
}
switch (sdl->sdl_type) {
case IFT_ETHER:
case IFT_FDDI:
- fmt = ether_ntoa(
- (struct ether_addr *)
+ fmt = ether_ntoa((struct ether_addr *)
LLADDR(sdl));
break;
}
u_int64_t oerrors = 0;
u_int64_t ierrors = 0;
u_int64_t collisions = 0;
- u_long mtu = 0;
+ uint32_t mtu = 0;
short timer = 0;
int drops = 0;
struct sockaddr *sa = NULL;
continue;
get_rti_info(ifam->ifam_addrs, (struct sockaddr*)(ifam + 1), rti_info);
sa = rti_info[RTAX_IFA];
- } else
+ } else {
continue;
- printf("%-5.5s %-5lu ", name, mtu);
+ }
+ printf("%-5.5s %-5u ", name, mtu);
if (sa == 0) {
printf("%-13.13s ", "none");
printf("%-13.13s ", "none");
printf("%-15.15s ", "none");
break;
+
case AF_INET: {
struct sockaddr_in *sin = (struct sockaddr_in *)sa;
struct sockaddr_in mask;
mask.sin_addr.s_addr = 0;
- memcpy(&mask, rti_info[RTAX_NETMASK], ((struct sockaddr_in *)rti_info[RTAX_NETMASK])->sin_len);
+ memcpy(&mask,
+ rti_info[RTAX_NETMASK],
+ ((struct sockaddr_in *)rti_info[RTAX_NETMASK])->sin_len);
- printf("%-13.13s ", netname(sin->sin_addr.s_addr & mask.sin_addr.s_addr,
+ printf("%-13.13s ",
+ netname(sin->sin_addr.s_addr & mask.sin_addr.s_addr,
ntohl(mask.sin_addr.s_addr)));
printf("%-15.15s ",
break;
}
#endif /*INET6*/
- case AF_LINK:
- {
+ case AF_LINK: {
struct sockaddr_dl *sdl =
(struct sockaddr_dl *)sa;
char linknum[10];
n = sdl->sdl_alen;
sprintf(linknum, "<Link#%d>", sdl->sdl_index);
m = printf("%-11.11s ", linknum);
- }
goto hexprint;
+ }
+
default:
m = printf("(%d)", sa->sa_family);
for (cp = sa->sa_len + (char *)sa;
link_layer = 1;
break;
}
-#ifndef __APPLE__
- /*
- * Fixup the statistics for interfaces that
- * update stats for their network addresses
- */
- if (network_layer) {
- opackets = ifaddr.in.ia_ifa.if_opackets;
- ipackets = ifaddr.in.ia_ifa.if_ipackets;
- obytes = ifaddr.in.ia_ifa.if_obytes;
- ibytes = ifaddr.in.ia_ifa.if_ibytes;
}
-#endif
- }
show_stat("llu", 8, ipackets, link_layer|network_layer);
printf(" ");
}
void
-intervalpr(void (*pr)(u_long, char *, int), u_long off, char *name , int af)
+intervalpr(void (*pr)(uint32_t, char *, int), uint32_t off, char *name , int af)
{
struct itimerval timer_interval;
sigset_t sigset, oldsigset;
+/*
+ * Copyright (c) 2008 Apple Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
/*
* Copyright (c) 1983, 1988, 1993, 1995
* The Regents of the University of California. All rights reserved.
* -a (all) flag is specified.
*/
void
-protopr(u_long proto, /* for sysctl version we pass proto # */
+protopr(uint32_t proto, /* for sysctl version we pass proto # */
char *name, int af)
{
int istcp;
static int first = 1;
char *buf;
const char *mibvar;
+ struct xinpgen *xig, *oxig;
+#if !TARGET_OS_EMBEDDED
+ struct xtcpcb64 *tp = NULL;
+ struct xinpcb64 *inp;
+ struct xsocket64 *so;
+#else
struct tcpcb *tp = NULL;
struct inpcb *inp;
- struct xinpgen *xig, *oxig;
struct xsocket *so;
+#endif
size_t len;
istcp = 0;
tcp_done = 1;
#endif
istcp = 1;
+#if !TARGET_OS_EMBEDDED
+ mibvar = "net.inet.tcp.pcblist64";
+#else
mibvar = "net.inet.tcp.pcblist";
+#endif
break;
case IPPROTO_UDP:
#ifdef INET6
else
udp_done = 1;
#endif
+#if !TARGET_OS_EMBEDDED
+ mibvar = "net.inet.udp.pcblist64";
+#else
mibvar = "net.inet.udp.pcblist";
+#endif
break;
case IPPROTO_DIVERT:
+#if !TARGET_OS_EMBEDDED
+ mibvar = "net.inet.divert.pcblist64";
+#else
mibvar = "net.inet.divert.pcblist";
+#endif
break;
default:
+#if !TARGET_OS_EMBEDDED
+ mibvar = "net.inet.raw.pcblist64";
+#else
mibvar = "net.inet.raw.pcblist";
+#endif
break;
}
len = 0;
xig->xig_len > sizeof(struct xinpgen);
xig = (struct xinpgen *)((char *)xig + xig->xig_len)) {
if (istcp) {
+#if !TARGET_OS_EMBEDDED
+ tp = (struct xtcpcb64 *)xig;
+ inp = &tp->xt_inpcb;
+ so = &inp->xi_socket;
+#else
tp = &((struct xtcpcb *)xig)->xt_tp;
inp = &((struct xtcpcb *)xig)->xt_inp;
so = &((struct xtcpcb *)xig)->xt_socket;
+#endif
} else {
+#if !TARGET_OS_EMBEDDED
+ inp = (struct xinpcb64 *)xig;
+ so = &inp->xi_socket;
+#else
inp = &((struct xinpcb *)xig)->xi_inp;
so = &((struct xinpcb *)xig)->xi_socket;
+#endif
}
/* Ignore sockets for protocols other than the desired one. */
))
)
continue;
-#ifdef __APPLE__
+
/*
* Local address is not an indication of listening socket or
* server sockey but just rather the socket has been bound.
*/
if (!aflag && istcp && tp->t_state <= TCPS_LISTEN)
continue;
-#else
- if (!aflag &&
- (
- (af == AF_INET &&
- inet_lnaof(inp->inp_laddr) == INADDR_ANY)
-#ifdef INET6
- || (af == AF_INET6 &&
- IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr))
-#endif /* INET6 */
- || (af == AF_UNSPEC &&
- (((inp->inp_vflag & INP_IPV4) != 0 &&
- inet_lnaof(inp->inp_laddr) == INADDR_ANY)
-#ifdef INET6
- || ((inp->inp_vflag & INP_IPV6) != 0 &&
- IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr))
-#endif
- ))
- ))
- continue;
-#endif
if (Lflag && !so->so_qlimit)
continue;
"Current listen queue sizes (qlen/incqlen/maxqlen)");
putchar('\n');
if (Aflag)
+#if !TARGET_OS_EMBEDDED
+ printf("%-16.16s ", "Socket");
+#else
printf("%-8.8s ", "Socket");
+#endif
if (Lflag)
printf("%-14.14s %-22.22s\n",
"Listen", "Local Address");
}
if (Aflag) {
if (istcp)
+#if !TARGET_OS_EMBEDDED
+ printf("%16lx ", (u_long)inp->inp_ppcb);
+#else
printf("%8lx ", (u_long)inp->inp_ppcb);
+
+#endif
else
+#if !TARGET_OS_EMBEDDED
+ printf("%16lx ", (u_long)so->so_pcb);
+#else
printf("%8lx ", (u_long)so->so_pcb);
+#endif
}
if (Lflag) {
char buf[15];
* Dump TCP statistics structure.
*/
void
-tcp_stats(u_long off , char *name, int af )
+tcp_stats(uint32_t off , char *name, int af )
{
static struct tcpstat ptcpstat;
struct tcpstat tcpstat;
* Dump UDP statistics structure.
*/
void
-udp_stats(u_long off , char *name, int af )
+udp_stats(uint32_t off , char *name, int af )
{
static struct udpstat pudpstat;
struct udpstat udpstat;
size_t len = sizeof udpstat;
- u_long delivered;
+ uint32_t delivered;
if (sysctlbyname("net.inet.udp.stats", &udpstat, &len, 0, 0) < 0) {
warn("sysctl: net.inet.udp.stats");
p1a(udps_hdrops, "\t%u with incomplete header\n");
p1a(udps_badlen, "\t%u with bad data length field\n");
p1a(udps_badsum, "\t%u with bad checksum\n");
-#ifndef __APPLE__
- p1a(udps_nosum, "\t%u with no checksum\n");
-#endif
p1a(udps_noport, "\t%u dropped due to no socket\n");
p(udps_noportbcast,
"\t%u broadcast/multicast datagram%s dropped due to no socket\n");
UDPDIFF(udps_noportbcast) -
UDPDIFF(udps_fullsock);
if (delivered || sflag <= 1)
- printf("\t%lu delivered\n", delivered);
+ printf("\t%u delivered\n", delivered);
p(udps_opackets, "\t%u datagram%s output\n");
if (interval > 0)
* Dump IP statistics structure.
*/
void
-ip_stats(u_long off , char *name, int af )
+ip_stats(uint32_t off , char *name, int af )
{
static struct ipstat pipstat;
struct ipstat ipstat;
* Dump ICMP statistics.
*/
void
-icmp_stats(u_long off , char *name, int af )
+icmp_stats(uint32_t off , char *name, int af )
{
static struct icmpstat picmpstat;
struct icmpstat icmpstat;
* Dump IGMP statistics structure.
*/
void
-igmp_stats(u_long off , char *name, int af )
+igmp_stats(uint32_t off , char *name, int af )
{
static struct igmpstat pigmpstat;
struct igmpstat igmpstat;
+/*
+ * Copyright (c) 2008 Apple Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
/* BSDI inet.c,v 2.3 1995/10/24 02:19:29 prb Exp */
/*
char *inet6name (struct in6_addr *);
void inet6print (struct in6_addr *, int, char *, int);
-static char ntop_buf[INET6_ADDRSTRLEN];
-
static char *ip6nh[] = {
"hop by hop",
"ICMP",
* Dump IP6 statistics structure.
*/
void
-ip6_stats(u_long off __unused, char *name, int af __unused)
+ip6_stats(uint32_t off __unused, char *name, int af __unused)
{
static struct ip6stat pip6stat;
struct ip6stat ip6stat;
* Dump ICMP6 statistics.
*/
void
-icmp6_stats(u_long off __unused, char *name, int af __unused)
+icmp6_stats(uint32_t off __unused, char *name, int af __unused)
{
static struct icmp6stat picmp6stat;
struct icmp6stat icmp6stat;
* Dump raw ip6 statistics structure.
*/
void
-rip6_stats(u_long off __unused, char *name, int af __unused)
+rip6_stats(uint32_t off __unused, char *name, int af __unused)
{
static struct rip6stat prip6stat;
struct rip6stat rip6stat;
+/*
+ * Copyright (c) 2008 Apple Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
/* $FreeBSD: src/usr.bin/netstat/ipsec.c,v 1.1.2.3 2001/08/10 09:07:09 ru Exp $ */
/* $NetBSD: inet.c,v 1.35.2.1 1999/04/29 14:57:08 perry Exp $ */
/* $KAME: ipsec.c,v 1.25 2001/03/12 09:04:39 itojun Exp $ */
}
void
-ipsec_stats(u_long off __unused, char *name, int af __unused)
+ipsec_stats(uint32_t off __unused, char *name, int af __unused)
{
size_t len;
}
void
-pfkey_stats(u_long off __unused, char *name, int af __unused)
+pfkey_stats(uint32_t off __unused, char *name, int af __unused)
{
static struct pfkeystat ppfkeystat;
struct pfkeystat pfkeystat;
/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2008 Apple Inc. All rights reserved.
*
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
*
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
- * @APPLE_LICENSE_HEADER_END@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1983, 1988, 1993
Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 3/1/94";
-#endif
-static const char rcsid[] =
- "$Id: main.c,v 1.8 2004/10/14 22:24:09 lindak Exp $";
-#endif /* not lint */
-
#include <sys/param.h>
#include <sys/file.h>
#include <sys/socket.h>
u_char pr_index; /* index into nlist of cb head */
u_char pr_sindex; /* index into nlist of stat block */
u_char pr_wanted; /* 1 if wanted, 0 otherwise */
- void (*pr_cblocks)(u_long, char *, int);
+ void (*pr_cblocks)(uint32_t, char *, int);
/* control blocks printing routine */
- void (*pr_stats)(u_long, char *, int);
+ void (*pr_stats)(uint32_t, char *, int);
/* statistics printing routine */
void (*pr_istats)(char *); /* per/if statistics printing routine */
char *pr_name; /* well-known name */
#ifdef IPSEC
{ -1, -1, 1, 0,
ipsec_stats, NULL, "ipsec", IPPROTO_ESP},
-#endif
-#if 0
- { -1, -1, 1, 0,
- bdg_stats, NULL, "bdg", 1 /* bridging... */ },
#endif
{ -1, -1, 0, 0,
0, NULL, 0 }
#endif
{ -1, -1, 1, 0,
rip6_stats, NULL, "rip6", IPPROTO_RAW },
-#if 0
- { -1, -1, 1, 0,
- bdg_stats, NULL, "bdg", 1 /* bridging... */ },
-#endif
{ -1, -1, 0, 0,
0, NULL, 0, 0 }
};
0, NULL, 0, 0 }
};
#endif
-#ifndef __APPLE__
-struct protox atalkprotox[] = {
- { N_DDPCB, N_DDPSTAT, 1, atalkprotopr,
- ddp_stats, NULL, "ddp" },
- { -1, -1, 0, 0,
- 0, NULL, 0 }
-};
-
-struct protox netgraphprotox[] = {
- { N_NGSOCKS, -1, 1, netgraphprotopr,
- NULL, NULL, "ctrl" },
- { N_NGSOCKS, -1, 1, netgraphprotopr,
- NULL, NULL, "data" },
- { -1, NULL, 0, 0,
- 0, NULL, 0 }
-};
-
-struct protox ipxprotox[] = {
- { N_IPX, N_IPXSTAT, 1, ipxprotopr,
- ipx_stats, NULL, "ipx", 0 },
- { N_IPX, N_SPXSTAT, 1, ipxprotopr,
- spx_stats, NULL, "spx", 0 },
- { -1, -1, 0, 0,
- 0, NULL, 0, 0 }
-};
-#endif
-#ifdef NS
-struct protox nsprotox[] = {
- { N_IDP, N_IDPSTAT, 1, nsprotopr,
- idp_stats, NULL, "idp" },
- { N_IDP, N_SPPSTAT, 1, nsprotopr,
- spp_stats, NULL, "spp" },
- { -1, N_NSERR, 1, 0,
- nserr_stats, NULL, "ns_err" },
- { -1, -1, 0, 0,
- 0, NULL, 0 }
-};
-#endif
-
-#ifdef ISO
-struct protox isoprotox[] = {
- { ISO_TP, N_TPSTAT, 1, iso_protopr,
- tp_stats, NULL, "tp" },
- { N_CLTP, N_CLTPSTAT, 1, iso_protopr,
- cltp_stats, NULL, "cltp" },
- { -1, N_CLNPSTAT, 1, 0,
- clnp_stats, NULL, "clnp"},
- { -1, N_ESISSTAT, 1, 0,
- esis_stats, NULL, "esis"},
- { -1, -1, 0, 0,
- 0, NULL, 0 }
-};
-#endif
struct protox *protoprotox[] = {
protox,
#endif
#ifdef IPSEC
pfkeyprotox,
-#endif
-#ifndef __APPLE__
- ipxprotox, atalkprotox,
-#endif
-#ifdef NS
- nsprotox,
-#endif
-#ifdef ISO
- isoprotox,
#endif
NULL };
dflag = 1;
break;
case 'f':
-#ifdef NS
- if (strcmp(optarg, "ns") == 0)
- af = AF_NS;
- else
-#endif
if (strcmp(optarg, "ipx") == 0)
af = AF_IPX;
else if (strcmp(optarg, "inet") == 0)
#endif /*INET6*/
else if (strcmp(optarg, "unix") == 0)
af = AF_UNIX;
-#ifndef __APPLE__
- else if (strcmp(optarg, "atalk") == 0)
- af = AF_APPLETALK;
- else if (strcmp(optarg, "ng") == 0
- || strcmp(optarg, "netgraph") == 0)
- af = AF_NETGRAPH;
-#endif
-#ifdef ISO
- else if (strcmp(optarg, "iso") == 0)
- af = AF_ISO;
-#endif
else {
errx(1, "%s: unknown address family", optarg);
}
mbpr();
exit(0);
}
-#if 0
- /*
- * Keep file descriptors open to avoid overhead
- * of open/close on each call to get* routines.
- */
- sethostent(1);
- setnetent(1);
-#else
- /*
- * This does not make sense any more with DNS being default over
- * the files. Doing a setXXXXent(1) causes a tcp connection to be
- * used for the queries, which is slower.
- */
-#endif
if (iflag && !sflag) {
intpr(NULL);
exit(0);
for (tp = pfkeyprotox; tp->pr_name; tp++)
printproto(tp, tp->pr_name);
#endif /*IPSEC*/
-#ifndef __APPLE__
- if (af == AF_IPX || af == AF_UNSPEC) {
- for (tp = ipxprotox; tp->pr_name; tp++)
- printproto(tp, tp->pr_name);
- }
- if (af == AF_APPLETALK || af == AF_UNSPEC)
- for (tp = atalkprotox; tp->pr_name; tp++)
- printproto(tp, tp->pr_name);
- if (af == AF_NETGRAPH || af == AF_UNSPEC)
- for (tp = netgraphprotox; tp->pr_name; tp++)
- printproto(tp, tp->pr_name);
-#endif
-#ifdef NS
- if (af == AF_NS || af == AF_UNSPEC)
- for (tp = nsprotox; tp->pr_name; tp++)
- printproto(tp, tp->pr_name);
-#endif
-#ifdef ISO
- if (af == AF_ISO || af == AF_UNSPEC)
- for (tp = isoprotox; tp->pr_name; tp++)
- printproto(tp, tp->pr_name);
-#endif
if ((af == AF_UNIX || af == AF_UNSPEC) && !Lflag && !sflag)
unixpr();
#ifdef SRVCACHE
register struct protox *tp;
char *name;
{
- void (*pr)(u_long, char *, int);
- u_long off;
+ void (*pr)(uint32_t, char *, int);
+ uint32_t off;
if (sflag) {
if (iflag && !pflag) {
(void) fprintf(stderr, "%s\n", NETSTAT_USAGE);
exit(1);
}
-
/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2008 Apple Inc. All rights reserved.
*
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
*
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
- * @APPLE_LICENSE_HEADER_END@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1983, 1988, 1993
#include <stdlib.h>
#include <errno.h>
#include "netstat.h"
-#include <netat/sysglue.h> /* To get Appletalk message/mbuf types */
#define YES 1
typedef int bool;
{ MT_RIGHTS, "access rights" },
{ MT_IFADDR, "interface addresses" }, /* XXX */
{ MT_TAG, "packet tags" }, /* XXX */
- { MSG_DATA, "Appletalk data blocks"},
- { MSG_PROTO, "Appletalk internal msgs"},
- { MSG_IOCTL, "Appletalk ioctl requests"},
- { MSG_ERROR, "Appletalk error indicators"},
- { MSG_HANGUP, "Appletalk termination requests"},
- { MSG_IOCACK, "Appletalk ioctl acks"},
- { MSG_IOCNAK, "Appletalk ioctl failure indicators"},
- { MSG_CTL, "Appletalk control msgs"},
{ 0, 0 }
};
+/*
+ * Copyright (c) 2008 Apple Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
/*
* Copyright (c) 2007 Bruce M. Simpson <bms@FreeBSD.org>
* All rights reserved.
void ifmalist_dump_af(const struct ifmaddrs * const ifmap, int const af);
-#define SALIGN (sizeof(long) - 1)
+#define SALIGN (sizeof(uint32_t) - 1)
#define SA_RLEN(sa) (sa ? ((sa)->sa_len ? (((sa)->sa_len + SALIGN) & ~SALIGN) : \
(SALIGN + 1)) : 0)
#define MAX_SYSCTL_TRY 5
/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2008 Apple Inc. All rights reserved.
*
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
*
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
- * @APPLE_LICENSE_HEADER_END@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1989 Stephen Deering
printf(" %-15.15s", (v->v_flags & VIFF_TUNNEL) ?
routename(v->v_rmt_addr.s_addr) : "");
- printf(" %9lu %9lu\n", v->v_pkt_in, v->v_pkt_out);
+ printf(" %9u %9u\n", v->v_pkt_in, v->v_pkt_out);
}
if (!banner_printed)
printf("\nVirtual Interface Table is empty\n");
printf(" %-15.15s", routename(m->mfc_origin.s_addr));
printf(" %-15.15s", routename(m->mfc_mcastgrp.s_addr));
- printf(" %9lu", m->mfc_pkt_cnt);
+ printf(" %9u", m->mfc_pkt_cnt);
printf(" %3d ", m->mfc_parent);
for (vifi = 0; vifi <= maxvif; vifi++) {
if (m->mfc_ttls[vifi] > 0)
+/*
+ * Copyright (c) 2008 Apple Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
/*
* Copyright (C) 1998 WIDE Project.
* All rights reserved.
register int banner_printed;
register int saved_nflag;
mifi_t maxmif = 0;
- long int waitings;
+ long waitings;
size_t len;
len = sizeof(mif6table);
banner_printed = 0;
for (mifi = 0, mifp = mif6table; mifi < MAXMIFS; ++mifi, ++mifp) {
- struct ifnet ifnet;
+ struct ifnet ifnet = { 0 } ;
char ifname[IFNAMSIZ];
if (mifp->m6_ifp == NULL)
D RTF_DYNAMIC Created dynamically (by redirect)
G RTF_GATEWAY Destination requires forwarding by intermediary
H RTF_HOST Host entry (net otherwise)
+I RTF_IFSCOPE Route is associated with an interface scope
L RTF_LLINFO Valid protocol to link address translation
M RTF_MODIFIED Modified dynamically (by redirect)
+m RTF_MULTICAST The route represents a multicast address
R RTF_REJECT Host or net unreachable
S RTF_STATIC Manually added
U RTF_UP Route usable
obtain a route while sending to the same destination. The use field
provides a count of the number of packets sent using that route. The
interface entry indicates the network interface utilized for the route.
+A route which is marked with the RTF_IFSCOPE flag is instantiated for
+the corresponding interface.
.Pp
When
.Nm netstat
.Xr hosts 5 ,
.Xr networks 5 ,
.Xr protocols 5 ,
+.Xr route 8 ,
.Xr services 5 ,
.Xr iostat 8 ,
.Xr trpt 8 ,
/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2008 Apple Inc. All rights reserved.
*
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
*
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
- * @APPLE_LICENSE_HEADER_END@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1992, 1993
#include <sys/cdefs.h>
#include <sys/types.h>
+#include <stdint.h>
-#ifdef __APPLE__
#include <TargetConditionals.h>
-#endif
extern int Aflag; /* show addresses of protocol control block */
extern int aflag; /* show all sockets (including servers) */
extern int af; /* address family */
-#if 0
-int kread (u_long addr, char *buf, int size);
-#endif
-char *plural (int);
-char *plurales (int);
-
-void protopr (u_long, char *, int);
-void tcp_stats (u_long, char *, int);
-void udp_stats (u_long, char *, int);
-void ip_stats (u_long, char *, int);
-void icmp_stats (u_long, char *, int);
-void igmp_stats (u_long, char *, int);
+extern char *plural (int);
+extern char *plurales (int);
+
+extern void protopr(uint32_t, char *, int);
+extern void tcp_stats(uint32_t, char *, int);
+extern void udp_stats(uint32_t, char *, int);
+extern void ip_stats(uint32_t, char *, int);
+extern void icmp_stats(uint32_t, char *, int);
+extern void igmp_stats(uint32_t, char *, int);
#ifdef IPSEC
-void ipsec_stats (u_long, char *, int);
+extern void ipsec_stats(uint32_t, char *, int);
#endif
#ifdef INET6
-void ip6_stats (u_long, char *, int);
-void ip6_ifstats (char *);
-void icmp6_stats (u_long, char *, int);
-void icmp6_ifstats (char *);
+extern void ip6_stats(uint32_t, char *, int);
+extern void ip6_ifstats(char *);
+extern void icmp6_stats(uint32_t, char *, int);
+extern void icmp6_ifstats(char *);
#ifdef notyet
-void pim6_stats (u_long, char *, int);
+extern void pim6_stats(uint32_t, char *, int);
#endif
-void rip6_stats (u_long, char *, int);
+extern void rip6_stats(uint32_t, char *, int);
#if defined(__APPLE__) && !TARGET_OS_EMBEDDED
-void mroute6pr (void);
-void mrt6_stats (void);
+extern void mroute6pr(void);
+extern void mrt6_stats(void);
#endif
+/* forward references */
struct sockaddr_in6;
struct in6_addr;
-char *routename6 (struct sockaddr_in6 *);
-struct sockaddr; /* forward reference */
-char *netname6 (struct sockaddr_in6 *, struct sockaddr *);
+struct sockaddr;
+
+extern char *routename6(struct sockaddr_in6 *);
+extern char *netname6(struct sockaddr_in6 *, struct sockaddr *);
#endif /*INET6*/
#ifdef IPSEC
-void pfkey_stats (u_long, char *, int);
-#endif
-
-void bdg_stats (u_long, char *, int);
-
-void mbpr (void);
-
-void hostpr (u_long, u_long);
-void impstats (u_long, u_long);
-
-void intpr (void (*)(char *));
-void intervalpr(void (*)(u_long, char *, int), u_long, char *, int);
-
-void pr_rthdr (int);
-void pr_family (int);
-void rt_stats (void);
-char *ipx_pnet (struct sockaddr *);
-char *ipx_phost (struct sockaddr *);
-char *ns_phost (struct sockaddr *);
-void upHex (char *);
-
-char *routename (u_long);
-char *netname (u_long, u_long);
-#if 0
-char *atalk_print (struct sockaddr *, int);
-char *atalk_print2 (struct sockaddr *, struct sockaddr *, int);
-char *ipx_print (struct sockaddr *);
-char *ns_print (struct sockaddr *);
+extern void pfkey_stats(uint32_t, char *, int);
#endif
-void routepr (u_long);
-#if 0
-void ipxprotopr (u_long, char *, int);
-void spx_stats (u_long, char *, int);
-void ipx_stats (u_long, char *, int);
-void ipxerr_stats (u_long, char *, int);
+extern void mbpr(void);
-void nsprotopr (u_long, char *, int);
-void spp_stats (u_long, char *, int);
-void idp_stats (u_long, char *, int);
-void nserr_stats (u_long, char *, int);
+extern void intpr(void (*)(char *));
+extern void intervalpr(void (*)(uint32_t, char *, int), uint32_t,
+ char *, int);
-void atalkprotopr (u_long, char *, int);
-void ddp_stats (u_long, char *, int);
+extern void pr_rthdr(int);
+extern void pr_family(int);
+extern void rt_stats(void);
+extern void upHex(char *);
+extern char *routename(uint32_t);
+extern char *netname(uint32_t, uint32_t);
+extern void routepr(uint32_t);
-void netgraphprotopr (u_long, char *, int);
-#endif
-
-void unixpr (void);
-
-void esis_stats (u_long, char *, int);
-void clnp_stats (u_long, char *, int);
-void cltp_stats (u_long, char *, int);
-void iso_protopr (u_long, char *, int);
-void iso_protopr1 (u_long, int);
-void tp_protopr (u_long, char *, int);
-void tp_inproto (u_long);
-void tp_stats (caddr_t, caddr_t);
+extern void unixpr(void);
#if defined(__APPLE__) && !TARGET_OS_EMBEDDED
-void mroutepr (void);
-void mrt_stats (void);
+extern void mroutepr(void);
+extern void mrt_stats(void);
#endif
-void ifmalist_dump(void);
+
+extern void ifmalist_dump(void);
+++ /dev/null
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright (c) 1983, 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)ns.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/mbuf.h>
-
-#include <net/route.h>
-#include <net/if.h>
-
-#include <netinet/tcp_fsm.h>
-
-#include <netns/ns.h>
-#include <netns/ns_pcb.h>
-#include <netns/idp.h>
-#include <netns/idp_var.h>
-#include <netns/ns_error.h>
-#include <netns/sp.h>
-#include <netns/spidp.h>
-#include <netns/spp_timer.h>
-#include <netns/spp_var.h>
-#define SANAMES
-#include <netns/spp_debug.h>
-
-#include <nlist.h>
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include "netstat.h"
-
-struct nspcb nspcb;
-struct sppcb sppcb;
-static struct socket sockb;
-
-static char *ns_prpr __P((struct ns_addr *));
-static void ns_erputil __P((int, int));
-
-static int first = 1;
-
-/*
- * Print a summary of connections related to a Network Systems
- * protocol. For SPP, also give state of connection.
- * Listening processes (aflag) are suppressed unless the
- * -a (all) flag is specified.
- */
-
-void
-nsprotopr(off, name)
- u_long off;
- char *name;
-{
- struct nspcb cb;
- register struct nspcb *prev, *next;
- int isspp;
-
- if (off == 0)
- return;
- isspp = strcmp(name, "spp") == 0;
- kread(off, (char *)&cb, sizeof (struct nspcb));
- nspcb = cb;
- prev = (struct nspcb *)off;
- if (nspcb.nsp_next == (struct nspcb *)off)
- return;
- for (;nspcb.nsp_next != (struct nspcb *)off; prev = next) {
- u_long ppcb;
-
- next = nspcb.nsp_next;
- kread((u_long)next, (char *)&nspcb, sizeof (nspcb));
- if (nspcb.nsp_prev != prev) {
- printf("???\n");
- break;
- }
- if (!aflag && ns_nullhost(nspcb.nsp_faddr) ) {
- continue;
- }
- kread((u_long)nspcb.nsp_socket,
- (char *)&sockb, sizeof (sockb));
- ppcb = (u_long) nspcb.nsp_pcb;
- if (ppcb) {
- if (isspp) {
- kread(ppcb, (char *)&sppcb, sizeof (sppcb));
- } else continue;
- } else
- if (isspp) continue;
- if (first) {
- printf("Active NS connections");
- if (aflag)
- printf(" (including servers)");
- putchar('\n');
- if (Aflag)
- printf("%-8.8s ", "PCB");
- printf(Aflag ?
- "%-5.5s %-6.6s %-6.6s %-18.18s %-18.18s %s\n" :
- "%-5.5s %-6.6s %-6.6s %-22.22s %-22.22s %s\n",
- "Proto", "Recv-Q", "Send-Q",
- "Local Address", "Foreign Address", "(state)");
- first = 0;
- }
- if (Aflag)
- printf("%8x ", ppcb);
- printf("%-5.5s %6d %6d ", name, sockb.so_rcv.sb_cc,
- sockb.so_snd.sb_cc);
- printf(" %-22.22s", ns_prpr(&nspcb.nsp_laddr));
- printf(" %-22.22s", ns_prpr(&nspcb.nsp_faddr));
- if (isspp) {
- extern char *tcpstates[];
- if (sppcb.s_state >= TCP_NSTATES)
- printf(" %d", sppcb.s_state);
- else
- printf(" %s", tcpstates[sppcb.s_state]);
- }
- putchar('\n');
- prev = next;
- }
-}
-#define ANY(x,y,z) \
- ((x) ? printf("\t%d %s%s%s -- %s\n",x,y,plural(x),z,"x") : 0)
-
-/*
- * Dump SPP statistics structure.
- */
-void
-spp_stats(off, name)
- u_long off;
- char *name;
-{
- struct spp_istat spp_istat;
-#define sppstat spp_istat.newstats
-
- if (off == 0)
- return;
- kread(off, (char *)&spp_istat, sizeof (spp_istat));
- printf("%s:\n", name);
- ANY(spp_istat.nonucn, "connection", " dropped due to no new sockets ");
- ANY(spp_istat.gonawy, "connection", " terminated due to our end dying");
- ANY(spp_istat.nonucn, "connection",
- " dropped due to inability to connect");
- ANY(spp_istat.noconn, "connection",
- " dropped due to inability to connect");
- ANY(spp_istat.notme, "connection",
- " incompleted due to mismatched id's");
- ANY(spp_istat.wrncon, "connection", " dropped due to mismatched id's");
- ANY(spp_istat.bdreas, "packet", " dropped out of sequence");
- ANY(spp_istat.lstdup, "packet", " duplicating the highest packet");
- ANY(spp_istat.notyet, "packet", " refused as exceeding allocation");
- ANY(sppstat.spps_connattempt, "connection", " initiated");
- ANY(sppstat.spps_accepts, "connection", " accepted");
- ANY(sppstat.spps_connects, "connection", " established");
- ANY(sppstat.spps_drops, "connection", " dropped");
- ANY(sppstat.spps_conndrops, "embryonic connection", " dropped");
- ANY(sppstat.spps_closed, "connection", " closed (includes drops)");
- ANY(sppstat.spps_segstimed, "packet", " where we tried to get rtt");
- ANY(sppstat.spps_rttupdated, "time", " we got rtt");
- ANY(sppstat.spps_delack, "delayed ack", " sent");
- ANY(sppstat.spps_timeoutdrop, "connection", " dropped in rxmt timeout");
- ANY(sppstat.spps_rexmttimeo, "retransmit timeout", "");
- ANY(sppstat.spps_persisttimeo, "persist timeout", "");
- ANY(sppstat.spps_keeptimeo, "keepalive timeout", "");
- ANY(sppstat.spps_keepprobe, "keepalive probe", " sent");
- ANY(sppstat.spps_keepdrops, "connection", " dropped in keepalive");
- ANY(sppstat.spps_sndtotal, "total packet", " sent");
- ANY(sppstat.spps_sndpack, "data packet", " sent");
- ANY(sppstat.spps_sndbyte, "data byte", " sent");
- ANY(sppstat.spps_sndrexmitpack, "data packet", " retransmitted");
- ANY(sppstat.spps_sndrexmitbyte, "data byte", " retransmitted");
- ANY(sppstat.spps_sndacks, "ack-only packet", " sent");
- ANY(sppstat.spps_sndprobe, "window probe", " sent");
- ANY(sppstat.spps_sndurg, "packet", " sent with URG only");
- ANY(sppstat.spps_sndwinup, "window update-only packet", " sent");
- ANY(sppstat.spps_sndctrl, "control (SYN|FIN|RST) packet", " sent");
- ANY(sppstat.spps_sndvoid, "request", " to send a non-existant packet");
- ANY(sppstat.spps_rcvtotal, "total packet", " received");
- ANY(sppstat.spps_rcvpack, "packet", " received in sequence");
- ANY(sppstat.spps_rcvbyte, "byte", " received in sequence");
- ANY(sppstat.spps_rcvbadsum, "packet", " received with ccksum errs");
- ANY(sppstat.spps_rcvbadoff, "packet", " received with bad offset");
- ANY(sppstat.spps_rcvshort, "packet", " received too short");
- ANY(sppstat.spps_rcvduppack, "duplicate-only packet", " received");
- ANY(sppstat.spps_rcvdupbyte, "duplicate-only byte", " received");
- ANY(sppstat.spps_rcvpartduppack, "packet", " with some duplicate data");
- ANY(sppstat.spps_rcvpartdupbyte, "dup. byte", " in part-dup. packet");
- ANY(sppstat.spps_rcvoopack, "out-of-order packet", " received");
- ANY(sppstat.spps_rcvoobyte, "out-of-order byte", " received");
- ANY(sppstat.spps_rcvpackafterwin, "packet", " with data after window");
- ANY(sppstat.spps_rcvbyteafterwin, "byte", " rcvd after window");
- ANY(sppstat.spps_rcvafterclose, "packet", " rcvd after 'close'");
- ANY(sppstat.spps_rcvwinprobe, "rcvd window probe packet", "");
- ANY(sppstat.spps_rcvdupack, "rcvd duplicate ack", "");
- ANY(sppstat.spps_rcvacktoomuch, "rcvd ack", " for unsent data");
- ANY(sppstat.spps_rcvackpack, "rcvd ack packet", "");
- ANY(sppstat.spps_rcvackbyte, "byte", " acked by rcvd acks");
- ANY(sppstat.spps_rcvwinupd, "rcvd window update packet", "");
-}
-#undef ANY
-#define ANY(x,y,z) ((x) ? printf("\t%d %s%s%s\n",x,y,plural(x),z) : 0)
-
-/*
- * Dump IDP statistics structure.
- */
-void
-idp_stats(off, name)
- u_long off;
- char *name;
-{
- struct idpstat idpstat;
-
- if (off == 0)
- return;
- kread(off, (char *)&idpstat, sizeof (idpstat));
- printf("%s:\n", name);
- ANY(idpstat.idps_toosmall, "packet", " smaller than a header");
- ANY(idpstat.idps_tooshort, "packet", " smaller than advertised");
- ANY(idpstat.idps_badsum, "packet", " with bad checksums");
-}
-
-static struct {
- u_short code;
- char *name;
- char *where;
-} ns_errnames[] = {
- {0, "Unspecified Error", " at Destination"},
- {1, "Bad Checksum", " at Destination"},
- {2, "No Listener", " at Socket"},
- {3, "Packet", " Refused due to lack of space at Destination"},
- {01000, "Unspecified Error", " while gatewayed"},
- {01001, "Bad Checksum", " while gatewayed"},
- {01002, "Packet", " forwarded too many times"},
- {01003, "Packet", " too large to be forwarded"},
- {-1, 0, 0},
-};
-
-/*
- * Dump NS Error statistics structure.
- */
-/*ARGSUSED*/
-void
-nserr_stats(off, name)
- u_long off;
- char *name;
-{
- struct ns_errstat ns_errstat;
- register int j;
- register int histoprint = 1;
- int z;
-
- if (off == 0)
- return;
- kread(off, (char *)&ns_errstat, sizeof (ns_errstat));
- printf("NS error statistics:\n");
- ANY(ns_errstat.ns_es_error, "call", " to ns_error");
- ANY(ns_errstat.ns_es_oldshort, "error",
- " ignored due to insufficient addressing");
- ANY(ns_errstat.ns_es_oldns_err, "error request",
- " in response to error packets");
- ANY(ns_errstat.ns_es_tooshort, "error packet",
- " received incomplete");
- ANY(ns_errstat.ns_es_badcode, "error packet",
- " received of unknown type");
- for(j = 0; j < NS_ERR_MAX; j ++) {
- z = ns_errstat.ns_es_outhist[j];
- if (z && histoprint) {
- printf("Output Error Histogram:\n");
- histoprint = 0;
- }
- ns_erputil(z, ns_errstat.ns_es_codes[j]);
-
- }
- histoprint = 1;
- for(j = 0; j < NS_ERR_MAX; j ++) {
- z = ns_errstat.ns_es_inhist[j];
- if (z && histoprint) {
- printf("Input Error Histogram:\n");
- histoprint = 0;
- }
- ns_erputil(z, ns_errstat.ns_es_codes[j]);
- }
-}
-
-static void
-ns_erputil(z, c)
- int z, c;
-{
- int j;
- char codebuf[30];
- char *name, *where;
-
- for(j = 0;; j ++) {
- if ((name = ns_errnames[j].name) == 0)
- break;
- if (ns_errnames[j].code == c)
- break;
- }
- if (name == 0) {
- if (c > 01000)
- where = "in transit";
- else
- where = "at destination";
- sprintf(codebuf, "Unknown XNS error code 0%o", c);
- name = codebuf;
- } else
- where = ns_errnames[j].where;
- ANY(z, name, where);
-}
-
-static struct sockaddr_ns ssns = {AF_NS};
-
-static
-char *ns_prpr(x)
- struct ns_addr *x;
-{
- struct sockaddr_ns *sns = &ssns;
-
- sns->sns_addr = *x;
- return(ns_print((struct sockaddr *)sns));
-}
/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2008 Apple Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
*
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1983, 1988, 1993
* SUCH DAMAGE.
*/
-#ifndef lint
-#if 0
-static char sccsid[] = "From: @(#)route.c 8.6 (Berkeley) 4/28/95";
-#endif
-static const char rcsid[] =
- "$Id: route.c,v 1.8 2006/02/07 06:22:20 lindak Exp $";
-#endif /* not lint */
-
+#include <stdint.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <net/radix.h>
#include <netinet/in.h>
-#ifndef __APPLE__
-#include <netipx/ipx.h>
-#include <netatalk/at.h>
-#include <netgraph/ng_socket.h>
-#endif
-
-#ifdef NS
-#include <netns/ns.h>
-#endif
#include <sys/sysctl.h>
#include <arpa/inet.h>
-#ifndef __APPLE__
-#include <libutil.h>
-#endif
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "netstat.h"
-#if 0
-#define kget(p, d) (kread((u_long)(p), (char *)&(d), sizeof (d)))
-#endif
-
/* alignment constraint for routing socket */
#define ROUNDUP(a) \
- ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
+ ((a) > 0 ? (1 + (((a) - 1) | (sizeof(uint32_t) - 1))) : sizeof(uint32_t))
#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
/*
* Definitions for showing gateway flags.
*/
struct bits {
- u_long b_mask;
+ uint32_t b_mask;
char b_val;
} bits[] = {
{ RTF_UP, 'U' },
{ RTF_REJECT, 'R' },
{ RTF_DYNAMIC, 'D' },
{ RTF_MODIFIED, 'M' },
+ { RTF_MULTICAST,'m' },
{ RTF_DONE, 'd' }, /* Completed -- for routing messages only */
{ RTF_CLONING, 'C' },
{ RTF_XRESOLVE, 'X' },
{ RTF_PROTO3, '3' },
{ RTF_BLACKHOLE,'B' },
{ RTF_BROADCAST,'b' },
+ { RTF_IFSCOPE, 'I' },
{ 0 }
};
typedef union {
- long dummy; /* Helps align structure. */
+ uint32_t dummy; /* Helps align structure. */
struct sockaddr u_sa;
u_short u_data[128];
} sa_u;
-#if 0
-static sa_u pt_u;
-#endif
-
-int do_rtent = 0;
-struct rtentry rtentry;
-struct radix_node rnode;
-struct radix_mask rmask;
-struct radix_node_head *rt_tables[AF_MAX+1];
-
-#if 0
-static struct sockaddr *kgetsa __P((struct sockaddr *));
-static void p_tree __P((struct radix_node *));
-static void p_rtnode __P((void));
-static void p_rtentry __P((struct rtentry *));
-#endif
static void ntreestuff __P((void));
static void np_rtentry __P((struct rt_msghdr2 *));
static void p_sockaddr __P((struct sockaddr *, struct sockaddr *, int, int));
static void p_flags __P((int, char *));
-static u_long forgemask __P((u_long));
-static void domask __P((char *, u_long, u_long));
+static uint32_t forgemask __P((uint32_t));
+static void domask __P((char *, uint32_t, uint32_t));
/*
* Print routing tables.
*/
void
-routepr(u_long rtree)
+routepr(uint32_t rtree)
{
-#if 0
- struct radix_node_head *rnh, head;
- int i;
-#endif
-
printf("Routing tables\n");
- if (dflag == 0)
+ if (dflag == 0) {
ntreestuff();
- else {
+ } else {
if (rtree == 0) {
printf("rt_tables: symbol not in namelist\n");
return;
}
-#if 0
- kget(rtree, rt_tables);
- for (i = 0; i <= AF_MAX; i++) {
- if ((rnh = rt_tables[i]) == 0)
- continue;
- kget(rnh, head);
- if (i == AF_UNSPEC) {
- if (Aflag && af == 0) {
- printf("Netmasks:\n");
- p_tree(head.rnh_treetop);
}
- } else if (af == AF_UNSPEC || af == i) {
- pr_family(i);
- do_rtent = 1;
- pr_rthdr(i);
- p_tree(head.rnh_treetop);
}
- }
-#endif
- }
-}
/*
* Print address family header before a section of the routing table.
case AF_IPX:
afname = "IPX";
break;
-#ifdef NS
- case AF_NS:
- afname = "XNS";
- break;
-#endif
-#ifndef __APPLE__
- case AF_ISO:
- afname = "ISO";
- break;
- case AF_APPLETALK:
- afname = "AppleTalk";
- break;
- case AF_CCITT:
- afname = "X.25";
- break;
- case AF_NETGRAPH:
- afname = "Netgraph";
- break;
-#endif
default:
afname = NULL;
break;
#ifndef INET6
#define WID_DST(af) 18 /* width of destination column */
#define WID_GW(af) 18 /* width of gateway column */
-#define WID_IF(af) 6 /* width of netif column */
+#define WID_IF(af) 7 /* width of netif column */
#else
#define WID_DST(af) \
((af) == AF_INET6 ? (lflag ? 39 : (nflag ? 39: 18)) : 18)
#define WID_GW(af) \
((af) == AF_INET6 ? (lflag ? 31 : (nflag ? 31 : 18)) : 18)
-#define WID_IF(af) ((af) == AF_INET6 ? 8 : 6)
+#define WID_IF(af) ((af) == AF_INET6 ? 8 : 7)
#endif /*INET6*/
/*
printf("%-8.8s ","Address");
if (af == AF_INET || lflag)
if (lflag)
- printf("%-*.*s %-*.*s %-6.6s %6.6s %8.8s %6.6s %*.*s %6s\n",
+ printf("%-*.*s %-*.*s %-10.10s %6.6s %8.8s %6.6s %*.*s %6s\n",
WID_DST(af), WID_DST(af), "Destination",
WID_GW(af), WID_GW(af), "Gateway",
"Flags", "Refs", "Use", "Mtu",
WID_IF(af), WID_IF(af), "Netif", "Expire");
else
- printf("%-*.*s %-*.*s %-6.6s %6.6s %8.8s %*.*s %6s\n",
+ printf("%-*.*s %-*.*s %-10.10s %6.6s %8.8s %*.*s %6s\n",
WID_DST(af), WID_DST(af), "Destination",
WID_GW(af), WID_GW(af), "Gateway",
"Flags", "Refs", "Use",
WID_IF(af), WID_IF(af), "Netif", "Expire");
else
- printf("%-*.*s %-*.*s %-6.6s %8.8s %6s\n",
+ printf("%-*.*s %-*.*s %-10.10s %8.8s %6s\n",
WID_DST(af), WID_DST(af), "Destination",
WID_GW(af), WID_GW(af), "Gateway",
"Flags", "Netif", "Expire");
}
-#if 0
-static struct sockaddr *
-kgetsa(struct sockaddr *dst)
-{
-
- kget(dst, pt_u.u_sa);
- if (pt_u.u_sa.sa_len > sizeof (pt_u.u_sa))
- kread((u_long)dst, (char *)pt_u.u_data, pt_u.u_sa.sa_len);
- return (&pt_u.u_sa);
-}
-
-static void
-p_tree(struct radix_node *rn)
-{
-
-again:
- kget(rn, rnode);
- if (rnode.rn_bit < 0) {
- if (Aflag)
- printf("%-8.8lx ", (u_long)rn);
- if (rnode.rn_flags & RNF_ROOT) {
- if (Aflag)
- printf("(root node)%s",
- rnode.rn_dupedkey ? " =>\n" : "\n");
- } else if (do_rtent) {
- kget(rn, rtentry);
- p_rtentry(&rtentry);
- if (Aflag)
- p_rtnode();
- } else {
- p_sockaddr(kgetsa((struct sockaddr *)rnode.rn_key),
- NULL, 0, 44);
- putchar('\n');
- }
- if ((rn = rnode.rn_dupedkey))
- goto again;
- } else {
- if (Aflag && do_rtent) {
- printf("%-8.8lx ", (u_long)rn);
- p_rtnode();
- }
- rn = rnode.rn_right;
- p_tree(rnode.rn_left);
- p_tree(rn);
- }
-}
-
-char nbuf[20];
-
-static void
-p_rtnode(void)
-{
- struct radix_mask *rm = rnode.rn_mklist;
-
- if (rnode.rn_bit < 0) {
- if (rnode.rn_mask) {
- printf("\t mask ");
- p_sockaddr(kgetsa((struct sockaddr *)rnode.rn_mask),
- NULL, 0, -1);
- } else if (rm == 0)
- return;
- } else {
- sprintf(nbuf, "(%d)", rnode.rn_bit);
- printf("%6.6s %8.8lx : %8.8lx", nbuf, (u_long)rnode.rn_left, (u_long)rnode.rn_right);
- }
- while (rm) {
- kget(rm, rmask);
- sprintf(nbuf, " %d refs, ", rmask.rm_refs);
- printf(" mk = %8.8lx {(%d),%s",
- (u_long)rm, -1 - rmask.rm_bit, rmask.rm_refs ? nbuf : " ");
- if (rmask.rm_flags & RNF_NORMAL) {
- struct radix_node rnode_aux;
- printf(" <normal>, ");
- kget(rmask.rm_leaf, rnode_aux);
- p_sockaddr(kgetsa((struct sockaddr *)rnode_aux.rn_mask),
- NULL, 0, -1);
- } else
- p_sockaddr(kgetsa((struct sockaddr *)rmask.rm_mask),
- NULL, 0, -1);
- putchar('}');
- if ((rm = rmask.rm_mklist))
- printf(" ->");
- }
- putchar('\n');
-}
-#endif
-
static void
ntreestuff(void)
{
size_t needed;
int mib[6];
char *buf, *next, *lim;
- register struct rt_msghdr2 *rtm;
+ struct rt_msghdr2 *rtm;
mib[0] = CTL_NET;
mib[1] = PF_ROUTE;
if (addrs & (1 << i)) {
rti_info[i] = sa;
sa = (struct sockaddr *)(ROUNDUP(sa->sa_len) + (char *)sa);
- }
- else
+ } else {
rti_info[i] = NULL;
}
}
+}
static void
np_rtentry(struct rt_msghdr2 *rtm)
/*
* Don't print protocol-cloned routes unless -a.
*/
- if ((rtm->rtm_flags & RTF_WASCLONED) && (rtm->rtm_parentflags & RTF_PRCLONING) && !aflag) {
+ if ((rtm->rtm_flags & RTF_WASCLONED) &&
+ (rtm->rtm_parentflags & RTF_PRCLONING) &&
+ !aflag) {
return;
}
p_sockaddr(rti_info[RTAX_GATEWAY], NULL, RTF_HOST,
WID_GW(addr.u_sa.sa_family));
- p_flags(rtm->rtm_flags, "%-6.6s ");
+ p_flags(rtm->rtm_flags, "%-10.10s ");
if (addr.u_sa.sa_family == AF_INET || lflag) {
- printf("%6u %8d ", rtm->rtm_refcnt, rtm->rtm_use);
+ printf("%6u %8u ", rtm->rtm_refcnt, (unsigned int)rtm->rtm_use);
if (lflag) {
if (rtm->rtm_rmx.rmx_mtu != 0)
printf("%6u ", rtm->rtm_rmx.rmx_mtu);
p_sockaddr(struct sockaddr *sa, struct sockaddr *mask, int flags, int width)
{
char workbuf[128], *cplim;
- register char *cp = workbuf;
+ char *cp = workbuf;
switch(sa->sa_family) {
- case AF_INET:
- {
- register struct sockaddr_in *sin = (struct sockaddr_in *)sa;
+ case AF_INET: {
+ struct sockaddr_in *sin = (struct sockaddr_in *)sa;
if ((sin->sin_addr.s_addr == INADDR_ANY) &&
mask &&
- (ntohl(((struct sockaddr_in *)mask)->sin_addr.s_addr) == 0L ||
- mask->sa_len == 0))
+ (ntohl(((struct sockaddr_in *)mask)->sin_addr.s_addr) == 0L || mask->sa_len == 0))
cp = "default" ;
else if (flags & RTF_HOST)
cp = routename(sin->sin_addr.s_addr);
else if (mask)
cp = netname(sin->sin_addr.s_addr,
- ntohl(((struct sockaddr_in *)mask)
- ->sin_addr.s_addr));
+ ntohl(((struct sockaddr_in *)mask)->
+ sin_addr.s_addr));
else
cp = netname(sin->sin_addr.s_addr, 0L);
break;
}
#ifdef INET6
- case AF_INET6:
- {
+ case AF_INET6: {
struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *)sa;
struct in6_addr *in6 = &sa6->sin6_addr;
cp = routename6(sa6);
else if (mask)
cp = netname6(sa6, mask);
- else {
+ else
cp = netname6(sa6, NULL);
- }
break;
}
#endif /*INET6*/
-#ifndef __APPLE__
- case AF_IPX:
- {
- struct ipx_addr work = ((struct sockaddr_ipx *)sa)->sipx_addr;
- if (ipx_nullnet(satoipx_addr(work)))
- cp = "default";
- else
- cp = ipx_print(sa);
- break;
- }
- case AF_APPLETALK:
- {
- if (!(flags & RTF_HOST) && mask)
- cp = atalk_print2(sa,mask,9);
- else
- cp = atalk_print(sa,11);
- break;
- }
- case AF_NETGRAPH:
- {
- printf("%s", ((struct sockaddr_ng *)sa)->sg_data);
- break;
- }
-#endif
-#ifdef NS
- case AF_NS:
- cp = ns_print(sa);
- break;
-#endif
- case AF_LINK:
- {
- register struct sockaddr_dl *sdl = (struct sockaddr_dl *)sa;
+ case AF_LINK: {
+ struct sockaddr_dl *sdl = (struct sockaddr_dl *)sa;
if (sdl->sdl_nlen == 0 && sdl->sdl_alen == 0 &&
- sdl->sdl_slen == 0)
+ sdl->sdl_slen == 0) {
(void) sprintf(workbuf, "link#%d", sdl->sdl_index);
- else
+ } else {
switch (sdl->sdl_type) {
- case IFT_ETHER:
- {
- register int i;
- register u_char *lla = (u_char *)sdl->sdl_data +
+ case IFT_ETHER: {
+ int i;
+ u_char *lla = (u_char *)sdl->sdl_data +
sdl->sdl_nlen;
cplim = "";
cp = link_ntoa(sdl);
break;
}
+ }
break;
}
- default:
- {
- register u_char *s = (u_char *)sa->sa_data, *slim;
+ default: {
+ u_char *s = (u_char *)sa->sa_data, *slim;
slim = sa->sa_len + (u_char *) sa;
cplim = cp + sizeof(workbuf) - 6;
cp = workbuf;
}
}
- if (width < 0 )
+ if (width < 0 ) {
printf("%s ", cp);
- else {
+ } else {
if (nflag)
printf("%-*s ", width, cp);
else
p_flags(int f, char *format)
{
char name[33], *flags;
- register struct bits *p = bits;
+ struct bits *p = bits;
for (flags = name; p->b_mask; p++)
if (p->b_mask & f)
printf(format, name);
}
-#if 0
-static void
-p_rtentry(struct rtentry *rt)
-{
- static struct ifnet ifnet, *lastif;
- struct rtentry parent;
- static char name[16];
- static char prettyname[9];
- struct sockaddr *sa;
- sa_u addr, mask;
-
- /*
- * Don't print protocol-cloned routes unless -a.
- */
- if (rt->rt_flags & RTF_WASCLONED && !aflag) {
- kget(rt->rt_parent, parent);
- if (parent.rt_flags & RTF_PRCLONING)
- return;
- }
-
- bzero(&addr, sizeof(addr));
- if ((sa = kgetsa(rt_key(rt))))
- bcopy(sa, &addr, sa->sa_len);
- bzero(&mask, sizeof(mask));
- if (rt_mask(rt) && (sa = kgetsa(rt_mask(rt))))
- bcopy(sa, &mask, sa->sa_len);
- p_sockaddr(&addr.u_sa, &mask.u_sa, rt->rt_flags,
- WID_DST(addr.u_sa.sa_family));
- p_sockaddr(kgetsa(rt->rt_gateway), NULL, RTF_HOST,
- WID_GW(addr.u_sa.sa_family));
- p_flags(rt->rt_flags, "%-6.6s ");
- if (addr.u_sa.sa_family == AF_INET || lflag) {
- printf("%6u %8ld ", rt->rt_refcnt, rt->rt_use);
- if (lflag) {
- if (rt->rt_rmx.rmx_mtu != 0)
- printf("%6lu ", rt->rt_rmx.rmx_mtu);
- else
- printf("%6s ", "");
- }
- }
- if (rt->rt_ifp) {
- if (rt->rt_ifp != lastif) {
- kget(rt->rt_ifp, ifnet);
- kread((u_long)ifnet.if_name, name, 16);
- lastif = rt->rt_ifp;
- snprintf(prettyname, sizeof prettyname,
- "%s%d", name, ifnet.if_unit);
- }
- printf("%*.*s", WID_IF(addr.u_sa.sa_family),
- WID_IF(addr.u_sa.sa_family), prettyname);
- if (rt->rt_rmx.rmx_expire) {
- time_t expire_time;
-
- if ((expire_time =
- rt->rt_rmx.rmx_expire - time((time_t *)0)) > 0)
- printf(" %6d", (int)expire_time);
- }
- if (rt->rt_nodes[0].rn_dupedkey)
- printf(" =>");
- }
- putchar('\n');
-}
-#endif
-
char *
-routename(u_long in)
+routename(uint32_t in)
{
- register char *cp;
+ char *cp;
static char line[MAXHOSTNAMELEN];
struct hostent *hp;
} else {
#define C(x) ((x) & 0xff)
in = ntohl(in);
- sprintf(line, "%lu.%lu.%lu.%lu",
+ sprintf(line, "%u.%u.%u.%u",
C(in >> 24), C(in >> 16), C(in >> 8), C(in));
}
return (line);
}
-static u_long
-forgemask(u_long a)
+static uint32_t
+forgemask(uint32_t a)
{
- u_long m;
+ uint32_t m;
if (IN_CLASSA(a))
m = IN_CLASSA_NET;
}
static void
-domask(char *dst, u_long addr, u_long mask)
+domask(char *dst, uint32_t addr, uint32_t mask)
{
- register int b, i;
+ int b, i;
if (!mask || (forgemask(addr) == mask)) {
*dst = '\0';
i = 0;
for (b = 0; b < 32; b++)
if (mask & (1 << b)) {
- register int bb;
+ int bb;
i = b;
for (bb = b+1; bb < 32; bb++)
break;
}
if (i == -1)
- sprintf(dst, "&0x%lx", mask);
+ sprintf(dst, "&0x%x", mask);
else
sprintf(dst, "/%d", 32-i);
}
* The address is assumed to be that of a net or subnet, not a host.
*/
char *
-netname(u_long in, u_long mask)
+netname(uint32_t in, uint32_t mask)
{
char *cp = 0;
static char line[MAXHOSTNAMELEN];
struct netent *np = 0;
- u_long net, omask, dmask;
- register u_long i;
+ uint32_t net, omask, dmask;
+ uint32_t i;
i = ntohl(in);
dmask = forgemask(i);
switch (dmask) {
case IN_CLASSA_NET:
if ((i & IN_CLASSA_HOST) == 0) {
- sprintf(line, "%lu", C(i >> 24));
+ sprintf(line, "%u", C(i >> 24));
break;
}
/* FALLTHROUGH */
case IN_CLASSB_NET:
if ((i & IN_CLASSB_HOST) == 0) {
- sprintf(line, "%lu.%lu",
+ sprintf(line, "%u.%u",
C(i >> 24), C(i >> 16));
break;
}
/* FALLTHROUGH */
case IN_CLASSC_NET:
if ((i & IN_CLASSC_HOST) == 0) {
- sprintf(line, "%lu.%lu.%lu",
+ sprintf(line, "%u.%u.%u",
C(i >> 24), C(i >> 16), C(i >> 8));
break;
}
/* FALLTHROUGH */
default:
- sprintf(line, "%lu.%lu.%lu.%lu",
+ sprintf(line, "%u.%u.%u.%u",
C(i >> 24), C(i >> 16), C(i >> 8), C(i));
break;
}
}
if (illegal)
fprintf(stderr, "illegal prefixlen\n");
- }
- else
+ } else {
masklen = 128;
-
+ }
if (masklen == 0 && IN6_IS_ADDR_UNSPECIFIED(&sa6->sin6_addr))
return("default");
printf("\t%u route%s not in table but not freed\n",
rttrash, plural(rttrash));
}
-#ifndef __APPLE__
-char *
-ipx_print(struct sockaddr *sa)
-{
- u_short port;
- struct servent *sp = 0;
- char *net = "", *host = "";
- register char *p;
- register u_char *q;
- struct ipx_addr work = ((struct sockaddr_ipx *)sa)->sipx_addr;
- static char mybuf[50];
- char cport[10], chost[15], cnet[15];
-
- port = ntohs(work.x_port);
-
- if (ipx_nullnet(work) && ipx_nullhost(work)) {
-
- if (port) {
- if (sp)
- sprintf(mybuf, "*.%s", sp->s_name);
- else
- sprintf(mybuf, "*.%x", port);
- } else
- sprintf(mybuf, "*.*");
-
- return (mybuf);
- }
-
- if (ipx_wildnet(work))
- net = "any";
- else if (ipx_nullnet(work))
- net = "*";
- else {
- q = work.x_net.c_net;
- sprintf(cnet, "%02x%02x%02x%02x",
- q[0], q[1], q[2], q[3]);
- for (p = cnet; *p == '0' && p < cnet + 8; p++)
- continue;
- net = p;
- }
-
- if (ipx_wildhost(work))
- host = "any";
- else if (ipx_nullhost(work))
- host = "*";
- else {
- q = work.x_host.c_host;
- sprintf(chost, "%02x%02x%02x%02x%02x%02x",
- q[0], q[1], q[2], q[3], q[4], q[5]);
- for (p = chost; *p == '0' && p < chost + 12; p++)
- continue;
- host = p;
- }
-
- if (port) {
- if (strcmp(host, "*") == 0)
- host = "";
- if (sp)
- snprintf(cport, sizeof(cport),
- "%s%s", *host ? "." : "", sp->s_name);
- else
- snprintf(cport, sizeof(cport),
- "%s%x", *host ? "." : "", port);
- } else
- *cport = 0;
-
- snprintf(mybuf, sizeof(mybuf), "%s.%s%s", net, host, cport);
- return(mybuf);
-}
-
-char *
-ipx_phost(struct sockaddr *sa)
-{
- register struct sockaddr_ipx *sipx = (struct sockaddr_ipx *)sa;
- struct sockaddr_ipx work;
- static union ipx_net ipx_zeronet;
- char *p;
- struct ipx_addr in;
-
- work = *sipx;
- in = work.sipx_addr;
-
- work.sipx_addr.x_port = 0;
- work.sipx_addr.x_net = ipx_zeronet;
- p = ipx_print((struct sockaddr *)&work);
- if (strncmp("*.", p, 2) == 0) p += 2;
-
- return(p);
-}
-#endif
-#ifdef NS
-short ns_nullh[] = {0,0,0};
-short ns_bh[] = {-1,-1,-1};
-
-char *
-ns_print(struct sockaddr *sa)
-{
- register struct sockaddr_ns *sns = (struct sockaddr_ns*)sa;
- struct ns_addr work;
- union { union ns_net net_e; u_long long_e; } net;
- u_short port;
- static char mybuf[50], cport[10], chost[25];
- char *host = "";
- register char *p; register u_char *q;
-
- work = sns->sns_addr;
- port = ntohs(work.x_port);
- work.x_port = 0;
- net.net_e = work.x_net;
- if (ns_nullhost(work) && net.long_e == 0) {
- if (port ) {
- sprintf(mybuf, "*.%xH", port);
- upHex(mybuf);
- } else
- sprintf(mybuf, "*.*");
- return (mybuf);
- }
-
- if (bcmp(ns_bh, work.x_host.c_host, 6) == 0) {
- host = "any";
- } else if (bcmp(ns_nullh, work.x_host.c_host, 6) == 0) {
- host = "*";
- } else {
- q = work.x_host.c_host;
- sprintf(chost, "%02x%02x%02x%02x%02x%02xH",
- q[0], q[1], q[2], q[3], q[4], q[5]);
- for (p = chost; *p == '0' && p < chost + 12; p++)
- continue;
- host = p;
- }
- if (port)
- sprintf(cport, ".%xH", htons(port));
- else
- *cport = 0;
-
- sprintf(mybuf,"%xH.%s%s", ntohl(net.long_e), host, cport);
- upHex(mybuf);
- return(mybuf);
-}
-
-char *
-ns_phost(struct sockaddr *sa)
-{
- register struct sockaddr_ns *sns = (struct sockaddr_ns *)sa;
- struct sockaddr_ns work;
- static union ns_net ns_zeronet;
- char *p;
-
- work = *sns;
- work.sns_addr.x_port = 0;
- work.sns_addr.x_net = ns_zeronet;
-
- p = ns_print((struct sockaddr *)&work);
- if (strncmp("0H.", p, 3) == 0)
- p += 3;
- return(p);
-}
-#endif
void
upHex(char *p0)
{
- register char *p = p0;
+ char *p = p0;
for (; *p; p++)
switch (*p) {
/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2008 Apple Inc. All rights reserved.
*
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
*
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
- * @APPLE_LICENSE_HEADER_END@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*-
* Copyright (c) 1983, 1988, 1993
*/
#ifndef lint
-#if 0
-static char sccsid[] = "@(#)unix.c 8.1 (Berkeley) 6/6/93";
-#endif
static const char rcsid[] =
"$Id: unix.c,v 1.4 2006/02/07 06:22:20 lindak Exp $";
#endif /* not lint */
#include <stdlib.h>
#include "netstat.h"
+#if !TARGET_OS_EMBEDDED
+static void unixdomainpr __P((struct xunpcb64 *, struct xsocket64 *));
+#else
static void unixdomainpr __P((struct xunpcb *, struct xsocket *));
+#endif
static const char *const socktype[] =
{ "#0", "stream", "dgram", "raw", "rdm", "seqpacket" };
char *buf;
int type;
size_t len;
- struct xsocket *so;
struct xunpgen *xug, *oxug;
+#if !TARGET_OS_EMBEDDED
+ struct xsocket64 *so;
+ struct xunpcb64 *xunp;
+ char mibvar[sizeof "net.local.seqpacket.pcblist64"];
+#else
+ struct xsocket *so;
struct xunpcb *xunp;
char mibvar[sizeof "net.local.seqpacket.pcblist"];
+#endif
for (type = SOCK_STREAM; type <= SOCK_SEQPACKET; type++) {
+#if !TARGET_OS_EMBEDDED
+ sprintf(mibvar, "net.local.%s.pcblist64", socktype[type]);
+#else
sprintf(mibvar, "net.local.%s.pcblist", socktype[type]);
-
+#endif
len = 0;
if (sysctlbyname(mibvar, 0, &len, 0, 0) < 0) {
if (errno != ENOENT)
for (xug = (struct xunpgen *)((char *)xug + xug->xug_len);
xug->xug_len > sizeof(struct xunpgen);
xug = (struct xunpgen *)((char *)xug + xug->xug_len)) {
+#if !TARGET_OS_EMBEDDED
+ xunp = (struct xunpcb64 *)xug;
+#else
xunp = (struct xunpcb *)xug;
+#endif
so = &xunp->xu_socket;
/* Ignore PCBs which were freed during copyout. */
+#if !TARGET_OS_EMBEDDED
+ if (xunp->xunp_gencnt > oxug->xug_gen)
+#else
if (xunp->xu_unp.unp_gencnt > oxug->xug_gen)
+#endif
continue;
unixdomainpr(xunp, so);
}
static void
unixdomainpr(xunp, so)
+#if !TARGET_OS_EMBEDDED
+ struct xunpcb64 *xunp;
+ struct xsocket64 *so;
+#else
struct xunpcb *xunp;
struct xsocket *so;
+#endif
{
+#if TARGET_OS_EMBEDDED
struct unpcb *unp;
+#endif
struct sockaddr_un *sa;
static int first = 1;
+#if !TARGET_OS_EMBEDDED
+ sa = &xunp->xu_addr;
+#else
unp = &xunp->xu_unp;
if (unp->unp_addr)
sa = &xunp->xu_addr;
else
sa = (struct sockaddr_un *)0;
+#endif
if (first) {
printf("Active LOCAL (UNIX) domain sockets\n");
printf(
+#if !TARGET_OS_EMBEDDED
+"%-16.16s %-6.6s %-6.6s %-6.6s %16.16s %16.16s %16.16s %16.16s Addr\n",
+#else
"%-8.8s %-6.6s %-6.6s %-6.6s %8.8s %8.8s %8.8s %8.8s Addr\n",
+#endif
"Address", "Type", "Recv-Q", "Send-Q",
"Inode", "Conn", "Refs", "Nextref");
first = 0;
}
+#if !TARGET_OS_EMBEDDED
+ printf("%16lx %-6.6s %6u %6u %16lx %16lx %16lx %16lx",
+ (long)xunp->xu_unpp, socktype[so->so_type], so->so_rcv.sb_cc,
+ so->so_snd.sb_cc,
+ (long)xunp->xunp_vnode, (long)xunp->xunp_conn,
+ (long)xunp->xunp_refs, (long)xunp->xunp_reflink.le_next);
+#else
printf("%8lx %-6.6s %6u %6u %8lx %8lx %8lx %8lx",
(long)so->so_pcb, socktype[so->so_type], so->so_rcv.sb_cc,
so->so_snd.sb_cc,
(long)unp->unp_vnode, (long)unp->unp_conn,
(long)unp->unp_refs.lh_first, (long)unp->unp_reflink.le_next);
+#endif
+
+#if !TARGET_OS_EMBEDDED
+ if (sa->sun_len)
+#else
if (sa)
+#endif
printf(" %.*s",
(int)(sa->sun_len - offsetof(struct sockaddr_un, sun_path)),
sa->sun_path);
--- /dev/null
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 45;
+ objects = {
+
+/* Begin PBXAggregateTarget section */
+ 72570DA20EE8EBF3000F4CFB /* All-Embedded */ = {
+ isa = PBXAggregateTarget;
+ buildConfigurationList = 72570DA60EE8EC0F000F4CFB /* Build configuration list for PBXAggregateTarget "All-Embedded" */;
+ buildPhases = (
+ );
+ dependencies = (
+ 72570DB60EE8EC46000F4CFB /* PBXTargetDependency */,
+ 72570E130EE8F517000F4CFB /* PBXTargetDependency */,
+ 72570E110EE8F517000F4CFB /* PBXTargetDependency */,
+ 7251B2080EE9D36800F29440 /* PBXTargetDependency */,
+ 72570E0F0EE8F517000F4CFB /* PBXTargetDependency */,
+ 72570E0D0EE8F517000F4CFB /* PBXTargetDependency */,
+ );
+ name = "All-Embedded";
+ productName = "All-Embedded";
+ };
+ 726121430EE8717500AFED1B /* All */ = {
+ isa = PBXAggregateTarget;
+ buildConfigurationList = 7261214B0EE8717D00AFED1B /* Build configuration list for PBXAggregateTarget "All" */;
+ buildPhases = (
+ );
+ dependencies = (
+ 726121470EE8717B00AFED1B /* PBXTargetDependency */,
+ 726121490EE8717B00AFED1B /* PBXTargetDependency */,
+ 7261217D0EE8896800AFED1B /* PBXTargetDependency */,
+ 726121B30EE88B7900AFED1B /* PBXTargetDependency */,
+ 724DAB790EE88EA6008900D0 /* PBXTargetDependency */,
+ 724DAB9A0EE88F5D008900D0 /* PBXTargetDependency */,
+ 724DABC30EE890A6008900D0 /* PBXTargetDependency */,
+ 724DABEC0EE891DF008900D0 /* PBXTargetDependency */,
+ 724DAC240EE89525008900D0 /* PBXTargetDependency */,
+ 7216D2670EE8978F00AE70E4 /* PBXTargetDependency */,
+ 7216D2C00EE89ADF00AE70E4 /* PBXTargetDependency */,
+ 7216D2C20EE89ADF00AE70E4 /* PBXTargetDependency */,
+ 7216D2DA0EE89BE900AE70E4 /* PBXTargetDependency */,
+ 7216D3060EE89D9A00AE70E4 /* PBXTargetDependency */,
+ 7216D34D0EE89FEC00AE70E4 /* PBXTargetDependency */,
+ 7216D37F0EE8A0B300AE70E4 /* PBXTargetDependency */,
+ 7294F0EA0EE8BAC80052EC88 /* PBXTargetDependency */,
+ 7294F1210EE8BCC20052EC88 /* PBXTargetDependency */,
+ 72CD1D9C0EE8C47C005F825D /* PBXTargetDependency */,
+ );
+ name = All;
+ productName = "network_cmds (Aggregate)";
+ };
+/* End PBXAggregateTarget section */
+
+/* Begin PBXBuildFile section */
+ 7216D24C0EE896F300AE70E4 /* data.c in Sources */ = {isa = PBXBuildFile; fileRef = 7261208B0EE86F4800AFED1B /* data.c */; };
+ 7216D24D0EE896F300AE70E4 /* if.c in Sources */ = {isa = PBXBuildFile; fileRef = 7261208D0EE86F4800AFED1B /* if.c */; };
+ 7216D24E0EE896F300AE70E4 /* inet.c in Sources */ = {isa = PBXBuildFile; fileRef = 7261208E0EE86F4800AFED1B /* inet.c */; };
+ 7216D24F0EE896F300AE70E4 /* inet6.c in Sources */ = {isa = PBXBuildFile; fileRef = 7261208F0EE86F4800AFED1B /* inet6.c */; };
+ 7216D2500EE896F300AE70E4 /* ipsec.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120900EE86F4800AFED1B /* ipsec.c */; };
+ 7216D2510EE896F300AE70E4 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120910EE86F4800AFED1B /* main.c */; };
+ 7216D2520EE896F300AE70E4 /* mbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120930EE86F4800AFED1B /* mbuf.c */; };
+ 7216D2530EE896F300AE70E4 /* mcast.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120940EE86F4800AFED1B /* mcast.c */; };
+ 7216D2540EE896F300AE70E4 /* mroute.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120950EE86F4800AFED1B /* mroute.c */; };
+ 7216D2550EE896F300AE70E4 /* mroute6.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120960EE86F4800AFED1B /* mroute6.c */; };
+ 7216D2560EE896F300AE70E4 /* route.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120990EE86F4800AFED1B /* route.c */; };
+ 7216D2570EE896F300AE70E4 /* tp_astring.c in Sources */ = {isa = PBXBuildFile; fileRef = 7261209A0EE86F4800AFED1B /* tp_astring.c */; };
+ 7216D2580EE896F300AE70E4 /* unix.c in Sources */ = {isa = PBXBuildFile; fileRef = 7261209B0EE86F4800AFED1B /* unix.c */; };
+ 7216D2600EE8971500AE70E4 /* netstat.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 726120970EE86F4800AFED1B /* netstat.1 */; };
+ 7216D2800EE8981C00AE70E4 /* ping.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120A10EE86F5000AFED1B /* ping.c */; };
+ 7216D2880EE8982F00AE70E4 /* ping.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 726120A00EE86F5000AFED1B /* ping.8 */; };
+ 7216D2A00EE898DF00AE70E4 /* md5.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120A60EE86F5C00AFED1B /* md5.c */; };
+ 7216D2A10EE898DF00AE70E4 /* ping6.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120A90EE86F5C00AFED1B /* ping6.c */; };
+ 7216D2A90EE898F300AE70E4 /* ping6.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 726120A80EE86F5C00AFED1B /* ping6.8 */; };
+ 7216D2D10EE89B8300AE70E4 /* rarpd.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120AF0EE86F6700AFED1B /* rarpd.c */; };
+ 7216D2E40EE89C8B00AE70E4 /* rarpd.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 726120AE0EE86F6700AFED1B /* rarpd.8 */; };
+ 7216D2F20EE89CD600AE70E4 /* route.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120B80EE86F7200AFED1B /* route.c */; };
+ 7216D3040EE89D4900AE70E4 /* route.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 726120B70EE86F7200AFED1B /* route.8 */; };
+ 7216D3190EE89EC100AE70E4 /* advcap.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120BC0EE86F8200AFED1B /* advcap.c */; };
+ 7216D31A0EE89EC100AE70E4 /* config.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120BE0EE86F8200AFED1B /* config.c */; };
+ 7216D31B0EE89EC100AE70E4 /* dump.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120C00EE86F8200AFED1B /* dump.c */; };
+ 7216D31C0EE89EC100AE70E4 /* if.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120C20EE86F8200AFED1B /* if.c */; };
+ 7216D31D0EE89EC100AE70E4 /* rrenum.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120C60EE86F8200AFED1B /* rrenum.c */; };
+ 7216D31E0EE89EC100AE70E4 /* rtadvd.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120C90EE86F8200AFED1B /* rtadvd.c */; };
+ 7216D31F0EE89EC100AE70E4 /* timer.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120CD0EE86F8200AFED1B /* timer.c */; };
+ 7216D3240EE89F4200AE70E4 /* rtadvd.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 726120C80EE86F8200AFED1B /* rtadvd.8 */; };
+ 7216D3390EE89F8400AE70E4 /* rtadvd.conf.5 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 726120CB0EE86F8200AFED1B /* rtadvd.conf.5 */; };
+ 7216D3410EE89FAF00AE70E4 /* rtadvd.conf in CopyFiles */ = {isa = PBXBuildFile; fileRef = 726120CA0EE86F8200AFED1B /* rtadvd.conf */; };
+ 7216D3670EE8A04700AE70E4 /* dump.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120D20EE86F9100AFED1B /* dump.c */; };
+ 7216D3680EE8A04700AE70E4 /* if.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120D30EE86F9100AFED1B /* if.c */; };
+ 7216D3690EE8A04700AE70E4 /* probe.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120D50EE86F9100AFED1B /* probe.c */; };
+ 7216D36A0EE8A04700AE70E4 /* rtsock.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120D60EE86F9100AFED1B /* rtsock.c */; };
+ 7216D36B0EE8A04700AE70E4 /* rtsol.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120D80EE86F9100AFED1B /* rtsol.c */; };
+ 7216D36C0EE8A04700AE70E4 /* rtsold.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120D90EE86F9100AFED1B /* rtsold.c */; };
+ 7216D3700EE8A05B00AE70E4 /* rtsol.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 726120D70EE86F9100AFED1B /* rtsol.8 */; };
+ 7216D3AB0EE8A3C400AE70E4 /* spray.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120E00EE86F9D00AFED1B /* spray.c */; };
+ 7216D3AF0EE8A3D800AE70E4 /* spray.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 726120DF0EE86F9D00AFED1B /* spray.8 */; };
+ 724DAB640EE88E63008900D0 /* ipfw2.c in Sources */ = {isa = PBXBuildFile; fileRef = 726121000EE8701100AFED1B /* ipfw2.c */; };
+ 724DAB680EE88E78008900D0 /* ipfw.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 726120FF0EE8701100AFED1B /* ipfw.8 */; };
+ 724DAB860EE88F0D008900D0 /* ip6fw.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120690EE86F2300AFED1B /* ip6fw.c */; };
+ 724DAB8A0EE88F24008900D0 /* ip6fw.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 726120680EE86F2300AFED1B /* ip6fw.8 */; };
+ 724DABA60EE88FED008900D0 /* kdumpd.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120710EE86F2D00AFED1B /* kdumpd.c */; };
+ 724DABA70EE88FED008900D0 /* kdumpsubs.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120720EE86F2D00AFED1B /* kdumpsubs.c */; };
+ 724DABAB0EE89006008900D0 /* kdumpd.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 726120700EE86F2D00AFED1B /* kdumpd.8 */; };
+ 724DABBC0EE8908A008900D0 /* com.apple.kdumpd.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7261206E0EE86F2D00AFED1B /* com.apple.kdumpd.plist */; };
+ 724DABDF0EE89151008900D0 /* natd.c in Sources */ = {isa = PBXBuildFile; fileRef = 7261207C0EE86F3600AFED1B /* natd.c */; };
+ 724DABE00EE89155008900D0 /* icmp.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120790EE86F3600AFED1B /* icmp.c */; };
+ 724DABE40EE8916B008900D0 /* natd.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7261207B0EE86F3600AFED1B /* natd.8 */; };
+ 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 */; };
+ 726121150EE870AB00AFED1B /* alias_ftp.c in Sources */ = {isa = PBXBuildFile; fileRef = 7261203D0EE86EEB00AFED1B /* alias_ftp.c */; };
+ 726121160EE870AB00AFED1B /* alias_irc.c in Sources */ = {isa = PBXBuildFile; fileRef = 7261203E0EE86EEB00AFED1B /* alias_irc.c */; };
+ 726121180EE870AB00AFED1B /* alias_nbt.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120400EE86EEB00AFED1B /* alias_nbt.c */; };
+ 726121190EE870AB00AFED1B /* alias_pptp.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120410EE86EEB00AFED1B /* alias_pptp.c */; };
+ 7261211A0EE870AB00AFED1B /* alias_proxy.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120420EE86EEB00AFED1B /* alias_proxy.c */; };
+ 7261211B0EE870AB00AFED1B /* alias_smedia.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120430EE86EEB00AFED1B /* alias_smedia.c */; };
+ 7261211C0EE870AB00AFED1B /* alias_util.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120440EE86EEB00AFED1B /* alias_util.c */; };
+ 726121310EE8711E00AFED1B /* arp.c in Sources */ = {isa = PBXBuildFile; fileRef = 7261204E0EE86EF900AFED1B /* arp.c */; };
+ 726121350EE8713800AFED1B /* arp.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7261204D0EE86EF900AFED1B /* arp.8 */; };
+ 7261215A0EE8883900AFED1B /* ifbond.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120550EE86F0900AFED1B /* ifbond.c */; };
+ 7261215B0EE8883900AFED1B /* ifconfig.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120570EE86F0900AFED1B /* ifconfig.c */; };
+ 7261215C0EE8883900AFED1B /* ifmedia.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120590EE86F0900AFED1B /* ifmedia.c */; };
+ 7261215D0EE8883900AFED1B /* ifvlan.c in Sources */ = {isa = PBXBuildFile; fileRef = 7261205A0EE86F0900AFED1B /* ifvlan.c */; };
+ 726121610EE8885400AFED1B /* ifconfig.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 726120560EE86F0900AFED1B /* ifconfig.8 */; };
+ 726121890EE889C100AFED1B /* ip6tool.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120630EE86F1A00AFED1B /* ip6tool.c */; };
+ 7261219A0EE88AB500AFED1B /* ip6.8 in Copy Files man */ = {isa = PBXBuildFile; fileRef = 726120600EE86F1A00AFED1B /* ip6.8 */; };
+ 7261219B0EE88AB500AFED1B /* ip6config.8 in Copy Files man */ = {isa = PBXBuildFile; fileRef = 726120620EE86F1A00AFED1B /* ip6config.8 */; };
+ 7261219F0EE88ADD00AFED1B /* 6to4.conf in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7261205F0EE86F1A00AFED1B /* 6to4.conf */; };
+ 726121AA0EE88B2700AFED1B /* ip6config in CopyFiles */ = {isa = PBXBuildFile; fileRef = 726120610EE86F1A00AFED1B /* ip6config */; };
+ 7263A9630EEE31C800164D5D /* libipsec.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 72CD1DB50EE8C619005F825D /* libipsec.dylib */; };
+ 7294F0DF0EE8BA730052EC88 /* spray.x in Sources */ = {isa = PBXBuildFile; fileRef = 726120E10EE86F9D00AFED1B /* spray.x */; };
+ 7294F1000EE8BB990052EC88 /* as.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120E50EE86FA700AFED1B /* as.c */; };
+ 7294F1010EE8BB990052EC88 /* findsaddr-socket.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120E70EE86FA700AFED1B /* findsaddr-socket.c */; };
+ 7294F1020EE8BB990052EC88 /* ifaddrlist.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120EA0EE86FA700AFED1B /* ifaddrlist.c */; };
+ 7294F1030EE8BB990052EC88 /* traceroute.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120F10EE86FA700AFED1B /* traceroute.c */; };
+ 7294F1040EE8BB990052EC88 /* version.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120F30EE86FA700AFED1B /* version.c */; };
+ 7294F1080EE8BBB10052EC88 /* traceroute.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 726120F00EE86FA700AFED1B /* traceroute.8 */; };
+ 7294F12E0EE8BD2F0052EC88 /* traceroute6.c in Sources */ = {isa = PBXBuildFile; fileRef = 726120FB0EE86FB500AFED1B /* traceroute6.c */; };
+ 7294F1320EE8BD430052EC88 /* traceroute6.8 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 726120FA0EE86FB500AFED1B /* traceroute6.8 */; };
+ 72B894EC0EEDB17C00C218D6 /* libipsec.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 72CD1DB50EE8C619005F825D /* libipsec.dylib */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXBuildRule section */
+ 7216D47D0EE8B84900AE70E4 /* PBXBuildRule */ = {
+ isa = PBXBuildRule;
+ compilerSpec = com.apple.compilers.proxy.script;
+ filePatterns = "$(PROJECT_DIR)/spray.tproj/spray.x";
+ fileType = pattern.proxy;
+ isEditable = 1;
+ outputFiles = (
+ "$(DERIVED_FILES_DIR)/$(INPUT_FILE_BASE).h",
+ "$(DERIVED_FILES_DIR)/$(INPUT_FILE_BASE)_xdr.c",
+ );
+ script = "/usr/bin/rpcgen -h -o ${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}.h ${INPUT_FILE_PATH}\n/usr/bin/rpcgen -c -o ${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}_xdr.c ${INPUT_FILE_PATH}";
+ };
+/* End PBXBuildRule section */
+
+/* Begin PBXContainerItemProxy section */
+ 7216D2660EE8978F00AE70E4 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 724862310EE86EB7001D0DE9 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 7216D2450EE896C000AE70E4;
+ remoteInfo = netstat;
+ };
+ 7216D2BF0EE89ADF00AE70E4 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 724862310EE86EB7001D0DE9 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 7216D27B0EE8980A00AE70E4;
+ remoteInfo = ping;
+ };
+ 7216D2C10EE89ADF00AE70E4 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 724862310EE86EB7001D0DE9 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 7216D2990EE898BD00AE70E4;
+ remoteInfo = ping6;
+ };
+ 7216D2D90EE89BE900AE70E4 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 724862310EE86EB7001D0DE9 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 7216D2CC0EE89B7900AE70E4;
+ remoteInfo = rarpd;
+ };
+ 7216D3050EE89D9A00AE70E4 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 724862310EE86EB7001D0DE9 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 7216D2EC0EE89CBC00AE70E4;
+ remoteInfo = route;
+ };
+ 7216D34C0EE89FEC00AE70E4 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 724862310EE86EB7001D0DE9 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 7216D3130EE89E9E00AE70E4;
+ remoteInfo = rtadvd;
+ };
+ 7216D37E0EE8A0B300AE70E4 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 724862310EE86EB7001D0DE9 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 7216D3580EE8A02200AE70E4;
+ remoteInfo = rtsol;
+ };
+ 724DAB780EE88EA6008900D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 724862310EE86EB7001D0DE9 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 724DAB5E0EE88E2A008900D0;
+ remoteInfo = ipfw;
+ };
+ 724DAB990EE88F5D008900D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 724862310EE86EB7001D0DE9 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 724DAB810EE88EFA008900D0;
+ remoteInfo = ip6fw;
+ };
+ 724DABC20EE890A6008900D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 724862310EE86EB7001D0DE9 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 724DABA10EE88FE3008900D0;
+ remoteInfo = kdumpd;
+ };
+ 724DABEB0EE891DF008900D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 724862310EE86EB7001D0DE9 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 724DABDA0EE8912D008900D0;
+ remoteInfo = natd;
+ };
+ 724DAC230EE89525008900D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 724862310EE86EB7001D0DE9 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 724DAC0C0EE8940D008900D0;
+ remoteInfo = ndp;
+ };
+ 7251B2070EE9D36800F29440 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 724862310EE86EB7001D0DE9 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 7251B1F60EE9D2AB00F29440;
+ remoteInfo = "ping embedded";
+ };
+ 72570DB50EE8EC46000F4CFB /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 724862310EE86EB7001D0DE9 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 72570DA90EE8EC2E000F4CFB;
+ remoteInfo = "arp-embedded";
+ };
+ 72570E0C0EE8F517000F4CFB /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 724862310EE86EB7001D0DE9 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 72570DFC0EE8F4EA000F4CFB;
+ remoteInfo = "traceroute embedded";
+ };
+ 72570E0E0EE8F517000F4CFB /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 724862310EE86EB7001D0DE9 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 72570DEE0EE8F4DE000F4CFB;
+ remoteInfo = "route embedded";
+ };
+ 72570E100EE8F517000F4CFB /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 724862310EE86EB7001D0DE9 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 72570DD20EE8F4C4000F4CFB;
+ remoteInfo = "netstat embedded";
+ };
+ 72570E120EE8F517000F4CFB /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 724862310EE86EB7001D0DE9 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 72570DBE0EE8F49A000F4CFB;
+ remoteInfo = "ifconfig embedded";
+ };
+ 726121460EE8717B00AFED1B /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 724862310EE86EB7001D0DE9 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 7261210B0EE8707500AFED1B;
+ remoteInfo = alias;
+ };
+ 726121480EE8717B00AFED1B /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 724862310EE86EB7001D0DE9 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 7261212C0EE8710B00AFED1B;
+ remoteInfo = arp;
+ };
+ 7261217C0EE8896800AFED1B /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 724862310EE86EB7001D0DE9 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 726121530EE8881700AFED1B;
+ remoteInfo = ifconfig;
+ };
+ 726121B20EE88B7900AFED1B /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 724862310EE86EB7001D0DE9 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 726121820EE8897C00AFED1B;
+ remoteInfo = ip6conf;
+ };
+ 7294F0E90EE8BAC80052EC88 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 724862310EE86EB7001D0DE9 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 7216D3A60EE8A3BA00AE70E4;
+ remoteInfo = spray;
+ };
+ 7294F1200EE8BCC20052EC88 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 724862310EE86EB7001D0DE9 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 7294F0F80EE8BB460052EC88;
+ remoteInfo = traceroute;
+ };
+ 72CD1D9B0EE8C47C005F825D /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 724862310EE86EB7001D0DE9 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 7294F1290EE8BD280052EC88;
+ remoteInfo = traceroute6;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ 7216D2750EE8979500AE70E4 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 8;
+ dstPath = /usr/share/man/man1;
+ dstSubfolderSpec = 0;
+ files = (
+ 7216D2600EE8971500AE70E4 /* netstat.1 in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+ 7216D2930EE8988200AE70E4 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 8;
+ dstPath = /usr/share/man/man8;
+ dstSubfolderSpec = 0;
+ files = (
+ 7216D2880EE8982F00AE70E4 /* ping.8 in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+ 7216D2AA0EE8991200AE70E4 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 8;
+ dstPath = /usr/share/man/man8;
+ dstSubfolderSpec = 0;
+ files = (
+ 7216D2A90EE898F300AE70E4 /* ping6.8 in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+ 7216D2E20EE89BEA00AE70E4 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 8;
+ dstPath = /usr/share/man/man8;
+ dstSubfolderSpec = 0;
+ files = (
+ 7216D2E40EE89C8B00AE70E4 /* rarpd.8 in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+ 7216D2FA0EE89D2600AE70E4 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 8;
+ dstPath = /usr/share/man/man8;
+ dstSubfolderSpec = 0;
+ files = (
+ 7216D3040EE89D4900AE70E4 /* route.8 in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+ 7216D3370EE89F7500AE70E4 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 8;
+ dstPath = /usr/share/man/man8;
+ dstSubfolderSpec = 0;
+ files = (
+ 7216D3240EE89F4200AE70E4 /* rtadvd.8 in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+ 7216D3380EE89F7500AE70E4 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 8;
+ dstPath = /usr/share/man/man5;
+ dstSubfolderSpec = 0;
+ files = (
+ 7216D3390EE89F8400AE70E4 /* rtadvd.conf.5 in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+ 7216D3460EE89FD700AE70E4 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 8;
+ dstPath = /private/etc;
+ dstSubfolderSpec = 0;
+ files = (
+ 7216D3410EE89FAF00AE70E4 /* rtadvd.conf in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+ 7216D37B0EE8A06200AE70E4 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 8;
+ dstPath = /usr/share/man/man8;
+ dstSubfolderSpec = 0;
+ files = (
+ 7216D3700EE8A05B00AE70E4 /* rtsol.8 in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+ 7216D3C10EE8A42D00AE70E4 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 8;
+ dstPath = /usr/share/man/man8;
+ dstSubfolderSpec = 0;
+ files = (
+ 7216D3AF0EE8A3D800AE70E4 /* spray.8 in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+ 724DAB760EE88E9C008900D0 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 8;
+ dstPath = /usr/share/man/man8;
+ dstSubfolderSpec = 0;
+ files = (
+ 724DAB680EE88E78008900D0 /* ipfw.8 in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+ 724DAB970EE88F56008900D0 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 8;
+ dstPath = /usr/share/man/man8;
+ dstSubfolderSpec = 0;
+ files = (
+ 724DAB8A0EE88F24008900D0 /* ip6fw.8 in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+ 724DABB70EE89035008900D0 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 8;
+ dstPath = /usr/share/man/man8;
+ dstSubfolderSpec = 0;
+ files = (
+ 724DABAB0EE89006008900D0 /* kdumpd.8 in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+ 724DABC10EE89090008900D0 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 8;
+ dstPath = /System/Library/LaunchDaemons;
+ dstSubfolderSpec = 0;
+ files = (
+ 724DABBC0EE8908A008900D0 /* com.apple.kdumpd.plist in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+ 724DABE90EE891AD008900D0 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 8;
+ dstPath = /usr/share/man/man8;
+ dstSubfolderSpec = 0;
+ files = (
+ 724DABE40EE8916B008900D0 /* natd.8 in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+ 724DAC1D0EE894E8008900D0 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 8;
+ dstPath = /usr/share/man/man8;
+ dstSubfolderSpec = 0;
+ files = (
+ 724DAC3B0EE89555008900D0 /* ndp.8 in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+ 7261213F0EE8713B00AFED1B /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 8;
+ dstPath = /usr/share/man/man8;
+ dstSubfolderSpec = 0;
+ files = (
+ 726121350EE8713800AFED1B /* arp.8 in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+ 726121620EE8887300AFED1B /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 8;
+ dstPath = /usr/share/man/man8;
+ dstSubfolderSpec = 0;
+ files = (
+ 726121610EE8885400AFED1B /* ifconfig.8 in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+ 726121A50EE88AF300AFED1B /* Copy Files man */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 8;
+ dstPath = /usr/share/man/man8;
+ dstSubfolderSpec = 0;
+ files = (
+ 7261219A0EE88AB500AFED1B /* ip6.8 in Copy Files man */,
+ 7261219B0EE88AB500AFED1B /* ip6config.8 in Copy Files man */,
+ );
+ name = "Copy Files man";
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+ 726121A60EE88AF300AFED1B /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 8;
+ dstPath = /private/etc;
+ dstSubfolderSpec = 0;
+ files = (
+ 7261219F0EE88ADD00AFED1B /* 6to4.conf in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+ 726121AE0EE88B4200AFED1B /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 8;
+ dstPath = /usr/sbin;
+ dstSubfolderSpec = 0;
+ files = (
+ 726121AA0EE88B2700AFED1B /* ip6config in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+ 7294F11A0EE8BC0C0052EC88 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 8;
+ dstPath = /usr/share/man/man8;
+ dstSubfolderSpec = 0;
+ files = (
+ 7294F1080EE8BBB10052EC88 /* traceroute.8 in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+ 7294F13E0EE8BDB30052EC88 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 8;
+ dstPath = /usr/share/man/man8;
+ dstSubfolderSpec = 0;
+ files = (
+ 7294F1320EE8BD430052EC88 /* traceroute6.8 in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ 7216D2460EE896C000AE70E4 /* netstat */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = netstat; sourceTree = BUILT_PRODUCTS_DIR; };
+ 7216D27C0EE8980A00AE70E4 /* ping */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ping; sourceTree = BUILT_PRODUCTS_DIR; };
+ 7216D29A0EE898BD00AE70E4 /* ping6 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ping6; sourceTree = BUILT_PRODUCTS_DIR; };
+ 7216D2CD0EE89B7900AE70E4 /* rarpd */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = rarpd; sourceTree = BUILT_PRODUCTS_DIR; };
+ 7216D2ED0EE89CBC00AE70E4 /* route */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = route; sourceTree = BUILT_PRODUCTS_DIR; };
+ 7216D3140EE89E9E00AE70E4 /* rtadvd */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = rtadvd; sourceTree = BUILT_PRODUCTS_DIR; };
+ 7216D3590EE8A02200AE70E4 /* rtsol */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = rtsol; sourceTree = BUILT_PRODUCTS_DIR; };
+ 7216D3A70EE8A3BB00AE70E4 /* spray */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = spray; sourceTree = BUILT_PRODUCTS_DIR; };
+ 724DAB5F0EE88E2A008900D0 /* ipfw */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ipfw; sourceTree = BUILT_PRODUCTS_DIR; };
+ 724DAB820EE88EFA008900D0 /* ip6fw */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ip6fw; sourceTree = BUILT_PRODUCTS_DIR; };
+ 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 = "<group>"; };
+ 7261203B0EE86EEB00AFED1B /* alias_cuseeme.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = alias_cuseeme.c; sourceTree = "<group>"; };
+ 7261203C0EE86EEB00AFED1B /* alias_db.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = alias_db.c; sourceTree = "<group>"; };
+ 7261203D0EE86EEB00AFED1B /* alias_ftp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = alias_ftp.c; sourceTree = "<group>"; };
+ 7261203E0EE86EEB00AFED1B /* alias_irc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = alias_irc.c; sourceTree = "<group>"; };
+ 726120400EE86EEB00AFED1B /* alias_nbt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = alias_nbt.c; sourceTree = "<group>"; };
+ 726120410EE86EEB00AFED1B /* alias_pptp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = alias_pptp.c; sourceTree = "<group>"; };
+ 726120420EE86EEB00AFED1B /* alias_proxy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = alias_proxy.c; sourceTree = "<group>"; };
+ 726120430EE86EEB00AFED1B /* alias_smedia.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = alias_smedia.c; sourceTree = "<group>"; };
+ 726120440EE86EEB00AFED1B /* alias_util.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = alias_util.c; sourceTree = "<group>"; };
+ 7261204D0EE86EF900AFED1B /* arp.8 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = arp.8; sourceTree = "<group>"; };
+ 7261204E0EE86EF900AFED1B /* arp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = arp.c; sourceTree = "<group>"; };
+ 7261204F0EE86EF900AFED1B /* arp4.4 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = arp4.4; sourceTree = "<group>"; };
+ 726120550EE86F0900AFED1B /* ifbond.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ifbond.c; sourceTree = "<group>"; };
+ 726120560EE86F0900AFED1B /* ifconfig.8 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ifconfig.8; sourceTree = "<group>"; };
+ 726120570EE86F0900AFED1B /* ifconfig.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ifconfig.c; sourceTree = "<group>"; };
+ 726120580EE86F0900AFED1B /* ifconfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ifconfig.h; sourceTree = "<group>"; };
+ 726120590EE86F0900AFED1B /* ifmedia.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ifmedia.c; sourceTree = "<group>"; };
+ 7261205A0EE86F0900AFED1B /* ifvlan.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ifvlan.c; sourceTree = "<group>"; };
+ 7261205F0EE86F1A00AFED1B /* 6to4.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = 6to4.conf; sourceTree = "<group>"; };
+ 726120600EE86F1A00AFED1B /* ip6.8 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ip6.8; sourceTree = "<group>"; };
+ 726120610EE86F1A00AFED1B /* ip6config */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = ip6config; sourceTree = "<group>"; };
+ 726120620EE86F1A00AFED1B /* ip6config.8 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ip6config.8; sourceTree = "<group>"; };
+ 726120630EE86F1A00AFED1B /* ip6tool.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ip6tool.c; sourceTree = "<group>"; };
+ 726120680EE86F2300AFED1B /* ip6fw.8 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ip6fw.8; sourceTree = "<group>"; };
+ 726120690EE86F2300AFED1B /* ip6fw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ip6fw.c; sourceTree = "<group>"; };
+ 7261206E0EE86F2D00AFED1B /* com.apple.kdumpd.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = com.apple.kdumpd.plist; sourceTree = "<group>"; };
+ 7261206F0EE86F2D00AFED1B /* kdump.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kdump.h; sourceTree = "<group>"; };
+ 726120700EE86F2D00AFED1B /* kdumpd.8 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = kdumpd.8; sourceTree = "<group>"; };
+ 726120710EE86F2D00AFED1B /* kdumpd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = kdumpd.c; sourceTree = "<group>"; };
+ 726120720EE86F2D00AFED1B /* kdumpsubs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = kdumpsubs.c; sourceTree = "<group>"; };
+ 726120730EE86F2D00AFED1B /* kdumpsubs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kdumpsubs.h; sourceTree = "<group>"; };
+ 726120780EE86F3600AFED1B /* HISTORY */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HISTORY; sourceTree = "<group>"; };
+ 726120790EE86F3600AFED1B /* icmp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = icmp.c; sourceTree = "<group>"; };
+ 7261207B0EE86F3600AFED1B /* natd.8 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = natd.8; sourceTree = "<group>"; };
+ 7261207C0EE86F3600AFED1B /* natd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = natd.c; sourceTree = "<group>"; };
+ 7261207D0EE86F3600AFED1B /* natd.cf.sample */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = natd.cf.sample; sourceTree = "<group>"; };
+ 7261207E0EE86F3600AFED1B /* natd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = natd.h; sourceTree = "<group>"; };
+ 7261207F0EE86F3600AFED1B /* natd.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = natd.test; sourceTree = "<group>"; };
+ 726120800EE86F3600AFED1B /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ 726120840EE86F4000AFED1B /* gnuc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gnuc.h; sourceTree = "<group>"; };
+ 726120860EE86F4000AFED1B /* ndp.8 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ndp.8; sourceTree = "<group>"; };
+ 726120870EE86F4000AFED1B /* ndp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ndp.c; sourceTree = "<group>"; };
+ 7261208B0EE86F4800AFED1B /* data.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = data.c; sourceTree = "<group>"; };
+ 7261208C0EE86F4800AFED1B /* DERIVED_FILES */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DERIVED_FILES; sourceTree = "<group>"; };
+ 7261208D0EE86F4800AFED1B /* if.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = if.c; sourceTree = "<group>"; };
+ 7261208E0EE86F4800AFED1B /* inet.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = inet.c; sourceTree = "<group>"; };
+ 7261208F0EE86F4800AFED1B /* inet6.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = inet6.c; sourceTree = "<group>"; };
+ 726120900EE86F4800AFED1B /* ipsec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ipsec.c; sourceTree = "<group>"; };
+ 726120910EE86F4800AFED1B /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
+ 726120930EE86F4800AFED1B /* mbuf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mbuf.c; sourceTree = "<group>"; };
+ 726120940EE86F4800AFED1B /* mcast.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mcast.c; sourceTree = "<group>"; };
+ 726120950EE86F4800AFED1B /* mroute.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mroute.c; sourceTree = "<group>"; };
+ 726120960EE86F4800AFED1B /* mroute6.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mroute6.c; sourceTree = "<group>"; };
+ 726120970EE86F4800AFED1B /* netstat.1 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.man; path = netstat.1; sourceTree = "<group>"; };
+ 726120980EE86F4800AFED1B /* netstat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = netstat.h; sourceTree = "<group>"; };
+ 726120990EE86F4800AFED1B /* route.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = route.c; sourceTree = "<group>"; };
+ 7261209A0EE86F4800AFED1B /* tp_astring.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tp_astring.c; sourceTree = "<group>"; };
+ 7261209B0EE86F4800AFED1B /* unix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = unix.c; sourceTree = "<group>"; };
+ 726120A00EE86F5000AFED1B /* ping.8 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ping.8; sourceTree = "<group>"; };
+ 726120A10EE86F5000AFED1B /* ping.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ping.c; sourceTree = "<group>"; };
+ 726120A50EE86F5C00AFED1B /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
+ 726120A60EE86F5C00AFED1B /* md5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = md5.c; sourceTree = "<group>"; };
+ 726120A70EE86F5C00AFED1B /* md5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = md5.h; sourceTree = "<group>"; };
+ 726120A80EE86F5C00AFED1B /* ping6.8 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ping6.8; sourceTree = "<group>"; };
+ 726120A90EE86F5C00AFED1B /* ping6.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ping6.c; sourceTree = "<group>"; };
+ 726120AE0EE86F6700AFED1B /* rarpd.8 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rarpd.8; sourceTree = "<group>"; };
+ 726120AF0EE86F6700AFED1B /* rarpd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rarpd.c; sourceTree = "<group>"; };
+ 726120B30EE86F7200AFED1B /* gen_header.pl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = gen_header.pl; sourceTree = "<group>"; };
+ 726120B40EE86F7200AFED1B /* keywords */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = keywords; sourceTree = "<group>"; };
+ 726120B50EE86F7200AFED1B /* keywords.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = keywords.h; sourceTree = "<group>"; };
+ 726120B70EE86F7200AFED1B /* route.8 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = route.8; sourceTree = "<group>"; };
+ 726120B80EE86F7200AFED1B /* route.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = route.c; sourceTree = "<group>"; };
+ 726120BC0EE86F8200AFED1B /* advcap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = advcap.c; sourceTree = "<group>"; };
+ 726120BD0EE86F8200AFED1B /* advcap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = advcap.h; sourceTree = "<group>"; };
+ 726120BE0EE86F8200AFED1B /* config.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = config.c; sourceTree = "<group>"; };
+ 726120BF0EE86F8200AFED1B /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; };
+ 726120C00EE86F8200AFED1B /* dump.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dump.c; sourceTree = "<group>"; };
+ 726120C10EE86F8200AFED1B /* dump.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dump.h; sourceTree = "<group>"; };
+ 726120C20EE86F8200AFED1B /* if.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = if.c; sourceTree = "<group>"; };
+ 726120C30EE86F8200AFED1B /* if.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = if.h; sourceTree = "<group>"; };
+ 726120C50EE86F8200AFED1B /* pathnames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pathnames.h; sourceTree = "<group>"; };
+ 726120C60EE86F8200AFED1B /* rrenum.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rrenum.c; sourceTree = "<group>"; };
+ 726120C70EE86F8200AFED1B /* rrenum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rrenum.h; sourceTree = "<group>"; };
+ 726120C80EE86F8200AFED1B /* rtadvd.8 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rtadvd.8; sourceTree = "<group>"; };
+ 726120C90EE86F8200AFED1B /* rtadvd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rtadvd.c; sourceTree = "<group>"; };
+ 726120CA0EE86F8200AFED1B /* rtadvd.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rtadvd.conf; sourceTree = "<group>"; };
+ 726120CB0EE86F8200AFED1B /* rtadvd.conf.5 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rtadvd.conf.5; sourceTree = "<group>"; };
+ 726120CC0EE86F8200AFED1B /* rtadvd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rtadvd.h; sourceTree = "<group>"; };
+ 726120CD0EE86F8200AFED1B /* timer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = timer.c; sourceTree = "<group>"; };
+ 726120CE0EE86F8200AFED1B /* timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = timer.h; sourceTree = "<group>"; };
+ 726120D20EE86F9100AFED1B /* dump.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dump.c; sourceTree = "<group>"; };
+ 726120D30EE86F9100AFED1B /* if.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = if.c; sourceTree = "<group>"; };
+ 726120D50EE86F9100AFED1B /* probe.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = probe.c; sourceTree = "<group>"; };
+ 726120D60EE86F9100AFED1B /* rtsock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rtsock.c; sourceTree = "<group>"; };
+ 726120D70EE86F9100AFED1B /* rtsol.8 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rtsol.8; sourceTree = "<group>"; };
+ 726120D80EE86F9100AFED1B /* rtsol.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rtsol.c; sourceTree = "<group>"; };
+ 726120D90EE86F9100AFED1B /* rtsold.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rtsold.c; sourceTree = "<group>"; };
+ 726120DA0EE86F9100AFED1B /* rtsold.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rtsold.h; sourceTree = "<group>"; };
+ 726120DF0EE86F9D00AFED1B /* spray.8 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = spray.8; sourceTree = "<group>"; };
+ 726120E00EE86F9D00AFED1B /* spray.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = spray.c; sourceTree = "<group>"; };
+ 726120E10EE86F9D00AFED1B /* spray.x */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = spray.x; sourceTree = "<group>"; };
+ 726120E50EE86FA700AFED1B /* as.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = as.c; sourceTree = "<group>"; };
+ 726120E60EE86FA700AFED1B /* as.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = as.h; sourceTree = "<group>"; };
+ 726120E70EE86FA700AFED1B /* findsaddr-socket.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "findsaddr-socket.c"; sourceTree = "<group>"; };
+ 726120E80EE86FA700AFED1B /* findsaddr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = findsaddr.h; sourceTree = "<group>"; };
+ 726120E90EE86FA700AFED1B /* gnuc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gnuc.h; sourceTree = "<group>"; };
+ 726120EA0EE86FA700AFED1B /* ifaddrlist.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ifaddrlist.c; sourceTree = "<group>"; };
+ 726120EB0EE86FA700AFED1B /* ifaddrlist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ifaddrlist.h; sourceTree = "<group>"; };
+ 726120ED0EE86FA700AFED1B /* mean.awk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mean.awk; sourceTree = "<group>"; };
+ 726120EE0EE86FA700AFED1B /* median.awk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = median.awk; sourceTree = "<group>"; };
+ 726120EF0EE86FA700AFED1B /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ 726120F00EE86FA700AFED1B /* traceroute.8 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = traceroute.8; sourceTree = "<group>"; };
+ 726120F10EE86FA700AFED1B /* traceroute.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = traceroute.c; sourceTree = "<group>"; };
+ 726120F20EE86FA700AFED1B /* traceroute.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = traceroute.h; sourceTree = "<group>"; };
+ 726120F30EE86FA700AFED1B /* version.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = version.c; sourceTree = "<group>"; };
+ 726120F90EE86FB500AFED1B /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
+ 726120FA0EE86FB500AFED1B /* traceroute6.8 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = traceroute6.8; sourceTree = "<group>"; };
+ 726120FB0EE86FB500AFED1B /* traceroute6.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = traceroute6.c; sourceTree = "<group>"; };
+ 726120FF0EE8701100AFED1B /* ipfw.8 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ipfw.8; sourceTree = "<group>"; };
+ 726121000EE8701100AFED1B /* ipfw2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ipfw2.c; sourceTree = "<group>"; };
+ 7261210C0EE8707500AFED1B /* libalias.A.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libalias.A.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
+ 726121220EE870D400AFED1B /* alias_local.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = alias_local.h; sourceTree = "<group>"; };
+ 726121230EE870D400AFED1B /* alias.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = alias.h; sourceTree = "<group>"; };
+ 726121240EE870D400AFED1B /* libalias.3 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = libalias.3; sourceTree = "<group>"; };
+ 7261212D0EE8710B00AFED1B /* arp */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = arp; sourceTree = BUILT_PRODUCTS_DIR; };
+ 726121540EE8881700AFED1B /* ifconfig */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ifconfig; sourceTree = BUILT_PRODUCTS_DIR; };
+ 726121830EE8897C00AFED1B /* ip6 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ip6; sourceTree = BUILT_PRODUCTS_DIR; };
+ 7294F0F90EE8BB460052EC88 /* traceroute */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = traceroute; sourceTree = BUILT_PRODUCTS_DIR; };
+ 7294F12A0EE8BD280052EC88 /* traceroute6 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = traceroute6; sourceTree = BUILT_PRODUCTS_DIR; };
+ 72CD1DB50EE8C619005F825D /* libipsec.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libipsec.dylib; path = /usr/lib/libipsec.dylib; sourceTree = "<absolute>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 7216D2440EE896C000AE70E4 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7216D27A0EE8980A00AE70E4 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7216D2980EE898BD00AE70E4 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 7263A9630EEE31C800164D5D /* libipsec.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7216D2CB0EE89B7900AE70E4 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7216D2EB0EE89CBC00AE70E4 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7216D3120EE89E9E00AE70E4 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7216D3570EE8A02200AE70E4 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7216D3A50EE8A3BA00AE70E4 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 724DAB5D0EE88E2A008900D0 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 724DAB800EE88EFA008900D0 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 724DABA00EE88FE3008900D0 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 724DABD90EE8912D008900D0 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 724DABF90EE89269008900D0 /* libalias.A.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 724DAC0B0EE8940D008900D0 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ 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;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7261212B0EE8710B00AFED1B /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 726121520EE8881700AFED1B /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 726121810EE8897C00AFED1B /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7294F0F70EE8BB460052EC88 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7294F1280EE8BD280052EC88 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 72B894EC0EEDB17C00C218D6 /* libipsec.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 7248622F0EE86EB7001D0DE9 = {
+ isa = PBXGroup;
+ children = (
+ 726120380EE86EEB00AFED1B /* alias */,
+ 7261204C0EE86EF900AFED1B /* arp.tproj */,
+ 726120540EE86F0900AFED1B /* ifconfig.tproj */,
+ 7261205E0EE86F1A00AFED1B /* ip6conf.tproj */,
+ 726120FE0EE8701100AFED1B /* ipfw.tproj */,
+ 726120670EE86F2300AFED1B /* ip6fw.tproj */,
+ 7261206D0EE86F2D00AFED1B /* kdumpd.tproj */,
+ 726120770EE86F3600AFED1B /* natd.tproj */,
+ 726120830EE86F4000AFED1B /* ndp.tproj */,
+ 7261208A0EE86F4800AFED1B /* netstat.tproj */,
+ 7261209E0EE86F5000AFED1B /* ping.tproj */,
+ 726120A40EE86F5C00AFED1B /* ping6.tproj */,
+ 726120AC0EE86F6700AFED1B /* rarpd.tproj */,
+ 726120B20EE86F7200AFED1B /* route.tproj */,
+ 726120BB0EE86F8200AFED1B /* rtadvd.tproj */,
+ 726120D10EE86F9100AFED1B /* rtsol.tproj */,
+ 726120DD0EE86F9D00AFED1B /* spray.tproj */,
+ 726120E40EE86FA700AFED1B /* traceroute.tproj */,
+ 726120F80EE86FB500AFED1B /* traceroute6.tproj */,
+ 72CD1DB50EE8C619005F825D /* libipsec.dylib */,
+ 7261210D0EE8707500AFED1B /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ 726120380EE86EEB00AFED1B /* alias */ = {
+ isa = PBXGroup;
+ children = (
+ 726121220EE870D400AFED1B /* alias_local.h */,
+ 726121230EE870D400AFED1B /* alias.h */,
+ 726121240EE870D400AFED1B /* libalias.3 */,
+ 726120390EE86EEB00AFED1B /* alias.c */,
+ 7261203B0EE86EEB00AFED1B /* alias_cuseeme.c */,
+ 7261203C0EE86EEB00AFED1B /* alias_db.c */,
+ 7261203D0EE86EEB00AFED1B /* alias_ftp.c */,
+ 7261203E0EE86EEB00AFED1B /* alias_irc.c */,
+ 726120400EE86EEB00AFED1B /* alias_nbt.c */,
+ 726120410EE86EEB00AFED1B /* alias_pptp.c */,
+ 726120420EE86EEB00AFED1B /* alias_proxy.c */,
+ 726120430EE86EEB00AFED1B /* alias_smedia.c */,
+ 726120440EE86EEB00AFED1B /* alias_util.c */,
+ );
+ path = alias;
+ sourceTree = "<group>";
+ };
+ 7261204C0EE86EF900AFED1B /* arp.tproj */ = {
+ isa = PBXGroup;
+ children = (
+ 7261204D0EE86EF900AFED1B /* arp.8 */,
+ 7261204E0EE86EF900AFED1B /* arp.c */,
+ 7261204F0EE86EF900AFED1B /* arp4.4 */,
+ );
+ path = arp.tproj;
+ sourceTree = "<group>";
+ };
+ 726120540EE86F0900AFED1B /* ifconfig.tproj */ = {
+ isa = PBXGroup;
+ children = (
+ 726120550EE86F0900AFED1B /* ifbond.c */,
+ 726120560EE86F0900AFED1B /* ifconfig.8 */,
+ 726120570EE86F0900AFED1B /* ifconfig.c */,
+ 726120580EE86F0900AFED1B /* ifconfig.h */,
+ 726120590EE86F0900AFED1B /* ifmedia.c */,
+ 7261205A0EE86F0900AFED1B /* ifvlan.c */,
+ );
+ path = ifconfig.tproj;
+ sourceTree = "<group>";
+ };
+ 7261205E0EE86F1A00AFED1B /* ip6conf.tproj */ = {
+ isa = PBXGroup;
+ children = (
+ 7261205F0EE86F1A00AFED1B /* 6to4.conf */,
+ 726120600EE86F1A00AFED1B /* ip6.8 */,
+ 726120610EE86F1A00AFED1B /* ip6config */,
+ 726120620EE86F1A00AFED1B /* ip6config.8 */,
+ 726120630EE86F1A00AFED1B /* ip6tool.c */,
+ );
+ path = ip6conf.tproj;
+ sourceTree = "<group>";
+ };
+ 726120670EE86F2300AFED1B /* ip6fw.tproj */ = {
+ isa = PBXGroup;
+ children = (
+ 726120680EE86F2300AFED1B /* ip6fw.8 */,
+ 726120690EE86F2300AFED1B /* ip6fw.c */,
+ );
+ path = ip6fw.tproj;
+ sourceTree = "<group>";
+ };
+ 7261206D0EE86F2D00AFED1B /* kdumpd.tproj */ = {
+ isa = PBXGroup;
+ children = (
+ 7261206E0EE86F2D00AFED1B /* com.apple.kdumpd.plist */,
+ 7261206F0EE86F2D00AFED1B /* kdump.h */,
+ 726120700EE86F2D00AFED1B /* kdumpd.8 */,
+ 726120710EE86F2D00AFED1B /* kdumpd.c */,
+ 726120720EE86F2D00AFED1B /* kdumpsubs.c */,
+ 726120730EE86F2D00AFED1B /* kdumpsubs.h */,
+ );
+ path = kdumpd.tproj;
+ sourceTree = "<group>";
+ };
+ 726120770EE86F3600AFED1B /* natd.tproj */ = {
+ isa = PBXGroup;
+ children = (
+ 726120780EE86F3600AFED1B /* HISTORY */,
+ 726120790EE86F3600AFED1B /* icmp.c */,
+ 7261207B0EE86F3600AFED1B /* natd.8 */,
+ 7261207C0EE86F3600AFED1B /* natd.c */,
+ 7261207D0EE86F3600AFED1B /* natd.cf.sample */,
+ 7261207E0EE86F3600AFED1B /* natd.h */,
+ 7261207F0EE86F3600AFED1B /* natd.test */,
+ 726120800EE86F3600AFED1B /* README */,
+ );
+ path = natd.tproj;
+ sourceTree = "<group>";
+ };
+ 726120830EE86F4000AFED1B /* ndp.tproj */ = {
+ isa = PBXGroup;
+ children = (
+ 726120840EE86F4000AFED1B /* gnuc.h */,
+ 726120860EE86F4000AFED1B /* ndp.8 */,
+ 726120870EE86F4000AFED1B /* ndp.c */,
+ );
+ path = ndp.tproj;
+ sourceTree = "<group>";
+ };
+ 7261208A0EE86F4800AFED1B /* netstat.tproj */ = {
+ isa = PBXGroup;
+ children = (
+ 7261208B0EE86F4800AFED1B /* data.c */,
+ 7261208C0EE86F4800AFED1B /* DERIVED_FILES */,
+ 7261208D0EE86F4800AFED1B /* if.c */,
+ 7261208E0EE86F4800AFED1B /* inet.c */,
+ 7261208F0EE86F4800AFED1B /* inet6.c */,
+ 726120900EE86F4800AFED1B /* ipsec.c */,
+ 726120910EE86F4800AFED1B /* main.c */,
+ 726120930EE86F4800AFED1B /* mbuf.c */,
+ 726120940EE86F4800AFED1B /* mcast.c */,
+ 726120950EE86F4800AFED1B /* mroute.c */,
+ 726120960EE86F4800AFED1B /* mroute6.c */,
+ 726120970EE86F4800AFED1B /* netstat.1 */,
+ 726120980EE86F4800AFED1B /* netstat.h */,
+ 726120990EE86F4800AFED1B /* route.c */,
+ 7261209A0EE86F4800AFED1B /* tp_astring.c */,
+ 7261209B0EE86F4800AFED1B /* unix.c */,
+ );
+ path = netstat.tproj;
+ sourceTree = "<group>";
+ };
+ 7261209E0EE86F5000AFED1B /* ping.tproj */ = {
+ isa = PBXGroup;
+ children = (
+ 726120A00EE86F5000AFED1B /* ping.8 */,
+ 726120A10EE86F5000AFED1B /* ping.c */,
+ );
+ path = ping.tproj;
+ sourceTree = "<group>";
+ };
+ 726120A40EE86F5C00AFED1B /* ping6.tproj */ = {
+ isa = PBXGroup;
+ children = (
+ 726120A50EE86F5C00AFED1B /* Makefile */,
+ 726120A60EE86F5C00AFED1B /* md5.c */,
+ 726120A70EE86F5C00AFED1B /* md5.h */,
+ 726120A80EE86F5C00AFED1B /* ping6.8 */,
+ 726120A90EE86F5C00AFED1B /* ping6.c */,
+ );
+ path = ping6.tproj;
+ sourceTree = "<group>";
+ };
+ 726120AC0EE86F6700AFED1B /* rarpd.tproj */ = {
+ isa = PBXGroup;
+ children = (
+ 726120AE0EE86F6700AFED1B /* rarpd.8 */,
+ 726120AF0EE86F6700AFED1B /* rarpd.c */,
+ );
+ path = rarpd.tproj;
+ sourceTree = "<group>";
+ };
+ 726120B20EE86F7200AFED1B /* route.tproj */ = {
+ isa = PBXGroup;
+ children = (
+ 726120B30EE86F7200AFED1B /* gen_header.pl */,
+ 726120B40EE86F7200AFED1B /* keywords */,
+ 726120B50EE86F7200AFED1B /* keywords.h */,
+ 726120B70EE86F7200AFED1B /* route.8 */,
+ 726120B80EE86F7200AFED1B /* route.c */,
+ );
+ path = route.tproj;
+ sourceTree = "<group>";
+ };
+ 726120BB0EE86F8200AFED1B /* rtadvd.tproj */ = {
+ isa = PBXGroup;
+ children = (
+ 726120BC0EE86F8200AFED1B /* advcap.c */,
+ 726120BD0EE86F8200AFED1B /* advcap.h */,
+ 726120BE0EE86F8200AFED1B /* config.c */,
+ 726120BF0EE86F8200AFED1B /* config.h */,
+ 726120C00EE86F8200AFED1B /* dump.c */,
+ 726120C10EE86F8200AFED1B /* dump.h */,
+ 726120C20EE86F8200AFED1B /* if.c */,
+ 726120C30EE86F8200AFED1B /* if.h */,
+ 726120C50EE86F8200AFED1B /* pathnames.h */,
+ 726120C60EE86F8200AFED1B /* rrenum.c */,
+ 726120C70EE86F8200AFED1B /* rrenum.h */,
+ 726120C80EE86F8200AFED1B /* rtadvd.8 */,
+ 726120C90EE86F8200AFED1B /* rtadvd.c */,
+ 726120CA0EE86F8200AFED1B /* rtadvd.conf */,
+ 726120CB0EE86F8200AFED1B /* rtadvd.conf.5 */,
+ 726120CC0EE86F8200AFED1B /* rtadvd.h */,
+ 726120CD0EE86F8200AFED1B /* timer.c */,
+ 726120CE0EE86F8200AFED1B /* timer.h */,
+ );
+ path = rtadvd.tproj;
+ sourceTree = "<group>";
+ };
+ 726120D10EE86F9100AFED1B /* rtsol.tproj */ = {
+ isa = PBXGroup;
+ children = (
+ 726120D20EE86F9100AFED1B /* dump.c */,
+ 726120D30EE86F9100AFED1B /* if.c */,
+ 726120D50EE86F9100AFED1B /* probe.c */,
+ 726120D60EE86F9100AFED1B /* rtsock.c */,
+ 726120D70EE86F9100AFED1B /* rtsol.8 */,
+ 726120D80EE86F9100AFED1B /* rtsol.c */,
+ 726120D90EE86F9100AFED1B /* rtsold.c */,
+ 726120DA0EE86F9100AFED1B /* rtsold.h */,
+ );
+ path = rtsol.tproj;
+ sourceTree = "<group>";
+ };
+ 726120DD0EE86F9D00AFED1B /* spray.tproj */ = {
+ isa = PBXGroup;
+ children = (
+ 726120DF0EE86F9D00AFED1B /* spray.8 */,
+ 726120E00EE86F9D00AFED1B /* spray.c */,
+ 726120E10EE86F9D00AFED1B /* spray.x */,
+ );
+ path = spray.tproj;
+ sourceTree = "<group>";
+ };
+ 726120E40EE86FA700AFED1B /* traceroute.tproj */ = {
+ isa = PBXGroup;
+ children = (
+ 726120E50EE86FA700AFED1B /* as.c */,
+ 726120E60EE86FA700AFED1B /* as.h */,
+ 726120E70EE86FA700AFED1B /* findsaddr-socket.c */,
+ 726120E80EE86FA700AFED1B /* findsaddr.h */,
+ 726120E90EE86FA700AFED1B /* gnuc.h */,
+ 726120EA0EE86FA700AFED1B /* ifaddrlist.c */,
+ 726120EB0EE86FA700AFED1B /* ifaddrlist.h */,
+ 726120ED0EE86FA700AFED1B /* mean.awk */,
+ 726120EE0EE86FA700AFED1B /* median.awk */,
+ 726120EF0EE86FA700AFED1B /* README */,
+ 726120F00EE86FA700AFED1B /* traceroute.8 */,
+ 726120F10EE86FA700AFED1B /* traceroute.c */,
+ 726120F20EE86FA700AFED1B /* traceroute.h */,
+ 726120F30EE86FA700AFED1B /* version.c */,
+ );
+ path = traceroute.tproj;
+ sourceTree = "<group>";
+ };
+ 726120F80EE86FB500AFED1B /* traceroute6.tproj */ = {
+ isa = PBXGroup;
+ children = (
+ 726120F90EE86FB500AFED1B /* Makefile */,
+ 726120FA0EE86FB500AFED1B /* traceroute6.8 */,
+ 726120FB0EE86FB500AFED1B /* traceroute6.c */,
+ );
+ path = traceroute6.tproj;
+ sourceTree = "<group>";
+ };
+ 726120FE0EE8701100AFED1B /* ipfw.tproj */ = {
+ isa = PBXGroup;
+ children = (
+ 726120FF0EE8701100AFED1B /* ipfw.8 */,
+ 726121000EE8701100AFED1B /* ipfw2.c */,
+ );
+ path = ipfw.tproj;
+ sourceTree = "<group>";
+ };
+ 7261210D0EE8707500AFED1B /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 7261210C0EE8707500AFED1B /* libalias.A.dylib */,
+ 7261212D0EE8710B00AFED1B /* arp */,
+ 726121540EE8881700AFED1B /* ifconfig */,
+ 726121830EE8897C00AFED1B /* ip6 */,
+ 724DAB5F0EE88E2A008900D0 /* ipfw */,
+ 724DAB820EE88EFA008900D0 /* ip6fw */,
+ 724DABA20EE88FE3008900D0 /* kdumpd */,
+ 724DABDB0EE8912D008900D0 /* natd */,
+ 724DAC0D0EE8940D008900D0 /* ndp */,
+ 7216D2460EE896C000AE70E4 /* netstat */,
+ 7216D27C0EE8980A00AE70E4 /* ping */,
+ 7216D29A0EE898BD00AE70E4 /* ping6 */,
+ 7216D2CD0EE89B7900AE70E4 /* rarpd */,
+ 7216D2ED0EE89CBC00AE70E4 /* route */,
+ 7216D3140EE89E9E00AE70E4 /* rtadvd */,
+ 7216D3590EE8A02200AE70E4 /* rtsol */,
+ 7216D3A70EE8A3BB00AE70E4 /* spray */,
+ 7294F0F90EE8BB460052EC88 /* traceroute */,
+ 7294F12A0EE8BD280052EC88 /* traceroute6 */,
+ 72570DB30EE8EC2E000F4CFB /* arp */,
+ 72570DCB0EE8F49A000F4CFB /* ifconfig */,
+ 72570DE80EE8F4C4000F4CFB /* netstat */,
+ 72570DF80EE8F4DE000F4CFB /* route */,
+ 72570E0A0EE8F4EA000F4CFB /* traceroute */,
+ 7251B2000EE9D2AB00F29440 /* ping */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+ 726121080EE8707500AFED1B /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+ 7216D2450EE896C000AE70E4 /* netstat */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 7216D24B0EE896EC00AE70E4 /* Build configuration list for PBXNativeTarget "netstat" */;
+ buildPhases = (
+ 7216D2430EE896C000AE70E4 /* Sources */,
+ 7216D2440EE896C000AE70E4 /* Frameworks */,
+ 7216D2750EE8979500AE70E4 /* CopyFiles */,
+ 7216D2640EE8972E00AE70E4 /* ShellScript */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = netstat;
+ productName = netstat;
+ productReference = 7216D2460EE896C000AE70E4 /* netstat */;
+ productType = "com.apple.product-type.tool";
+ };
+ 7216D27B0EE8980A00AE70E4 /* ping */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 7216D2940EE8988200AE70E4 /* Build configuration list for PBXNativeTarget "ping" */;
+ buildPhases = (
+ 7216D2790EE8980A00AE70E4 /* Sources */,
+ 7216D27A0EE8980A00AE70E4 /* Frameworks */,
+ 7216D2930EE8988200AE70E4 /* CopyFiles */,
+ 7216D2870EE8982900AE70E4 /* ShellScript */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = ping;
+ productName = ping;
+ productReference = 7216D27C0EE8980A00AE70E4 /* ping */;
+ productType = "com.apple.product-type.tool";
+ };
+ 7216D2990EE898BD00AE70E4 /* ping6 */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 7216D2AB0EE8991200AE70E4 /* Build configuration list for PBXNativeTarget "ping6" */;
+ buildPhases = (
+ 7216D2970EE898BD00AE70E4 /* Sources */,
+ 7216D2980EE898BD00AE70E4 /* Frameworks */,
+ 7216D2AA0EE8991200AE70E4 /* CopyFiles */,
+ 7216D2AF0EE8993100AE70E4 /* ShellScript */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = ping6;
+ productName = ping6;
+ productReference = 7216D29A0EE898BD00AE70E4 /* ping6 */;
+ productType = "com.apple.product-type.tool";
+ };
+ 7216D2CC0EE89B7900AE70E4 /* rarpd */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 7216D2E30EE89BEA00AE70E4 /* Build configuration list for PBXNativeTarget "rarpd" */;
+ buildPhases = (
+ 7216D2CA0EE89B7900AE70E4 /* Sources */,
+ 7216D2CB0EE89B7900AE70E4 /* Frameworks */,
+ 7216D2E20EE89BEA00AE70E4 /* CopyFiles */,
+ 7216D2D80EE89B9B00AE70E4 /* ShellScript */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = rarpd;
+ productName = rarpd;
+ productReference = 7216D2CD0EE89B7900AE70E4 /* rarpd */;
+ productType = "com.apple.product-type.tool";
+ };
+ 7216D2EC0EE89CBC00AE70E4 /* route */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 7216D2FB0EE89D2600AE70E4 /* Build configuration list for PBXNativeTarget "route" */;
+ buildPhases = (
+ 7216D2EA0EE89CBC00AE70E4 /* Sources */,
+ 7216D2EB0EE89CBC00AE70E4 /* Frameworks */,
+ 7216D2FA0EE89D2600AE70E4 /* CopyFiles */,
+ 7216D3030EE89D4300AE70E4 /* ShellScript */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = route;
+ productName = route;
+ productReference = 7216D2ED0EE89CBC00AE70E4 /* route */;
+ productType = "com.apple.product-type.tool";
+ };
+ 7216D3130EE89E9E00AE70E4 /* rtadvd */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 7216D3200EE89EDF00AE70E4 /* Build configuration list for PBXNativeTarget "rtadvd" */;
+ buildPhases = (
+ 7216D3110EE89E9E00AE70E4 /* Sources */,
+ 7216D3120EE89E9E00AE70E4 /* Frameworks */,
+ 7216D3370EE89F7500AE70E4 /* CopyFiles */,
+ 7216D3380EE89F7500AE70E4 /* CopyFiles */,
+ 7216D3460EE89FD700AE70E4 /* CopyFiles */,
+ 7216D3450EE89FB900AE70E4 /* ShellScript */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = rtadvd;
+ productName = rtadvd;
+ productReference = 7216D3140EE89E9E00AE70E4 /* rtadvd */;
+ productType = "com.apple.product-type.tool";
+ };
+ 7216D3580EE8A02200AE70E4 /* rtsol */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 7216D3660EE8A02B00AE70E4 /* Build configuration list for PBXNativeTarget "rtsol" */;
+ buildPhases = (
+ 7216D3560EE8A02200AE70E4 /* Sources */,
+ 7216D3570EE8A02200AE70E4 /* Frameworks */,
+ 7216D37B0EE8A06200AE70E4 /* CopyFiles */,
+ 7216D3740EE8A06000AE70E4 /* ShellScript */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = rtsol;
+ productName = rtsol;
+ productReference = 7216D3590EE8A02200AE70E4 /* rtsol */;
+ productType = "com.apple.product-type.tool";
+ };
+ 7216D3A60EE8A3BA00AE70E4 /* spray */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 7216D3C20EE8A42D00AE70E4 /* Build configuration list for PBXNativeTarget "spray" */;
+ buildPhases = (
+ 7216D3A40EE8A3BA00AE70E4 /* Sources */,
+ 7216D3A50EE8A3BA00AE70E4 /* Frameworks */,
+ 7216D3C10EE8A42D00AE70E4 /* CopyFiles */,
+ 7216D3B30EE8A3E000AE70E4 /* ShellScript */,
+ );
+ buildRules = (
+ 7216D47D0EE8B84900AE70E4 /* PBXBuildRule */,
+ );
+ dependencies = (
+ );
+ name = spray;
+ productName = spray;
+ productReference = 7216D3A70EE8A3BB00AE70E4 /* spray */;
+ productType = "com.apple.product-type.tool";
+ };
+ 724DAB5E0EE88E2A008900D0 /* ipfw */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 724DAB770EE88E9C008900D0 /* Build configuration list for PBXNativeTarget "ipfw" */;
+ buildPhases = (
+ 724DAB5C0EE88E2A008900D0 /* Sources */,
+ 724DAB5D0EE88E2A008900D0 /* Frameworks */,
+ 724DAB760EE88E9C008900D0 /* CopyFiles */,
+ 72CD1DB00EE8C551005F825D /* ShellScript */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = ipfw;
+ productName = ipfw;
+ productReference = 724DAB5F0EE88E2A008900D0 /* ipfw */;
+ productType = "com.apple.product-type.tool";
+ };
+ 724DAB810EE88EFA008900D0 /* ip6fw */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 724DAB980EE88F56008900D0 /* Build configuration list for PBXNativeTarget "ip6fw" */;
+ buildPhases = (
+ 724DAB7F0EE88EFA008900D0 /* Sources */,
+ 724DAB800EE88EFA008900D0 /* Frameworks */,
+ 724DAB970EE88F56008900D0 /* CopyFiles */,
+ 724DAC1B0EE89440008900D0 /* ShellScript */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = ip6fw;
+ productName = ip6fw;
+ productReference = 724DAB820EE88EFA008900D0 /* ip6fw */;
+ productType = "com.apple.product-type.tool";
+ };
+ 724DABA10EE88FE3008900D0 /* kdumpd */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 724DABB80EE89035008900D0 /* Build configuration list for PBXNativeTarget "kdumpd" */;
+ buildPhases = (
+ 724DAB9F0EE88FE3008900D0 /* Sources */,
+ 724DABA00EE88FE3008900D0 /* Frameworks */,
+ 724DABB70EE89035008900D0 /* CopyFiles */,
+ 724DABC10EE89090008900D0 /* CopyFiles */,
+ 7216D25F0EE8970100AE70E4 /* ShellScript */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = kdumpd;
+ productName = kdumpd;
+ productReference = 724DABA20EE88FE3008900D0 /* kdumpd */;
+ productType = "com.apple.product-type.tool";
+ };
+ 724DABDA0EE8912D008900D0 /* natd */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 724DABEA0EE891AD008900D0 /* Build configuration list for PBXNativeTarget "natd" */;
+ buildPhases = (
+ 724DABD80EE8912D008900D0 /* Sources */,
+ 724DABD90EE8912D008900D0 /* Frameworks */,
+ 724DABE90EE891AD008900D0 /* CopyFiles */,
+ 724DABE80EE8917A008900D0 /* ShellScript */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = natd;
+ productName = natd;
+ productReference = 724DABDB0EE8912D008900D0 /* natd */;
+ productType = "com.apple.product-type.tool";
+ };
+ 724DAC0C0EE8940D008900D0 /* ndp */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 724DAC1E0EE894E8008900D0 /* Build configuration list for PBXNativeTarget "ndp" */;
+ buildPhases = (
+ 724DAC0A0EE8940D008900D0 /* Sources */,
+ 724DAC0B0EE8940D008900D0 /* Frameworks */,
+ 724DAC1D0EE894E8008900D0 /* CopyFiles */,
+ 724DAC440EE89562008900D0 /* ShellScript */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = ndp;
+ productName = ndp;
+ 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" */;
+ buildPhases = (
+ 726121080EE8707500AFED1B /* Headers */,
+ 726121090EE8707500AFED1B /* Sources */,
+ 7261210A0EE8707500AFED1B /* Frameworks */,
+ 7294F1510EE8BF2D0052EC88 /* ShellScript */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = alias;
+ productName = alias;
+ productReference = 7261210C0EE8707500AFED1B /* libalias.A.dylib */;
+ productType = "com.apple.product-type.library.dynamic";
+ };
+ 7261212C0EE8710B00AFED1B /* arp */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 726121400EE8713B00AFED1B /* Build configuration list for PBXNativeTarget "arp" */;
+ buildPhases = (
+ 7261212A0EE8710B00AFED1B /* Sources */,
+ 7261212B0EE8710B00AFED1B /* Frameworks */,
+ 7261213F0EE8713B00AFED1B /* CopyFiles */,
+ 72CD1DA00EE8C4EC005F825D /* ShellScript */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = arp;
+ productName = arp;
+ productReference = 7261212D0EE8710B00AFED1B /* arp */;
+ productType = "com.apple.product-type.tool";
+ };
+ 726121530EE8881700AFED1B /* ifconfig */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 726121630EE8887300AFED1B /* Build configuration list for PBXNativeTarget "ifconfig" */;
+ buildPhases = (
+ 726121510EE8881700AFED1B /* Sources */,
+ 726121520EE8881700AFED1B /* Frameworks */,
+ 726121620EE8887300AFED1B /* CopyFiles */,
+ 72CD1DA40EE8C500005F825D /* ShellScript */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = ifconfig;
+ productName = ifconfig;
+ productReference = 726121540EE8881700AFED1B /* ifconfig */;
+ productType = "com.apple.product-type.tool";
+ };
+ 726121820EE8897C00AFED1B /* ip6conf */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 726121870EE8898B00AFED1B /* Build configuration list for PBXNativeTarget "ip6conf" */;
+ buildPhases = (
+ 726121800EE8897C00AFED1B /* Sources */,
+ 726121810EE8897C00AFED1B /* Frameworks */,
+ 726121A50EE88AF300AFED1B /* Copy Files man */,
+ 726121A60EE88AF300AFED1B /* CopyFiles */,
+ 726121AE0EE88B4200AFED1B /* CopyFiles */,
+ 726121BB0EE88BB300AFED1B /* ShellScript */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = ip6conf;
+ productName = ip6conf;
+ productReference = 726121830EE8897C00AFED1B /* ip6 */;
+ productType = "com.apple.product-type.tool";
+ };
+ 7294F0F80EE8BB460052EC88 /* traceroute */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 7294F0FD0EE8BB550052EC88 /* Build configuration list for PBXNativeTarget "traceroute" */;
+ buildPhases = (
+ 7294F0F60EE8BB460052EC88 /* Sources */,
+ 7294F0F70EE8BB460052EC88 /* Frameworks */,
+ 7294F11A0EE8BC0C0052EC88 /* CopyFiles */,
+ 7294F10C0EE8BBB60052EC88 /* ShellScript */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = traceroute;
+ productName = traceroute;
+ productReference = 7294F0F90EE8BB460052EC88 /* traceroute */;
+ productType = "com.apple.product-type.tool";
+ };
+ 7294F1290EE8BD280052EC88 /* traceroute6 */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 7294F13F0EE8BDB30052EC88 /* Build configuration list for PBXNativeTarget "traceroute6" */;
+ buildPhases = (
+ 7294F1270EE8BD280052EC88 /* Sources */,
+ 7294F1280EE8BD280052EC88 /* Frameworks */,
+ 7294F13E0EE8BDB30052EC88 /* CopyFiles */,
+ 7294F1360EE8BD4D0052EC88 /* ShellScript */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = traceroute6;
+ productName = traceroute6;
+ productReference = 7294F12A0EE8BD280052EC88 /* traceroute6 */;
+ productType = "com.apple.product-type.tool";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 724862310EE86EB7001D0DE9 /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = 724862340EE86EB7001D0DE9 /* Build configuration list for PBXProject "network_cmds" */;
+ compatibilityVersion = "Xcode 3.1";
+ hasScannedForEncodings = 0;
+ mainGroup = 7248622F0EE86EB7001D0DE9;
+ productRefGroup = 7261210D0EE8707500AFED1B /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 726121430EE8717500AFED1B /* All */,
+ 7261210B0EE8707500AFED1B /* alias */,
+ 7261212C0EE8710B00AFED1B /* arp */,
+ 726121530EE8881700AFED1B /* ifconfig */,
+ 726121820EE8897C00AFED1B /* ip6conf */,
+ 724DAB5E0EE88E2A008900D0 /* ipfw */,
+ 724DAB810EE88EFA008900D0 /* ip6fw */,
+ 724DABA10EE88FE3008900D0 /* kdumpd */,
+ 724DABDA0EE8912D008900D0 /* natd */,
+ 724DAC0C0EE8940D008900D0 /* ndp */,
+ 7216D2450EE896C000AE70E4 /* netstat */,
+ 7216D27B0EE8980A00AE70E4 /* ping */,
+ 7216D2990EE898BD00AE70E4 /* ping6 */,
+ 7216D2CC0EE89B7900AE70E4 /* rarpd */,
+ 7216D2EC0EE89CBC00AE70E4 /* route */,
+ 7216D3130EE89E9E00AE70E4 /* rtadvd */,
+ 7216D3580EE8A02200AE70E4 /* rtsol */,
+ 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 */
+
+/* Begin PBXShellScriptBuildPhase section */
+ 7216D25F0EE8970100AE70E4 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "/bin/chmod 0444 $DSTROOT/usr/share/man/man8/kdumpd.8\n/bin/chmod 0644 $DSTROOT/System/Library/LaunchDaemons/com.apple.kdumpd.plist";
+ };
+ 7216D2640EE8972E00AE70E4 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "/bin/chmod 0444 $DSTROOT/usr/share/man/man1/netstat.1\t";
+ };
+ 7216D2870EE8982900AE70E4 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "/bin/chmod 0444 $DSTROOT/usr/share/man/man8/ping.8\t";
+ };
+ 7216D2AF0EE8993100AE70E4 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "/bin/chmod 0444 $DSTROOT/usr/share/man/man8/ping6.8";
+ };
+ 7216D2D80EE89B9B00AE70E4 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "/bin/chmod 0444 $DSTROOT/usr/share/man/man8/rarpd.8";
+ };
+ 7216D3030EE89D4300AE70E4 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "/bin/chmod 0444 $DSTROOT/usr/share/man/man8/route.8";
+ };
+ 7216D3450EE89FB900AE70E4 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "/bin/chmod 0444 $DSTROOT/usr/share/man/man8/rtadvd.8\n/bin/chmod 0444 $DSTROOT/usr/share/man/man5/rtadvd.conf.5\n/bin/chmod 0644 $DSTROOT/private/etc/rtadvd.conf";
+ };
+ 7216D3740EE8A06000AE70E4 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "/bin/chmod 0444 $DSTROOT/usr/share/man/man8/rtsol.8\n/bin/ln -f $DSTROOT/usr/share/man/man8/rtsol.8 $DSTROOT/usr/share/man/man8/rtsold.8\n/bin/ln -f $DSTROOT/sbin/rtsol $DSTROOT/usr/sbin/rtsold\n/usr/bin/strip $DSTROOT/usr/sbin/rtsold\n/bin/chmod 0555 $DSTROOT/usr/sbin/rtsold\n";
+ };
+ 7216D3B30EE8A3E000AE70E4 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "/bin/chmod 0444 $DSTROOT/usr/share/man/man8/spray.8";
+ };
+ 724DABE80EE8917A008900D0 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "/bin/chmod 0444 $DSTROOT/usr/share/man/man8/natd.8\t";
+ };
+ 724DAC1B0EE89440008900D0 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "/bin/chmod 0444 $DSTROOT/usr/share/man/man8/ip6fw.8\t";
+ };
+ 724DAC440EE89562008900D0 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "/bin/chmod 0444 $DSTROOT/usr/share/man/man8/ndp.8\t";
+ };
+ 726121BB0EE88BB300AFED1B /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "/bin/chmod 0644 $DSTROOT/private/etc/6to4.conf\n/bin/chmod 0555 $DSTROOT/usr/sbin/ip6config\n/bin/chmod 0444 $DSTROOT/usr/share/man/man8/ip6.8\n/bin/chmod 0444 $DSTROOT/usr/share/man/man8/ip6config.8\n";
+ };
+ 7294F10C0EE8BBB60052EC88 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "/bin/chmod 0444 $DSTROOT/usr/share/man/man8/traceroute.8";
+ };
+ 7294F1360EE8BD4D0052EC88 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "/bin/chmod 0444 $DSTROOT/usr/share/man/man8/traceroute6.8";
+ };
+ 7294F1510EE8BF2D0052EC88 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "/bin/ln -s libalias.A.dylib $DSTROOT/usr/lib/libalias.dylib";
+ };
+ 72CD1DA00EE8C4EC005F825D /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "/bin/chmod 0444 $DSTROOT/usr/share/man/man8/arp.8";
+ };
+ 72CD1DA40EE8C500005F825D /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "/bin/chmod 0444 $DSTROOT/usr/share/man/man8/ifconfig.8\t";
+ };
+ 72CD1DB00EE8C551005F825D /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 8;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ shellPath = /bin/sh;
+ shellScript = "/bin/chmod 0444 $DSTROOT/usr/share/man/man8/ipfw.8\n";
+ };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 7216D2430EE896C000AE70E4 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 7216D24C0EE896F300AE70E4 /* data.c in Sources */,
+ 7216D24D0EE896F300AE70E4 /* if.c in Sources */,
+ 7216D24E0EE896F300AE70E4 /* inet.c in Sources */,
+ 7216D24F0EE896F300AE70E4 /* inet6.c in Sources */,
+ 7216D2500EE896F300AE70E4 /* ipsec.c in Sources */,
+ 7216D2510EE896F300AE70E4 /* main.c in Sources */,
+ 7216D2520EE896F300AE70E4 /* mbuf.c in Sources */,
+ 7216D2530EE896F300AE70E4 /* mcast.c in Sources */,
+ 7216D2540EE896F300AE70E4 /* mroute.c in Sources */,
+ 7216D2550EE896F300AE70E4 /* mroute6.c in Sources */,
+ 7216D2560EE896F300AE70E4 /* route.c in Sources */,
+ 7216D2570EE896F300AE70E4 /* tp_astring.c in Sources */,
+ 7216D2580EE896F300AE70E4 /* unix.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7216D2790EE8980A00AE70E4 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 7216D2800EE8981C00AE70E4 /* ping.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7216D2970EE898BD00AE70E4 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 7216D2A00EE898DF00AE70E4 /* md5.c in Sources */,
+ 7216D2A10EE898DF00AE70E4 /* ping6.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7216D2CA0EE89B7900AE70E4 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 7216D2D10EE89B8300AE70E4 /* rarpd.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7216D2EA0EE89CBC00AE70E4 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 7216D2F20EE89CD600AE70E4 /* route.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7216D3110EE89E9E00AE70E4 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 7216D3190EE89EC100AE70E4 /* advcap.c in Sources */,
+ 7216D31A0EE89EC100AE70E4 /* config.c in Sources */,
+ 7216D31B0EE89EC100AE70E4 /* dump.c in Sources */,
+ 7216D31C0EE89EC100AE70E4 /* if.c in Sources */,
+ 7216D31D0EE89EC100AE70E4 /* rrenum.c in Sources */,
+ 7216D31E0EE89EC100AE70E4 /* rtadvd.c in Sources */,
+ 7216D31F0EE89EC100AE70E4 /* timer.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7216D3560EE8A02200AE70E4 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 7216D3670EE8A04700AE70E4 /* dump.c in Sources */,
+ 7216D3680EE8A04700AE70E4 /* if.c in Sources */,
+ 7216D3690EE8A04700AE70E4 /* probe.c in Sources */,
+ 7216D36A0EE8A04700AE70E4 /* rtsock.c in Sources */,
+ 7216D36B0EE8A04700AE70E4 /* rtsol.c in Sources */,
+ 7216D36C0EE8A04700AE70E4 /* rtsold.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7216D3A40EE8A3BA00AE70E4 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 7216D3AB0EE8A3C400AE70E4 /* spray.c in Sources */,
+ 7294F0DF0EE8BA730052EC88 /* spray.x in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 724DAB5C0EE88E2A008900D0 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 724DAB640EE88E63008900D0 /* ipfw2.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 724DAB7F0EE88EFA008900D0 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 724DAB860EE88F0D008900D0 /* ip6fw.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 724DAB9F0EE88FE3008900D0 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 724DABA60EE88FED008900D0 /* kdumpd.c in Sources */,
+ 724DABA70EE88FED008900D0 /* kdumpsubs.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 724DABD80EE8912D008900D0 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 724DABDF0EE89151008900D0 /* natd.c in Sources */,
+ 724DABE00EE89155008900D0 /* icmp.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 724DAC0A0EE8940D008900D0 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 724DAC120EE89423008900D0 /* ndp.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7251B1F70EE9D2AB00F29440 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 7251B1F80EE9D2AB00F29440 /* ping.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 */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 726121310EE8711E00AFED1B /* arp.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 726121510EE8881700AFED1B /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 7261215A0EE8883900AFED1B /* ifbond.c in Sources */,
+ 7261215B0EE8883900AFED1B /* ifconfig.c in Sources */,
+ 7261215C0EE8883900AFED1B /* ifmedia.c in Sources */,
+ 7261215D0EE8883900AFED1B /* ifvlan.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 726121800EE8897C00AFED1B /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 726121890EE889C100AFED1B /* ip6tool.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7294F0F60EE8BB460052EC88 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 7294F1000EE8BB990052EC88 /* as.c in Sources */,
+ 7294F1010EE8BB990052EC88 /* findsaddr-socket.c in Sources */,
+ 7294F1020EE8BB990052EC88 /* ifaddrlist.c in Sources */,
+ 7294F1030EE8BB990052EC88 /* traceroute.c in Sources */,
+ 7294F1040EE8BB990052EC88 /* version.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 7294F1270EE8BD280052EC88 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 7294F12E0EE8BD2F0052EC88 /* traceroute6.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ 7216D2670EE8978F00AE70E4 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 7216D2450EE896C000AE70E4 /* netstat */;
+ targetProxy = 7216D2660EE8978F00AE70E4 /* PBXContainerItemProxy */;
+ };
+ 7216D2C00EE89ADF00AE70E4 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 7216D27B0EE8980A00AE70E4 /* ping */;
+ targetProxy = 7216D2BF0EE89ADF00AE70E4 /* PBXContainerItemProxy */;
+ };
+ 7216D2C20EE89ADF00AE70E4 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 7216D2990EE898BD00AE70E4 /* ping6 */;
+ targetProxy = 7216D2C10EE89ADF00AE70E4 /* PBXContainerItemProxy */;
+ };
+ 7216D2DA0EE89BE900AE70E4 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 7216D2CC0EE89B7900AE70E4 /* rarpd */;
+ targetProxy = 7216D2D90EE89BE900AE70E4 /* PBXContainerItemProxy */;
+ };
+ 7216D3060EE89D9A00AE70E4 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 7216D2EC0EE89CBC00AE70E4 /* route */;
+ targetProxy = 7216D3050EE89D9A00AE70E4 /* PBXContainerItemProxy */;
+ };
+ 7216D34D0EE89FEC00AE70E4 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 7216D3130EE89E9E00AE70E4 /* rtadvd */;
+ targetProxy = 7216D34C0EE89FEC00AE70E4 /* PBXContainerItemProxy */;
+ };
+ 7216D37F0EE8A0B300AE70E4 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 7216D3580EE8A02200AE70E4 /* rtsol */;
+ targetProxy = 7216D37E0EE8A0B300AE70E4 /* PBXContainerItemProxy */;
+ };
+ 724DAB790EE88EA6008900D0 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 724DAB5E0EE88E2A008900D0 /* ipfw */;
+ targetProxy = 724DAB780EE88EA6008900D0 /* PBXContainerItemProxy */;
+ };
+ 724DAB9A0EE88F5D008900D0 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 724DAB810EE88EFA008900D0 /* ip6fw */;
+ targetProxy = 724DAB990EE88F5D008900D0 /* PBXContainerItemProxy */;
+ };
+ 724DABC30EE890A6008900D0 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 724DABA10EE88FE3008900D0 /* kdumpd */;
+ targetProxy = 724DABC20EE890A6008900D0 /* PBXContainerItemProxy */;
+ };
+ 724DABEC0EE891DF008900D0 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 724DABDA0EE8912D008900D0 /* natd */;
+ targetProxy = 724DABEB0EE891DF008900D0 /* PBXContainerItemProxy */;
+ };
+ 724DAC240EE89525008900D0 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 724DAC0C0EE8940D008900D0 /* ndp */;
+ 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 */;
+ targetProxy = 726121460EE8717B00AFED1B /* PBXContainerItemProxy */;
+ };
+ 726121490EE8717B00AFED1B /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 7261212C0EE8710B00AFED1B /* arp */;
+ targetProxy = 726121480EE8717B00AFED1B /* PBXContainerItemProxy */;
+ };
+ 7261217D0EE8896800AFED1B /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 726121530EE8881700AFED1B /* ifconfig */;
+ targetProxy = 7261217C0EE8896800AFED1B /* PBXContainerItemProxy */;
+ };
+ 726121B30EE88B7900AFED1B /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 726121820EE8897C00AFED1B /* ip6conf */;
+ targetProxy = 726121B20EE88B7900AFED1B /* PBXContainerItemProxy */;
+ };
+ 7294F0EA0EE8BAC80052EC88 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 7216D3A60EE8A3BA00AE70E4 /* spray */;
+ targetProxy = 7294F0E90EE8BAC80052EC88 /* PBXContainerItemProxy */;
+ };
+ 7294F1210EE8BCC20052EC88 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 7294F0F80EE8BB460052EC88 /* traceroute */;
+ targetProxy = 7294F1200EE8BCC20052EC88 /* PBXContainerItemProxy */;
+ };
+ 72CD1D9C0EE8C47C005F825D /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 7294F1290EE8BD280052EC88 /* traceroute6 */;
+ targetProxy = 72CD1D9B0EE8C47C005F825D /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
+/* Begin XCBuildConfiguration section */
+ 7216D2480EE896C100AE70E4 /* 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 = (
+ 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;
+ };
+ name = Debug;
+ };
+ 7216D2490EE896C100AE70E4 /* 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 = (
+ 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;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 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;
+ 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;
+ };
+ name = Debug;
+ };
+ 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;
+ 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;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 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;
+ INSTALL_GROUP = wheel;
+ INSTALL_MODE_FLAG = 0555;
+ INSTALL_OWNER = root;
+ INSTALL_PATH = /sbin;
+ PREBINDING = NO;
+ PRODUCT_NAME = ping6;
+ };
+ name = Debug;
+ };
+ 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 = (
+ INET6,
+ IPSEC_DEBUG,
+ KAME_SCOPEID,
+ IPSEC,
+ );
+ INSTALL_GROUP = wheel;
+ INSTALL_MODE_FLAG = 0555;
+ INSTALL_OWNER = root;
+ INSTALL_PATH = /sbin;
+ PREBINDING = NO;
+ PRODUCT_NAME = ping6;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 7216D2CF0EE89B7A00AE70E4 /* 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 = "TFTP_DIR=\\\"/tftpboot\\\"";
+ 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;
+ };
+ name = Debug;
+ };
+ 7216D2D00EE89B7A00AE70E4 /* 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 = "TFTP_DIR=\\\"/tftpboot\\\"";
+ 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;
+ };
+ name = Release;
+ };
+ 7216D2EF0EE89CBC00AE70E4 /* 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 = (
+ INET6,
+ IPSEC,
+ );
+ 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;
+ };
+ name = Debug;
+ };
+ 7216D2F00EE89CBC00AE70E4 /* 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 = (
+ INET6,
+ IPSEC,
+ );
+ 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;
+ };
+ name = Release;
+ };
+ 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 = (
+ INET6,
+ 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",
+ "-Wno-deprecated-declarations",
+ "-mdynamic-no-pic",
+ "-dead_strip",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = rtadvd;
+ WARNING_CFLAGS = "";
+ };
+ name = Debug;
+ };
+ 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 = (
+ INET6,
+ 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",
+ "-Wno-deprecated-declarations",
+ "-mdynamic-no-pic",
+ "-dead_strip",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = rtadvd;
+ WARNING_CFLAGS = "";
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 7216D35B0EE8A02300AE70E4 /* 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 = (
+ 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",
+ "-Wno-deprecated-declarations",
+ "-mdynamic-no-pic",
+ "-dead_strip",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = rtsol;
+ };
+ name = Debug;
+ };
+ 7216D35C0EE8A02300AE70E4 /* 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 = (
+ 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",
+ "-Wno-deprecated-declarations",
+ "-mdynamic-no-pic",
+ "-dead_strip",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = rtsol;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 7216D3A90EE8A3BB00AE70E4 /* 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 = spray;
+ };
+ name = Debug;
+ };
+ 7216D3AA0EE8A3BB00AE70E4 /* 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 = spray;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 724862320EE86EB7001D0DE9 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ };
+ name = Debug;
+ };
+ 724862330EE86EB7001D0DE9 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ };
+ name = Release;
+ };
+ 724DAB610EE88E2B008900D0 /* 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;
+ };
+ name = Debug;
+ };
+ 724DAB620EE88E2B008900D0 /* 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;
+ };
+ name = Release;
+ };
+ 724DAB840EE88EFA008900D0 /* 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;
+ };
+ name = Debug;
+ };
+ 724DAB850EE88EFA008900D0 /* 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;
+ };
+ name = Release;
+ };
+ 724DABA40EE88FE3008900D0 /* 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/libexec;
+ OTHER_CFLAGS = (
+ "-Wall",
+ "-Werror",
+ "-mdynamic-no-pic",
+ "-dead_strip",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = kdumpd;
+ };
+ name = Debug;
+ };
+ 724DABA50EE88FE3008900D0 /* 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/libexec;
+ OTHER_CFLAGS = (
+ "-Wall",
+ "-Werror",
+ "-mdynamic-no-pic",
+ "-dead_strip",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = kdumpd;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 724DABDD0EE8912E008900D0 /* 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;
+ 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;
+ };
+ name = Debug;
+ };
+ 724DABDE0EE8912E008900D0 /* 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;
+ 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;
+ };
+ name = Release;
+ };
+ 724DAC0F0EE8940E008900D0 /* 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 = (
+ INET6,
+ IPSEC_DEBUG,
+ KAME_SCOPEID,
+ );
+ 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 = ndp;
+ };
+ name = Debug;
+ };
+ 724DAC100EE8940E008900D0 /* 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 = (
+ INET6,
+ IPSEC_DEBUG,
+ KAME_SCOPEID,
+ );
+ 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 = ndp;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 7251B1FE0EE9D2AB00F29440 /* 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;
+ 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;
+ SDKROOT = iphoneos3.0.internal;
+ };
+ name = Debug;
+ };
+ 7251B1FF0EE9D2AB00F29440 /* 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;
+ 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;
+ SDKROOT = iphoneos3.0.internal;
+ STRIPFLAGS = "-S";
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 72570DA30EE8EBF3000F4CFB /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ PRODUCT_NAME = network_cmds;
+ };
+ name = Debug;
+ };
+ 72570DA40EE8EBF3000F4CFB /* 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;
+ };
+ name = Release;
+ };
+ 72570DB10EE8EC2E000F4CFB /* 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_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",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = arp;
+ SDKROOT = iphoneos3.0.internal;
+ STRIPFLAGS = "";
+ };
+ name = Debug;
+ };
+ 72570DB20EE8EC2E000F4CFB /* 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;
+ 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",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = arp;
+ SDKROOT = iphoneos3.0.internal;
+ STRIPFLAGS = "-S";
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 72570DC90EE8F49A000F4CFB /* 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,
+ );
+ 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";
+ };
+ name = Debug;
+ };
+ 72570DCA0EE8F49A000F4CFB /* 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,
+ );
+ 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;
+ };
+ name = Release;
+ };
+ 72570DE60EE8F4C4000F4CFB /* 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,
+ );
+ 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;
+ SDKROOT = iphoneos3.0.internal;
+ };
+ name = Debug;
+ };
+ 72570DE70EE8F4C4000F4CFB /* 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;
+ 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;
+ SDKROOT = iphoneos3.0.internal;
+ STRIPFLAGS = "-S";
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 72570DF60EE8F4DE000F4CFB /* 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,
+ );
+ 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;
+ };
+ name = Debug;
+ };
+ 72570DF70EE8F4DE000F4CFB /* 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;
+ 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;
+ };
+ name = Release;
+ };
+ 72570E080EE8F4EA000F4CFB /* 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;
+ };
+ name = Debug;
+ };
+ 72570E090EE8F4EA000F4CFB /* 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;
+ };
+ name = Release;
+ };
+ 7261210E0EE8707600AFED1B /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ DEAD_CODE_STRIPPING = YES;
+ DYLIB_CURRENT_VERSION = 1;
+ EXECUTABLE_PREFIX = lib;
+ 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/lib;
+ PREBINDING = NO;
+ PRODUCT_NAME = alias.A;
+ };
+ name = Debug;
+ };
+ 7261210F0EE8707600AFED1B /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ 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_ENABLE_FIX_AND_CONTINUE = NO;
+ GCC_MODEL_TUNING = G5;
+ INSTALL_GROUP = wheel;
+ INSTALL_MODE_FLAG = 0555;
+ INSTALL_OWNER = root;
+ INSTALL_PATH = /usr/lib;
+ PREBINDING = NO;
+ PRODUCT_NAME = alias.A;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 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;
+ };
+ 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;
+ };
+ 726121440EE8717500AFED1B /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ PRODUCT_NAME = network_cmds;
+ };
+ name = Debug;
+ };
+ 726121450EE8717500AFED1B /* 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;
+ };
+ name = Release;
+ };
+ 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 = (
+ USE_IF_MEDIA,
+ INET6,
+ NO_IPX,
+ 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;
+ OTHER_CFLAGS = (
+ "-Wall",
+ "-Werror",
+ "-mdynamic-no-pic",
+ "-dead_strip",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = ifconfig;
+ };
+ name = Debug;
+ };
+ 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 = (
+ USE_IF_MEDIA,
+ INET6,
+ NO_IPX,
+ 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;
+ OTHER_CFLAGS = (
+ "-Wall",
+ "-Werror",
+ "-mdynamic-no-pic",
+ "-dead_strip",
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = ifconfig;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 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;
+ };
+ 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;
+ };
+ 7294F0FB0EE8BB460052EC88 /* Debug */ = {
+ 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;
+ 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;
+ };
+ 7294F0FC0EE8BB460052EC88 /* Release */ = {
+ 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;
+ 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 = (
+ INET6,
+ IPSEC,
+ );
+ 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 = traceroute6;
+ };
+ name = Debug;
+ };
+ 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 = (
+ INET6,
+ IPSEC,
+ );
+ 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 = traceroute6;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 7216D24B0EE896EC00AE70E4 /* Build configuration list for PBXNativeTarget "netstat" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 7216D2480EE896C100AE70E4 /* Debug */,
+ 7216D2490EE896C100AE70E4 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 7216D2940EE8988200AE70E4 /* Build configuration list for PBXNativeTarget "ping" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 7216D27E0EE8980B00AE70E4 /* Debug */,
+ 7216D27F0EE8980B00AE70E4 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 7216D2AB0EE8991200AE70E4 /* Build configuration list for PBXNativeTarget "ping6" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 7216D29C0EE898BE00AE70E4 /* Debug */,
+ 7216D29D0EE898BE00AE70E4 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 7216D2E30EE89BEA00AE70E4 /* Build configuration list for PBXNativeTarget "rarpd" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 7216D2CF0EE89B7A00AE70E4 /* Debug */,
+ 7216D2D00EE89B7A00AE70E4 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 7216D2FB0EE89D2600AE70E4 /* Build configuration list for PBXNativeTarget "route" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 7216D2EF0EE89CBC00AE70E4 /* Debug */,
+ 7216D2F00EE89CBC00AE70E4 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 7216D3200EE89EDF00AE70E4 /* Build configuration list for PBXNativeTarget "rtadvd" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 7216D3160EE89E9F00AE70E4 /* Debug */,
+ 7216D3170EE89E9F00AE70E4 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 7216D3660EE8A02B00AE70E4 /* Build configuration list for PBXNativeTarget "rtsol" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 7216D35B0EE8A02300AE70E4 /* Debug */,
+ 7216D35C0EE8A02300AE70E4 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 7216D3C20EE8A42D00AE70E4 /* Build configuration list for PBXNativeTarget "spray" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 7216D3A90EE8A3BB00AE70E4 /* Debug */,
+ 7216D3AA0EE8A3BB00AE70E4 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 724862340EE86EB7001D0DE9 /* Build configuration list for PBXProject "network_cmds" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 724862320EE86EB7001D0DE9 /* Debug */,
+ 724862330EE86EB7001D0DE9 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 724DAB770EE88E9C008900D0 /* Build configuration list for PBXNativeTarget "ipfw" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 724DAB610EE88E2B008900D0 /* Debug */,
+ 724DAB620EE88E2B008900D0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 724DAB980EE88F56008900D0 /* Build configuration list for PBXNativeTarget "ip6fw" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 724DAB840EE88EFA008900D0 /* Debug */,
+ 724DAB850EE88EFA008900D0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 724DABB80EE89035008900D0 /* Build configuration list for PBXNativeTarget "kdumpd" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 724DABA40EE88FE3008900D0 /* Debug */,
+ 724DABA50EE88FE3008900D0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 724DABEA0EE891AD008900D0 /* Build configuration list for PBXNativeTarget "natd" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 724DABDD0EE8912E008900D0 /* Debug */,
+ 724DABDE0EE8912E008900D0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 724DAC1E0EE894E8008900D0 /* Build configuration list for PBXNativeTarget "ndp" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 724DAC0F0EE8940E008900D0 /* Debug */,
+ 724DAC100EE8940E008900D0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 7251B1FD0EE9D2AB00F29440 /* Build configuration list for PBXNativeTarget "ping embedded" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 7251B1FE0EE9D2AB00F29440 /* Debug */,
+ 7251B1FF0EE9D2AB00F29440 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 72570DA60EE8EC0F000F4CFB /* Build configuration list for PBXAggregateTarget "All-Embedded" */ = {
+ isa = XCConfigurationList;
+ 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 */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 726121100EE8707600AFED1B /* Build configuration list for PBXNativeTarget "alias" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 7261210E0EE8707600AFED1B /* Debug */,
+ 7261210F0EE8707600AFED1B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 726121400EE8713B00AFED1B /* Build configuration list for PBXNativeTarget "arp" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 7261212F0EE8710B00AFED1B /* Debug */,
+ 726121300EE8710B00AFED1B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 7261214B0EE8717D00AFED1B /* Build configuration list for PBXAggregateTarget "All" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 726121440EE8717500AFED1B /* Debug */,
+ 726121450EE8717500AFED1B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 726121630EE8887300AFED1B /* Build configuration list for PBXNativeTarget "ifconfig" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 726121560EE8881800AFED1B /* Debug */,
+ 726121570EE8881800AFED1B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 726121870EE8898B00AFED1B /* Build configuration list for PBXNativeTarget "ip6conf" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 726121850EE8897C00AFED1B /* Debug */,
+ 726121860EE8897C00AFED1B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 7294F0FD0EE8BB550052EC88 /* Build configuration list for PBXNativeTarget "traceroute" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 7294F0FB0EE8BB460052EC88 /* Debug */,
+ 7294F0FC0EE8BB460052EC88 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 7294F13F0EE8BDB30052EC88 /* Build configuration list for PBXNativeTarget "traceroute6" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 7294F12C0EE8BD290052EC88 /* Debug */,
+ 7294F12D0EE8BD290052EC88 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 724862310EE86EB7001D0DE9 /* Project object */;
+}
+++ /dev/null
-Project = ping
-Install_Dir = /sbin
-
-CFILES = ping.c
-MANPAGES = ping.8
-
-Extra_CC_Flags = -mdynamic-no-pic -dead_strip
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
-
-Install_Program_Mode = 04555
-.\" Copyright (c) 1985, 1991, 1993\r
-.\" The Regents of the University of California. All rights reserved.\r
-.\"\r
-.\" Redistribution and use in source and binary forms, with or without\r
-.\" modification, are permitted provided that the following conditions\r
-.\" are met:\r
-.\" 1. Redistributions of source code must retain the above copyright\r
-.\" notice, this list of conditions and the following disclaimer.\r
-.\" 2. Redistributions in binary form must reproduce the above copyright\r
-.\" notice, this list of conditions and the following disclaimer in the\r
-.\" documentation and/or other materials provided with the distribution.\r
-.\" 4. Neither the name of the University nor the names of its contributors\r
-.\" may be used to endorse or promote products derived from this software\r
-.\" without specific prior written permission.\r
-.\"\r
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\r
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\r
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
-.\" SUCH DAMAGE.\r
-.\"\r
-.\" @(#)ping.8 8.2 (Berkeley) 12/11/93\r
-.\" $FreeBSD: /repoman/r/ncvs/src/sbin/ping/ping.8,v 1.51 2004/04/09 19:58:34 markm Exp $\r
-.\"\r
-.Dd October 2, 2002\r
-.Dt PING 8\r
-.Os\r
-.Sh NAME\r
-.Nm ping\r
-.Nd send\r
-.Tn ICMP ECHO_REQUEST\r
-packets to network hosts\r
-.Sh SYNOPSIS\r
-.Nm\r
-.Op Fl AaDdfnoQqRrv\r
-.Op Fl c Ar count\r
-.Op Fl i Ar wait\r
-.Op Fl l Ar preload\r
-.Op Fl M Cm mask | time\r
-.Op Fl m Ar ttl\r
-.Op Fl P Ar policy\r
-.Op Fl p Ar pattern\r
-.Op Fl S Ar src_addr\r
-.Op Fl s Ar packetsize\r
-.Op Fl t Ar timeout\r
-.Op Fl z Ar tos\r
-.Ar host\r
-.Nm\r
-.Op Fl AaDdfLnoQqRrv\r
-.Op Fl c Ar count\r
-.Op Fl I Ar iface\r
-.Op Fl i Ar wait\r
-.Op Fl l Ar preload\r
-.Op Fl M Cm mask | time\r
-.Op Fl m Ar ttl\r
-.Op Fl P Ar policy\r
-.Op Fl p Ar pattern\r
-.Op Fl S Ar src_addr\r
-.Op Fl s Ar packetsize\r
-.Op Fl T Ar ttl\r
-.Op Fl t Ar timeout\r
-.Op Fl z Ar tos\r
-.Ar mcast-group\r
-.Sh DESCRIPTION\r
-The\r
-.Nm\r
-utility uses the\r
-.Tn ICMP\r
-.No protocol Ap s mandatory\r
-.Tn ECHO_REQUEST\r
-datagram to elicit an\r
-.Tn ICMP ECHO_RESPONSE\r
-from a host or gateway.\r
-.Tn ECHO_REQUEST\r
-datagrams\r
-.Pq Dq pings\r
-have an IP and\r
-.Tn ICMP\r
-header, followed by a\r
-.Dq struct timeval\r
-and then an arbitrary number of\r
-.Dq pad\r
-bytes used to fill out the packet.\r
-The options are as follows:\r
-.Bl -tag -width indent\r
-.It Fl A\r
-Audible.\r
-Output a bell\r
-.Tn ( ASCII\r
-0x07)\r
-character when no packet is received before the next packet\r
-is transmitted.\r
-To cater for round-trip times that are longer than the interval\r
-between transmissions, further missing packets cause a bell only\r
-if the maximum number of unreceived packets has increased.\r
-.It Fl a\r
-Audible.\r
-Include a bell\r
-.Tn ( ASCII\r
-0x07)\r
-character in the output when any packet is received.\r
-This option is ignored\r
-if other format options are present.\r
-.It Fl c Ar count\r
-Stop after sending\r
-(and receiving)\r
-.Ar count\r
-.Tn ECHO_RESPONSE\r
-packets.\r
-If this option is not specified,\r
-.Nm\r
-will operate until interrupted.\r
-.It Fl D\r
-Set the Don't Fragment bit.\r
-.It Fl d\r
-Set the\r
-.Dv SO_DEBUG\r
-option on the socket being used.\r
-.It Fl f\r
-Flood ping.\r
-Outputs packets as fast as they come back or one hundred times per second,\r
-whichever is more.\r
-For every\r
-.Tn ECHO_REQUEST\r
-sent a period\r
-.Dq .\&\r
-is printed, while for every\r
-.Tn ECHO_REPLY\r
-received a backspace is printed.\r
-This provides a rapid display of how many packets are being dropped.\r
-Only the super-user may use this option.\r
-.Bf -emphasis\r
-This can be very hard on a network and should be used with caution.\r
-.Ef\r
-.It Fl I Ar iface\r
-Source multicast packets with the given interface address.\r
-This flag only applies if the ping destination is a multicast address.\r
-.It Fl i Ar wait\r
-Wait\r
-.Ar wait\r
-seconds\r
-.Em between sending each packet .\r
-The default is to wait for one second between each packet.\r
-The wait time may be fractional, but only the super-user may specify\r
-values less than 1 second.\r
-This option is incompatible with the\r
-.Fl f\r
-option.\r
-.It Fl L\r
-Suppress loopback of multicast packets.\r
-This flag only applies if the ping destination is a multicast address.\r
-.It Fl l Ar preload\r
-If\r
-.Ar preload\r
-is specified,\r
-.Nm\r
-sends that many packets as fast as possible before falling into its normal\r
-mode of behavior.\r
-Only the super-user may use this option.\r
-.It Fl M Cm mask | time\r
-Use\r
-.Dv ICMP_MASKREQ\r
-or\r
-.Dv ICMP_TSTAMP\r
-instead of\r
-.Dv ICMP_ECHO .\r
-For\r
-.Cm mask ,\r
-print the netmask of the remote machine.\r
-Set the\r
-.Va net.inet.icmp.maskrepl\r
-MIB variable to enable\r
-.Dv ICMP_MASKREPLY .\r
-For\r
-.Cm time ,\r
-print the origination, reception and transmission timestamps.\r
-.It Fl m Ar ttl\r
-Set the IP Time To Live for outgoing packets.\r
-If not specified, the kernel uses the value of the\r
-.Va net.inet.ip.ttl\r
-MIB variable.\r
-.It Fl n\r
-Numeric output only.\r
-No attempt will be made to lookup symbolic names for host addresses.\r
-.It Fl o\r
-Exit successfully after receiving one reply packet.\r
-.It Fl P Ar policy\r
-.Ar policy\r
-specifies IPsec policy for the ping session.\r
-For details please refer to\r
-.Xr ipsec 4\r
-and\r
-.Xr ipsec_set_policy 3 .\r
-.It Fl p Ar pattern\r
-You may specify up to 16\r
-.Dq pad\r
-bytes to fill out the packet you send.\r
-This is useful for diagnosing data-dependent problems in a network.\r
-For example,\r
-.Dq Li \-p ff\r
-will cause the sent packet to be filled with all\r
-ones.\r
-.It Fl Q\r
-Somewhat quiet output.\r
-.No Don Ap t\r
-display ICMP error messages that are in response to our query messages.\r
-Originally, the\r
-.Fl v\r
-flag was required to display such errors, but\r
-.Fl v\r
-displays all ICMP error messages.\r
-On a busy machine, this output can be overbearing.\r
-Without the\r
-.Fl Q\r
-flag,\r
-.Nm\r
-prints out any ICMP error messages caused by its own ECHO_REQUEST\r
-messages.\r
-.It Fl q\r
-Quiet output.\r
-Nothing is displayed except the summary lines at startup time and\r
-when finished.\r
-.It Fl R\r
-Record route.\r
-Includes the\r
-.Tn RECORD_ROUTE\r
-option in the\r
-.Tn ECHO_REQUEST\r
-packet and displays\r
-the route buffer on returned packets.\r
-Note that the IP header is only large enough for nine such routes;\r
-the\r
-.Xr traceroute 8\r
-command is usually better at determining the route packets take to a\r
-particular destination.\r
-If more routes come back than should, such as due to an illegal spoofed\r
-packet, ping will print the route list and then truncate it at the correct\r
-spot.\r
-Many hosts ignore or discard the\r
-.Tn RECORD_ROUTE\r
-option.\r
-.It Fl r\r
-Bypass the normal routing tables and send directly to a host on an attached\r
-network.\r
-If the host is not on a directly-attached network, an error is returned.\r
-This option can be used to ping a local host through an interface\r
-that has no route through it\r
-(e.g., after the interface was dropped by\r
-.Xr routed 8 ) .\r
-.It Fl S Ar src_addr\r
-Use the following IP address as the source address in outgoing packets.\r
-On hosts with more than one IP address, this option can be used to\r
-force the source address to be something other than the IP address\r
-of the interface the probe packet is sent on.\r
-If the IP address\r
-is not one of this machine's interface addresses, an error is\r
-returned and nothing is sent.\r
-.It Fl s Ar packetsize\r
-Specify the number of data bytes to be sent.\r
-The default is 56, which translates into 64\r
-.Tn ICMP\r
-data bytes when combined\r
-with the 8 bytes of\r
-.Tn ICMP\r
-header data.\r
-.It Fl T Ar ttl\r
-Set the IP Time To Live for multicasted packets.\r
-This flag only applies if the ping destination is a multicast address.\r
-.It Fl t Ar timeout\r
-Specify a timeout, in seconds, before ping exits regardless of how\r
-many packets have been received.\r
-.It Fl v\r
-Verbose output.\r
-.Tn ICMP\r
-packets other than\r
-.Tn ECHO_RESPONSE\r
-that are received are listed.\r
-.It Fl z Ar tos\r
-Use the specified type of service.\r
-.El\r
-.Pp\r
-When using\r
-.Nm\r
-for fault isolation, it should first be run on the local host, to verify\r
-that the local network interface is up and running.\r
-Then, hosts and gateways further and further away should be\r
-.Dq pinged .\r
-Round-trip times and packet loss statistics are computed.\r
-If duplicate packets are received, they are not included in the packet\r
-loss calculation, although the round trip time of these packets is used\r
-in calculating the round-trip time statistics.\r
-When the specified number of packets have been sent\r
-(and received)\r
-or if the program is terminated with a\r
-.Dv SIGINT ,\r
-a brief summary is displayed, showing the number of packets sent and\r
-received, and the minimum, mean, maximum, and standard deviation of\r
-the round-trip times.\r
-.Pp\r
-If\r
-.Nm\r
-receives a\r
-.Dv SIGINFO\r
-(see the\r
-.Cm status\r
-argument for\r
-.Xr stty 1 )\r
-signal, the current number of packets sent and received, and the\r
-minimum, mean, and maximum of the round-trip times will be written to\r
-the standard error output.\r
-.Pp\r
-This program is intended for use in network testing, measurement and\r
-management.\r
-Because of the load it can impose on the network, it is unwise to use\r
-.Nm\r
-during normal operations or from automated scripts.\r
-.Sh ICMP PACKET DETAILS\r
-An IP header without options is 20 bytes.\r
-An\r
-.Tn ICMP\r
-.Tn ECHO_REQUEST\r
-packet contains an additional 8 bytes worth of\r
-.Tn ICMP\r
-header followed by an arbitrary amount of data.\r
-When a\r
-.Ar packetsize\r
-is given, this indicated the size of this extra piece of data\r
-(the default is 56).\r
-Thus the amount of data received inside of an IP packet of type\r
-.Tn ICMP\r
-.Tn ECHO_REPLY\r
-will always be 8 bytes more than the requested data space\r
-(the\r
-.Tn ICMP\r
-header).\r
-.Pp\r
-If the data space is at least eight bytes large,\r
-.Nm\r
-uses the first eight bytes of this space to include a timestamp which\r
-it uses in the computation of round trip times.\r
-If less than eight bytes of pad are specified, no round trip times are\r
-given.\r
-.Sh DUPLICATE AND DAMAGED PACKETS\r
-The\r
-.Nm\r
-utility will report duplicate and damaged packets.\r
-Duplicate packets should never occur when pinging a unicast address,\r
-and seem to be caused by\r
-inappropriate link-level retransmissions.\r
-Duplicates may occur in many situations and are rarely\r
-(if ever)\r
-a good sign, although the presence of low levels of duplicates may not\r
-always be cause for alarm.\r
-Duplicates are expected when pinging a broadcast or multicast address,\r
-since they are not really duplicates but replies from different hosts\r
-to the same request.\r
-.Pp\r
-Damaged packets are obviously serious cause for alarm and often\r
-indicate broken hardware somewhere in the\r
-.Nm\r
-packet's path (in the network or in the hosts).\r
-.Sh TRYING DIFFERENT DATA PATTERNS\r
-The\r
-(inter)network\r
-layer should never treat packets differently depending on the data\r
-contained in the data portion.\r
-Unfortunately, data-dependent problems have been known to sneak into\r
-networks and remain undetected for long periods of time.\r
-In many cases the particular pattern that will have problems is something\r
-that does not have sufficient\r
-.Dq transitions ,\r
-such as all ones or all zeros, or a pattern right at the edge, such as\r
-almost all zeros.\r
-It is not\r
-necessarily enough to specify a data pattern of all zeros (for example)\r
-on the command line because the pattern that is of interest is\r
-at the data link level, and the relationship between what you type and\r
-what the controllers transmit can be complicated.\r
-.Pp\r
-This means that if you have a data-dependent problem you will probably\r
-have to do a lot of testing to find it.\r
-If you are lucky, you may manage to find a file that either\r
-cannot\r
-be sent across your network or that takes much longer to transfer than\r
-other similar length files.\r
-You can then examine this file for repeated patterns that you can test\r
-using the\r
-.Fl p\r
-option of\r
-.Nm .\r
-.Sh TTL DETAILS\r
-The\r
-.Tn TTL\r
-value of an IP packet represents the maximum number of IP routers\r
-that the packet can go through before being thrown away.\r
-In current practice you can expect each router in the Internet to decrement\r
-the\r
-.Tn TTL\r
-field by exactly one.\r
-.Pp\r
-The\r
-.Tn TCP/IP\r
-specification recommends setting the\r
-.Tn TTL\r
-field for\r
-.Tn IP\r
-packets to 64, but many systems use smaller values\r
-.No ( Bx 4.3\r
-uses 30,\r
-.Bx 4.2\r
-used 15).\r
-.Pp\r
-The maximum possible value of this field is 255, and most\r
-.Ux\r
-systems set\r
-the\r
-.Tn TTL\r
-field of\r
-.Tn ICMP ECHO_REQUEST\r
-packets to 255.\r
-This is why you will find you can\r
-.Dq ping\r
-some hosts, but not reach them with\r
-.Xr telnet 1\r
-or\r
-.Xr ftp 1 .\r
-.Pp\r
-In normal operation\r
-.Nm\r
-prints the ttl value from the packet it receives.\r
-When a remote system receives a ping packet, it can do one of three things\r
-with the\r
-.Tn TTL\r
-field in its response:\r
-.Bl -bullet\r
-.It\r
-Not change it; this is what\r
-.Bx\r
-systems did before the\r
-.Bx 4.3 tahoe\r
-release.\r
-In this case the\r
-.Tn TTL\r
-value in the received packet will be 255 minus the\r
-number of routers in the round-trip path.\r
-.It\r
-Set it to 255; this is what current\r
-.Bx\r
-systems do.\r
-In this case the\r
-.Tn TTL\r
-value in the received packet will be 255 minus the\r
-number of routers in the path\r
-.Em from\r
-the remote system\r
-.Em to\r
-the\r
-.Nm Ns Em ing\r
-host.\r
-.It\r
-Set it to some other value.\r
-Some machines use the same value for\r
-.Tn ICMP\r
-packets that they use for\r
-.Tn TCP\r
-packets, for example either 30 or 60.\r
-Others may use completely wild values.\r
-.El\r
-.Sh RETURN VALUES\r
-The\r
-.Nm\r
-utility returns an exit status of zero if at least one response was\r
-heard from the specified\r
-.Ar host ;\r
-a status of two if the transmission was successful but no responses\r
-were received; or another value\r
-(from\r
-.In sysexits.h )\r
-if an error occurred.\r
-.Sh SEE ALSO\r
-.Xr netstat 1 ,\r
-.Xr ifconfig 8 ,\r
-.Xr routed 8 ,\r
-.Xr traceroute 8\r
-.Sh HISTORY\r
-The\r
-.Nm\r
-utility appeared in\r
-.Bx 4.3 .\r
-.Sh AUTHORS\r
-The original\r
-.Nm\r
-utility was written by\r
-.An Mike Muuss\r
-while at the US Army Ballistics\r
-Research Laboratory.\r
-.Sh BUGS\r
-Many Hosts and Gateways ignore the\r
-.Tn RECORD_ROUTE\r
-option.\r
-.Pp\r
-The maximum IP header length is too small for options like\r
-.Tn RECORD_ROUTE\r
-to be completely useful.\r
-.No There Ap s\r
-not much that can be done about this, however.\r
-.Pp\r
-Flood pinging is not recommended in general, and flood pinging the\r
-broadcast address should only be done under very controlled conditions.\r
-.Pp\r
-The\r
-.Fl v\r
-option is not worth much on busy hosts.\r
+.\" Copyright (c) 1985, 1991, 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.
+.\"
+.\" @(#)ping.8 8.2 (Berkeley) 12/11/93
+.\" $FreeBSD: src/sbin/ping/ping.8,v 1.51.8.2 2006/08/10 10:48:21 glebius Exp $
+.\"
+.Dd April 4, 2006
+.Dt PING 8
+.Os
+.Sh NAME
+.Nm ping
+.Nd send
+.Tn ICMP ECHO_REQUEST
+packets to network hosts
+.Sh SYNOPSIS
+.Nm
+.Op Fl AaDdfnoQqRrv
+.Op Fl b Ar boundif
+.Op Fl c Ar count
+.Op Fl G Ar sweepmaxsize
+.Op Fl g Ar sweepminsize
+.Op Fl h Ar sweepincrsize
+.Op Fl i Ar wait
+.Op Fl l Ar preload
+.Op Fl M Cm mask | time
+.Op Fl m Ar ttl
+.Op Fl P Ar policy
+.Op Fl p Ar pattern
+.Op Fl S Ar src_addr
+.Op Fl s Ar packetsize
+.Op Fl t Ar timeout
+.Op Fl W Ar waittime
+.Op Fl z Ar tos
+.Ar host
+.Nm
+.Op Fl AaDdfLnoQqRrv
+.Op Fl b Ar boundif
+.Op Fl c Ar count
+.Op Fl I Ar iface
+.Op Fl i Ar wait
+.Op Fl l Ar preload
+.Op Fl M Cm mask | time
+.Op Fl m Ar ttl
+.Op Fl P Ar policy
+.Op Fl p Ar pattern
+.Op Fl S Ar src_addr
+.Op Fl s Ar packetsize
+.Op Fl T Ar ttl
+.Op Fl t Ar timeout
+.Op Fl W Ar waittime
+.Op Fl z Ar tos
+.Ar mcast-group
+.Sh DESCRIPTION
+The
+.Nm
+utility uses the
+.Tn ICMP
+.No protocol Ap s mandatory
+.Tn ECHO_REQUEST
+datagram to elicit an
+.Tn ICMP ECHO_RESPONSE
+from a host or gateway.
+.Tn ECHO_REQUEST
+datagrams
+.Pq Dq pings
+have an IP and
+.Tn ICMP
+header, followed by a
+.Dq struct timeval
+and then an arbitrary number of
+.Dq pad
+bytes used to fill out the packet.
+The options are as follows:
+.Bl -tag -width indent
+.It Fl A
+Audible.
+Output a bell
+.Tn ( ASCII
+0x07)
+character when no packet is received before the next packet
+is transmitted.
+To cater for round-trip times that are longer than the interval
+between transmissions, further missing packets cause a bell only
+if the maximum number of unreceived packets has increased.
+.It Fl a
+Audible.
+Include a bell
+.Tn ( ASCII
+0x07)
+character in the output when any packet is received.
+This option is ignored
+if other format options are present.
+.It Fl b Ar boundif
+Bind the socket to interface
+.Ar boundif
+for sending.
+.It Fl c Ar count
+Stop after sending
+(and receiving)
+.Ar count
+.Tn ECHO_RESPONSE
+packets.
+If this option is not specified,
+.Nm
+will operate until interrupted.
+If this option is specified in conjunction with ping sweeps,
+each sweep will consist of
+.Ar count
+packets.
+.It Fl D
+Set the Don't Fragment bit.
+.It Fl d
+Set the
+.Dv SO_DEBUG
+option on the socket being used.
+.It Fl f
+Flood ping.
+Outputs packets as fast as they come back or one hundred times per second,
+whichever is more.
+For every
+.Tn ECHO_REQUEST
+sent a period
+.Dq .\&
+is printed, while for every
+.Tn ECHO_REPLY
+received a backspace is printed.
+This provides a rapid display of how many packets are being dropped.
+Only the super-user may use this option.
+.Bf -emphasis
+This can be very hard on a network and should be used with caution.
+.Ef
+.It Fl G Ar sweepmaxsize
+Specify the maximum size of
+.Tn ICMP
+payload when sending sweeping pings.
+This option is required for ping sweeps.
+.It Fl g Ar sweepminsize
+Specify the size of
+.Tn ICMP
+payload to start with when sending sweeping pings.
+The default value is 0.
+.It Fl h Ar sweepincrsize
+Specify the number of bytes to increment the size of
+.Tn ICMP
+payload after
+each sweep when sending sweeping pings. The default value is 1.
+.It Fl I Ar iface
+Source multicast packets with the given interface address.
+This flag only applies if the ping destination is a multicast address.
+.It Fl i Ar wait
+Wait
+.Ar wait
+seconds
+.Em between sending each packet .
+The default is to wait for one second between each packet.
+The wait time may be fractional, but only the super-user may specify
+values less than 1 second.
+This option is incompatible with the
+.Fl f
+option.
+.It Fl L
+Suppress loopback of multicast packets.
+This flag only applies if the ping destination is a multicast address.
+.It Fl l Ar preload
+If
+.Ar preload
+is specified,
+.Nm
+sends that many packets as fast as possible before falling into its normal
+mode of behavior.
+Only the super-user may use this option.
+.It Fl M Cm mask | time
+Use
+.Dv ICMP_MASKREQ
+or
+.Dv ICMP_TSTAMP
+instead of
+.Dv ICMP_ECHO .
+For
+.Cm mask ,
+print the netmask of the remote machine.
+Set the
+.Va net.inet.icmp.maskrepl
+MIB variable to enable
+.Dv ICMP_MASKREPLY .
+For
+.Cm time ,
+print the origination, reception and transmission timestamps.
+.It Fl m Ar ttl
+Set the IP Time To Live for outgoing packets.
+If not specified, the kernel uses the value of the
+.Va net.inet.ip.ttl
+MIB variable.
+.It Fl n
+Numeric output only.
+No attempt will be made to lookup symbolic names for host addresses.
+.It Fl o
+Exit successfully after receiving one reply packet.
+.It Fl P Ar policy
+.Ar policy
+specifies IPsec policy for the ping session.
+For details please refer to
+.Xr ipsec 4
+and
+.Xr ipsec_set_policy 3 .
+.It Fl p Ar pattern
+You may specify up to 16
+.Dq pad
+bytes to fill out the packet you send.
+This is useful for diagnosing data-dependent problems in a network.
+For example,
+.Dq Li \-p ff
+will cause the sent packet to be filled with all
+ones.
+.It Fl Q
+Somewhat quiet output.
+.No Don Ap t
+display ICMP error messages that are in response to our query messages.
+Originally, the
+.Fl v
+flag was required to display such errors, but
+.Fl v
+displays all ICMP error messages.
+On a busy machine, this output can be overbearing.
+Without the
+.Fl Q
+flag,
+.Nm
+prints out any ICMP error messages caused by its own ECHO_REQUEST
+messages.
+.It Fl q
+Quiet output.
+Nothing is displayed except the summary lines at startup time and
+when finished.
+.It Fl R
+Record route.
+Includes the
+.Tn RECORD_ROUTE
+option in the
+.Tn ECHO_REQUEST
+packet and displays
+the route buffer on returned packets.
+Note that the IP header is only large enough for nine such routes;
+the
+.Xr traceroute 8
+command is usually better at determining the route packets take to a
+particular destination.
+If more routes come back than should, such as due to an illegal spoofed
+packet, ping will print the route list and then truncate it at the correct
+spot.
+Many hosts ignore or discard the
+.Tn RECORD_ROUTE
+option.
+.It Fl r
+Bypass the normal routing tables and send directly to a host on an attached
+network.
+If the host is not on a directly-attached network, an error is returned.
+This option can be used to ping a local host through an interface
+that has no route through it
+(e.g., after the interface was dropped by
+.Xr routed 8 ) .
+.It Fl S Ar src_addr
+Use the following IP address as the source address in outgoing packets.
+On hosts with more than one IP address, this option can be used to
+force the source address to be something other than the IP address
+of the interface the probe packet is sent on.
+If the IP address
+is not one of this machine's interface addresses, an error is
+returned and nothing is sent.
+.It Fl s Ar packetsize
+Specify the number of data bytes to be sent.
+The default is 56, which translates into 64
+.Tn ICMP
+data bytes when combined
+with the 8 bytes of
+.Tn ICMP
+header data.
+This option cannot be used with ping sweeps.
+.It Fl T Ar ttl
+Set the IP Time To Live for multicasted packets.
+This flag only applies if the ping destination is a multicast address.
+.It Fl t Ar timeout
+Specify a timeout, in seconds, before ping exits regardless of how
+many packets have been received.
+.It Fl v
+Verbose output.
+.Tn ICMP
+packets other than
+.Tn ECHO_RESPONSE
+that are received are listed.
+.It Fl W Ar waittime
+Time in milliseconds to wait for a reply for each packet sent.
+If a reply arrives later, the packet is not printed as replied, but
+considered as replied when calculating statistics.
+.It Fl z Ar tos
+Use the specified type of service.
+.El
+.Pp
+When using
+.Nm
+for fault isolation, it should first be run on the local host, to verify
+that the local network interface is up and running.
+Then, hosts and gateways further and further away should be
+.Dq pinged .
+Round-trip times and packet loss statistics are computed.
+If duplicate packets are received, they are not included in the packet
+loss calculation, although the round trip time of these packets is used
+in calculating the round-trip time statistics.
+When the specified number of packets have been sent
+(and received)
+or if the program is terminated with a
+.Dv SIGINT ,
+a brief summary is displayed, showing the number of packets sent and
+received, and the minimum, mean, maximum, and standard deviation of
+the round-trip times.
+.Pp
+If
+.Nm
+receives a
+.Dv SIGINFO
+(see the
+.Cm status
+argument for
+.Xr stty 1 )
+signal, the current number of packets sent and received, and the
+minimum, mean, and maximum of the round-trip times will be written to
+the standard error output.
+.Pp
+This program is intended for use in network testing, measurement and
+management.
+Because of the load it can impose on the network, it is unwise to use
+.Nm
+during normal operations or from automated scripts.
+.Sh ICMP PACKET DETAILS
+An IP header without options is 20 bytes.
+An
+.Tn ICMP
+.Tn ECHO_REQUEST
+packet contains an additional 8 bytes worth of
+.Tn ICMP
+header followed by an arbitrary amount of data.
+When a
+.Ar packetsize
+is given, this indicated the size of this extra piece of data
+(the default is 56).
+Thus the amount of data received inside of an IP packet of type
+.Tn ICMP
+.Tn ECHO_REPLY
+will always be 8 bytes more than the requested data space
+(the
+.Tn ICMP
+header).
+.Pp
+If the data space is at least eight bytes large,
+.Nm
+uses the first eight bytes of this space to include a timestamp which
+it uses in the computation of round trip times.
+If less than eight bytes of pad are specified, no round trip times are
+given.
+.Sh DUPLICATE AND DAMAGED PACKETS
+The
+.Nm
+utility will report duplicate and damaged packets.
+Duplicate packets should never occur when pinging a unicast address,
+and seem to be caused by
+inappropriate link-level retransmissions.
+Duplicates may occur in many situations and are rarely
+(if ever)
+a good sign, although the presence of low levels of duplicates may not
+always be cause for alarm.
+Duplicates are expected when pinging a broadcast or multicast address,
+since they are not really duplicates but replies from different hosts
+to the same request.
+.Pp
+Damaged packets are obviously serious cause for alarm and often
+indicate broken hardware somewhere in the
+.Nm
+packet's path (in the network or in the hosts).
+.Sh TRYING DIFFERENT DATA PATTERNS
+The
+(inter)network
+layer should never treat packets differently depending on the data
+contained in the data portion.
+Unfortunately, data-dependent problems have been known to sneak into
+networks and remain undetected for long periods of time.
+In many cases the particular pattern that will have problems is something
+that does not have sufficient
+.Dq transitions ,
+such as all ones or all zeros, or a pattern right at the edge, such as
+almost all zeros.
+It is not
+necessarily enough to specify a data pattern of all zeros (for example)
+on the command line because the pattern that is of interest is
+at the data link level, and the relationship between what you type and
+what the controllers transmit can be complicated.
+.Pp
+This means that if you have a data-dependent problem you will probably
+have to do a lot of testing to find it.
+If you are lucky, you may manage to find a file that either
+cannot
+be sent across your network or that takes much longer to transfer than
+other similar length files.
+You can then examine this file for repeated patterns that you can test
+using the
+.Fl p
+option of
+.Nm .
+.Sh TTL DETAILS
+The
+.Tn TTL
+value of an IP packet represents the maximum number of IP routers
+that the packet can go through before being thrown away.
+In current practice you can expect each router in the Internet to decrement
+the
+.Tn TTL
+field by exactly one.
+.Pp
+The
+.Tn TCP/IP
+specification recommends setting the
+.Tn TTL
+field for
+.Tn IP
+packets to 64, but many systems use smaller values
+.No ( Bx 4.3
+uses 30,
+.Bx 4.2
+used 15).
+.Pp
+The maximum possible value of this field is 255, and most
+.Ux
+systems set
+the
+.Tn TTL
+field of
+.Tn ICMP ECHO_REQUEST
+packets to 255.
+This is why you will find you can
+.Dq ping
+some hosts, but not reach them with
+.Xr telnet 1
+or
+.Xr ftp 1 .
+.Pp
+In normal operation
+.Nm
+prints the ttl value from the packet it receives.
+When a remote system receives a ping packet, it can do one of three things
+with the
+.Tn TTL
+field in its response:
+.Bl -bullet
+.It
+Not change it; this is what
+.Bx
+systems did before the
+.Bx 4.3 tahoe
+release.
+In this case the
+.Tn TTL
+value in the received packet will be 255 minus the
+number of routers in the round-trip path.
+.It
+Set it to 255; this is what current
+.Bx
+systems do.
+In this case the
+.Tn TTL
+value in the received packet will be 255 minus the
+number of routers in the path
+.Em from
+the remote system
+.Em to
+the
+.Nm Ns Em ing
+host.
+.It
+Set it to some other value.
+Some machines use the same value for
+.Tn ICMP
+packets that they use for
+.Tn TCP
+packets, for example either 30 or 60.
+Others may use completely wild values.
+.El
+.Sh RETURN VALUES
+The
+.Nm
+utility returns an exit status of zero if at least one response was
+heard from the specified
+.Ar host ;
+a status of two if the transmission was successful but no responses
+were received; or another value
+(from
+.In sysexits.h )
+if an error occurred.
+.Sh SEE ALSO
+.Xr netstat 1 ,
+.Xr ifconfig 8 ,
+.Xr routed 8 ,
+.Xr traceroute 8
+.Sh HISTORY
+The
+.Nm
+utility appeared in
+.Bx 4.3 .
+.Sh AUTHORS
+The original
+.Nm
+utility was written by
+.An Mike Muuss
+while at the US Army Ballistics
+Research Laboratory.
+.Sh BUGS
+Many Hosts and Gateways ignore the
+.Tn RECORD_ROUTE
+option.
+.Pp
+The maximum IP header length is too small for options like
+.Tn RECORD_ROUTE
+to be completely useful.
+.No There Ap s
+not much that can be done about this, however.
+.Pp
+Flood pinging is not recommended in general, and flood pinging the
+broadcast address should only be done under very controlled conditions.
+.Pp
+The
+.Fl v
+option is not worth much on busy hosts.
+/*
+ * Copyright (c) 2008 Apple Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
#endif
#include <sys/cdefs.h>
#ifndef __APPLE__
-__FBSDID("$FreeBSD: /repoman/r/ncvs/src/sbin/ping/ping.c,v 1.105 2004/08/14 17:46:10 stefanf Exp $");
+__FBSDID("$FreeBSD: src/sbin/ping/ping.c,v 1.112 2007/07/01 12:08:06 gnn Exp $");
#endif
-
+
/*
* P I N G . C
*
#include <netinet/ip_icmp.h>
#include <netinet/ip_var.h>
#include <arpa/inet.h>
+#include <net/if.h>
#ifdef IPSEC
#include <netinet6/ipsec.h>
#include <unistd.h>
#define INADDR_LEN ((int)sizeof(in_addr_t))
-#define TIMEVAL_LEN ((int)sizeof(struct timeval))
+#define TIMEVAL_LEN ((int)sizeof(struct tv32))
#define MASK_LEN (ICMP_MASKLEN - ICMP_MINLEN)
#define TS_LEN (ICMP_TSLEN - ICMP_MINLEN)
#define DEFDATALEN 56 /* default data length */
/* runs out of buffer space */
#define MAXIPLEN (sizeof(struct ip) + MAX_IPOPTLEN)
#define MAXICMPLEN (ICMP_ADVLENMIN + MAX_IPOPTLEN)
-#define MAXWAIT 10 /* max seconds to wait for response */
+#define MAXWAIT 10000 /* max ms to wait for response */
#define MAXALARM (60 * 60) /* max seconds for alarm timeout */
#define MAXTOS 255
#define CLR(bit) (A(bit) &= (~B(bit)))
#define TST(bit) (A(bit) & B(bit))
+struct tv32 {
+ u_int32_t tv32_sec;
+ u_int32_t tv32_usec;
+};
+
/* various options */
int options;
#define F_FLOOD 0x0001
#define F_HDRINCL 0x40000
#define F_MASK 0x80000
#define F_TIME 0x100000
+#define F_SWEEP 0x200000
+#define F_WAITTIME 0x400000
/*
* MAX_DUP_CHK is the number of bits in received table, i.e. the maximum
u_char icmp_type_rsp = ICMP_ECHOREPLY;
int phdr_len = 0;
int send_len;
+char *boundif;
+unsigned int ifscope;
+#if defined(IP_FORCE_OUT_IFP) && TARGET_OS_EMBEDDED
+char boundifname[IFNAMSIZ];
+#endif /* IP_FORCE_OUT_IFP */
/* counters */
long nmissedmax; /* max value of ntransmitted - nreceived - 1 */
long nreceived; /* # of packets we got back */
long nrepeats; /* number of duplicates */
long ntransmitted; /* sequence # for outbound packets = #sent */
+long snpackets; /* max packets to transmit in one sweep */
+long snreceived; /* # of packets we got back in this sweep */
+long sntransmitted; /* # of packets we sent in this sweep */
+int sweepmax; /* max value of payload in sweep */
+int sweepmin = 0; /* start value of payload in sweep */
+int sweepincr = 1; /* payload increment in sweep */
int interval = 1000; /* interval between packets, ms */
+int waittime = MAXWAIT; /* timeout for each packet */
+long nrcvtimeout = 0; /* # of packets we got back after waittime */
/* timing */
int timing; /* flag to do timing */
* then drop our setuid bit. Save error reporting for
* after arg parsing.
*/
- s = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
+ if (getuid())
+ s = socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP);
+ else
+ s = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
sockerrno = errno;
setuid(getuid());
outpack = outpackhdr + sizeof(struct ip);
while ((ch = getopt(argc, argv,
- "Aac:DdfI:i:Ll:M:m:nop:QqRrS:s:T:t:vz:"
+ "Aab:c:DdfG:g:h:I:i:Ll:M:m:nop:QqRrS:s:T:t:vW:z:"
#ifdef IPSEC
#ifdef IPSEC_POLICY_IPSEC
"P:"
#endif /*IPSEC_POLICY_IPSEC*/
#endif /*IPSEC*/
+#if defined(IP_FORCE_OUT_IFP) && TARGET_OS_EMBEDDED
+ "B:"
+#endif /* IP_FORCE_OUT_IFP */
)) != -1)
{
switch(ch) {
case 'a':
options |= F_AUDIBLE;
break;
+#if defined(IP_FORCE_OUT_IFP) && TARGET_OS_EMBEDDED
+ case 'B':
+ (void) snprintf(boundifname, sizeof (boundifname),
+ "%s", optarg);
+ break;
+#endif /* IP_FORCE_OUT_IFP */
+ case 'b':
+ boundif = optarg;
+ break;
case 'c':
ultmp = strtoul(optarg, &ep, 0);
if (*ep || ep == optarg || ultmp > LONG_MAX || !ultmp)
options |= F_FLOOD;
setbuf(stdout, (char *)NULL);
break;
+ case 'G': /* Maximum packet size for ping sweep */
+ ultmp = strtoul(optarg, &ep, 0);
+ if (*ep || ep == optarg)
+ errx(EX_USAGE, "invalid packet size: `%s'",
+ optarg);
+#ifndef __APPLE__
+ if (uid != 0 && ultmp > DEFDATALEN) {
+ errno = EPERM;
+ err(EX_NOPERM,
+ "packet size too large: %lu > %u",
+ ultmp, DEFDATALEN);
+ }
+#endif /* __APPLE__ */
+ options |= F_SWEEP;
+ sweepmax = ultmp;
+ break;
+ case 'g': /* Minimum packet size for ping sweep */
+ ultmp = strtoul(optarg, &ep, 0);
+ if (*ep || ep == optarg)
+ errx(EX_USAGE, "invalid packet size: `%s'",
+ optarg);
+#ifndef __APPLE__
+ if (uid != 0 && ultmp > DEFDATALEN) {
+ errno = EPERM;
+ err(EX_NOPERM,
+ "packet size too large: %lu > %u",
+ ultmp, DEFDATALEN);
+ }
+#endif /* __APPLE__ */
+ options |= F_SWEEP;
+ sweepmin = ultmp;
+ break;
+ case 'h': /* Packet size increment for ping sweep */
+ ultmp = strtoul(optarg, &ep, 0);
+ if (*ep || ep == optarg || ultmp < 1)
+ errx(EX_USAGE, "invalid increment size: `%s'",
+ optarg);
+#ifndef __APPLE__
+ if (uid != 0 && ultmp > DEFDATALEN) {
+ errno = EPERM;
+ err(EX_NOPERM,
+ "packet size too large: %lu > %u",
+ ultmp, DEFDATALEN);
+ }
+#endif /* __APPLE__ */
+ options |= F_SWEEP;
+ sweepincr = ultmp;
+ break;
case 'I': /* multicast interface */
if (inet_aton(optarg, &ifaddr) == 0)
errx(EX_USAGE,
"packet size too large: %lu > %u",
ultmp, DEFDATALEN);
}
-#endif
+#endif /* __APPLE__ */
datalen = ultmp;
break;
case 'T': /* multicast TTL */
if (alarmtimeout > MAXALARM)
errx(EX_USAGE, "invalid timeout: `%s' > %d",
optarg, MAXALARM);
- alarm((int)alarmtimeout);
+ alarm((unsigned int)alarmtimeout);
break;
case 'v':
options |= F_VERBOSE;
break;
+ case 'W': /* wait ms for answer */
+ t = strtod(optarg, &ep);
+ if (*ep || ep == optarg || t > (double)INT_MAX)
+ errx(EX_USAGE, "invalid timing interval: `%s'",
+ optarg);
+ options |= F_WAITTIME;
+ waittime = (int)t;
+ break;
case 'z':
options |= F_HDRINCL;
ultmp = strtoul(optarg, &ep, 0);
}
}
+ if (boundif != NULL && (ifscope = if_nametoindex(boundif)) == 0)
+ errx(1, "bad interface name");
+
if (argc - optind != 1)
usage();
target = argv[optind];
err(EX_OSERR, "socket");
}
hold = 1;
+ if (ifscope != 0) {
+ if (setsockopt(s, IPPROTO_IP, IP_BOUND_IF,
+ (char *)&ifscope, sizeof (ifscope)) != 0)
+ err(EX_OSERR, "setsockopt(IP_BOUND_IF)");
+ }
+#if defined(IP_FORCE_OUT_IFP) && TARGET_OS_EMBEDDED
+ else if (boundifname[0] != 0) {
+ if (setsockopt(s, IPPROTO_IP, IP_FORCE_OUT_IFP, boundifname,
+ sizeof (boundifname)) != 0)
+ err(EX_OSERR, "setsockopt(IP_FORCE_OUT_IFP)");
+ }
+#endif /* IP_FORCE_OUT_IFP */
if (options & F_SO_DEBUG)
(void)setsockopt(s, SOL_SOCKET, SO_DEBUG, (char *)&hold,
sizeof(hold));
err(EX_OSERR, "setsockopt SO_TIMESTAMP");
}
#endif
+ if (sweepmax) {
+ if (sweepmin >= sweepmax)
+ errx(EX_USAGE, "Maximum packet size must be greater than the minimum packet size");
+
+ if (datalen != DEFDATALEN)
+ errx(EX_USAGE, "Packet size and ping sweep are mutually exclusive");
+
+ if (npackets > 0) {
+ snpackets = npackets;
+ npackets = 0;
+ } else
+ snpackets = 1;
+ datalen = sweepmin;
+ send_len = icmp_len + sweepmin;
+ }
+ if (options & F_SWEEP && !sweepmax)
+ errx(EX_USAGE, "Maximum sweep size must be specified");
/*
* When pinging the broadcast address, you can get a lot of answers.
inet_ntoa(to->sin_addr));
if (source)
(void)printf(" from %s", shostname);
- (void)printf(": %d data bytes\n", datalen);
- } else
- (void)printf("PING %s: %d data bytes\n", hostname, datalen);
+ if (sweepmax)
+ (void)printf(": (%d ... %d) data bytes\n",
+ sweepmin, sweepmax);
+ else
+ (void)printf(": %d data bytes\n", datalen);
+
+ } else {
+ if (sweepmax)
+ (void)printf("PING %s: (%d ... %d) data bytes\n",
+ hostname, sweepmin, sweepmax);
+ else
+ (void)printf("PING %s: %d data bytes\n", hostname, datalen);
+ }
/*
* Use sigaction() instead of signal() to get unambiguous semantics,
break;
}
if (n == 0 || options & F_FLOOD) {
+ if (sweepmax && sntransmitted == snpackets) {
+ for (i = 0; i < sweepincr ; ++i)
+ *datap++ = i;
+ datalen += sweepincr;
+ if (datalen > sweepmax)
+ break;
+ send_len = icmp_len + datalen;
+ sntransmitted = 0;
+ }
if (!npackets || ntransmitted < npackets)
pinger();
else {
intvl.tv_sec = 2 * tmax / 1000;
if (!intvl.tv_sec)
intvl.tv_sec = 1;
- } else
- intvl.tv_sec = MAXWAIT;
+ } else {
+ intvl.tv_sec = waittime / 1000;
+ intvl.tv_usec = waittime % 1000 * 1000;
+ }
}
(void)gettimeofday(&last, NULL);
if (ntransmitted - nreceived - 1 > nmissedmax) {
nmissedmax = ntransmitted - nreceived - 1;
if (options & F_MISSED)
(void)write(STDOUT_FILENO, &BBELL, 1);
+ if (!(options & F_QUIET))
+ printf("Request timeout for icmp_seq %ld\n", ntransmitted - 2);
}
}
}
pinger(void)
{
struct timeval now;
+ struct tv32 tv32;
struct ip *ip;
struct icmp *icp;
int cc, i;
if ((options & F_TIME) || timing) {
(void)gettimeofday(&now, NULL);
+ tv32.tv32_sec = htonl(now.tv_sec);
+ tv32.tv32_usec = htonl(now.tv_usec);
if (options & F_TIME)
icp->icmp_otime = htonl((now.tv_sec % (24*60*60))
* 1000 + now.tv_usec / 1000);
if (timing)
- bcopy((void *)&now,
+ bcopy((void *)&tv32,
(void *)&outpack[ICMP_MINLEN + phdr_len],
- sizeof(struct timeval));
+ sizeof(tv32));
}
cc = ICMP_MINLEN + phdr_len + datalen;
}
}
ntransmitted++;
+ sntransmitted++;
if (!(options & F_QUIET) && options & F_FLOOD)
(void)write(STDOUT_FILENO, &DOT, 1);
}
triptime = 0.0;
if (timing) {
struct timeval tv1;
+ struct tv32 tv32;
#ifndef icmp_data
tp = &icp->icmp_ip;
#else
if (cc - ICMP_MINLEN - phdr_len >= sizeof(tv1)) {
/* Copy to avoid alignment problems: */
- memcpy(&tv1, tp, sizeof(tv1));
+ memcpy(&tv32, tp, sizeof(tv32));
+ tv1.tv_sec = ntohl(tv32.tv32_sec);
+ tv1.tv_usec = ntohl(tv32.tv32_usec);
tvsub(tv, &tv1);
triptime = ((double)tv->tv_sec) * 1000.0 +
((double)tv->tv_usec) / 1000.0;
if (options & F_QUIET)
return;
+
+ if (options & F_WAITTIME && triptime > waittime) {
+ ++nrcvtimeout;
+ return;
+ }
if (options & F_FLOOD)
(void)write(STDOUT_FILENO, &BSPACE, 1);
(void)printf(" ttl=%d", ip->ip_ttl);
if (timing)
(void)printf(" time=%.3f ms", triptime);
- if (dupflag)
- (void)printf(" (DUP!)");
+ if (dupflag) {
+ if (!IN_MULTICAST(ntohl(whereto.sin_addr.s_addr)))
+ (void)printf(" (DUP!)");
+ }
if (options & F_AUDIBLE)
(void)write(STDOUT_FILENO, &BBELL, 1);
if (options & F_MASK) {
if (siginfo_p) {
siginfo_p = 0;
- (void)fprintf(stderr, "\r%ld/%ld packets received (%.0f%%)",
+ (void)fprintf(stderr, "\r%ld/%ld packets received (%.1f%%)",
nreceived, ntransmitted,
ntransmitted ? nreceived * 100.0 / ntransmitted : 0.0);
if (nreceived && timing)
if (nreceived > ntransmitted)
(void)printf("-- somebody's printing up packets!");
else
- (void)printf("%d%% packet loss",
- (int)(((ntransmitted - nreceived) * 100) /
- ntransmitted));
+ (void)printf("%.1f%% packet loss",
+ ((ntransmitted - nreceived) * 100.0) /
+ ntransmitted);
}
+ if (nrcvtimeout)
+ (void)printf(", %ld packets out of wait time", nrcvtimeout);
(void)putchar('\n');
if (nreceived && timing) {
double n = nreceived + nrepeats;
usage()
{
- (void)fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n",
-"usage: ping [-AaDdfnoQqRrv] [-c count] [-i wait] [-l preload] [-M mask | time]",
-" [-m ttl]" SECOPT " [-p pattern] [-S src_addr] [-s packetsize]",
-" [-t timeout] [-z tos] host",
+ (void)fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
+"usage: ping [-AaDdfnoQqRrv] [-b boundif] [-c count] [-G sweepmaxsize] [-g sweepminsize]",
+" [-h sweepincrsize] [-i wait] [-l preload] [-M mask | time] [-m ttl]",
+" " SECOPT " [-p pattern] [-S src_addr] [-s packetsize] [-t timeout]",
+" [-W waittime] [-z tos] host",
" ping [-AaDdfLnoQqRrv] [-c count] [-I iface] [-i wait] [-l preload]",
" [-M mask | time] [-m ttl]" SECOPT " [-p pattern] [-S src_addr]",
-" [-s packetsize] [-T ttl] [-t timeout] [-z tos] mcast-group");
+" [-s packetsize] [-T ttl] [-t timeout] [-W waittime]",
+" [-z tos] mcast-group");
exit(EX_USAGE);
}
+++ /dev/null
-Project = ping6
-Install_Dir = /sbin
-
-CFILES = ping6.c md5.c
-HFILES = md5.h
-MANPAGES = ping6.8
-
-Extra_CC_Flags = -mdynamic-no-pic -dead_strip \
- -DINET6 -DIPSEC_DEBUG -DKAME_SCOPEID -DIPSEC
-Extra_LD_Flags = -lipsec
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
-
-Install_Program_Mode = 04555
-.\" $KAME: ping6.8,v 1.43 2001/06/28 06:54:29 suz Exp $
+.\" $KAME: ping6.8,v 1.58 2003/06/20 12:00:22 itojun Exp $
.\"
.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
.\" All rights reserved.
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/sbin/ping6/ping6.8,v 1.3.2.8 2001/07/06 08:56:46 ume Exp $
+.\" $FreeBSD: src/sbin/ping6/ping6.8,v 1.24 2007/11/20 01:58:34 dd Exp $
.\"
-.Dd May 17, 1998
+.Dd November 15, 2007
.Dt PING6 8
.Os
.Sh NAME
.Sh SYNOPSIS
.Nm
.\" without ipsec, or new ipsec
-.Op Fl dfHnNqRtvwW
+.Op Fl dfHmnNoqtvwW
.\" old ipsec
-.\" .Op Fl AdEfnNqRtvwW
+.\" .Op Fl AdEfmnNqRtvwW
.Bk -words
.Op Fl a Ar addrtype
.Ek
.Op Fl c Ar count
.Ek
.Bk -words
+.Op Fl g Ar gateway
+.Ek
+.Bk -words
.Op Fl h Ar hoplimit
.Ek
.Bk -words
.Op Fl l Ar preload
.Ek
.Bk -words
-.Op Fl p Ar pattern
-.Ek
-.Bk -words
.\" new ipsec
.Op Fl P Ar policy
.Ek
.Bk -words
+.Op Fl p Ar pattern
+.Ek
+.Bk -words
.Op Fl S Ar sourceaddr
.Ek
.Bk -words
.Op Fl s Ar packetsize
.Ek
.Bk -words
-.Op Ar hops...\&
+.Op Fl z Ar tclass
+.Ek
+.Bk -words
+.Op Ar hops ...
.Ek
.Bk -words
.Ar host
.Ek
.Sh DESCRIPTION
+The
.Nm
-uses the
+utility uses the
.Tn ICMPv6
protocol's mandatory
.Tn ICMP6_ECHO_REQUEST
.\" old ipsec
.\" .It Fl A
.\" Enables transport-mode IPsec authentication header
-.\" .Pq experimental .
+.\" (experimental).
.It Fl a Ar addrtype
Generate ICMPv6 Node Information Node Addresses query, rather than echo-request.
.Ar addrtype
must be a string constructed of the following characters.
.Bl -tag -width Ds -compact
.It Ic a
-requests all the responder's unicast addresses.
+requests unicast addresses from all of the responder's interfaces.
If the character is omitted,
only those addresses which belong to the interface which has the
responder's address are requests.
Set socket buffer size.
.It Fl c Ar count
Stop after sending
-.Pq and receiving
+(and receiving)
.Ar count
.Tn ECHO_RESPONSE
packets.
option on the socket being used.
.\" .It Fl E
.\" Enables transport-mode IPsec encapsulated security payload
-.\" .Pq experimental .
+.\" (experimental).
.It Fl f
Flood ping.
Outputs packets as fast as they come back or one hundred times per second,
For every
.Tn ECHO_REQUEST
sent a period
-.Dq .\&
+.Dq \&.
is printed, while for every
.Tn ECHO_REPLY
received a backspace is printed.
.Bf -emphasis
This can be very hard on a network and should be used with caution.
.Ef
+.It Fl g Ar gateway
+Specifies to use
+.Ar gateway
+as the next hop to the destination.
+The gateway must be a neighbor of the sending node.
.It Fl H
Specifies to try reverse-lookup of IPv6 addresses.
The
.Nm
-command does not try reverse-lookup unless the option is specified.
+utility does not try reverse-lookup unless the option is specified.
.It Fl h Ar hoplimit
Set the IPv6 hoplimit.
.It Fl I Ar interface
sends that many packets as fast as possible before falling into its normal
mode of behavior.
Only the super-user may use this option.
+.It Fl m
+By default,
+.Nm
+asks the kernel to fragment packets to fit into the minimum IPv6 MTU.
+The
+.Fl m
+option
+will suppress the behavior in the following two levels:
+when the option is specified once, the behavior will be disabled for
+unicast packets.
+When the option is more than once, it will be disabled for both
+unicast and multicast packets.
.It Fl n
Numeric output only.
No attempt will be made to lookup symbolic names from addresses in the reply.
.Pq Li ff02::2:xxxx:xxxx .
.Ar host
must be string hostname of the target
-.Pq must not be a numeric IPv6 address .
+(must not be a numeric IPv6 address).
Node information multicast group will be computed based on given
.Ar host ,
and will be used as the final destination.
Since node information multicast group is a link-local multicast group,
-destination link needs to be specified by
+outgoing interface needs to be specified by
.Fl I
option.
+.It Fl o
+Exit successfully after receiving one reply packet.
.It Fl p Ar pattern
You may specify up to 16
.Dq pad
Quiet output.
Nothing is displayed except the summary lines at startup time and
when finished.
-.It Fl R
-Make the kernel believe that the target
-.Ar host
-.Po
-or the first
-.Ar hop
-if you specify
-.Ar hops
-.Pc
-is reachable, by injecting upper-layer reachability confirmation hint.
-The option is meaningful only if the target
-.Ar host
-.Pq or the first hop
-is a neighbor.
.It Fl S Ar sourceaddr
Specifies the source address of request packets.
-The source address must be one of the unicast addresses of the sending node.
-If the outgoing interface is specified by the
-.Fl I
-option as well,
-.Ar sourceaddr
-needs to be an address assigned to the specified interface.
+The source address must be one of the unicast addresses of the sending node,
+and must be numeric.
.It Fl s Ar packetsize
Specifies the number of data bytes to be sent.
The default is 56, which translates into 64
has no effect if
.Fl w
is specified.
+.It Fl z Ar tclass
+Use the specified traffic class.
.It Ar hops
IPv6 addresses for intermediate nodes,
which will be put into type 0 routing header.
.It Ar host
-IPv6 adddress of the final destination node.
+IPv6 address of the final destination node.
.El
.Pp
When using
loss calculation, although the round trip time of these packets is used
in calculating the round-trip time statistics.
When the specified number of packets have been sent
-.Pq and received
+(and received)
or if the program is terminated with a
.Dv SIGINT ,
a brief summary is displayed, showing the number of packets sent and
-received, and the minimum, maximum, mean, and standard deviation of
+received, and the minimum, mean, maximum, and standard deviation of
the round-trip times.
.Pp
+If
+.Nm
+receives a
+.Dv SIGINFO
+(see the
+.Cm status
+argument for
+.Xr stty 1 )
+signal, the current number of packets sent and received, and the
+minimum, mean, maximum, and standard deviation of the round-trip times
+will be written to the standard output in the same format as the
+standard completion message.
+.Pp
This program is intended for use in network testing, measurement and
management.
Because of the load it can impose on the network, it is unwise to use
.\" When a
.\" .Ar packetsize
.\" is given, this indicated the size of this extra piece of data
-.\" .Pq the default is 56 .
+.\" (the default is 56).
.\" Thus the amount of data received inside of an IP packet of type
.\" .Tn ICMP
.\" .Tn ECHO_REPLY
.\" will always be 8 bytes more than the requested data space
-.\" .Pq the Tn ICMP header .
+.\" (the
+.\" .Tn ICMP
+.\" header).
.\" .Pp
.\" If the data space is at least eight bytes large,
.\" .Nm
.\" If less than eight bytes of pad are specified, no round trip times are
.\" given.
.Sh DUPLICATE AND DAMAGED PACKETS
+The
.Nm
-will report duplicate and damaged packets.
+utility will report duplicate and damaged packets.
Duplicate packets should never occur when pinging a unicast address,
and seem to be caused by
inappropriate link-level retransmissions.
Duplicates may occur in many situations and are rarely
-.Pq if ever
+(if ever)
a good sign, although the presence of low levels of duplicates may not
always be cause for alarm.
Duplicates are expected when pinging a broadcast or multicast address,
indicate broken hardware somewhere in the
.Nm
packet's path
-.Pq in the network or in the hosts .
+(in the network or in the hosts).
.Sh TRYING DIFFERENT DATA PATTERNS
The
(inter)network
.Fl p
option of
.Nm .
-.Sh RETURN VALUES
+.Sh EXIT STATUS
+The
.Nm
-returns 0 on success (the host is alive),
+utility returns 0 on success (the host is alive),
and non-zero if the arguments are incorrect or the host is not responding.
.Sh EXAMPLES
Normally,
-.Xr ping6 8
+.Nm
works just like
.Xr ping 8
would work; the following will send ICMPv6 echo request to
.Bd -literal -offset indent
ping6 -a agl dst.foo.com
.Ed
-.Pp
.Sh SEE ALSO
.Xr netstat 1 ,
.Xr icmp6 4 ,
.Rs
.%A Matt Crawford
.%T "IPv6 Node Information Queries"
-.%N draft-ietf-ipngwg-icmp-name-lookups-07.txt
-.%D August 2000
+.%N draft-ietf-ipngwg-icmp-name-lookups-09.txt
+.%D May 2002
.%O work in progress material
.Re
+.Sh HISTORY
+The
+.Xr ping 8
+utility appeared in
+.Bx 4.3 .
+The
+.Nm
+utility with IPv6 support first appeared in the WIDE Hydrangea IPv6
+protocol stack kit.
+.Pp
+IPv6 and IPsec support based on the KAME Project
+.Pq Pa http://www.kame.net/
+stack was initially integrated into
+.Fx 4.0 .
.Sh BUGS
+The
+.Nm
+utility
+is intentionally separate from
+.Xr ping 8 .
+.Pp
There have been many discussions on why we separate
-.Xr ping6 8
+.Nm
and
.Xr ping 8 .
Some people argued that it would be more convenient to uniform the
.Fl 4
option (or something like those) to specify the particular address family.
This essentially means that we have two different commands.
-.Sh HISTORY
-The
-.Xr ping 8
-command appeared in
-.Bx 4.3 .
-The
-.Nm
-command with IPv6 support first appeared in WIDE Hydrangea IPv6 protocol stack
-kit.
-.Pp
-IPv6 and IPsec support based on the KAME Project (http://www.kame.net/) stack
-was initially integrated into
-.Fx 4.0
-/* $KAME: ping6.c,v 1.126 2001/05/17 03:39:08 itojun Exp $ */
+/* $KAME: ping6.c,v 1.169 2003/07/25 06:01:47 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#ifndef lint
-__unused static char copyright[] =
+static const char copyright[] =
"@(#) Copyright (c) 1989, 1993\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#if 0
static char sccsid[] = "@(#)ping.c 8.1 (Berkeley) 6/5/93";
#endif
-__unused static const char rcsid[] =
- "$FreeBSD: src/sbin/ping6/ping6.c,v 1.4.2.6 2001/07/06 08:56:47 ume Exp $";
+static const char rcsid[] =
+ "$FreeBSD: src/sbin/ping6/ping6.c,v 1.29.2.1 2007/05/22 22:01:44 mtm Exp $";
#endif /* not lint */
/*
#include <err.h>
#include <errno.h>
#include <fcntl.h>
-#if defined(__OpenBSD__) || defined(__NetBSD__)
#include <math.h>
-#endif
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#ifdef HAVE_POLL_H
+#include <poll.h>
+#endif
#ifdef IPSEC
#include <netinet6/ah.h>
#include "md5.h"
#endif
+struct tv32 {
+ u_int32_t tv32_sec;
+ u_int32_t tv32_usec;
+};
+
#define MAXPACKETLEN 131072
#define IP6LEN 40
#define ICMP6ECHOLEN 8 /* icmp echo header len excluding time */
-#define ICMP6ECHOTMLEN sizeof(struct timeval)
+#define ICMP6ECHOTMLEN sizeof(struct tv32)
#define ICMP6_NIQLEN (ICMP6ECHOLEN + 8)
+# define CONTROLLEN 10240 /* ancillary data buffer size RFC3542 20.1 */
/* FQDN case, 64 bits of nonce + 32 bits ttl */
#define ICMP6_NIRLEN (ICMP6ECHOLEN + 12)
#define EXTRA 256 /* for AH and various other headers. weird. */
#define F_FQDN 0x1000
#define F_INTERFACE 0x2000
#define F_SRCADDR 0x4000
-#ifdef IPV6_REACHCONF
-#define F_REACHCONF 0x8000
-#endif
#define F_HOSTNAME 0x10000
#define F_FQDNOLD 0x20000
#define F_NIGROUP 0x40000
#define F_SUPTYPES 0x80000
#define F_NOMINMTU 0x100000
+#define F_ONCE 0x200000
#define F_NOUSERDATA (F_NODEADDR | F_FQDN | F_FQDNOLD | F_SUPTYPES)
u_int options;
#define SIN6(s) ((struct sockaddr_in6 *)(s))
+#define MAXTOS 255
+
/*
* MAX_DUP_CHK is the number of bits in received table, i.e. the maximum
* number of received sequence numbers we can keep track of. Change 128
struct addrinfo *res;
struct sockaddr_in6 dst; /* who to ping6 */
struct sockaddr_in6 src; /* src addr of this packet */
+socklen_t srclen;
int datalen = DEFDATALEN;
int s; /* socket file descriptor */
u_char outpack[MAXPACKETLEN];
char *hostname;
int ident; /* process id to identify our packets */
u_int8_t nonce[8]; /* nonce field for node information */
-struct in6_addr srcaddr;
int hoplimit = -1; /* hoplimit */
int pathmtu = 0; /* path MTU for the destination. 0 = unspec. */
long nreceived; /* # of packets we got back */
long nrepeats; /* number of duplicates */
long ntransmitted; /* sequence # for outbound packets = #sent */
+long nmissed; /* # of packet missed */
struct timeval interval = {1, 0}; /* interval between packets */
/* timing */
double tmin = 999999999.0; /* minimum round trip time */
double tmax = 0.0; /* maximum round trip time */
double tsum = 0.0; /* sum of all times, for doing average */
-#if defined(__OpenBSD__) || defined(__NetBSD__)
double tsumsq = 0.0; /* sum of all times squared, for std. dev. */
-#endif
/* for node addresses */
u_short naflags;
struct iovec smsgiov;
char *scmsg = 0;
-volatile int signo;
volatile sig_atomic_t seenalrm;
volatile sig_atomic_t seenint;
#ifdef SIGINFO
volatile sig_atomic_t seeninfo;
#endif
-int main __P((int, char *[]));
-void fill __P((char *, char *));
-int get_hoplim __P((struct msghdr *));
-int get_pathmtu __P((struct msghdr *));
-void set_pathmtu __P((int));
-struct in6_pktinfo *get_rcvpktinfo __P((struct msghdr *));
-void onsignal __P((int));
-void retransmit __P((void));
-void onint __P((int));
-size_t pingerlen __P((void));
-int pinger __P((void));
-const char *pr_addr __P((struct sockaddr *, int));
-void pr_icmph __P((struct icmp6_hdr *, u_char *));
-void pr_iph __P((struct ip6_hdr *));
-void pr_suptypes __P((struct icmp6_nodeinfo *, size_t));
-void pr_nodeaddr __P((struct icmp6_nodeinfo *, int));
-int myechoreply __P((const struct icmp6_hdr *));
-int mynireply __P((const struct icmp6_nodeinfo *));
-char *dnsdecode __P((const u_char **, const u_char *, const u_char *,
- u_char *, size_t));
-void pr_pack __P((u_char *, int, struct msghdr *));
-void pr_exthdrs __P((struct msghdr *));
-void pr_ip6opt __P((void *));
-void pr_rthdr __P((void *));
-int pr_bitrange __P((u_int32_t, int, int));
-void pr_retip __P((struct ip6_hdr *, u_char *));
-void summary __P((void));
-void tvsub __P((struct timeval *, struct timeval *));
-int setpolicy __P((int, char *));
-char *nigroup __P((char *));
-void usage __P((void));
+int rcvtclass = 0;
+
+int main(int, char *[]);
+void fill(char *, char *);
+int get_hoplim(struct msghdr *);
+int get_pathmtu(struct msghdr *);
+int get_tclass(struct msghdr *);
+struct in6_pktinfo *get_rcvpktinfo(struct msghdr *);
+void onsignal(int);
+void retransmit(void);
+void onint(int);
+size_t pingerlen(void);
+int pinger(void);
+const char *pr_addr(struct sockaddr *, int);
+void pr_icmph(struct icmp6_hdr *, u_char *);
+void pr_iph(struct ip6_hdr *);
+void pr_suptypes(struct icmp6_nodeinfo *, size_t);
+void pr_nodeaddr(struct icmp6_nodeinfo *, int);
+int myechoreply(const struct icmp6_hdr *);
+int mynireply(const struct icmp6_nodeinfo *);
+char *dnsdecode(const u_char **, const u_char *, const u_char *,
+ char *, size_t);
+void pr_pack(u_char *, int, struct msghdr *);
+void pr_exthdrs(struct msghdr *);
+void pr_ip6opt(void *, size_t);
+void pr_rthdr(void *, size_t);
+int pr_bitrange(u_int32_t, int, int);
+void pr_retip(struct ip6_hdr *, u_char *);
+void summary(void);
+void tvsub(struct timeval *, struct timeval *);
+int setpolicy(int, char *);
+char *nigroup(char *);
+void usage(void);
int
main(argc, argv)
{
struct itimerval itimer;
struct sockaddr_in6 from;
+#ifndef HAVE_ARC4RANDOM
+ struct timeval seed;
+#endif
+#ifdef HAVE_POLL_H
+ int timeout;
+#else
struct timeval timeout, *tv;
+#endif
struct addrinfo hints;
+#ifdef HAVE_POLL_H
+ struct pollfd fdmaskp[1];
+#else
fd_set *fdmaskp;
int fdmasks;
- register int cc, i;
- int ch, fromlen, hold, packlen, preload, optval, ret_ga;
+#endif
+ int cc, i;
+ int ch, hold, packlen, preload, optval, ret_ga;
u_char *datap, *packet;
- char *e, *target, *ifname = NULL;
+ char *e, *target, *ifname = NULL, *gateway = NULL;
int ip6optlen = 0;
struct cmsghdr *scmsgp = NULL;
+ struct cmsghdr *cm;
+#if defined(SO_SNDBUF) && defined(SO_RCVBUF)
+ u_long lsockbufsize;
int sockbufsize = 0;
+#endif
int usepktinfo = 0;
struct in6_pktinfo *pktinfo = NULL;
#ifdef USE_RFC2292BIS
#endif
double intval;
size_t rthlen;
+#ifdef IPV6_USE_MIN_MTU
+ int mflag = 0;
+#endif
+ int tclass = -2; /* T_CLASS value -1 means default, so -2 means do not bother */
/* just to be sure */
- memset(&smsghdr, 0, sizeof(&smsghdr));
- memset(&smsgiov, 0, sizeof(&smsgiov));
+ memset(&smsghdr, 0, sizeof(smsghdr));
+ memset(&smsgiov, 0, sizeof(smsgiov));
preload = 0;
datap = &outpack[ICMP6ECHOLEN + ICMP6ECHOTMLEN];
#endif /*IPSEC_POLICY_IPSEC*/
#endif
while ((ch = getopt(argc, argv,
- "a:b:c:dfHh:I:i:l:mnNp:qRS:s:tvwW" ADDOPTS)) != -1) {
+ "a:b:c:dfHg:h:I:i:l:mnNop:qS:s:tvwWz:" ADDOPTS)) != -1) {
#undef ADDOPTS
switch (ch) {
case 'a':
}
case 'b':
#if defined(SO_SNDBUF) && defined(SO_RCVBUF)
- sockbufsize = atoi(optarg);
+ errno = 0;
+ e = NULL;
+ lsockbufsize = strtoul(optarg, &e, 10);
+ sockbufsize = lsockbufsize;
+ if (errno || !*optarg || *e ||
+ sockbufsize != lsockbufsize)
+ errx(1, "invalid socket buffer size");
#else
- err(1,
+ errx(1,
"-b option ignored: SO_SNDBUF/SO_RCVBUF socket options not supported");
#endif
break;
options |= F_FLOOD;
setbuf(stdout, (char *)NULL);
break;
+ case 'g':
+ gateway = optarg;
+ break;
case 'H':
options |= F_HOSTNAME;
break;
case 'h': /* hoplimit */
hoplimit = strtol(optarg, &e, 10);
+ if (*optarg == '\0' || *e != '\0')
+ errx(1, "illegal hoplimit %s", optarg);
if (255 < hoplimit || hoplimit < -1)
errx(1,
"illegal hoplimit -- %s", optarg);
if (interval.tv_sec < 0)
errx(1, "illegal timing interval %s", optarg);
/* less than 1/hz does not make sense */
- if (interval.tv_sec == 0 && interval.tv_usec < 10000) {
- warnx("too small interval, raised to 0.01");
- interval.tv_usec = 10000;
+ if (interval.tv_sec == 0 && interval.tv_usec < 1) {
+ warnx("too small interval, raised to .000001");
+ interval.tv_usec = 1;
}
options |= F_INTERVAL;
break;
break;
case 'm':
#ifdef IPV6_USE_MIN_MTU
- options |= F_NOMINMTU;
+ mflag++;
break;
#else
errx(1, "-%c is not supported on this platform", ch);
case 'N':
options |= F_NIGROUP;
break;
+ case 'o':
+ options |= F_ONCE;
+ break;
case 'p': /* fill buffer with user pattern */
options |= F_PINGFILLED;
fill((char *)datap, optarg);
case 'q':
options |= F_QUIET;
break;
- case 'R':
-#ifdef IPV6_REACHCONF
- options |= F_REACHCONF;
- break;
-#else
- errx(1, "-R is not supported in this configuration");
-#endif
case 'S':
- /* XXX: use getaddrinfo? */
- if (inet_pton(AF_INET6, optarg, (void *)&srcaddr) != 1)
- errx(1, "invalid IPv6 address: %s", optarg);
+ memset(&hints, 0, sizeof(struct addrinfo));
+ hints.ai_flags = AI_NUMERICHOST; /* allow hostname? */
+ hints.ai_family = AF_INET6;
+ hints.ai_socktype = SOCK_RAW;
+ hints.ai_protocol = IPPROTO_ICMPV6;
+
+ ret_ga = getaddrinfo(optarg, NULL, &hints, &res);
+ if (ret_ga) {
+ errx(1, "invalid source address: %s",
+ gai_strerror(ret_ga));
+ }
+ /*
+ * res->ai_family must be AF_INET6 and res->ai_addrlen
+ * must be sizeof(src).
+ */
+ memcpy(&src, res->ai_addr, res->ai_addrlen);
+ srclen = res->ai_addrlen;
+ freeaddrinfo(res);
options |= F_SRCADDR;
- usepktinfo++;
break;
case 's': /* size of packet to send */
datalen = strtol(optarg, &e, 10);
options &= ~F_NOUSERDATA;
options |= F_FQDNOLD;
break;
+ case 'z':
+ tclass = (int)strtol(optarg, &e, 10);
+ if (tclass < -1 || *optarg == '\0' || *e != '\0')
+ errx(1, "illegal TOS value -- %s", optarg);
+ if (tclass > MAXTOS)
+ errx(1,
+ "TOS value too large, maximum is %d",
+ MAXTOS);
+ rcvtclass = 1;
+ break;
#ifdef IPSEC
#ifdef IPSEC_POLICY_IPSEC
case 'P':
/*NOTREACHED*/
}
}
+
argc -= optind;
argv += optind;
target = argv[argc - 1];
/* getaddrinfo */
- bzero(&hints, sizeof(struct addrinfo));
+ memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_flags = AI_CANONNAME;
hints.ai_family = AF_INET6;
+ /* XXX getaddrinfo does like SOCK_DGRAM for IPPROTO_ICMPV6 */
hints.ai_socktype = SOCK_RAW;
hints.ai_protocol = IPPROTO_ICMPV6;
ret_ga = getaddrinfo(target, NULL, &hints, &res);
- if (ret_ga) {
- fprintf(stderr, "ping6: %s\n", gai_strerror(ret_ga));
- exit(1);
- }
+ if (ret_ga)
+ errx(1, "getaddrinfo -- %s", gai_strerror(ret_ga));
if (res->ai_canonname)
hostname = res->ai_canonname;
else
(void)memcpy(&dst, res->ai_addr, res->ai_addrlen);
- res->ai_socktype = SOCK_RAW;
+ res->ai_socktype = getuid() ? SOCK_DGRAM : SOCK_RAW;
res->ai_protocol = IPPROTO_ICMPV6;
if ((s = socket(res->ai_family, res->ai_socktype,
res->ai_protocol)) < 0)
err(1, "socket");
+ /* set the source address if specified. */
+ if ((options & F_SRCADDR) &&
+ bind(s, (struct sockaddr *)&src, srclen) != 0) {
+ err(1, "bind");
+ }
+
+ /* set the gateway (next hop) if specified */
+ if (gateway) {
+ struct addrinfo ghints, *gres;
+ int error;
+
+ memset(&ghints, 0, sizeof(ghints));
+ ghints.ai_family = AF_INET6;
+ ghints.ai_socktype = SOCK_RAW;
+ ghints.ai_protocol = IPPROTO_ICMPV6;
+
+ error = getaddrinfo(gateway, NULL, &hints, &gres);
+ if (error) {
+ errx(1, "getaddrinfo for the gateway %s: %s",
+ gateway, gai_strerror(error));
+ }
+ if (gres->ai_next && (options & F_VERBOSE))
+ warnx("gateway resolves to multiple addresses");
+
+ if (setsockopt(s, IPPROTO_IPV6, IPV6_NEXTHOP,
+ gres->ai_addr, gres->ai_addrlen)) {
+ err(1, "setsockopt(IPV6_NEXTHOP)");
+ }
+
+ freeaddrinfo(gres);
+ }
+
/*
* let the kerel pass extension headers of incoming packets,
* for privileged socket options
seteuid(getuid());
setuid(getuid());
- if (options & F_FLOOD && options & F_INTERVAL)
+ if ((options & F_FLOOD) && (options & F_INTERVAL))
errx(1, "-f and -i incompatible options");
if ((options & F_NOUSERDATA) == 0) {
- if (datalen >= sizeof(struct timeval)) {
+ if (datalen >= sizeof(struct tv32)) {
/* we can time transfer */
timing = 1;
} else
*datap++ = i;
ident = getpid() & 0xFFFF;
-#ifndef __OpenBSD__
- gettimeofday(&timeout, NULL);
- srand((unsigned int)(timeout.tv_sec ^ timeout.tv_usec ^ (long)ident));
+#ifndef HAVE_ARC4RANDOM
+ gettimeofday(&seed, NULL);
+ srand((unsigned int)(seed.tv_sec ^ seed.tv_usec ^ (long)ident));
memset(nonce, 0, sizeof(nonce));
for (i = 0; i < sizeof(nonce); i += sizeof(int))
*((int *)&nonce[i]) = rand();
&optval, sizeof(optval)) == -1)
err(1, "IPV6_MULTICAST_HOPS");
#ifdef IPV6_USE_MIN_MTU
- if ((options & F_NOMINMTU) == 0) {
- optval = 1;
+ if (mflag != 1) {
+ optval = mflag > 1 ? 0 : 1;
+
if (setsockopt(s, IPPROTO_IPV6, IPV6_USE_MIN_MTU,
&optval, sizeof(optval)) == -1)
err(1, "setsockopt(IPV6_USE_MIN_MTU)");
#endif
}
+ if (tclass != -2) {
+ int on = 1;
+
+ if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVTCLASS, &on, sizeof(on)))
+ err(1, "setsockopt(IPV6_RECVTCLASS)");
+
+ if (setsockopt(s, IPPROTO_IPV6, IPV6_TCLASS, &tclass, sizeof(tclass)))
+ err(1, "setsockopt(IPV6_TCLASS)");
+ }
+
/*
optval = 1;
if (IN6_IS_ADDR_MULTICAST(&dst.sin6_addr))
if (hoplimit != -1)
ip6optlen += CMSG_SPACE(sizeof(int));
-#ifdef IPV6_REACHCONF
- if (options & F_REACHCONF)
- ip6optlen += CMSG_SPACE(0);
-#endif
+ if (tclass != -2)
+ ip6optlen += CMSG_SPACE(sizeof(int));
/* set IP6 packet options */
if (ip6optlen) {
errx(1, "%s: invalid interface name", ifname);
#endif
}
- /* set the source address */
- if (options & F_SRCADDR)/* pktinfo must be valid */
- pktinfo->ipi6_addr = srcaddr;
-
if (hoplimit != -1) {
scmsgp->cmsg_len = CMSG_LEN(sizeof(int));
scmsgp->cmsg_level = IPPROTO_IPV6;
scmsgp = CMSG_NXTHDR(&smsghdr, scmsgp);
}
-#ifdef IPV6_REACHCONF
- if (options & F_REACHCONF) {
- scmsgp->cmsg_len = CMSG_LEN(0);
- scmsgp->cmsg_level = IPPROTO_IPV6;
- scmsgp->cmsg_type = IPV6_REACHCONF;
-
- scmsgp = CMSG_NXTHDR(&smsghdr, scmsgp);
- }
-#endif
if (argc > 1) { /* some intermediate addrs are specified */
int hops, error;
scmsgp = CMSG_NXTHDR(&smsghdr, scmsgp);
}
- {
+ if (tclass != -2) {
+ scmsgp->cmsg_len = CMSG_LEN(sizeof(int));
+ scmsgp->cmsg_level = IPPROTO_IPV6;
+ scmsgp->cmsg_type = IPV6_TCLASS;
+ *(int *)(CMSG_DATA(scmsgp)) = tclass;
+
+ scmsgp = CMSG_NXTHDR(&smsghdr, scmsgp);
+ }
+
+ if (!(options & F_SRCADDR)) {
/*
- * source selection
+ * get the source address. XXX since we revoked the root
+ * privilege, we cannot use a raw socket for this.
*/
int dummy;
socklen_t len = sizeof(src);
err(1, "UDP setsockopt(IPV6_PKTINFO)");
if (hoplimit != -1 &&
- setsockopt(dummy, IPPROTO_IPV6, IPV6_HOPLIMIT,
+ setsockopt(dummy, IPPROTO_IPV6, IPV6_UNICAST_HOPS,
(void *)&hoplimit, sizeof(hoplimit)))
- err(1, "UDP setsockopt(IPV6_HOPLIMIT)");
+ err(1, "UDP setsockopt(IPV6_UNICAST_HOPS)");
+
+ if (hoplimit != -1 &&
+ setsockopt(dummy, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
+ (void *)&hoplimit, sizeof(hoplimit)))
+ err(1, "UDP setsockopt(IPV6_MULTICAST_HOPS)");
if (rthdr &&
setsockopt(dummy, IPPROTO_IPV6, IPV6_RTHDR,
#else /* old adv. API */
if (setsockopt(s, IPPROTO_IPV6, IPV6_HOPLIMIT, &optval,
sizeof(optval)) < 0)
- warn("setsockopt(IPV6_HOPLIMIT)"); /* XXX err? */
+ warn("setsockopt(IPV6_HOPLIMIT, %d, %u)", optval, sizeof(optval)); /* XXX err? */
#endif
printf("PING6(%lu=40+8+%lu bytes) ", (unsigned long)(40 + pingerlen()),
itimer.it_interval = interval;
itimer.it_value = interval;
(void)setitimer(ITIMER_REAL, &itimer, NULL);
- retransmit();
+ if (ntransmitted == 0)
+ retransmit();
}
+#ifndef HAVE_POLL_H
fdmasks = howmany(s + 1, NFDBITS) * sizeof(fd_mask);
if ((fdmaskp = malloc(fdmasks)) == NULL)
err(1, "malloc");
+#endif
- signo = seenalrm = seenint = 0;
+ seenalrm = seenint = 0;
#ifdef SIGINFO
seeninfo = 0;
#endif
+ /* For control (ancillary) data received from recvmsg() */
+ cm = (struct cmsghdr *)malloc(CONTROLLEN);
+ if (cm == NULL)
+ err(1, "malloc");
+
for (;;) {
struct msghdr m;
- struct cmsghdr *cm;
- u_char buf[1024];
struct iovec iov[2];
/* signal handling */
if (seenalrm) {
+ if (ntransmitted - nreceived > nmissed) {
+ nmissed++;
+ if (!(options & F_QUIET))
+ printf("Request timeout for icmp_seq=%ld\n", ntransmitted - 1);
+ }
retransmit();
seenalrm = 0;
continue;
if (options & F_FLOOD) {
(void)pinger();
+#ifdef HAVE_POLL_H
+ timeout = 10;
+#else
timeout.tv_sec = 0;
timeout.tv_usec = 10000;
tv = &timeout;
- } else
+#endif
+ } else {
+#ifdef HAVE_POLL_H
+ timeout = INFTIM;
+#else
tv = NULL;
+#endif
+ }
+#ifdef HAVE_POLL_H
+ fdmaskp[0].fd = s;
+ fdmaskp[0].events = POLLIN;
+ cc = poll(fdmaskp, 1, timeout);
+#else
memset(fdmaskp, 0, fdmasks);
FD_SET(s, fdmaskp);
cc = select(s + 1, fdmaskp, NULL, NULL, tv);
+#endif
if (cc < 0) {
if (errno != EINTR) {
+#ifdef HAVE_POLL_H
+ warn("poll");
+#else
warn("select");
+#endif
sleep(1);
}
continue;
} else if (cc == 0)
continue;
- fromlen = sizeof(from);
m.msg_name = (caddr_t)&from;
m.msg_namelen = sizeof(from);
memset(&iov, 0, sizeof(iov));
iov[0].iov_len = packlen;
m.msg_iov = iov;
m.msg_iovlen = 1;
- cm = (struct cmsghdr *)buf;
- m.msg_control = (caddr_t)buf;
- m.msg_controllen = sizeof(buf);
+ memset(cm, 0, CONTROLLEN);
+ m.msg_control = (void *)cm;
+ m.msg_controllen = CONTROLLEN;
cc = recvmsg(s, &m, 0);
if (cc < 0) {
printf("new path MTU (%d) is "
"notified\n", mtu);
}
- set_pathmtu(mtu);
}
continue;
} else {
*/
pr_pack(packet, cc, &m);
}
- if (npackets && nreceived >= npackets)
+ if (((options & F_ONCE) != 0 && nreceived > 0) ||
+ (npackets > 0 && nreceived >= npackets))
break;
}
summary();
onsignal(sig)
int sig;
{
- signo = sig;
+
switch (sig) {
case SIGALRM:
seenalrm++;
icp->icmp6_code = 0;
icp->icmp6_id = htons(ident);
icp->icmp6_seq = ntohs(seq);
- if (timing)
- (void)gettimeofday((struct timeval *)
- &outpack[ICMP6ECHOLEN], NULL);
+ if (timing) {
+ struct timeval tv;
+ struct tv32 *tv32;
+ (void)gettimeofday(&tv, NULL);
+ tv32 = (struct tv32 *)&outpack[ICMP6ECHOLEN];
+ tv32->tv32_sec = htonl(tv.tv_sec);
+ tv32->tv32_usec = htonl(tv.tv_usec);
+ }
cc = ICMP6ECHOLEN + datalen;
}
const u_char **sp;
const u_char *ep;
const u_char *base; /*base for compressed name*/
- u_char *buf;
+ char *buf;
size_t bufsiz;
{
int i;
return NULL;
comp = base + (i & 0x3f);
- if (dnsdecode(&comp, cp, base, (u_char *)cresult,
+ if (dnsdecode(&comp, cp, base, cresult,
sizeof(cresult)) == NULL)
return NULL;
- if (strlcat((char *)buf, cresult, bufsiz) >= bufsiz)
+ if (strlcat(buf, cresult, bufsiz) >= bufsiz)
return NULL; /*result overrun*/
break;
} else if ((i & 0x3f) == i) {
while (i-- > 0 && cp < ep) {
l = snprintf(cresult, sizeof(cresult),
isprint(*cp) ? "%c" : "\\%03o", *cp & 0xff);
- if (l >= sizeof(cresult))
+ if (l >= sizeof(cresult) || l < 0)
return NULL;
- if (strlcat((char *)buf, cresult, bufsiz) >= bufsiz)
+ if (strlcat(buf, cresult, bufsiz) >= bufsiz)
return NULL; /*result overrun*/
cp++;
}
return NULL; /*not terminated*/
cp++;
*sp = cp;
- return (char *)buf;
+ return buf;
}
/*
int fromlen;
u_char *cp = NULL, *dp, *end = buf + cc;
struct in6_pktinfo *pktinfo = NULL;
- struct timeval tv, *tp;
+ struct timeval tv, tp;
+ struct tv32 *tpp;
double triptime = 0;
int dupflag;
size_t off;
int oldfqdn;
u_int16_t seq;
char dnsname[NS_MAXDNAME + 1];
+ int tclass;
(void)gettimeofday(&tv, NULL);
mhdr->msg_namelen != sizeof(struct sockaddr_in6) ||
((struct sockaddr *)mhdr->msg_name)->sa_family != AF_INET6) {
if (options & F_VERBOSE)
- warnx("invalid peername\n");
+ warnx("invalid peername");
return;
}
from = (struct sockaddr *)mhdr->msg_name;
fromlen = mhdr->msg_namelen;
if (cc < sizeof(struct icmp6_hdr)) {
if (options & F_VERBOSE)
- warnx("packet too short (%d bytes) from %s\n", cc,
+ warnx("packet too short (%d bytes) from %s", cc,
pr_addr(from, fromlen));
return;
}
+ if (((mhdr->msg_flags & MSG_CTRUNC) != 0) &&
+ (options & F_VERBOSE) != 0)
+ warnx("some control data discarded, insufficient buffer size");
icp = (struct icmp6_hdr *)buf;
ni = (struct icmp6_nodeinfo *)buf;
off = 0;
return;
}
if ((pktinfo = get_rcvpktinfo(mhdr)) == NULL) {
- warnx("failed to get receiving pakcet information");
+ warnx("failed to get receiving packet information");
return;
}
-
+ if (rcvtclass && (tclass = get_tclass(mhdr)) == -1) {
+ warnx("failed to get receiving traffic class");
+ return;
+ }
+
if (icp->icmp6_type == ICMP6_ECHO_REPLY && myechoreply(icp)) {
seq = ntohs(icp->icmp6_seq);
++nreceived;
if (timing) {
- tp = (struct timeval *)(icp + 1);
- tvsub(&tv, tp);
+ tpp = (struct tv32 *)(icp + 1);
+ tp.tv_sec = ntohl(tpp->tv32_sec);
+ tp.tv_usec = ntohl(tpp->tv32_usec);
+ tvsub(&tv, &tp);
triptime = ((double)tv.tv_sec) * 1000.0 +
((double)tv.tv_usec) / 1000.0;
tsum += triptime;
-#if defined(__OpenBSD__) || defined(__NetBSD__)
tsumsq += triptime * triptime;
-#endif
if (triptime < tmin)
tmin = triptime;
if (triptime > tmax)
memset(&dstsa, 0, sizeof(dstsa));
dstsa.sin6_family = AF_INET6;
-#ifdef SIN6_LEN
dstsa.sin6_len = sizeof(dstsa);
-#endif
dstsa.sin6_scope_id = pktinfo->ipi6_ifindex;
dstsa.sin6_addr = pktinfo->ipi6_addr;
(void)printf(" dst=%s",
sizeof(dstsa)));
}
if (timing)
- (void)printf(" time=%g ms", triptime);
- if (dupflag)
- (void)printf("(DUP!)");
+ (void)printf(" time=%.3f ms", triptime);
+ if (dupflag) {
+ if (!IN6_IS_ADDR_MULTICAST(&dst.sin6_addr))
+ (void)printf("(DUP!)");
+ }
/* check the data */
cp = buf + off + ICMP6ECHOLEN + ICMP6ECHOTMLEN;
dp = outpack + ICMP6ECHOLEN + ICMP6ECHOTMLEN;
i = 0;
while (cp < end) {
if (dnsdecode((const u_char **)&cp, end,
- (const u_char *)(ni + 1), (u_char *)dnsname,
+ (const u_char *)(ni + 1), dnsname,
sizeof(dnsname)) == NULL) {
printf("???");
break;
comma++;
break;
case ICMP6_NI_UNKNOWN:
- (void)printf("unknwon qtype");
+ (void)printf("unknown qtype");
comma++;
break;
}
putchar(')');
goto fqdnend;
}
- ttl = (int32_t)ntohl(*(u_long *)&buf[off+ICMP6ECHOLEN+8]);
+ ttl = (int32_t)ntohl(*(u_int32_t *)&buf[off+ICMP6ECHOLEN+8]);
if (comma)
printf(",");
if (!(ni->ni_flags & NI_FQDN_FLAG_VALIDTTL)) {
pr_exthdrs(mhdr)
struct msghdr *mhdr;
{
+ ssize_t bufsize;
+ void *bufp;
struct cmsghdr *cm;
+ bufsize = 0;
+ bufp = mhdr->msg_control;
for (cm = (struct cmsghdr *)CMSG_FIRSTHDR(mhdr); cm;
cm = (struct cmsghdr *)CMSG_NXTHDR(mhdr, cm)) {
if (cm->cmsg_level != IPPROTO_IPV6)
continue;
+ bufsize = CONTROLLEN - ((caddr_t)CMSG_DATA(cm) - (caddr_t)bufp);
+ if (bufsize <= 0)
+ continue;
switch (cm->cmsg_type) {
case IPV6_HOPOPTS:
printf(" HbH Options: ");
- pr_ip6opt(CMSG_DATA(cm));
+ pr_ip6opt(CMSG_DATA(cm), (size_t)bufsize);
break;
case IPV6_DSTOPTS:
#ifdef IPV6_RTHDRDSTOPTS
case IPV6_RTHDRDSTOPTS:
#endif
printf(" Dst Options: ");
- pr_ip6opt(CMSG_DATA(cm));
+ pr_ip6opt(CMSG_DATA(cm), (size_t)bufsize);
break;
case IPV6_RTHDR:
printf(" Routing: ");
- pr_rthdr(CMSG_DATA(cm));
+ pr_rthdr(CMSG_DATA(cm), (size_t)bufsize);
break;
}
}
#ifdef USE_RFC2292BIS
void
-pr_ip6opt(void *extbuf)
+pr_ip6opt(void *extbuf, size_t bufsize)
{
struct ip6_hbh *ext;
int currentlen;
u_int8_t type;
- size_t extlen, len;
+ socklen_t extlen, len, origextlen;
void *databuf;
size_t offset;
u_int16_t value2;
printf("nxt %u, len %u (%lu bytes)\n", ext->ip6h_nxt,
(unsigned int)ext->ip6h_len, (unsigned long)extlen);
+ /*
+ * Bounds checking on the ancillary data buffer:
+ * subtract the size of a cmsg structure from the buffer size.
+ */
+ if (bufsize < (extlen + CMSG_SPACE(0))) {
+ origextlen = extlen;
+ extlen = bufsize - CMSG_SPACE(0);
+ warnx("options truncated, showing only %u (total=%u)",
+ (unsigned int)(extlen / 8 - 1),
+ (unsigned int)(ext->ip6h_len));
+ }
+
currentlen = 0;
while (1) {
currentlen = inet6_opt_next(extbuf, extlen, currentlen,
#else /* !USE_RFC2292BIS */
/* ARGSUSED */
void
-pr_ip6opt(void *extbuf)
+pr_ip6opt(void *extbuf, size_t bufsize __unused)
{
putchar('\n');
return;
#ifdef USE_RFC2292BIS
void
-pr_rthdr(void *extbuf)
+pr_rthdr(void *extbuf, size_t bufsize)
{
struct in6_addr *in6;
char ntopbuf[INET6_ADDRSTRLEN];
struct ip6_rthdr *rh = (struct ip6_rthdr *)extbuf;
- int i, segments;
+ int i, segments, origsegs, rthsize, size0, size1;
/* print fixed part of the header */
printf("nxt %u, len %u (%d bytes), type %u, ", rh->ip6r_nxt,
rh->ip6r_len, (rh->ip6r_len + 1) << 3, rh->ip6r_type);
- if ((segments = inet6_rth_segments(extbuf)) >= 0)
+ if ((segments = inet6_rth_segments(extbuf)) >= 0) {
printf("%d segments, ", segments);
- else
+ printf("%d left\n", rh->ip6r_segleft);
+ } else {
printf("segments unknown, ");
- printf("%d left\n", rh->ip6r_segleft);
+ printf("%d left\n", rh->ip6r_segleft);
+ return;
+ }
+
+ /*
+ * Bounds checking on the ancillary data buffer. When calculating
+ * the number of items to show keep in mind:
+ * - The size of the cmsg structure
+ * - The size of one segment (the size of a Type 0 routing header)
+ * - When dividing add a fudge factor of one in case the
+ * dividend is not evenly divisible by the divisor
+ */
+ rthsize = (rh->ip6r_len + 1) * 8;
+ if (bufsize < (rthsize + CMSG_SPACE(0))) {
+ origsegs = segments;
+ size0 = inet6_rth_space(IPV6_RTHDR_TYPE_0, 0);
+ size1 = inet6_rth_space(IPV6_RTHDR_TYPE_0, 1);
+ segments -= (rthsize - (bufsize - CMSG_SPACE(0))) /
+ (size1 - size0) + 1;
+ warnx("segments truncated, showing only %d (total=%d)",
+ segments, origsegs);
+ }
for (i = 0; i < segments; i++) {
in6 = inet6_rth_getaddr(extbuf, i);
else {
if (!inet_ntop(AF_INET6, in6, ntopbuf,
sizeof(ntopbuf)))
- strncpy(ntopbuf, "?", sizeof(ntopbuf));
+ strlcpy(ntopbuf, "?", sizeof(ntopbuf));
printf(" [%d]%s\n", i, ntopbuf);
}
}
#else /* !USE_RFC2292BIS */
/* ARGSUSED */
void
-pr_rthdr(void *extbuf)
+pr_rthdr(void *extbuf, size_t bufsize __unused)
{
putchar('\n');
return;
#endif /* USE_RFC2292BIS */
int
-pr_bitrange(v, s, ii)
+pr_bitrange(v, soff, ii)
u_int32_t v;
- int s;
+ int soff;
int ii;
{
int off;
/* shift till we have 0x01 */
if ((v & 0x01) == 0) {
if (ii > 1)
- printf("-%u", s + off - 1);
+ printf("-%u", soff + off - 1);
ii = 0;
switch (v & 0x0f) {
case 0x00:
break;
}
if (!ii)
- printf(" %u", s + off);
+ printf(" %u", soff + off);
ii += i;
v >>= i; off += i;
}
if (inet_ntop(AF_INET6, cp, ntop_buf, sizeof(ntop_buf)) ==
NULL)
- strncpy(ntop_buf, "?", sizeof(ntop_buf));
+ strlcpy(ntop_buf, "?", sizeof(ntop_buf));
printf(" %s", ntop_buf);
if (withttl) {
if (ttl == 0xffffffff) {
return(0);
}
-void
-set_pathmtu(mtu)
- int mtu;
+int
+get_tclass(mhdr)
+ struct msghdr *mhdr;
{
-#ifdef IPV6_USE_MTU
- static int firsttime = 1;
struct cmsghdr *cm;
- if (firsttime) {
- int oldlen = smsghdr.msg_controllen;
- char *oldbuf = smsghdr.msg_control;
-
- /* XXX: We need to enlarge control message buffer */
- firsttime = 0; /* prevent further enlargement */
-
- smsghdr.msg_controllen = oldlen + CMSG_SPACE(sizeof(int));
- if ((smsghdr.msg_control =
- (char *)malloc(smsghdr.msg_controllen)) == NULL)
- err(1, "set_pathmtu: malloc");
- cm = (struct cmsghdr *)CMSG_FIRSTHDR(&smsghdr);
- cm->cmsg_len = CMSG_LEN(sizeof(int));
- cm->cmsg_level = IPPROTO_IPV6;
- cm->cmsg_type = IPV6_USE_MTU;
-
- cm = (struct cmsghdr *)CMSG_NXTHDR(&smsghdr, cm);
- if (oldlen)
- memcpy((void *)cm, (void *)oldbuf, oldlen);
-
- free(oldbuf);
- }
-
- /*
- * look for a cmsgptr that points MTU structure.
- * XXX: this procedure seems redundant at this moment, but we'd better
- * keep the code generic enough for future extensions.
- */
- for (cm = CMSG_FIRSTHDR(&smsghdr); cm;
- cm = (struct cmsghdr *)CMSG_NXTHDR(&smsghdr, cm)) {
- if (cm->cmsg_len == 0) /* XXX: paranoid check */
- errx(1, "set_pathmtu: internal error");
+ for (cm = (struct cmsghdr *)CMSG_FIRSTHDR(mhdr); cm;
+ cm = (struct cmsghdr *)CMSG_NXTHDR(mhdr, cm)) {
+ if (cm->cmsg_len == 0)
+ return(-1);
if (cm->cmsg_level == IPPROTO_IPV6 &&
- cm->cmsg_type == IPV6_USE_MTU &&
+ cm->cmsg_type == IPV6_TCLASS &&
cm->cmsg_len == CMSG_LEN(sizeof(int)))
- break;
+ return(*(int *)CMSG_DATA(cm));
}
- if (cm == NULL)
- errx(1, "set_pathmtu: internal error: no space for path MTU");
-
- *(int *)CMSG_DATA(cm) = mtu;
-#endif
+ return(-1);
}
+
+
/*
* tvsub --
* Subtract 2 timeval structs: out = out - in. Out is assumed to
*/
void
tvsub(out, in)
- register struct timeval *out, *in;
+ struct timeval *out, *in;
{
if ((out->tv_usec -= in->tv_usec) < 0) {
--out->tv_sec;
(void)printf("+%ld duplicates, ", nrepeats);
if (ntransmitted) {
if (nreceived > ntransmitted)
- (void)printf("-- somebody's printing up packets!");
+ (void)printf("-- somebody's duplicating packets!");
else
- (void)printf("%d%% packet loss",
- (int) (((ntransmitted - nreceived) * 100) /
+ (void)printf("%.1f%% packet loss",
+ ((((double)ntransmitted - nreceived) * 100.0) /
ntransmitted));
}
(void)putchar('\n');
/* Only display average to microseconds */
double num = nreceived + nrepeats;
double avg = tsum / num;
-#if defined(__OpenBSD__) || defined(__NetBSD__)
double dev = sqrt(tsumsq / num - avg * avg);
(void)printf(
"round-trip min/avg/max/std-dev = %.3f/%.3f/%.3f/%.3f ms\n",
tmin, avg, tmax, dev);
-#else
- (void)printf(
- "round-trip min/avg/max = %.3f/%.3f/%.3f ms\n",
- tmin, avg, tmax);
-#endif
(void)fflush(stdout);
}
(void)fflush(stdout);
}
/*subject type*/
-static char *niqcode[] = {
+static const char *niqcode[] = {
"IPv6 address",
"DNS label", /*or empty*/
"IPv4 address",
};
/*result code*/
-static char *nircode[] = {
+static const char *nircode[] = {
"Success", "Refused", "Unknown",
};
(void)printf("Redirect\n");
if (!inet_ntop(AF_INET6, &red->nd_rd_dst, ntop_buf,
sizeof(ntop_buf)))
- strncpy(ntop_buf, "?", sizeof(ntop_buf));
+ strlcpy(ntop_buf, "?", sizeof(ntop_buf));
(void)printf("Destination: %s", ntop_buf);
if (!inet_ntop(AF_INET6, &red->nd_rd_target, ntop_buf,
sizeof(ntop_buf)))
- strncpy(ntop_buf, "?", sizeof(ntop_buf));
+ strlcpy(ntop_buf, "?", sizeof(ntop_buf));
(void)printf(" New Target: %s", ntop_buf);
break;
case ICMP6_NI_QUERY:
}
printf(", subject=%s", niqcode[ni->ni_code]);
cp = (const u_char *)(ni + 1);
- if (dnsdecode(&cp, end, NULL, (u_char *)dnsname,
+ if (dnsdecode(&cp, end, NULL, dnsname,
sizeof(dnsname)) != NULL)
printf("(%s)", dnsname);
else
(ip6->ip6_vfc & IPV6_VERSION_MASK) >> 4, tc, (u_int32_t)ntohl(flow),
ntohs(ip6->ip6_plen), ip6->ip6_nxt, ip6->ip6_hlim);
if (!inet_ntop(AF_INET6, &ip6->ip6_src, ntop_buf, sizeof(ntop_buf)))
- strncpy(ntop_buf, "?", sizeof(ntop_buf));
+ strlcpy(ntop_buf, "?", sizeof(ntop_buf));
printf("%s->", ntop_buf);
if (!inet_ntop(AF_INET6, &ip6->ip6_dst, ntop_buf, sizeof(ntop_buf)))
- strncpy(ntop_buf, "?", sizeof(ntop_buf));
+ strlcpy(ntop_buf, "?", sizeof(ntop_buf));
printf("%s\n", ntop_buf);
}
int addrlen;
{
static char buf[NI_MAXHOST];
- int flag;
+ int flag = 0;
-#ifdef NI_WITHSCOPEID
- flag = NI_WITHSCOPEID;
-#else
- flag = 0;
-#endif
if ((options & F_HOSTNAME) == 0)
flag |= NI_NUMERICHOST;
fill(bp, patp)
char *bp, *patp;
{
- register int ii, jj, kk;
+ int ii, jj, kk;
int pat[16];
char *cp;
/* xxx */
if (ii > 0)
for (kk = 0;
- kk <= MAXDATALEN - (8 + sizeof(struct timeval) + ii);
+ kk <= MAXDATALEN - (8 + sizeof(struct tv32) + ii);
kk += ii)
for (jj = 0; jj < ii; ++jj)
bp[jj + kk] = pat[jj];
errx(1, "%s", ipsec_strerror());
if (setsockopt(s, IPPROTO_IPV6, IPV6_IPSEC_POLICY, buf,
ipsec_get_policylen(buf)) < 0)
- warnx("Unable to set IPSec policy");
+ warnx("Unable to set IPsec policy");
free(buf);
return 0;
char *name;
{
char *p;
- unsigned char *q;
+ char *q;
MD5_CTX ctxt;
u_int8_t digest[16];
u_int8_t c;
strncpy(hbuf, name, l);
hbuf[(int)l] = '\0';
- for (q = (unsigned char *)name; *q; q++) {
- if (isupper(*q))
- *q = tolower(*q);
+ for (q = name; *q; q++) {
+ if (isupper(*(unsigned char *)q))
+ *q = tolower(*(unsigned char *)q);
}
/* generate 8 bytes of pseudo-random value. */
- bzero(&ctxt, sizeof(ctxt));
+ memset(&ctxt, 0, sizeof(ctxt));
MD5Init(&ctxt);
c = l & 0xff;
MD5Update(&ctxt, &c, sizeof(c));
usage()
{
(void)fprintf(stderr,
- "usage: ping6 [-dfH"
-#ifdef IPV6_USE_MIN_MTU
- "m"
+#if defined(IPSEC) && !defined(IPSEC_POLICY_IPSEC)
+ "A"
#endif
- "nNqtvwW"
-#ifdef IPV6_REACHCONF
- "R"
+ "usage: ping6 [-"
+ "d"
+#if defined(IPSEC) && !defined(IPSEC_POLICY_IPSEC)
+ "E"
#endif
-#ifdef IPSEC
-#ifdef IPSEC_POLICY_IPSEC
- "] [-P policy"
-#else
- "AE"
+ "fH"
+#ifdef IPV6_USE_MIN_MTU
+ "m"
#endif
+ "nNoqtvwW] "
+ "[-a addrtype] [-b bufsiz] [-c count] [-g gateway]\n"
+ " [-h hoplimit] [-I interface] [-i wait] [-l preload]"
+#if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC)
+ " [-P policy]"
#endif
- "] [-a [aAclsg]] [-b sockbufsiz] [-c count] \n"
- "\t[-I interface] [-i wait] [-l preload] [-p pattern] "
- "[-S sourceaddr]\n"
- "\t[-s packetsize] [-h hoplimit] [hops...] host\n");
+ "\n"
+ " [-p pattern] [-S sourceaddr] [-s packetsize] [-z tclass] "
+ "[hops ...] host\n");
exit(1);
}
+++ /dev/null
-Project = rarpd
-Install_Dir = /usr/sbin
-
-CFILES = rarpd.c
-MANPAGES = rarpd.8
-
-Extra_CC_Flags = -mdynamic-no-pic -dead_strip \
- -I. -DTFTP_DIR=\"/tftpboot\"
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
struct if_info {
int ii_fd; /* BPF file descriptor */
u_char ii_eaddr[6]; /* Ethernet address of this interface */
- u_long ii_ipaddr; /* IP address of this interface */
- u_long ii_netmask; /* subnet or net mask */
+ in_addr_t ii_ipaddr; /* IP address of this interface */
+ in_addr_t ii_netmask; /* subnet or net mask */
struct if_info *ii_next;
};
/*
struct if_info *iflist;
int rarp_open __P((char *));
-int rarp_bootable __P((u_long));
+int rarp_bootable __P((in_addr_t));
void init_one __P((char *));
void init_all __P((void));
void rarp_loop __P((void));
void lookup_eaddr __P((char *, u_char *));
-void lookup_ipaddr __P((char *, u_long *, u_long *));
+void lookup_ipaddr __P((char *, in_addr_t *, in_addr_t *));
void usage __P((void));
void rarp_process __P((struct if_info *, u_char *));
-void rarp_reply __P((struct if_info *, struct ether_header *, u_long));
-void update_arptab __P((u_char *, u_long));
+void rarp_reply __P((struct if_info *, struct ether_header *, in_addr_t));
+void update_arptab __P((u_char *, in_addr_t));
void err __P((int, const char *,...));
void debug __P((const char *,...));
-u_long ipaddrtonetmask __P((u_long));
+in_addr_t ipaddrtonetmask __P((in_addr_t));
int aflag = 0; /* listen on "all" interfaces */
int dflag = 0; /* print debugging messages */
extern char *optarg;
extern int optind, opterr;
- if (name = strrchr(argv[0], '/'))
+ if ((name = strrchr(argv[0], '/')) != NULL)
++name;
else
name = argv[0];
*/
int
rarp_bootable(addr)
- u_long addr;
+ in_addr_t addr;
{
register struct dirent *dent;
register DIR *d;
char ipname[9];
static DIR *dd = 0;
- (void) sprintf(ipname, "%08lX", addr);
+ (void) sprintf(ipname, "%08X", addr);
/* If directory is already open, rewind it. Otherwise, open it. */
- if (d = dd)
+ if ((d = dd) != NULL)
rewinddir(d);
else {
if (chdir(TFTP_DIR) == -1) {
}
dd = d;
}
- while (dent = readdir(d))
+ while ((dent = readdir(d)) != NULL)
if (strncmp(dent->d_name, ipname, 8) == 0)
return 1;
return 0;
* is on network 'net'; 'netmask' is a mask indicating the network portion
* of the address.
*/
-u_long
+in_addr_t
choose_ipaddr(alist, net, netmask)
- u_long **alist;
- u_long net;
- u_long netmask;
+ in_addr_t **alist;
+ in_addr_t net;
+ in_addr_t netmask;
{
for (; *alist; ++alist) {
if ((**alist & netmask) == net)
{
struct ether_header *ep;
struct hostent *hp;
- u_long target_ipaddr;
+ in_addr_t target_ipaddr;
char ename[256];
struct in_addr in;
err(FATAL, "cannot handle non IP addresses");
/* NOTREACHED */
}
- target_ipaddr = choose_ipaddr((u_long **) hp->h_addr_list,
+ target_ipaddr = choose_ipaddr((in_addr_t **) hp->h_addr_list,
ii->ii_ipaddr & ii->ii_netmask, ii->ii_netmask);
if (target_ipaddr == 0) {
void
lookup_ipaddr(ifname, addrp, netmaskp)
char *ifname;
- u_long *addrp;
- u_long *netmaskp;
+ in_addr_t *addrp;
+ in_addr_t *netmaskp;
{
int fd;
struct ifreq ifr;
void
update_arptab(ep, ipaddr)
u_char *ep;
- u_long ipaddr;
+ in_addr_t ipaddr;
{
//int s;
struct arpreq request;
rarp_reply(ii, ep, ipaddr)
struct if_info *ii;
struct ether_header *ep;
- u_long ipaddr;
+ in_addr_t ipaddr;
{
int n;
struct ether_arp *ap = (struct ether_arp *) (ep + 1);
* Get the netmask of an IP address. This routine is used if
* SIOCGIFNETMASK doesn't work.
*/
-u_long
+in_addr_t
ipaddrtonetmask(addr)
- u_long addr;
+ in_addr_t addr;
{
if (IN_CLASSA(addr))
return IN_CLASSA_NET;
+++ /dev/null
-Project = route
-Install_Dir = /sbin
-
-HFILES = keywords.h
-CFILES = route.c
-MANPAGES = route.8
-
-Extra_CC_Flags = -mdynamic-no-pic -dead_strip \
- -I$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders \
- -DINET6 -DIPSEC
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
-
-Install_Program_Mode = 04555
host
hopcount
iface
+ifscope
interface
ifa
ifp
/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2008 Apple Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
*
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#define K_ADD 1
{"add", K_ADD},
{"xns", K_XNS},
#define K_XRESOLVE 45
{"xresolve", K_XRESOLVE},
+#define K_IFSCOPE 46
+ {"ifscope", K_IFSCOPE},
.Op Fl n
.Ar command
.Op Fl net No \&| Fl host
+.Oo Fl ifscope
+.Ar boundif
+.Oc
.Ar destination gateway
.Op Ar netmask
.Ed
itself may be given, in which case the route remains valid even
if the local or remote addresses change.
.Pp
-The optional modifiers
-.Fl xns ,
-.Fl osi ,
-and
+For AF_INET, the
+.Fl ifscope
+modifier specifies the additional property of the route related to
+the interface scope derived from interface
+.Ar boundif .
+Such property allows for the presence of multiple route entries with
+the same destination, where each route is associated with a unique
+interface. This modifier is required in order to manipulate route
+entries marked with the RTF_IFSCOPE flag.
+.Pp
+The optional modifier
.Fl link
-specify that all subsequent addresses are in the
-.Tn XNS ,
-.Tn OSI ,
-or
-.Tn AppleTalk
-address families,
-or are specified as link-level addresses,
+specify that all subsequent addresses
+are specified as link-level addresses,
and the names must be numeric specifications rather than
symbolic names.
.Pp
/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2008 Apple Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
*
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1983, 1989, 1991, 1993
#include <net/route.h>
#include <net/if_dl.h>
#include <netinet/in.h>
-#ifndef __APPLE__
-#include <netatalk/at.h>
-#endif
-#ifdef NS
-#include <netns/ns.h>
-#endif
#include <arpa/inet.h>
#include <netdb.h>
{0, 0}
};
-struct ortentry route;
union sockunion {
struct sockaddr sa;
struct sockaddr_in sin;
#ifdef INET6
struct sockaddr_in6 sin6;
-#endif
-#ifndef __APPLE__
- struct sockaddr_at sat;
-#endif
-#ifdef NS
- struct sockaddr_ns sns;
#endif
struct sockaddr_dl sdl;
struct sockaddr_storage ss; /* added to avoid memory overrun */
int locking, lockrest, debugonly;
struct rt_metrics rt_metrics;
u_long rtm_inits;
-#ifndef __APPLE__
-int atalk_aton __P((const char *, struct at_addr *));
-char *atalk_ntoa __P((struct at_addr));
-#endif
+unsigned int ifscope;
const char *routename(), *netname();
void flushroutes(), newroute(), monitor(), sockaddr(), sodump(), bprintf();
void print_getmsg(), print_rtmsg(), pmsg_common(), pmsg_addrs(), mask_addr();
}
#define ROUNDUP(a) \
- ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
+ ((a) > 0 ? (1 + (((a) - 1) | (sizeof(uint32_t) - 1))) : sizeof(uint32_t))
#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
int
case K_INET6:
af = AF_INET6;
break;
-#endif
-#ifndef __APPLE__
- case K_ATALK:
- af = AF_APPLETALK;
- break;
-#endif
-#ifdef NS
- case K_XNS:
- af = AF_NS;
- break;
#endif
case K_LINK:
af = AF_LINK;
struct hostent *hp;
static char domain[MAXHOSTNAMELEN + 1];
static int first = 1;
-#ifdef NS
- char *ns_print();
-#endif
if (first) {
first = 0;
return(line);
}
#endif
-#ifndef __APPLE__
- case AF_APPLETALK:
- (void) snprintf(line, sizeof(line), "atalk %s",
- atalk_ntoa(((struct sockaddr_at *)sa)->sat_addr));
- break;
-#endif
-
-#ifdef NS
- case AF_NS:
- return (ns_print((struct sockaddr_ns *)sa));
-#endif
case AF_LINK:
return (link_ntoa((struct sockaddr_dl *)sa));
char *cp = 0;
static char line[MAXHOSTNAMELEN + 1];
struct netent *np = 0;
- u_long net, mask;
- register u_long i;
+ in_addr_t net, mask;
+ register in_addr_t i;
int subnetshift;
-#ifdef NS
- char *ns_print();
-#endif
switch (sa->sa_family) {
* width subnet fields.
*/
while (in.s_addr &~ mask)
- mask = (long)mask >> subnetshift;
+ mask = mask >> subnetshift;
net = in.s_addr & mask;
while ((mask & 1) == 0)
mask >>= 1, net >>= 1;
}
#endif
-#ifndef __APPLE__
- case AF_APPLETALK:
- (void) snprintf(line, sizeof(line), "atalk %s",
- atalk_ntoa(((struct sockaddr_at *)sa)->sat_addr));
- break;
-#endif
-
-#ifdef NS
- case AF_NS:
- return (ns_print((struct sockaddr_ns *)sa));
- break;
-#endif
-
case AF_LINK:
return (link_ntoa((struct sockaddr_dl *)sa));
af = AF_INET6;
aflen = sizeof(struct sockaddr_in6);
break;
-#endif
-#ifndef __APPLE__
- case K_ATALK:
- af = AF_APPLETALK;
- aflen = sizeof(struct sockaddr_at);
- break;
#endif
case K_SA:
af = PF_ROUTE;
aflen = sizeof(union sockunion);
break;
-#ifdef NS
- case K_XNS:
- af = AF_NS;
- aflen = sizeof(struct sockaddr_ns);
- break;
-#endif
case K_IFACE:
case K_INTERFACE:
iflag++;
usage((char *)NULL);
set_metric(*++argv, key);
break;
+ case K_IFSCOPE:
+ if (!--argc)
+ usage((char *)NULL);
+ if ((ifscope = if_nametoindex(*++argv)) != 0)
+ flags |= RTF_IFSCOPE;
+ else
+ errx(1, "bad interface name");
+ break;
default:
usage(1+*argv);
}
if (*gateway) {
(void) printf(": gateway %s", gateway);
if (attempts > 1 && ret == 0 && af == AF_INET)
- (void) printf(" (%s)",
- inet_ntoa(((struct sockaddr_in *)&route.rt_gateway)->sin_addr));
+ (void) printf(" (%s)", inet_ntoa(so_gate.sin.sin_addr));
}
if (ret == 0)
(void) printf("\n");
void
inet_makenetandmask(net, sin, bits)
- u_long net, bits;
+ in_addr_t net, bits;
register struct sockaddr_in *sin;
{
- u_long addr, mask = 0;
+ in_addr_t addr, mask = 0;
register char *cp;
rtm_addrs |= RTA_NETMASK;
register sup su = NULL;
struct hostent *hp;
struct netent *np;
- u_long val;
+ in_addr_t val;
char *q;
int afamily; /* local copy of af so we can change it */
}
#endif /* INET6 */
-#ifdef NS
- case AF_NS:
- if (which == RTA_DST) {
- extern short ns_bh[3];
- struct sockaddr_ns *sms = &(so_mask.sns);
- bzero((char *)sms, sizeof(*sms));
- sms->sns_family = 0;
- sms->sns_len = 6;
- sms->sns_addr.x_net = *(union ns_net *)ns_bh;
- rtm_addrs |= RTA_NETMASK;
- }
- su->sns.sns_addr = ns_addr(s);
- return (!ns_nullhost(su->sns.sns_addr));
-#endif
-
-
-#ifndef __APPLE__
- case AF_APPLETALK:
- if (!atalk_aton(s, &su->sat.sat_addr))
- errx(EX_NOHOST, "bad address: %s", s);
- rtm_addrs |= RTA_NETMASK;
- return(forcehost || su->sat.sat_addr.s_node != 0);
-#endif
-
case AF_LINK:
link_addr(s, &su->sdl);
return (1);
return len;
}
-#ifdef NS
-short ns_nullh[] = {0,0,0};
-short ns_bh[] = {-1,-1,-1};
-
-char *
-ns_print(sns)
- struct sockaddr_ns *sns;
-{
- struct ns_addr work;
- union { union ns_net net_e; u_long long_e; } net;
- u_short port;
- static char mybuf[50+MAXHOSTNAMELEN], cport[10], chost[25];
- char *host = "";
- register char *p;
- register u_char *q;
-
- work = sns->sns_addr;
- port = ntohs(work.x_port);
- work.x_port = 0;
- net.net_e = work.x_net;
- if (ns_nullhost(work) && net.long_e == 0) {
- if (!port)
- return ("*.*");
- (void) sprintf(mybuf, "*.%XH", port);
- return (mybuf);
- }
-
- if (bcmp((char *)ns_bh, (char *)work.x_host.c_host, 6) == 0)
- host = "any";
- else if (bcmp((char *)ns_nullh, (char *)work.x_host.c_host, 6) == 0)
- host = "*";
- else {
- q = work.x_host.c_host;
- (void) sprintf(chost, "%02X%02X%02X%02X%02X%02XH",
- q[0], q[1], q[2], q[3], q[4], q[5]);
- for (p = chost; *p == '0' && p < chost + 12; p++)
- /* void */;
- host = p;
- }
- if (port)
- (void) sprintf(cport, ".%XH", htons(port));
- else
- *cport = 0;
-
- (void) snprintf(mybuf, sizeof(mybuf), "%lxH.%s%s",
- (unsigned long)ntohl(net.long_e),
- host, cport);
- return (mybuf);
-}
-#endif
-
void
interfaces()
{
rtm.rtm_addrs = rtm_addrs;
rtm.rtm_rmx = rt_metrics;
rtm.rtm_inits = rtm_inits;
+ rtm.rtm_index = ifscope;
if (rtm_addrs & RTA_NETMASK)
mask_addr();
if ((rtm_addrs & RTA_DST) == 0)
return;
switch (so_dst.sa.sa_family) {
-#ifdef NS
- case AF_NS:
-#endif
case AF_INET:
#ifdef INET6
case AF_INET6:
"\011pksent\010rttvar\7rtt\6ssthresh\5sendpipe\4recvpipe\3expire\2hopcount"
"\1mtu";
char routeflags[] =
-"\1UP\2GATEWAY\3HOST\4REJECT\5DYNAMIC\6MODIFIED\7DONE\010MASK_PRESENT"
+"\1UP\2GATEWAY\3HOST\4REJECT\5DYNAMIC\6MODIFIED\7DONE\010DELCLONE"
"\011CLONING\012XRESOLVE\013LLINFO\014STATIC\015BLACKHOLE\016b016"
-"\017PROTO2\020PROTO1\021PRCLONING\022WASCLONED\023PROTO3\024CHAINDELETE"
-"\025PINNED\026LOCAL\027BROADCAST\030MULTICAST";
+"\017PROTO2\020PROTO1\021PRCLONING\022WASCLONED\023PROTO3\024b024"
+"\025PINNED\026LOCAL\027BROADCAST\030MULTICAST\031IFSCOPE";
char ifnetflags[] =
"\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5PTP\6b6\7RUNNING\010NOARP"
"\011PPROMISC\012ALLMULTI\013OACTIVE\014SIMPLEX\015LINK0\016LINK1"
break;
#endif
default:
- (void) printf("pid: %ld, seq %d, errno %d, flags:",
+ (void) printf("pid: %ld, seq %d, errno %d, ",
(long)rtm->rtm_pid, rtm->rtm_seq, rtm->rtm_errno);
+ if (rtm->rtm_flags & RTF_IFSCOPE)
+ (void) printf("ifscope %d, ", rtm->rtm_index);
+ (void) printf("flags:");
bprintf(stdout, rtm->rtm_flags, routeflags);
pmsg_common(rtm);
}
(void) printf("%s: inet %s; ",
which, inet_ntoa(su->sin.sin_addr));
break;
-#ifndef __APPLE__
- case AF_APPLETALK:
- (void) printf("%s: atalk %s; ",
- which, atalk_ntoa(su->sat.sat_addr));
- break;
-#endif
-#ifdef NS
- case AF_NS:
- (void) printf("%s: xns %s; ",
- which, ns_ntoa(su->sns.sns_addr));
- break;
-#endif
}
(void) fflush(stdout);
}
} while (cp < cplim);
sa->sa_len = cp - (char *)sa;
}
-
-#ifndef __APPLE__
-int
-atalk_aton(const char *text, struct at_addr *addr)
-{
- u_int net, node;
-
- if (sscanf(text, "%u.%u", &net, &node) != 2
- || net > 0xffff || node > 0xff)
- return(0);
- addr->s_net = htons(net);
- addr->s_node = node;
- return(1);
-}
-
-char *
-atalk_ntoa(struct at_addr at)
-{
- static char buf[20];
-
- (void) snprintf(buf, sizeof(buf), "%u.%u", ntohs(at.s_net), at.s_node);
- return(buf);
-}
-#endif
+++ /dev/null
-Project = routed
-Install_Dir = /sbin
-
-HFILES = af.h defs.h interface.h pathnames.h table.h trace.h
-CFILES = af.c defs.c if.c inet.c input.c main.c output.c startup.c\
- tables.c timer.c trace.c
-MANPAGES = routed.8
-
-Extra_CC_Flags = -mdynamic-no-pic -dead_strip \
- -I$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
+++ /dev/null
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * 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.
- * 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.
- *
- * 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.
- *
- * @(#)defs.h 8.1 (Berkeley) 6/5/93
- */
-
-
-#include "defs.h"
-
-/*
- * Address family support routines
- */
-int inet_hash(), inet_netmatch(), inet_output(),
- inet_portmatch(), inet_portcheck(),
- inet_checkhost(), inet_rtflags(), inet_sendroute(), inet_canon();
-char *inet_format();
-
-#define NIL { 0 }
-#define INET \
- { inet_hash, inet_netmatch, inet_output, \
- inet_portmatch, inet_portcheck, inet_checkhost, \
- inet_rtflags, inet_sendroute, inet_canon, \
- inet_format \
- }
-
-struct afswitch afswitch[AF_MAX] = {
- NIL, /* 0- unused */
- NIL, /* 1- Unix domain, unused */
- INET, /* Internet */
-};
-
-int af_max = sizeof(afswitch) / sizeof(afswitch[0]);
-
-struct sockaddr_in inet_default = {
-#ifdef RTM_ADD
- sizeof (inet_default),
-#endif
- AF_INET, INADDR_ANY };
-
-int
-inet_hash(sin, hp)
- register struct sockaddr_in *sin;
- struct afhash *hp;
-{
- register u_long n;
-
- n = inet_netof(sin->sin_addr);
- if (n)
- while ((n & 0xff) == 0)
- n >>= 8;
- hp->afh_nethash = n;
- hp->afh_hosthash = ntohl(sin->sin_addr.s_addr);
- hp->afh_hosthash &= 0x7fffffff;
- return 0;
-}
-
-int
-inet_netmatch(sin1, sin2)
- struct sockaddr_in *sin1, *sin2;
-{
-
- return (inet_netof(sin1->sin_addr) == inet_netof(sin2->sin_addr));
-}
-
-/*
- * Verify the message is from the right port.
- */
-int
-inet_portmatch(sin)
- register struct sockaddr_in *sin;
-{
-
- return (sin->sin_port == sp->s_port);
-}
-
-/*
- * Verify the message is from a "trusted" port.
- */
-int
-inet_portcheck(sin)
- struct sockaddr_in *sin;
-{
-
- return (ntohs(sin->sin_port) <= IPPORT_RESERVED);
-}
-
-/*
- * Internet output routine.
- */
-int
-inet_output(s, flags, sin, size)
- int s, flags;
- struct sockaddr_in *sin;
- int size;
-{
- struct sockaddr_in dst;
-
- dst = *sin;
- sin = &dst;
- if (sin->sin_port == 0)
- sin->sin_port = sp->s_port;
- if (sin->sin_len == 0)
- sin->sin_len = sizeof (*sin);
- if (sendto(s, packet, size, flags,
- (struct sockaddr *)sin, sizeof (*sin)) < 0)
- perror("sendto");
- return 0;
-}
-
-/*
- * Return 1 if the address is believed
- * for an Internet host -- THIS IS A KLUDGE.
- */
-int
-inet_checkhost(sin)
- struct sockaddr_in *sin;
-{
- u_long i = ntohl(sin->sin_addr.s_addr);
-
-#ifndef IN_EXPERIMENTAL
-#define IN_EXPERIMENTAL(i) (((long) (i) & 0xe0000000) == 0xe0000000)
-#endif
-
- if (IN_EXPERIMENTAL(i) || sin->sin_port != 0)
- return (0);
- if (i != 0 && (i & 0xff000000) == 0)
- return (0);
- for (i = 0; i < sizeof(sin->sin_zero)/sizeof(sin->sin_zero[0]); i++)
- if (sin->sin_zero[i])
- return (0);
- return (1);
-}
-
-int
-inet_canon(sin)
- struct sockaddr_in *sin;
-{
-
- sin->sin_port = 0;
- sin->sin_len = sizeof(*sin);
- return 0;
-}
-
-char *
-inet_format(sin)
- struct sockaddr_in *sin;
-{
- char *inet_ntoa();
-
- return (inet_ntoa(sin->sin_addr));
-}
+++ /dev/null
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * 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.
- * 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.
- *
- * 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.
- *
- * @(#)defs.h 8.1 (Berkeley) 6/5/93
- */
-
-/*
- * Routing table management daemon.
- */
-
-/*
- * Per address family routines.
- */
-struct afswitch {
- int (*af_hash)(); /* returns keys based on address */
- int (*af_netmatch)(); /* verifies net # matching */
- int (*af_output)(); /* interprets address for sending */
- int (*af_portmatch)(); /* packet from some other router? */
- int (*af_portcheck)(); /* packet from privileged peer? */
- int (*af_checkhost)(); /* tells if address is valid */
- int (*af_rtflags)(); /* get flags for route (host or net) */
- int (*af_sendroute)(); /* check bounds of subnet broadcast */
- int (*af_canon)(); /* canonicalize address for compares */
- char *(*af_format)(); /* convert address to string */
-};
-
-/*
- * Structure returned by af_hash routines.
- */
-struct afhash {
- u_int afh_hosthash; /* host based hash */
- u_int afh_nethash; /* network based hash */
-};
-
-extern struct afswitch afswitch[]; /* table proper */
-extern int af_max; /* number of entries in table */
+++ /dev/null
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-/* NeXT */
-#define EXTERN
-#include "defs.h"
+++ /dev/null
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright (c) 1983, 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following 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.
- *
- * 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.
- *
- * @(#)defs.h 8.1 (Berkeley) 6/5/93
- */
-
-/*
- * Internal data structure definitions for
- * user routing process. Based on Xerox NS
- * protocol specs with mods relevant to more
- * general addressing scheme.
- */
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-
-struct mbuf; /* forward reference */
-#include <net/route.h>
-#include <netinet/in.h>
-#include <protocols/routed.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <netdb.h>
-
-/* NeXT */
-#ifndef EXTERN
-#define EXTERN extern
-#endif
-
-#include "trace.h"
-#include "interface.h"
-#include "table.h"
-#include "af.h"
-
-/*
- * When we find any interfaces marked down we rescan the
- * kernel every CHECK_INTERVAL seconds to see if they've
- * come up.
- */
-#define CHECK_INTERVAL (1*60)
-
-#define equal(a1, a2) \
- (memcmp((a1), (a2), sizeof (struct sockaddr)) == 0)
-
-EXTERN struct sockaddr_in addr; /* address of daemon's socket */
-
-EXTERN int s; /* source and sink of all data */
-EXTERN int r; /* routing socket */
-EXTERN pid_t pid; /* process id for identifying messages */
-EXTERN uid_t uid; /* user id for identifying messages */
-EXTERN int seqno; /* sequence number for identifying messages */
-EXTERN int kmem;
-extern int supplier; /* process should supply updates */
-extern int install; /* if 1 call kernel */
-extern int lookforinterfaces; /* if 1 probe kernel for new up interfaces */
-EXTERN int performnlist; /* if 1 check if /vmunix has changed */
-extern int externalinterfaces; /* # of remote and local interfaces */
-EXTERN struct timeval now; /* current idea of time */
-EXTERN struct timeval lastbcast; /* last time all/changes broadcast */
-EXTERN struct timeval lastfullupdate; /* last time full table broadcast */
-EXTERN struct timeval nextbcast; /* time to wait before changes broadcast */
-EXTERN int needupdate; /* true if we need update at nextbcast */
-
-EXTERN char packet[MAXPACKETSIZE+1];
-extern struct rip *msg;
-
-EXTERN char **argv0;
-EXTERN struct servent *sp;
-
-#define ADD 1
-#define DELETE 2
-#define CHANGE 3
-
-/* arpa/inet.h */
-in_addr_t inet_addr(const char *);
-in_addr_t inet_network(const char *);
-char *inet_ntoa(struct in_addr);
-
-/* inet.c */
-struct in_addr inet_makeaddr(u_long, u_long);
-int inet_netof(struct in_addr);
-int inet_lnaof(struct in_addr);
-int inet_maskof(u_long);
-int inet_rtflags(struct sockaddr_in *);
-int inet_sendroute(struct rt_entry *, struct sockaddr_in *);
-
-/* input.c */
-void rip_input(struct sockaddr *, struct rip *, int);
-
-/* main.c */
-void timevaladd(struct timeval *, struct timeval *);
-
-/* startup.c */
-void quit(char *);
-void rt_xaddrs(caddr_t, caddr_t, struct rt_addrinfo *);
-void ifinit(void);
-void addrouteforif(struct interface *);
-void add_ptopt_localrt(struct interface *);
-void gwkludge(void);
-int getnetorhostname(char *, char *, struct sockaddr_in *);
-int gethostnameornumber(char *, struct sockaddr_in *);
-
-/* output.c */
-void toall(int (*)(), int, struct interface *);
-void sndmsg(struct sockaddr *, int, struct interface *, int);
-void supply(struct sockaddr *, int, struct interface *, int);
+++ /dev/null
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * 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.
- * 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.
- *
- * 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.
- *
- * @(#)defs.h 8.1 (Berkeley) 6/5/93
- */
-
-
-/*
- * Routing Table Management Daemon
- */
-#include "defs.h"
-
-extern struct interface *ifnet;
-
-/*
- * Find the interface with address addr.
- */
-struct interface *
-if_ifwithaddr(addr)
- struct sockaddr *addr;
-{
- register struct interface *ifp;
-
-#define same(a1, a2) \
- (memcmp((a1)->sa_data, (a2)->sa_data, 14) == 0)
- for (ifp = ifnet; ifp; ifp = ifp->int_next) {
- if (ifp->int_flags & IFF_REMOTE)
- continue;
- if (ifp->int_addr.sa_family != addr->sa_family)
- continue;
- if (same(&ifp->int_addr, addr))
- break;
- if ((ifp->int_flags & IFF_BROADCAST) &&
- same(&ifp->int_broadaddr, addr))
- break;
- }
- return (ifp);
-}
-
-/*
- * Find the point-to-point interface with destination address addr.
- */
-struct interface *
-if_ifwithdstaddr(addr)
- struct sockaddr *addr;
-{
- register struct interface *ifp;
-
- for (ifp = ifnet; ifp; ifp = ifp->int_next) {
- if ((ifp->int_flags & IFF_POINTOPOINT) == 0)
- continue;
- if (same(&ifp->int_dstaddr, addr))
- break;
- }
- return (ifp);
-}
-
-/*
- * Find the interface on the network
- * of the specified address.
- */
-struct interface *
-if_ifwithnet(addr)
- register struct sockaddr *addr;
-{
- register struct interface *ifp;
- register int af = addr->sa_family;
- register int (*netmatch)();
-
- if (af >= af_max)
- return (0);
- netmatch = afswitch[af].af_netmatch;
- for (ifp = ifnet; ifp; ifp = ifp->int_next) {
- if (ifp->int_flags & IFF_REMOTE)
- continue;
- if (af != ifp->int_addr.sa_family)
- continue;
- if ((*netmatch)(addr, &ifp->int_addr))
- break;
- }
- return (ifp);
-}
-
-/*
- * Find an interface from which the specified address
- * should have come from. Used for figuring out which
- * interface a packet came in on -- for tracing.
- */
-struct interface *
-if_iflookup(addr)
- struct sockaddr *addr;
-{
- register struct interface *ifp, *maybe;
- register int af = addr->sa_family;
- register int (*netmatch)();
-
- if (af >= af_max)
- return (0);
- maybe = 0;
- netmatch = afswitch[af].af_netmatch;
- for (ifp = ifnet; ifp; ifp = ifp->int_next) {
- if (ifp->int_addr.sa_family != af)
- continue;
- if (same(&ifp->int_addr, addr))
- break;
- if ((ifp->int_flags & IFF_BROADCAST) &&
- same(&ifp->int_broadaddr, addr))
- break;
- if ((ifp->int_flags & IFF_POINTOPOINT) &&
- same(&ifp->int_dstaddr, addr))
- break;
- if (maybe == 0 && (*netmatch)(addr, &ifp->int_addr))
- maybe = ifp;
- }
- if (ifp == 0)
- ifp = maybe;
- return (ifp);
-}
+++ /dev/null
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * 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.
- * 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.
- *
- * 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.
- *
- * @(#)defs.h 8.1 (Berkeley) 6/5/93
- */
-
-
-/*
- * Temporarily, copy these routines from the kernel,
- * as we need to know about subnets.
- */
-#include "defs.h"
-
-extern struct interface *ifnet;
-
-/*
- * Formulate an Internet address from network + host.
- */
-__private_extern__
-struct in_addr
-inet_makeaddr(net, host)
- u_long net, host;
-{
- register struct interface *ifp;
- register u_long mask;
- u_long addr;
-
- if (IN_CLASSA(net))
- mask = IN_CLASSA_HOST;
- else if (IN_CLASSB(net))
- mask = IN_CLASSB_HOST;
- else
- mask = IN_CLASSC_HOST;
- for (ifp = ifnet; ifp; ifp = ifp->int_next)
- if ((ifp->int_netmask & net) == ifp->int_net) {
- mask = ~ifp->int_subnetmask;
- break;
- }
- addr = net | (host & mask);
- addr = htonl(addr);
- return (*(struct in_addr *)&addr);
-}
-
-/*
- * Return the network number from an internet address.
- */
-__private_extern__ int
-inet_netof(in)
- struct in_addr in;
-{
- register u_long i = ntohl(in.s_addr);
- register u_long net;
- register struct interface *ifp;
-
- if (IN_CLASSA(i))
- net = i & IN_CLASSA_NET;
- else if (IN_CLASSB(i))
- net = i & IN_CLASSB_NET;
- else
- net = i & IN_CLASSC_NET;
-
- /*
- * Check whether network is a subnet;
- * if so, return subnet number.
- */
- for (ifp = ifnet; ifp; ifp = ifp->int_next)
- if ((ifp->int_netmask & net) == ifp->int_net)
- return (i & ifp->int_subnetmask);
- return (net);
-}
-
-/*
- * Return the host portion of an internet address.
- */
-int
-inet_lnaof(in)
- struct in_addr in;
-{
- register u_long i = ntohl(in.s_addr);
- register u_long net, host;
- register struct interface *ifp;
-
- if (IN_CLASSA(i)) {
- net = i & IN_CLASSA_NET;
- host = i & IN_CLASSA_HOST;
- } else if (IN_CLASSB(i)) {
- net = i & IN_CLASSB_NET;
- host = i & IN_CLASSB_HOST;
- } else {
- net = i & IN_CLASSC_NET;
- host = i & IN_CLASSC_HOST;
- }
-
- /*
- * Check whether network is a subnet;
- * if so, use the modified interpretation of `host'.
- */
- for (ifp = ifnet; ifp; ifp = ifp->int_next)
- if ((ifp->int_netmask & net) == ifp->int_net)
- return (host &~ ifp->int_subnetmask);
- return ((int)host);
-}
-
-/*
- * Return the netmask pertaining to an internet address.
- */
-int
-inet_maskof(inaddr)
- u_long inaddr;
-{
- register u_long i = ntohl(inaddr);
- register u_long mask;
- register struct interface *ifp;
-
- if (i == 0) {
- mask = 0;
- } else if (IN_CLASSA(i)) {
- mask = IN_CLASSA_NET;
- } else if (IN_CLASSB(i)) {
- mask = IN_CLASSB_NET;
- } else
- mask = IN_CLASSC_NET;
-
- /*
- * Check whether network is a subnet;
- * if so, use the modified interpretation of `host'.
- */
- for (ifp = ifnet; ifp; ifp = ifp->int_next)
- if ((ifp->int_netmask & i) == ifp->int_net)
- mask = ifp->int_subnetmask;
- return ((int)htonl(mask));
-}
-
-/*
- * Return RTF_HOST if the address is
- * for an Internet host, RTF_SUBNET for a subnet,
- * 0 for a network.
- */
-int
-inet_rtflags(sin)
- struct sockaddr_in *sin;
-{
- register u_long i = ntohl(sin->sin_addr.s_addr);
- register u_long net, host;
- register struct interface *ifp;
-
- if (IN_CLASSA(i)) {
- net = i & IN_CLASSA_NET;
- host = i & IN_CLASSA_HOST;
- } else if (IN_CLASSB(i)) {
- net = i & IN_CLASSB_NET;
- host = i & IN_CLASSB_HOST;
- } else {
- net = i & IN_CLASSC_NET;
- host = i & IN_CLASSC_HOST;
- }
-
- /*
- * Check whether this network is subnetted;
- * if so, check whether this is a subnet or a host.
- */
- for (ifp = ifnet; ifp; ifp = ifp->int_next)
- if (net == ifp->int_net) {
- if (host &~ ifp->int_subnetmask)
- return (RTF_HOST);
- else if (ifp->int_subnetmask != ifp->int_netmask)
- return (RTF_SUBNET);
- else
- return (0); /* network */
- }
- if (host == 0)
- return (0); /* network */
- else
- return (RTF_HOST);
-}
-
-/*
- * Return true if a route to subnet/host of route rt should be sent to dst.
- * Send it only if dst is on the same logical network if not "internal",
- * otherwise only if the route is the "internal" route for the logical net.
- */
-int
-inet_sendroute(rt, dst)
- struct rt_entry *rt;
- struct sockaddr_in *dst;
-{
- register u_long r =
- ntohl(((struct sockaddr_in *)&rt->rt_dst)->sin_addr.s_addr);
- register u_long d = ntohl(dst->sin_addr.s_addr);
-
- if (IN_CLASSA(r)) {
- if ((r & IN_CLASSA_NET) == (d & IN_CLASSA_NET)) {
- if ((r & IN_CLASSA_HOST) == 0)
- return ((rt->rt_state & RTS_INTERNAL) == 0);
- return (1);
- }
- if (r & IN_CLASSA_HOST)
- return (0);
- return ((rt->rt_state & RTS_INTERNAL) != 0);
- } else if (IN_CLASSB(r)) {
- if ((r & IN_CLASSB_NET) == (d & IN_CLASSB_NET)) {
- if ((r & IN_CLASSB_HOST) == 0)
- return ((rt->rt_state & RTS_INTERNAL) == 0);
- return (1);
- }
- if (r & IN_CLASSB_HOST)
- return (0);
- return ((rt->rt_state & RTS_INTERNAL) != 0);
- } else {
- if ((r & IN_CLASSC_NET) == (d & IN_CLASSC_NET)) {
- if ((r & IN_CLASSC_HOST) == 0)
- return ((rt->rt_state & RTS_INTERNAL) == 0);
- return (1);
- }
- if (r & IN_CLASSC_HOST)
- return (0);
- return ((rt->rt_state & RTS_INTERNAL) != 0);
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright (c) 1983, 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following 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.
- *
- * 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.
- *
- * @(#)defs.h 8.1 (Berkeley) 6/5/93
- */
-
-
-/*
- * Routing Table Management Daemon
- */
-#include "defs.h"
-#include <sys/syslog.h>
-
-/*
- * Process a newly received packet.
- */
-void
-rip_input(from, rip, size)
- struct sockaddr *from;
- register struct rip *rip;
- int size;
-{
- register struct rt_entry *rt;
- register struct netinfo *n;
- register struct interface *ifp;
- struct interface *if_ifwithdstaddr();
- int count, changes = 0;
- register struct afswitch *afp;
- static struct sockaddr badfrom, badfrom2;
-
- ifp = 0;
- TRACE_INPUT(ifp, from, (char *)rip, size);
- if (from->sa_family >= af_max ||
- (afp = &afswitch[from->sa_family])->af_hash == (int (*)())0) {
- syslog(LOG_INFO,
- "\"from\" address in unsupported address family (%d), cmd %d\n",
- from->sa_family, rip->rip_cmd);
- return;
- }
- if (rip->rip_vers == 0) {
- syslog(LOG_ERR,
- "RIP version 0 packet received from %s! (cmd %d)",
- (*afswitch[from->sa_family].af_format)(from), rip->rip_cmd);
- return;
- }
- switch (rip->rip_cmd) {
-
- case RIPCMD_REQUEST:
- n = rip->rip_nets;
- count = size - ((char *)n - (char *)rip);
- if (count < sizeof (struct netinfo))
- return;
- for (; count > 0; n++) {
- if (count < sizeof (struct netinfo))
- break;
- count -= sizeof (struct netinfo);
- n->rip_metric = ntohl(n->rip_metric);
- /*
- * A single entry with sa_family == AF_UNSPEC and
- * metric ``infinity'' means ``all routes''.
- * We respond to routers only if we are acting
- * as a supplier, or to anyone other than a router
- * (eg, query).
- */
- if (n->rip_dst.sa_family == AF_UNSPEC &&
- n->rip_metric == HOPCNT_INFINITY && count == 0) {
- if (supplier || (*afp->af_portmatch)(from) == 0)
- supply(from, 0, 0, 0);
- return;
- }
- if (n->rip_dst.sa_family < af_max &&
- afswitch[n->rip_dst.sa_family].af_hash)
- rt = rtlookup(&n->rip_dst);
- else
- rt = 0;
-#define min(a, b) (a < b ? a : b)
- n->rip_metric = rt == 0 ? HOPCNT_INFINITY :
- min(rt->rt_metric + 1, HOPCNT_INFINITY);
- n->rip_metric = htonl(n->rip_metric);
- }
- rip->rip_cmd = RIPCMD_RESPONSE;
- memmove(packet, rip, size);
- (*afp->af_output)(s, 0, from, size);
- return;
-
- case RIPCMD_TRACEON:
- case RIPCMD_TRACEOFF:
- /* verify message came from a privileged port */
- if ((*afp->af_portcheck)(from) == 0)
- return;
- if ((ifp = if_iflookup(from)) == 0 || (ifp->int_flags &
- (IFF_BROADCAST | IFF_POINTOPOINT | IFF_REMOTE)) == 0 ||
- ifp->int_flags & IFF_PASSIVE) {
- syslog(LOG_ERR, "trace command from unknown router, %s",
- (*afswitch[from->sa_family].af_format)(from));
- return;
- }
- ((char *)rip)[size] = '\0';
- if (rip->rip_cmd == RIPCMD_TRACEON)
- traceon(rip->rip_tracefile);
- else
- traceoff();
- return;
-
- case RIPCMD_RESPONSE:
- /* verify message came from a router */
- if ((*afp->af_portmatch)(from) == 0)
- return;
- (*afp->af_canon)(from);
- /* are we talking to ourselves? */
- ifp = if_ifwithaddr(from);
- if (ifp) {
- if (ifp->int_flags & IFF_PASSIVE) {
- syslog(LOG_ERR,
- "bogus input (from passive interface, %s)",
- (*afswitch[from->sa_family].af_format)(from));
- return;
- }
- rt = rtfind(from);
- if (rt == 0 || ((rt->rt_state & RTS_INTERFACE) == 0) &&
- rt->rt_metric >= ifp->int_metric)
- addrouteforif(ifp);
- else
- rt->rt_timer = 0;
- return;
- }
- /*
- * Update timer for interface on which the packet arrived.
- * If from other end of a point-to-point link that isn't
- * in the routing tables, (re-)add the route.
- */
- if ((rt = rtfind(from)) &&
- (rt->rt_state & (RTS_INTERFACE | RTS_REMOTE)))
- rt->rt_timer = 0;
- else if ((ifp = if_ifwithdstaddr(from)) &&
- (rt == 0 || rt->rt_metric >= ifp->int_metric))
- addrouteforif(ifp);
- /*
- * "Authenticate" router from which message originated.
- * We accept routing packets from routers directly connected
- * via broadcast or point-to-point networks,
- * and from those listed in /etc/gateways.
- */
- if ((ifp = if_iflookup(from)) == 0 || (ifp->int_flags &
- (IFF_BROADCAST | IFF_POINTOPOINT | IFF_REMOTE)) == 0 ||
- ifp->int_flags & IFF_PASSIVE) {
- if (memcmp(from, &badfrom, sizeof(badfrom)) != 0) {
- syslog(LOG_ERR,
- "packet from unknown router, %s",
- (*afswitch[from->sa_family].af_format)(from));
- badfrom = *from;
- }
- return;
- }
- size -= 4 * sizeof (char);
- n = rip->rip_nets;
- for (; size > 0; size -= sizeof (struct netinfo), n++) {
- if (size < sizeof (struct netinfo))
- break;
- n->rip_metric = ntohl(n->rip_metric);
- if (n->rip_dst.sa_family >= af_max ||
- (afp = &afswitch[n->rip_dst.sa_family])->af_hash ==
- (int (*)())0) {
- syslog(LOG_INFO,
- "route in unsupported address family (%d), from %s (af %d)\n",
- n->rip_dst.sa_family,
- (*afswitch[from->sa_family].af_format)(from),
- from->sa_family);
- continue;
- }
- if (((*afp->af_checkhost)(&n->rip_dst)) == 0) {
- syslog(LOG_DEBUG,
- "bad host in route from %s (af %d)\n",
- (*afswitch[from->sa_family].af_format)(from),
- from->sa_family);
- continue;
- }
- if (n->rip_metric == 0 ||
- (unsigned) n->rip_metric > HOPCNT_INFINITY) {
- if (memcmp(from, &badfrom2,
- sizeof(badfrom2)) != 0) {
- syslog(LOG_ERR,
- "bad metric (%d) from %s\n",
- n->rip_metric,
- (*afswitch[from->sa_family].af_format)(from));
- badfrom2 = *from;
- }
- continue;
- }
- /*
- * Adjust metric according to incoming interface.
- */
- if ((unsigned) n->rip_metric < HOPCNT_INFINITY)
- n->rip_metric += ifp->int_metric;
- if ((unsigned) n->rip_metric > HOPCNT_INFINITY)
- n->rip_metric = HOPCNT_INFINITY;
- rt = rtlookup(&n->rip_dst);
- if (rt == 0 ||
- (rt->rt_state & (RTS_INTERNAL|RTS_INTERFACE)) ==
- (RTS_INTERNAL|RTS_INTERFACE)) {
- /*
- * If we're hearing a logical network route
- * back from a peer to which we sent it,
- * ignore it.
- */
- if (rt && rt->rt_state & RTS_SUBNET &&
- (*afp->af_sendroute)(rt, from))
- continue;
- if ((unsigned)n->rip_metric < HOPCNT_INFINITY) {
- /*
- * Look for an equivalent route that
- * includes this one before adding
- * this route.
- */
- rt = rtfind(&n->rip_dst);
- if (rt && equal(from, &rt->rt_router))
- continue;
- rtadd(&n->rip_dst, from, n->rip_metric, 0);
- changes++;
- }
- continue;
- }
-
- /*
- * Update if from gateway and different,
- * shorter, or equivalent but old route
- * is getting stale.
- */
- if (equal(from, &rt->rt_router)) {
- if (n->rip_metric != rt->rt_metric) {
- rtchange(rt, from, n->rip_metric);
- changes++;
- rt->rt_timer = 0;
- if (rt->rt_metric >= HOPCNT_INFINITY)
- rt->rt_timer =
- GARBAGE_TIME - EXPIRE_TIME;
- } else if (rt->rt_metric < HOPCNT_INFINITY)
- rt->rt_timer = 0;
- } else if ((unsigned) n->rip_metric < rt->rt_metric ||
- (rt->rt_metric == n->rip_metric &&
- rt->rt_timer > (EXPIRE_TIME/2) &&
- (unsigned) n->rip_metric < HOPCNT_INFINITY)) {
- rtchange(rt, from, n->rip_metric);
- changes++;
- rt->rt_timer = 0;
- }
- }
- break;
- }
-
- /*
- * If changes have occurred, and if we have not sent a broadcast
- * recently, send a dynamic update. This update is sent only
- * on interfaces other than the one on which we received notice
- * of the change. If we are within MIN_WAITTIME of a full update,
- * don't bother sending; if we just sent a dynamic update
- * and set a timer (nextbcast), delay until that time.
- * If we just sent a full update, delay the dynamic update.
- * Set a timer for a randomized value to suppress additional
- * dynamic updates until it expires; if we delayed sending
- * the current changes, set needupdate.
- */
- if (changes && supplier &&
- now.tv_sec - lastfullupdate.tv_sec < SUPPLY_INTERVAL-MAX_WAITTIME) {
- u_long delay;
- extern long random();
-
- if (now.tv_sec - lastbcast.tv_sec >= MIN_WAITTIME &&
- timercmp(&nextbcast, &now, <)) {
- if (traceactions)
- fprintf(ftrace, "send dynamic update\n");
- toall((int (*)())supply, RTS_CHANGED, ifp);
- lastbcast = now;
- needupdate = 0;
- nextbcast.tv_sec = 0;
- } else {
- needupdate++;
- if (traceactions)
- fprintf(ftrace, "delay dynamic update\n");
- }
-#define RANDOMDELAY() (MIN_WAITTIME * 1000000 + \
- (u_long)random() % ((MAX_WAITTIME - MIN_WAITTIME) * 1000000))
-
- if (nextbcast.tv_sec == 0) {
- delay = RANDOMDELAY();
- if (traceactions)
- fprintf(ftrace,
- "inhibit dynamic update for %lu usec\n",
- delay);
- nextbcast.tv_sec = delay / 1000000;
- nextbcast.tv_usec = delay % 1000000;
- timevaladd(&nextbcast, &now);
- /*
- * If the next possibly dynamic update
- * is within MIN_WAITTIME of the next full update,
- * force the delay past the full update,
- * or we might send a dynamic update just before
- * the full update.
- */
- if (nextbcast.tv_sec > lastfullupdate.tv_sec +
- SUPPLY_INTERVAL - MIN_WAITTIME)
- nextbcast.tv_sec = lastfullupdate.tv_sec +
- SUPPLY_INTERVAL + 1;
- }
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * 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.
- * 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.
- *
- * 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.
- *
- * @(#)defs.h 8.1 (Berkeley) 6/5/93
- */
-
-/*
- * Routing table management daemon.
- */
-
-/*
- * An ``interface'' is similar to an ifnet structure,
- * except it doesn't contain q'ing info, and it also
- * handles ``logical'' interfaces (remote gateways
- * that we want to keep polling even if they go down).
- * The list of interfaces which we maintain is used
- * in supplying the gratuitous routing table updates.
- */
-struct interface {
- struct interface *int_next;
- struct sockaddr int_addr; /* address on this host */
- union {
- struct sockaddr intu_broadaddr;
- struct sockaddr intu_dstaddr;
- } int_intu;
-#define int_broadaddr int_intu.intu_broadaddr /* broadcast address */
-#define int_dstaddr int_intu.intu_dstaddr /* other end of p-to-p link */
- int int_metric; /* init's routing entry */
- int int_flags; /* see below */
- /* START INTERNET SPECIFIC */
- u_long int_net; /* network # */
- u_long int_netmask; /* net mask for addr */
- u_long int_subnet; /* subnet # */
- u_long int_subnetmask; /* subnet mask for addr */
- /* END INTERNET SPECIFIC */
- struct ifdebug int_input, int_output; /* packet tracing stuff */
- int int_ipackets; /* input packets received */
- int int_opackets; /* output packets sent */
- char *int_name; /* from kernel if structure */
- u_short int_transitions; /* times gone up-down */
-};
-
-/*
- * 0x1 to 0x10 are reused from the kernel's ifnet definitions,
- * the others agree with the RTS_ flags defined elsewhere.
- */
-#define IFF_UP 0x1 /* interface is up */
-#define IFF_BROADCAST 0x2 /* broadcast address valid */
-#define IFF_DEBUG 0x4 /* turn on debugging */
-#define IFF_LOOPBACK 0x8 /* software loopback net */
-#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */
-
-#define IFF_SUBNET 0x100000 /* interface on subnetted network */
-#define IFF_PASSIVE 0x200000 /* can't tell if up/down */
-#define IFF_INTERFACE 0x400000 /* hardware interface */
-#define IFF_REMOTE 0x800000 /* interface isn't on this machine */
-
-struct interface *if_ifwithaddr();
-struct interface *if_ifwithdstaddr();
-struct interface *if_ifwithnet();
-struct interface *if_iflookup();
+++ /dev/null
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright (c) 1983, 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following 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.
- *
- * 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.
- *
- * @(#)defs.h 8.1 (Berkeley) 6/5/93
- */
-
-
-/*
- * Routing Table Management Daemon
- */
-#include "defs.h"
-#include <sys/ioctl.h>
-#include <sys/file.h>
-#include <signal.h>
-
-#include <net/if.h>
-
-#include <sys/errno.h>
-#include <sys/signal.h>
-#include <sys/syslog.h>
-#include "pathnames.h"
-
-int supplier = -1; /* process should supply updates */
-int gateway = 0; /* 1 if we are a gateway to parts beyond */
-int debug = 0;
-int bufspace = 127*1024; /* max. input buffer size to request */
-
-struct rip *msg = (struct rip *)packet;
-void hup(), rtdeleteall(), sigtrace(), timer();
-
-int getsocket(int, int, struct sockaddr_in *);
-void process(int);
-void timevalsub( struct timeval *, struct timeval *);
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- int n, nfd, omask, tflags = 0;
- struct timeval *tvp, waittime;
- struct itimerval itval;
- register struct rip *query = msg;
- fd_set ibits;
-
- argv0 = argv;
-#if BSD >= 43
- openlog("routed", LOG_PID | LOG_ODELAY, LOG_DAEMON);
- setlogmask(LOG_UPTO(LOG_WARNING));
-#else
- openlog("routed", LOG_PID);
-#define LOG_UPTO(x) (x)
-#define setlogmask(x) (x)
-#endif
- sp = getservbyname("router", "udp");
- if (sp == NULL) {
- fprintf(stderr, "routed: router/udp: unknown service\n");
- exit(1);
- }
- addr.sin_family = AF_INET;
- addr.sin_port = sp->s_port;
- r = socket(AF_ROUTE, SOCK_RAW, 0);
- /* later, get smart about lookingforinterfaces */
- if (r)
- shutdown(r, 0); /* for now, don't want reponses */
- else {
- fprintf(stderr, "routed: no routing socket\n");
- exit(1);
- }
- s = getsocket(AF_INET, SOCK_DGRAM, &addr);
- if (s < 0)
- exit(1);
- argv++, argc--;
- while (argc > 0 && **argv == '-') {
- if (strcmp(*argv, "-s") == 0) {
- supplier = 1;
- argv++, argc--;
- continue;
- }
- if (strcmp(*argv, "-q") == 0) {
- supplier = 0;
- argv++, argc--;
- continue;
- }
- if (strcmp(*argv, "-t") == 0) {
- tflags++;
- setlogmask(LOG_UPTO(LOG_DEBUG));
- argv++, argc--;
- continue;
- }
- if (strcmp(*argv, "-d") == 0) {
- debug++;
- setlogmask(LOG_UPTO(LOG_DEBUG));
- argv++, argc--;
- continue;
- }
- if (strcmp(*argv, "-g") == 0) {
- gateway = 1;
- argv++, argc--;
- continue;
- }
- fprintf(stderr,
- "usage: routed [ -s ] [ -q ] [ -t ] [ -g ]\n");
- exit(1);
- }
-
- if (debug == 0 && tflags == 0)
- daemon(0, 0);
- /*
- * Any extra argument is considered
- * a tracing log file.
- */
- if (argc > 0)
- traceon(*argv);
- while (tflags-- > 0)
- bumploglevel();
-
- (void) gettimeofday(&now, (struct timezone *)NULL);
- /*
- * Collect an initial view of the world by
- * checking the interface configuration and the gateway kludge
- * file. Then, send a request packet on all
- * directly connected networks to find out what
- * everyone else thinks.
- */
- rtinit();
- ifinit();
- gwkludge();
- if (gateway > 0)
- rtdefault();
- if (supplier < 0)
- supplier = 0;
- query->rip_cmd = RIPCMD_REQUEST;
- query->rip_vers = RIPVERSION;
- query->rip_nets[0].rip_dst.sa_family = AF_UNSPEC;
- query->rip_nets[0].rip_dst.sa_len = sizeof (query->rip_nets[0].rip_dst);
- query->rip_nets[0].rip_metric = htonl((u_long)HOPCNT_INFINITY);
- toall((int (*)())sndmsg, 0, NULL);
- signal(SIGALRM, timer);
- signal(SIGHUP, hup);
- signal(SIGTERM, hup);
- signal(SIGINT, rtdeleteall);
- signal(SIGUSR1, sigtrace);
- signal(SIGUSR2, sigtrace);
- itval.it_interval.tv_sec = TIMER_RATE;
- itval.it_value.tv_sec = TIMER_RATE;
- itval.it_interval.tv_usec = 0;
- itval.it_value.tv_usec = 0;
- srandom(getpid());
- if (setitimer(ITIMER_REAL, &itval, (struct itimerval *)NULL) < 0)
- syslog(LOG_ERR, "setitimer: %m\n");
-
- FD_ZERO(&ibits);
- nfd = s + 1; /* 1 + max(fd's) */
- for (;;) {
- FD_SET(s, &ibits);
- /*
- * If we need a dynamic update that was held off,
- * needupdate will be set, and nextbcast is the time
- * by which we want select to return. Compute time
- * until dynamic update should be sent, and select only
- * until then. If we have already passed nextbcast,
- * just poll.
- */
- if (needupdate) {
- waittime = nextbcast;
- timevalsub(&waittime, &now);
- if (waittime.tv_sec < 0) {
- waittime.tv_sec = 0;
- waittime.tv_usec = 0;
- }
- if (traceactions)
- fprintf(ftrace,
- "select until dynamic update %ld/%d sec/usec\n",
- waittime.tv_sec, waittime.tv_usec);
- tvp = &waittime;
- } else
- tvp = (struct timeval *)NULL;
- n = select(nfd, &ibits, 0, 0, tvp);
- if (n <= 0) {
- /*
- * Need delayed dynamic update if select returned
- * nothing and we timed out. Otherwise, ignore
- * errors (e.g. EINTR).
- */
- if (n < 0) {
- if (errno == EINTR)
- continue;
- syslog(LOG_ERR, "select: %m");
- }
- omask = sigblock(sigmask(SIGALRM));
- if (n == 0 && needupdate) {
- if (traceactions)
- fprintf(ftrace,
- "send delayed dynamic update\n");
- (void) gettimeofday(&now,
- (struct timezone *)NULL);
- toall((int (*)())supply, RTS_CHANGED,
- (struct interface *)NULL);
- lastbcast = now;
- needupdate = 0;
- nextbcast.tv_sec = 0;
- }
- sigsetmask(omask);
- continue;
- }
- (void) gettimeofday(&now, (struct timezone *)NULL);
- omask = sigblock(sigmask(SIGALRM));
-#ifdef doesntwork
-/*
-printf("s %d, ibits %x index %d, mod %d, sh %x, or %x &ibits %x\n",
- s,
- ibits.fds_bits[0],
- (s)/(sizeof(fd_mask) * 8),
- ((s) % (sizeof(fd_mask) * 8)),
- (1 << ((s) % (sizeof(fd_mask) * 8))),
- ibits.fds_bits[(s)/(sizeof(fd_mask) * 8)] & (1 << ((s) % (sizeof(fd_mask) * 8))),
- &ibits
- );
-*/
- if (FD_ISSET(s, &ibits))
-#else
- if (ibits.fds_bits[s/32] & (1 << s))
-#endif
- process(s);
- /* handle ICMP redirects */
- sigsetmask(omask);
- }
- /* NOTREACHED */
- return 0;
-}
-
-void
-timevaladd(t1, t2)
- struct timeval *t1, *t2;
-{
-
- t1->tv_sec += t2->tv_sec;
- if ((t1->tv_usec += t2->tv_usec) > 1000000) {
- t1->tv_sec++;
- t1->tv_usec -= 1000000;
- }
-}
-
-void
-timevalsub(t1, t2)
- struct timeval *t1, *t2;
-{
-
- t1->tv_sec -= t2->tv_sec;
- if ((t1->tv_usec -= t2->tv_usec) < 0) {
- t1->tv_sec--;
- t1->tv_usec += 1000000;
- }
-}
-
-void
-process(fd)
- int fd;
-{
- struct sockaddr from;
- socklen_t fromlen;
- int cc;
- union {
- char buf[MAXPACKETSIZE+1];
- struct rip rip;
- } inbuf;
-
- for (;;) {
- fromlen = sizeof (from);
- cc = recvfrom(fd, &inbuf, sizeof (inbuf), 0, &from, &fromlen);
- if (cc <= 0) {
- if (cc < 0 && errno != EWOULDBLOCK)
- perror("recvfrom");
- break;
- }
- if (fromlen != sizeof (struct sockaddr_in))
- break;
- rip_input(&from, &inbuf.rip, cc);
- }
-}
-
-int
-getsocket(domain, type, sin)
- int domain, type;
- struct sockaddr_in *sin;
-{
- int sock, on = 1;
-
- if ((sock = socket(domain, type, 0)) < 0) {
- perror("socket");
- syslog(LOG_ERR, "socket: %m");
- return (-1);
- }
-#ifdef SO_BROADCAST
- if (setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &on, sizeof (on)) < 0) {
- syslog(LOG_ERR, "setsockopt SO_BROADCAST: %m");
- close(sock);
- return (-1);
- }
-#endif
-#ifdef SO_RCVBUF
- for (on = bufspace; ; on -= 1024) {
- if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF,
- &on, sizeof (on)) == 0)
- break;
- if (on <= 8*1024) {
- syslog(LOG_ERR, "setsockopt SO_RCVBUF: %m");
- break;
- }
- }
- if (traceactions)
- fprintf(ftrace, "recv buf %d\n", on);
-#endif
- if (bind(sock, (struct sockaddr *)sin, sizeof (*sin)) < 0) {
- perror("bind");
- syslog(LOG_ERR, "bind: %m");
- close(sock);
- return (-1);
- }
- if (fcntl(sock, F_SETFL, O_NONBLOCK) == -1)
- syslog(LOG_ERR, "fcntl O_NONBLOCK: %m\n");
- return (sock);
-}
+++ /dev/null
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright (c) 1983, 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following 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.
- *
- * 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.
- *
- * @(#)defs.h 8.1 (Berkeley) 6/5/93
- */
-
-
-/*
- * Routing Table Management Daemon
- */
-#include "defs.h"
-
-/*
- * Apply the function "f" to all non-passive
- * interfaces. If the interface supports the
- * use of broadcasting use it, otherwise address
- * the output to the known router.
- */
-void
-toall(f, rtstate, skipif)
- int (*f)();
- int rtstate;
- struct interface *skipif;
-{
- register struct interface *ifp;
- register struct sockaddr *dst;
- register int flags;
- extern struct interface *ifnet;
-
- for (ifp = ifnet; ifp; ifp = ifp->int_next) {
- if (ifp->int_flags & IFF_PASSIVE || ifp == skipif)
- continue;
- dst = ifp->int_flags & IFF_BROADCAST ? &ifp->int_broadaddr :
- ifp->int_flags & IFF_POINTOPOINT ? &ifp->int_dstaddr :
- &ifp->int_addr;
- flags = ifp->int_flags & IFF_INTERFACE ? MSG_DONTROUTE : 0;
- (*f)(dst, flags, ifp, rtstate);
- }
-}
-
-/*
- * Output a preformed packet.
- */
-/*ARGSUSED*/
-void
-sndmsg(dst, flags, ifp, rtstate)
- struct sockaddr *dst;
- int flags;
- struct interface *ifp;
- int rtstate;
-{
-
- (*afswitch[dst->sa_family].af_output)(s, flags,
- dst, sizeof (struct rip));
- TRACE_OUTPUT(ifp, dst, sizeof (struct rip));
-}
-
-/*
- * Supply dst with the contents of the routing tables.
- * If this won't fit in one packet, chop it up into several.
- */
-void
-supply(dst, flags, ifp, rtstate)
- struct sockaddr *dst;
- int flags;
- register struct interface *ifp;
- int rtstate;
-{
- register struct rt_entry *rt;
- register struct netinfo *n = msg->rip_nets;
- register struct rthash *rh;
- struct rthash *base = hosthash;
- int doinghost = 1, size;
- int (*output)() = afswitch[dst->sa_family].af_output;
- int (*sendroute)() = afswitch[dst->sa_family].af_sendroute;
- int npackets = 0;
-
- msg->rip_cmd = RIPCMD_RESPONSE;
- msg->rip_vers = RIPVERSION;
- memset(msg->rip_res1, 0, sizeof(msg->rip_res1));
-again:
- for (rh = base; rh < &base[ROUTEHASHSIZ]; rh++)
- for (rt = rh->rt_forw; rt != (struct rt_entry *)rh; rt = rt->rt_forw) {
- /*
- * Don't resend the information on the network
- * from which it was received (unless sending
- * in response to a query).
- */
- if (ifp && rt->rt_ifp == ifp &&
- (rt->rt_state & RTS_INTERFACE) == 0)
- continue;
- if (rt->rt_state & RTS_EXTERNAL)
- continue;
- /*
- * For dynamic updates, limit update to routes
- * with the specified state.
- */
- if (rtstate && (rt->rt_state & rtstate) == 0)
- continue;
- /*
- * Limit the spread of subnet information
- * to those who are interested.
- */
- if (doinghost == 0 && rt->rt_state & RTS_SUBNET) {
- if (rt->rt_dst.sa_family != dst->sa_family)
- continue;
- if ((*sendroute)(rt, dst) == 0)
- continue;
- }
- size = (char *)n - packet;
- if (size > MAXPACKETSIZE - sizeof (struct netinfo)) {
- TRACE_OUTPUT(ifp, dst, size);
- (*output)(s, flags, dst, size);
- /*
- * If only sending to ourselves,
- * one packet is enough to monitor interface.
- */
- if (ifp && (ifp->int_flags &
- (IFF_BROADCAST | IFF_POINTOPOINT | IFF_REMOTE)) == 0)
- return;
- n = msg->rip_nets;
- npackets++;
- }
- n->rip_dst = rt->rt_dst;
- n->rip_metric = htonl(rt->rt_metric);
- n++;
- }
- if (doinghost) {
- doinghost = 0;
- base = nethash;
- goto again;
- }
- if (n != msg->rip_nets || (npackets == 0 && rtstate == 0)) {
- size = (char *)n - packet;
- TRACE_OUTPUT(ifp, dst, size);
- (*output)(s, flags, dst, size);
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following 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.
- *
- * 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.
- *
- * @(#)defs.h 8.1 (Berkeley) 6/5/93
- */
-
-#include <paths.h>
-
-#define _PATH_GATEWAYS "/etc/gateways"
+++ /dev/null
-# @(#)Makefile 8.1 (Berkeley) 6/5/93
-
-PROG= query
-NOMAN= noman
-
-.include "../../Makefile.inc"
-.include <bsd.prog.mk>
+++ /dev/null
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved
- *
- * Copyright (c) 1982, 1986, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * The NEXTSTEP Software License Agreement specifies the terms
- * and conditions for redistribution.
- *
- */
-
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1982, 1986, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)query.c 8.3 (Berkeley) 4/28/95";
-#endif /* not lint */
-
-#include <sys/param.h>
-#include <sys/protosw.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <signal.h>
-#include <netinet/in.h>
-#include <protocols/routed.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <errno.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define WTIME 5 /* Time to wait for all responses */
-#define STIME 500000 /* usec to wait for another response */
-
-int s;
-int timedout;
-void timeout();
-char packet[MAXPACKETSIZE];
-int nflag;
-
-main(argc, argv)
- int argc;
- char *argv[];
-{
- extern char *optarg;
- extern int optind;
- int ch, cc, count, bits;
- struct sockaddr from;
- struct sigaction sigact;
- int fromlen = sizeof(from), size = 32*1024;
- struct timeval shorttime;
-
- while ((ch = getopt(argc, argv, "n")) != EOF)
- switch (ch) {
- case 'n':
- nflag++;
- break;
- case '?':
- default:
- goto usage;
- }
- argv += optind;
-
- if (!*argv) {
-usage: printf("usage: query [-n] hosts...\n");
- exit(1);
- }
-
- s = socket(AF_INET, SOCK_DGRAM, 0);
- if (s < 0) {
- perror("socket");
- exit(2);
- }
- if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size)) < 0)
- perror("setsockopt SO_RCVBUF");
-
- while (*argv) {
- query(*argv++);
- count++;
- }
-
- /*
- * Listen for returning packets;
- * may be more than one packet per host.
- */
- bits = 1 << s;
- memset(&shorttime, 0, sizeof(shorttime));
- shorttime.tv_usec = STIME;
- memset(&sigact, 0, sizeof(sigact));
- sigact.sa_handler = timeout;
- /*sigact.sa_flags = 0; /* no restart */
- if (sigaction(SIGALRM, &sigact, (struct sigaction *)NULL) == -1)
- perror("sigaction");
- alarm(WTIME);
- while ((count > 0 && !timedout) ||
- select(20, (fd_set *)&bits, NULL, NULL, &shorttime) > 0) {
- cc = recvfrom(s, packet, sizeof (packet), 0,
- &from, &fromlen);
- if (cc <= 0) {
- if (cc < 0) {
- if (errno == EINTR)
- continue;
- perror("recvfrom");
- (void) close(s);
- exit(1);
- }
- continue;
- }
- rip_input(&from, cc);
- count--;
- }
- exit (count > 0 ? count : 0);
-}
-
-query(host)
- char *host;
-{
- struct sockaddr_in router;
- register struct rip *msg = (struct rip *)packet;
- struct hostent *hp;
- struct servent *sp;
-
- memset(&router, 0, sizeof (router));
- router.sin_family = AF_INET;
- router.sin_addr.s_addr = inet_addr(host);
- if (router.sin_addr.s_addr == -1) {
- hp = gethostbyname(host);
- if (hp == NULL) {
- fprintf(stderr, "query: %s: ", host);
- herror((char *)NULL);
- exit(1);
- }
- memmove(&router.sin_addr, hp->h_addr, hp->h_length);
- }
- sp = getservbyname("router", "udp");
- if (sp == 0) {
- printf("udp/router: service unknown\n");
- exit(1);
- }
- router.sin_port = sp->s_port;
- msg->rip_cmd = RIPCMD_REQUEST;
- msg->rip_vers = RIPVERSION;
- msg->rip_nets[0].rip_dst.sa_family = htons(AF_UNSPEC);
- msg->rip_nets[0].rip_metric = htonl(HOPCNT_INFINITY);
- if (sendto(s, packet, sizeof (struct rip), 0,
- (struct sockaddr *)&router, sizeof(router)) < 0)
- perror(host);
-}
-
-/*
- * Handle an incoming routing packet.
- */
-rip_input(from, size)
- struct sockaddr_in *from;
- int size;
-{
- register struct rip *msg = (struct rip *)packet;
- register struct netinfo *n;
- char *name;
- int lna, net, subnet;
- struct hostent *hp;
- struct netent *np;
-
- if (msg->rip_cmd != RIPCMD_RESPONSE)
- return;
- printf("%d bytes from ", size);
- if (nflag)
- printf("%s:\n", inet_ntoa(from->sin_addr));
- else {
- hp = gethostbyaddr((char *)&from->sin_addr,
- sizeof (struct in_addr), AF_INET);
- name = hp == 0 ? "???" : hp->h_name;
- printf("%s(%s):\n", name, inet_ntoa(from->sin_addr));
- }
- size -= sizeof (int);
- n = msg->rip_nets;
- while (size > 0) {
- if (size < sizeof (struct netinfo))
- break;
- if (msg->rip_vers > 0) {
- n->rip_dst.sa_family =
- ntohs(n->rip_dst.sa_family);
- n->rip_metric = ntohl(n->rip_metric);
- }
- switch (n->rip_dst.sa_family) {
-
- case AF_INET:
- { register struct sockaddr_in *sin;
-
- sin = (struct sockaddr_in *)&n->rip_dst;
- net = inet_netof(sin->sin_addr);
- subnet = inet_subnetof(sin->sin_addr);
- lna = inet_lnaof(sin->sin_addr);
- name = "???";
- if (!nflag) {
- if (sin->sin_addr.s_addr == 0)
- name = "default";
- else if (lna == INADDR_ANY) {
- np = getnetbyaddr(net, AF_INET);
- if (np)
- name = np->n_name;
- else if (net == 0)
- name = "default";
- } else if ((lna & 0xff) == 0 &&
- (np = getnetbyaddr(subnet, AF_INET))) {
- struct in_addr subnaddr, inet_makeaddr();
-
- subnaddr = inet_makeaddr(subnet, INADDR_ANY);
- if (memcmp(&sin->sin_addr, &subnaddr,
- sizeof(subnaddr)) == 0)
- name = np->n_name;
- else
- goto host;
- } else {
- host:
- hp = gethostbyaddr((char *)&sin->sin_addr,
- sizeof (struct in_addr), AF_INET);
- if (hp)
- name = hp->h_name;
- }
- printf("\t%-17s metric %2d name %s\n",
- inet_ntoa(sin->sin_addr), n->rip_metric, name);
- } else
- printf("\t%-17s metric %2d\n",
- inet_ntoa(sin->sin_addr), n->rip_metric);
- break;
- }
-
- default:
- { u_short *p = (u_short *)n->rip_dst.sa_data;
-
- printf("\t(af %d) %x %x %x %x %x %x %x, metric %d\n",
- p[0], p[1], p[2], p[3], p[4], p[5], p[6],
- n->rip_dst.sa_family,
- n->rip_metric);
- break;
- }
-
- }
- size -= sizeof (struct netinfo), n++;
- }
-}
-
-void
-timeout()
-{
- timedout = 1;
-}
-
-/*
- * Return the possible subnetwork number from an internet address.
- * SHOULD FIND OUT WHETHER THIS IS A LOCAL NETWORK BEFORE LOOKING
- * INSIDE OF THE HOST PART. We can only believe this if we have other
- * information (e.g., we can find a name for this number).
- */
-inet_subnetof(in)
- struct in_addr in;
-{
- register u_long i = ntohl(in.s_addr);
-
- if (IN_CLASSA(i))
- return ((i & IN_CLASSB_NET) >> IN_CLASSB_NSHIFT);
- else if (IN_CLASSB(i))
- return ((i & IN_CLASSC_NET) >> IN_CLASSC_NSHIFT);
- else
- return ((i & 0xffffffc0) >> 28);
-}
+++ /dev/null
-.\" $OpenBSD: routed.8,v 1.8 1997/01/28 07:16:41 deraadt Exp $
-.\"
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)routed.8 8.2 (Berkeley) 12/11/93
-.\"
-.Dd June 1, 1996
-.Dt ROUTED 8
-.Os BSD 4.4
-.Sh NAME
-.Nm routed
-.Nd network RIP and router discovery routing daemon
-.Sh SYNOPSIS
-.Nm
-.Op Fl sqdghmpAt
-.Op Fl T Ar tracefile
-.Oo
-.Fl F
-.Ar net Ns Op /mask Ns Op ,metric
-.Oc
-.OP Fl P Ar parms
-.Sh DESCRIPTION
-.Nm Routed
-is a daemon invoked at boot time to manage the network
-routing tables.
-It uses Routing Information Protocol, RIPv1 (RFC\ 1058),
-RIPv2 (RFC\ 1723),
-and Internet Router Discovery Protocol (RFC 1256)
-to maintain the kernel routing table.
-The RIPv1 protocol is based on the reference 4.3BSD daemon.
-.Pp
-It listens on the
-.Xr udp 4
-socket for the
-.Xr route 8
-service (see
-.Xr services 5 )
-for Routing Information Protocol packets.
-It also sends and receives multicast Router Discovery ICMP messages.
-If the host is a router,
-.Nm
-periodically supplies copies
-of its routing tables to any directly connected hosts and networks.
-It also advertise or solicits default routes using Router Discovery
-ICMP messages.
-.Pp
-When started (or when a network interface is later turned on),
-.Nm
-uses an AF_ROUTE address family facility to find those
-directly connected interfaces configured into the
-system and marked "up".
-It adds necessary routes for the interfaces
-to the kernel routing table.
-Soon after being first started, and provided there is at least one
-interface on which RIP has not been disabled,
-.Nm
-deletes all pre-existing
-non-static routes in kernel table.
-Static routes in the kernel table are preserved and
-included in RIP responses if they have a valid RIP metric
-(see
-.Xr route 8 ).
-.Pp
-If more than one interface is present (not counting the loopback interface),
-it is assumed that the host should forward packets among the
-connected networks.
-After transmitting a RIP
-.Em request
-and
-Router Discovery Advertisements or Solicitations on a new interface,
-the daemon enters a loop, listening for
-RIP request and response and Router Discover packets from other hosts.
-.Pp
-When a
-.Em request
-packet is received,
-.Nm
-formulates a reply based on the information maintained in its
-internal tables.
-The
-.Em response
-packet generated contains a list of known routes, each marked
-with a "hop count" metric (a count of 16 or greater is
-considered "infinite").
-Advertised metrics reflect the metric associated with interface
-(see
-.Xr ifconfig 8 ),
-so setting the metric on an interface
-is an effective way to steer traffic.
-.Pp
-Responses do not contain routes with a first hop on the requesting
-network to implement in part
-.Em split-horizon .
-.Pp
-The routing table maintained by the daemon
-includes space for several gateways for each destination
-to speed recovery from a failing router.
-RIP
-.Em response
-packets received are used to update the routing tables provided they are
-from one of the several currently recognized gateways or
-advertise a better metric than at least one of the existing
-gateways.
-.Pp
-When an update is applied,
-.Nm
-records the change in its own tables and updates the kernel routing table
-if the best route to the destination changes.
-The change in the kernel routing table is reflected in the next batch of
-.Em response
-packets sent.
-If the next response is not scheduled for a while, a
-.Em flash update
-response containing only recently changed routes is sent.
-.Pp
-In addition to processing incoming packets,
-.Nm
-also periodically checks the routing table entries.
-If an entry has not been updated for 3 minutes, the entry's metric
-is set to infinity and marked for deletion.
-Deletions are delayed until the route has been advertised with
-an infinite metric to insure the invalidation
-is propagated throughout the local internet.
-This is a form of
-.Em poison reverse .
-.Pp
-Routes in the kernel table that are added or changed as a result
-of ICMP Redirect messages are deleted after a while to minimize
-.Em black-holes .
-When a TCP connection suffers a timeout,
-the kernel tells
-.Nm routed ,
-which deletes all redirected routes
-through the gateway involved, advances the age of all RIP routes through
-the gateway to allow an alternate to be chosen, and advances of the
-age of any relevant Router Discovery Protocol default routes.
-.Pp
-Hosts acting as internetwork routers gratuitously supply their
-routing tables every 30 seconds to all directly connected hosts
-and networks.
-These RIP responses are sent to the broadcast address on nets that support
-broadcasting,
-to the destination address on point-to-point links, and to the router's
-own address on other networks.
-If RIPv2 is enabled, multicast packets are sent on interfaces that
-support multicasting.
-.Pp
-If no response is received on a remote interface, if there are errors
-while sending responses,
-or if there are more errors than input or output (see
-.Xr netstat 8 ),
-then the cable or some other part of the interface is assumed to be
-disconnected or broken, and routes are adjusted appropriately.
-.Pp
-The
-.Em Internet Router Discovery Protocol
-is handled similarly.
-When the daemon is supplying RIP routes, it also listens for
-Router Discovery Solicitations and sends Advertisements.
-When it is quiet and only listening to other RIP routers, it
-sends Solicitations and listens for Advertisements.
-If it receives
-a good Advertisement, it stops listening for broadcast or multicast
-RIP responses.
-It tracks several advertising routers to speed recovery when the
-currently chosen router dies.
-If all discovered routers disappear,
-the daemon resumes listening to RIP responses.
-.Pp
-While using Router Discovery (which happens by default when
-the system has a single network interface and a Router Discover Advertisement
-is received), there is a single default route and a variable number of
-redirected host routes in the kernel table.
-.Pp
-The Router Discover standard requires that advertisements
-have a default "lifetime" of 30 minutes. That means should
-something happen, a client can be without a good route for
-30 minutes. It is a good idea to reduce the default to 45
-seconds using
-.Fl P Cm rdisc_interval=45
-on the command line or
-.Cm rdisc_interval=45
-in the
-.Pa /etc/gateways
-file.
-.Pp
-See the
-.Cm pm_rdisc
-facility described below to support "legacy" systems
-that can handle neither RIPv2 nor Router Discovery.
-.Pp
-By default, neither Router Discovery advertisements nor solicitations
-are sent over point to point links (e.g. PPP).
-.Pp
-Options supported by
-.Nm routed :
-.Bl -tag -width Ds
-.It Fl s
-this option forces
-.Nm
-to supply routing information.
-This is the default if multiple network interfaces are present on which
-RIP or Router Discovery have not been disabled, and if the kernel switch
-ipforwarding=1.
-.It Fl q
-is the opposite of the
-.Fl s
-option.
-.It Fl d
-Do not run in the background.
-This option is meant for interactive use.
-.It Fl g
-This flag is used on internetwork routers to offer a route
-to the "default" destination.
-It is equivalent to
-.Fl F
-.Cm 0/0,1
-and is present mostly for historical reasons.
-A better choice is
-.Fl P Cm pm_rdisc
-on the command line or
-.Cm pm_rdisc in the
-.Pa /etc/gateways
-file.
-since a larger metric
-will be used, reducing the spread of the potentially dangerous
-default route.
-This is typically used on a gateway to the Internet,
-or on a gateway that uses another routing protocol whose routes
-are not reported to other local routers.
-Notice that because a metric of 1 is used, this feature is
-dangerous. It is more commonly accidently used to create chaos with routing
-loop than to solve problems.
-.It Fl h
-This causes host or point-to-point routes to not be advertised,
-provided there is a network route going the same direction.
-That is a limited kind of aggregation.
-This option is useful on gateways to ethernets that have other gateway
-machines connected with point-to-point links such as SLIP.
-.It Fl m
-This causes the machine to advertise a host or point-to-point route to
-its primary interface.
-It is useful on multi-homed machines such as NFS servers.
-This option should not be used except when the cost of
-the host routes it generates is justified by the popularity of
-the server.
-It is effective only when the machine is supplying
-routing information, because there is more than one interface.
-The
-.Fl m
-option overrides the
-.Fl q
-option to the limited extent of advertising the host route.
-.It Fl A
-do not ignore RIPv2 authentication if we do not care about RIPv2
-authentication.
-This option is required for conformance with RFC 1723.
-However, it makes no sense and breaks using RIP as a discovery protocol
-to ignore all RIPv2 packets that carry authentication when this machine
-does not care about authentication.
-.It Fl T Ar tracefile
-increases the debugging level to at least 1 and
-causes debugging information to be appended to the trace file.
-Note that because of security concerns, it is wisest to not run
-.Nm routed
-routinely with tracing directed to a file.
-.It Fl t
-increases the debugging level, which causes more information to be logged
-on the tracefile specified with
-.Fl T
-or standard out.
-The debugging level can be increased or decreased
-with the
-.Em SIGUSR1
-or
-.Em SIGUSR2
-signals.
-.It Fl F Ar net[/mask][,metric]
-minimize routes in transmissions via interfaces with addresses that match
-.Em net/mask ,
-and synthesizes a default route to this machine with the
-.Em metric .
-The intent is to reduce RIP traffic on slow, point-to-point links
-such as PPP links by replacing many large UDP packets of RIP information
-with a single, small packet containing a "fake" default route.
-If
-.Em metric
-is absent, a value of 14 is assumed to limit
-the spread of the "fake" default route.
-This is a dangerous feature that when used carelessly can cause routing
-loops.
-Notice also that more than one interface can match the specified network
-number and mask.
-See also
-.Fl g .
-.It Fl P Ar parms
-is equivalent to adding the parameter
-line
-.Em parms
-to the
-.Pa /etc/gateways
-file.
-.El
-.Pp
-Any other argument supplied is interpreted as the name
-of a file in which the actions of
-.Nm
-should be logged.
-It is better to use
-.Fl T
-instead of
-appending the name of the trace file to the command.
-.Pp
-.Nm
-also supports the notion of
-"distant"
-.Em passive
-or
-.Em active
-gateways.
-When
-.Nm
-is started, it reads the file
-.Pa /etc/gateways
-to find such distant gateways which may not be located using
-only information from a routing socket, to discover if some
-of the local gateways are
-.Em passive ,
-and to obtain other parameters.
-Gateways specified in this manner should be marked passive
-if they are not expected to exchange routing information,
-while gateways marked active
-should be willing to exchange RIP packets.
-Routes through
-.Em passive
-gateways are installed in the
-kernel's routing tables once upon startup and are not included in
-transmitted RIP responses.
-.Pp
-Distant active gateways are treated like network interfaces.
-RIP responses are sent
-to the distant
-.Em active
-gateway.
-If no responses are received, the associated route is deleted from
-the kernel table and RIP responses advertised via other interfaces.
-If the distant gateway resumes sending RIP responses, the associated
-route is restored.
-.Pp
-Such gateways can be useful on media that do not support broadcasts
-or multicasts but otherwise act like classic shared media like
-Ethernets such as some ATM networks.
-One can list all RIP routers reachable on the ATM network in
-.Pa /etc/gateways
-with a series of
-"host" lines.
-.Pp
-Gateways marked
-.Em external
-are also passive, but are not placed in the kernel
-routing table nor are they included in routing updates.
-The function of external entries is to indicate
-that another routing process
-will install such a route if necessary,
-and that alternate routes to that destination should not be installed
-by
-.Nm routed .
-Such entries are only required when both routers may learn of routes
-to the same destination.
-.Pp
-The
-.Pa /etc/gateways
-file is comprised of a series of lines, each in
-one of the following formats or consist of parameters described below:
-.Pp
-.Bd -ragged
-.Cm net
-.Ar Nname[/mask]
-.Cm gateway
-.Ar Gname
-.Cm metric
-.Ar value
-.Pf < Cm passive No \&|
-.Cm active No \&|
-.Cm extern Ns >
-.Ed
-.Bd -ragged
-.Cm host
-.Ar Hname
-.Cm gateway
-.Ar Gname
-.Cm metric
-.Ar value
-.Pf < Cm passive No \&|
-.Cm active No \&|
-.Cm extern Ns >
-.Ed
-.Pp
-.Ar Nname
-or
-.Ar Hname
-is the name of the destination network or host.
-It may be a symbolic network name or an Internet address
-specified in "dot" notation (see
-.Xr inet 3 ).
-(If it is a name, then it must either be defined in
-.Pa /etc/networks
-or
-.Pa /etc/hosts ,
-or
-.Xr named 8 ,
-must have been started before
-.Nm routed Ns .)
-.Pp
-.Ar mask
-is an optional number between 1 and 32 indicating the netmask associated
-with
-.Ar Nname .
-.Pp
-.Ar Gname
-is the name or address of the gateway to which RIP responses should
-be forwarded.
-.Pp
-.Ar Value
-is the hop count to the destination host or network.
-.Ar " host hname "
-is equivalent to
-.Ar " net nname/32 ".
-.Pp
-One of the keywords
-.Cm passive ,
-.Cm active
-or
-.Cm external
-must be present to indicate whether the gateway should be treated as
-.Cm passive
-or
-.Cm active
-(as described above),
-or whether the gateway is
-.Cm external
-to the scope of the RIP protocol.
-.Pp
-Lines that start with neither "net" nor "host" must consist of one
-or more of the following parameter settings, separated by commas or
-blanks:
-.Bl -tag -width Ds
-.It Cm if Ns \&= Ns Ar ifname
-indicates that the other parameters on the line apply to the interface
-name
-.Ar ifname .
-.It Cm subnet Ns \&= Ns Ar nname[/mask][,metric]
-advertises a route to network
-.Ar nname
-with mask
-.Ar mask
-and the supplied metric (default 1).
-This is useful for filling "holes" in CIDR allocations.
-This parameter must appear by itself on a line.
-.Pp
-Do not use this feature unless necessary. It is dangerous.
-.It Cm passwd Ns \&= Ns Ar XXX
-specifies a RIPv2 password that will be included on all RIPv2
-responses sent and checked on all RIPv2 responses received.
-The password must not contain any blanks, tab characters, commas
-or '#' characters.
-.It Cm no_ag
-turns off aggregation of subnets in RIPv1 and RIPv2 responses.
-.It Cm no_super_ag
-turns off aggregation of networks into supernets in RIPv2 responses.
-.It Cm passive
-is equivalent
-.Cm no_rip Cm no_rdisc .
-.It Cm no_rip
-disables all RIP processing on the specified interface.
-If no interfaces are allowed to process RIP packets,
-.Nm
-acts purely as a router discovery daemon.
-.Cm No_rip
-is equivalent to
-.Cm no_ripv1_in no_ripv2_in no_ripv1_out no_ripv2_out .
-.Pp
-Note that turning off RIP without explicitly turning on router
-discovery advertisements with
-.Cm rdisc_adv
-or
-.Fl s
-causes
-.Nm routed
-to act as a client router discovery daemon, not advertising.
-.It Cm no_ripv1_in
-causes RIPv1 received responses to be ignored.
-.It Cm no_ripv2_in
-causes RIPv2 received responses to be ignored.
-.It Cm ripv2_out
-turns off RIPv1 output and causes RIPv2 advertisements to be
-multicast when possible.
-.It Cm no_rdisc
-disables the Internet Router Discovery Protocol.
-.It Cm no_solicit
-disables the transmission of Router Discovery Solicitations.
-.It Cm send_solicit
-specifies that Router Discovery solicitations should be sent,
-even on point-to-point links,
-which by default only listen to Router Discovery messages.
-.It Cm no_rdisc_adv
-disables the transmission of Router Discovery Advertisements
-.It Cm rdisc_adv
-specifies that Router Discovery advertisements should be sent,
-even on point-to-point links,
-which by default only listen to Router Discovery messages
-.It Cm bcast_rdisc
-specifies that Router Discovery packets should be broadcast instead of
-multicast.
-.It Cm rdisc_pref Ns \&= Ns Ar N
-sets the preference in Router Discovery Advertisements to the integer
-.Ar N .
-.It Cm rdisc_interval Ns \&= Ns Ar N
-sets the nominal interval with which Router Discovery Advertisements
-are transmitted to N seconds and their lifetime to 3*N.
-.It Cm fake_default Ns \&= Ns Ar metric
-has an identical effect to
-.Fl F Ar net[/mask][,metric]
-with the network and mask coming from the specified interface.
-.It Cm pm_rdisc
-is similar to
-.Cm fake_default .
-When RIPv2 routes are multicast, so that RIPv1 listeners cannot
-receive them, this feature causes a RIPv1 default route to be
-broadcast to RIPv1 listeners.
-Unless modified with
-.Cm fake_default ,
-the default route is broadcast with a metric of 14.
-That serves as a "poor man's router discovery" protocol.
-.El
-.Pp
-Note that the netmask associated with point-to-point links (such as SLIP
-or PPP, with the IFF_POINTOPOINT flag) is used by
-.Nm routed
-to infer the netmask used by the remote system when RIPv1 is used.
-.Pp
-.Sh FILES
-.Bl -tag -width /etc/gateways -compact
-.It Pa /etc/gateways
-for distant gateways
-.El
-.Sh SEE ALSO
-.Xr udp 4 ,
-.Xr icmp 4 .
-.Rs
-.%T Internet Transport Protocols
-.%R XSIS 028112
-.%Q Xerox System Integration Standard
-.Re
-.Sh BUGS
-It does not always detect unidirectional failures in network interfaces
-(e.g., when the output side fails).
-.Sh HISTORY
-The
-.Nm
-command appeared in
-.Bx 4.2 .
+++ /dev/null
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright (c) 1983, 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following 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.
- *
- * 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.
- *
- * @(#)defs.h 8.1 (Berkeley) 6/5/93
- */
-
-
-/*
- * Routing Table Management Daemon
- */
-#include "defs.h"
-#include <sys/ioctl.h>
-#include <sys/sysctl.h>
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <syslog.h>
-#include <stdlib.h>
-#include "pathnames.h"
-
-struct interface *ifnet;
-struct interface **ifnext = &ifnet;
-int lookforinterfaces = 1;
-int externalinterfaces = 0; /* # of remote and local interfaces */
-int foundloopback; /* valid flag for loopaddr */
-struct sockaddr loopaddr; /* our address on loopback */
-
-
-void
-quit(s)
- char *s;
-{
- extern int errno;
- int sverrno = errno;
-
- (void) fprintf(stderr, "route: ");
- if (s)
- (void) fprintf(stderr, "%s: ", s);
- (void) fprintf(stderr, "%s\n", strerror(sverrno));
- exit(1);
- /* NOTREACHED */
-}
-
-struct rt_addrinfo info;
-/* Sleazy use of local variables throughout file, warning!!!! */
-#define netmask info.rti_info[RTAX_NETMASK]
-#define ifaaddr info.rti_info[RTAX_IFA]
-#define brdaddr info.rti_info[RTAX_BRD]
-
-#define ROUNDUP(a) \
- ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
-#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
-
-void
-rt_xaddrs(cp, cplim, rtinfo)
- register caddr_t cp, cplim;
- register struct rt_addrinfo *rtinfo;
-{
- register struct sockaddr *sa;
- register 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);
- }
-}
-
-/*
- * Find the network interfaces which have configured themselves.
- * If the interface is present but not yet up (for example an
- * ARPANET IMP), set the lookforinterfaces flag so we'll
- * come back later and look again.
- */
-void
-ifinit()
-{
- struct interface ifs, *ifp;
- size_t needed;
- int mib[6], no_ipaddr = 0, flags = 0;
- char *buf, *cplim, *cp;
- register struct if_msghdr *ifm;
- register struct ifa_msghdr *ifam;
- struct sockaddr_dl *sdl = NULL;
- struct sockaddr_in *sin;
- u_long i;
-
- mib[0] = CTL_NET;
- mib[1] = PF_ROUTE;
- mib[2] = 0;
- mib[3] = AF_INET;
- mib[4] = NET_RT_IFLIST;
- mib[5] = 0;
- if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0)
- quit("route-sysctl-estimate");
- if ((buf = malloc(needed)) == NULL)
- quit("malloc");
- if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0)
- quit("actual retrieval of interface table");
- lookforinterfaces = 0;
- cplim = buf + needed;
- for (cp = buf; cp < cplim; cp += ifm->ifm_msglen) {
- ifm = (struct if_msghdr *)cp;
- if (ifm->ifm_type == RTM_IFINFO) {
- memset(&ifs, 0, sizeof(ifs));
- ifs.int_flags = flags = (0xffff & ifm->ifm_flags) | IFF_INTERFACE;
- if ((flags & IFF_UP) == 0 || no_ipaddr)
- lookforinterfaces = 1;
- sdl = (struct sockaddr_dl *) (ifm + 1);
- sdl->sdl_data[sdl->sdl_nlen] = 0;
- no_ipaddr = 1;
- continue;
- }
- if (ifm->ifm_type != RTM_NEWADDR)
- quit("ifinit: out of sync");
- if ((flags & IFF_UP) == 0)
- continue;
- ifam = (struct ifa_msghdr *)ifm;
- info.rti_addrs = ifam->ifam_addrs;
- rt_xaddrs((char *)(ifam + 1), cp + ifam->ifam_msglen, &info);
- if (ifaaddr == 0) {
- syslog(LOG_ERR, "%s: (get addr)", sdl->sdl_data);
- continue;
- }
- ifs.int_addr = *ifaaddr;
- if (ifs.int_addr.sa_family != AF_INET)
- continue;
- no_ipaddr = 0;
- if (ifs.int_flags & IFF_POINTOPOINT) {
- if (brdaddr == 0) {
- syslog(LOG_ERR, "%s: (get dstaddr)",
- sdl->sdl_data);
- continue;
- }
- if (brdaddr->sa_family == AF_UNSPEC) {
- lookforinterfaces = 1;
- continue;
- }
- ifs.int_dstaddr = *brdaddr;
- }
- /*
- * already known to us?
- * This allows multiple point-to-point links
- * to share a source address (possibly with one
- * other link), but assumes that there will not be
- * multiple links with the same destination address.
- */
- if (ifs.int_flags & IFF_POINTOPOINT) {
- if (if_ifwithdstaddr(&ifs.int_dstaddr))
- continue;
- } else if (if_ifwithaddr(&ifs.int_addr))
- continue;
- if (ifs.int_flags & IFF_LOOPBACK) {
- ifs.int_flags |= IFF_PASSIVE;
- foundloopback = 1;
- loopaddr = ifs.int_addr;
- for (ifp = ifnet; ifp; ifp = ifp->int_next)
- if (ifp->int_flags & IFF_POINTOPOINT)
- add_ptopt_localrt(ifp);
- }
- if (ifs.int_flags & IFF_BROADCAST) {
- if (brdaddr == 0) {
- syslog(LOG_ERR, "%s: (get broadaddr)",
- sdl->sdl_data);
- continue;
- }
- ifs.int_dstaddr = *brdaddr;
- }
- /*
- * Use a minimum metric of one;
- * treat the interface metric (default 0)
- * as an increment to the hop count of one.
- */
- ifs.int_metric = ifam->ifam_metric + 1;
- if (netmask == 0) {
- syslog(LOG_ERR, "%s: (get netmask)",
- sdl->sdl_data);
- continue;
- }
- sin = (struct sockaddr_in *)netmask;
- ifs.int_subnetmask = ntohl(sin->sin_addr.s_addr);
- sin = (struct sockaddr_in *)&ifs.int_addr;
- i = ntohl(sin->sin_addr.s_addr);
- if (IN_CLASSA(i))
- ifs.int_netmask = IN_CLASSA_NET;
- else if (IN_CLASSB(i))
- ifs.int_netmask = IN_CLASSB_NET;
- else
- ifs.int_netmask = IN_CLASSC_NET;
- ifs.int_net = i & ifs.int_netmask;
- ifs.int_subnet = i & ifs.int_subnetmask;
- if (ifs.int_subnetmask != ifs.int_netmask)
- ifs.int_flags |= IFF_SUBNET;
- ifp = (struct interface *)
- malloc(sdl->sdl_nlen + 1 + sizeof(ifs));
- if (ifp == 0) {
- printf("routed: out of memory\n");
- lookforinterfaces = 1;
- break;
- }
- *ifp = ifs;
- /*
- * Count the # of directly connected networks
- * and point to point links which aren't looped
- * back to ourself. This is used below to
- * decide if we should be a routing ``supplier''.
- */
- if ((ifs.int_flags & IFF_LOOPBACK) == 0 &&
- ((ifs.int_flags & IFF_POINTOPOINT) == 0 ||
- if_ifwithaddr(&ifs.int_dstaddr) == 0))
- externalinterfaces++;
- /*
- * If we have a point-to-point link, we want to act
- * as a supplier even if it's our only interface,
- * as that's the only way our peer on the other end
- * can tell that the link is up.
- */
- if ((ifs.int_flags & IFF_POINTOPOINT) && supplier < 0)
- supplier = 1;
- ifp->int_name = (char *)(ifp + 1);
- strcpy(ifp->int_name, sdl->sdl_data);
- *ifnext = ifp;
- ifnext = &ifp->int_next;
- traceinit(ifp);
- addrouteforif(ifp);
- }
- if (externalinterfaces > 1 && supplier < 0)
- supplier = 1;
- free(buf);
-}
-
-/*
- * Add route for interface if not currently installed.
- * Create route to other end if a point-to-point link,
- * otherwise a route to this (sub)network.
- * INTERNET SPECIFIC.
- */
-void
-addrouteforif(ifp)
- register struct interface *ifp;
-{
- struct sockaddr_in net;
- struct sockaddr *dst;
- int state;
- register struct rt_entry *rt;
-
- if (ifp->int_flags & IFF_POINTOPOINT)
- dst = &ifp->int_dstaddr;
- else {
- memset(&net, 0, sizeof (net));
- net.sin_family = AF_INET;
- net.sin_addr = inet_makeaddr(ifp->int_subnet, INADDR_ANY);
- dst = (struct sockaddr *)&net;
- }
- rt = rtfind(dst);
- if (rt &&
- (rt->rt_state & (RTS_INTERFACE | RTS_INTERNAL)) == RTS_INTERFACE)
- return;
- if (rt)
- rtdelete(rt);
- /*
- * If interface on subnetted network,
- * install route to network as well.
- * This is meant for external viewers.
- */
- if ((ifp->int_flags & (IFF_SUBNET|IFF_POINTOPOINT)) == IFF_SUBNET) {
- struct in_addr subnet;
-
- subnet = net.sin_addr;
- net.sin_addr = inet_makeaddr(ifp->int_net, INADDR_ANY);
- rt = rtfind(dst);
- if (rt == 0)
- rtadd(dst, &ifp->int_addr, ifp->int_metric,
- ((ifp->int_flags & (IFF_INTERFACE|IFF_REMOTE)) |
- RTS_PASSIVE | RTS_INTERNAL | RTS_SUBNET));
- else if ((rt->rt_state & (RTS_INTERNAL|RTS_SUBNET)) ==
- (RTS_INTERNAL|RTS_SUBNET) &&
- ifp->int_metric < rt->rt_metric)
- rtchange(rt, &rt->rt_router, ifp->int_metric);
- net.sin_addr = subnet;
- }
- if (ifp->int_transitions++ > 0)
- syslog(LOG_ERR, "re-installing interface %s", ifp->int_name);
- state = ifp->int_flags &
- (IFF_INTERFACE | IFF_PASSIVE | IFF_REMOTE | IFF_SUBNET);
- if (ifp->int_flags & IFF_POINTOPOINT &&
- (ntohl(((struct sockaddr_in *)&ifp->int_dstaddr)->sin_addr.s_addr) &
- ifp->int_netmask) != ifp->int_net)
- state &= ~RTS_SUBNET;
- if (ifp->int_flags & IFF_LOOPBACK)
- state |= RTS_EXTERNAL;
- rtadd(dst, &ifp->int_addr, ifp->int_metric, state);
- if (ifp->int_flags & IFF_POINTOPOINT && foundloopback)
- add_ptopt_localrt(ifp);
-}
-
-/*
- * Add route to local end of point-to-point using loopback.
- * If a route to this network is being sent to neighbors on other nets,
- * mark this route as subnet so we don't have to propagate it too.
- */
-void
-add_ptopt_localrt(ifp)
- register struct interface *ifp;
-{
- struct rt_entry *rt;
- struct sockaddr *dst;
- struct sockaddr_in net;
- int state;
-
- state = RTS_INTERFACE | RTS_PASSIVE;
-
- /* look for route to logical network */
- memset(&net, 0, sizeof (net));
- net.sin_family = AF_INET;
- net.sin_addr = inet_makeaddr(ifp->int_net, INADDR_ANY);
- dst = (struct sockaddr *)&net;
- rt = rtfind(dst);
- if (rt && rt->rt_state & RTS_INTERNAL)
- state |= RTS_SUBNET;
-
- dst = &ifp->int_addr;
- if (rt = rtfind(dst)) {
- if (rt && rt->rt_state & RTS_INTERFACE)
- return;
- rtdelete(rt);
- }
- rtadd(dst, &loopaddr, 1, state);
-}
-
-/*
- * As a concession to the ARPANET we read a list of gateways
- * from /etc/gateways and add them to our tables. This file
- * exists at each ARPANET gateway and indicates a set of ``remote''
- * gateways (i.e. a gateway which we can't immediately determine
- * if it's present or not as we can do for those directly connected
- * at the hardware level). If a gateway is marked ``passive''
- * in the file, then we assume it doesn't have a routing process
- * of our design and simply assume it's always present. Those
- * not marked passive are treated as if they were directly
- * connected -- they're added into the interface list so we'll
- * send them routing updates.
- *
- * PASSIVE ENTRIES AREN'T NEEDED OR USED ON GATEWAYS RUNNING EGP.
- */
-void
-gwkludge()
-{
- struct sockaddr_in dst, gate;
- FILE *fp;
- char *type, *dname, *gname, *qual, buf[BUFSIZ];
- struct interface *ifp;
- int metric, n;
- struct rt_entry route;
-
- fp = fopen(_PATH_GATEWAYS, "r");
- if (fp == NULL)
- return;
- qual = buf;
- dname = buf + 64;
- gname = buf + ((BUFSIZ - 64) / 3);
- type = buf + (((BUFSIZ - 64) * 2) / 3);
- memset(&dst, 0, sizeof (dst));
- memset(&gate, 0, sizeof (gate));
- memset(&route, 0, sizeof(route));
-/* format: {net | host} XX gateway XX metric DD [passive | external]\n */
-#define readentry(fp) \
- fscanf((fp), "%s %s gateway %s metric %d %s\n", \
- type, dname, gname, &metric, qual)
- for (;;) {
- if ((n = readentry(fp)) == EOF)
- break;
- if (!getnetorhostname(type, dname, &dst))
- continue;
- if (!gethostnameornumber(gname, &gate))
- continue;
- if (metric == 0) /* XXX */
- metric = 1;
- if (strcmp(qual, "passive") == 0) {
- /*
- * Passive entries aren't placed in our tables,
- * only the kernel's, so we don't copy all of the
- * external routing information within a net.
- * Internal machines should use the default
- * route to a suitable gateway (like us).
- */
- route.rt_dst = *(struct sockaddr *) &dst;
- route.rt_router = *(struct sockaddr *) &gate;
- route.rt_flags = RTF_UP;
- if (strcmp(type, "host") == 0)
- route.rt_flags |= RTF_HOST;
- if (metric)
- route.rt_flags |= RTF_GATEWAY;
- (void) rtioctl(ADD, &route.rt_rt);
- continue;
- }
- if (strcmp(qual, "external") == 0) {
- /*
- * Entries marked external are handled
- * by other means, e.g. EGP,
- * and are placed in our tables only
- * to prevent overriding them
- * with something else.
- */
- rtadd((struct sockaddr *)&dst, (struct sockaddr *)&gate, metric, RTS_EXTERNAL|RTS_PASSIVE);
- continue;
- }
- /* assume no duplicate entries */
- externalinterfaces++;
- ifp = (struct interface *)malloc(sizeof (*ifp));
- memset(ifp, 0, sizeof (*ifp));
- ifp->int_flags = IFF_REMOTE;
- /* can't identify broadcast capability */
- ifp->int_net = inet_netof(dst.sin_addr);
- if (strcmp(type, "host") == 0) {
- ifp->int_flags |= IFF_POINTOPOINT;
- ifp->int_dstaddr = *((struct sockaddr *)&dst);
- }
- ifp->int_addr = *((struct sockaddr *)&gate);
- ifp->int_metric = metric;
- ifp->int_next = ifnet;
- ifnet = ifp;
- addrouteforif(ifp);
- }
- fclose(fp);
-}
-
-int
-getnetorhostname(type, name, sin)
- char *type, *name;
- struct sockaddr_in *sin;
-{
-
- if (strcmp(type, "net") == 0) {
- struct netent *np = getnetbyname(name);
- int n;
-
- if (np == 0)
- n = inet_network(name);
- else {
- if (np->n_addrtype != AF_INET)
- return (0);
- n = np->n_net;
- /*
- * getnetbyname returns right-adjusted value.
- */
- if (n < 128)
- n <<= IN_CLASSA_NSHIFT;
- else if (n < 65536)
- n <<= IN_CLASSB_NSHIFT;
- else
- n <<= IN_CLASSC_NSHIFT;
- }
- sin->sin_family = AF_INET;
- sin->sin_addr = inet_makeaddr(n, INADDR_ANY);
- return (1);
- }
- if (strcmp(type, "host") == 0) {
- struct hostent *hp = gethostbyname(name);
-
- if (hp == 0)
- sin->sin_addr.s_addr = inet_addr(name);
- else {
- if (hp->h_addrtype != AF_INET)
- return (0);
- memmove(&sin->sin_addr, hp->h_addr, hp->h_length);
- }
- sin->sin_family = AF_INET;
- return (1);
- }
- return (0);
-}
-
-int
-gethostnameornumber(name, sin)
- char *name;
- struct sockaddr_in *sin;
-{
- struct hostent *hp;
-
- hp = gethostbyname(name);
- if (hp) {
- memmove(&sin->sin_addr, hp->h_addr, hp->h_length);
- sin->sin_family = hp->h_addrtype;
- return (1);
- }
- sin->sin_addr.s_addr = inet_addr(name);
- sin->sin_family = AF_INET;
- return (sin->sin_addr.s_addr != -1);
-}
+++ /dev/null
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * 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.
- * 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.
- *
- * 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.
- *
- * @(#)defs.h 8.1 (Berkeley) 6/5/93
- */
-
-/*
- * Routing table management daemon.
- */
-
-/*
- * Routing table structure; differs a bit from kernel tables.
- *
- * Note: the union below must agree in the first 4 members
- * so the ioctl's will work.
- */
-struct rthash {
- struct rt_entry *rt_forw;
- struct rt_entry *rt_back;
-};
-#ifdef RTM_ADD
-#define rtentry ortentry
-#endif
-
-struct rt_entry {
- struct rt_entry *rt_forw;
- struct rt_entry *rt_back;
- union {
- struct rtentry rtu_rt;
- struct rtuentry {
- u_long rtu_hash;
- struct sockaddr rtu_dst;
- struct sockaddr rtu_router;
- short rtu_rtflags; /* used by rtioctl */
- short rtu_wasted[5];
- int rtu_flags;
- int rtu_state;
- int rtu_timer;
- int rtu_metric;
- int rtu_ifmetric;
- struct interface *rtu_ifp;
- } rtu_entry;
- } rt_rtu;
-};
-
-#define rt_rt rt_rtu.rtu_entry /* pass to ioctl */
-#define rt_hash rt_rtu.rtu_entry.rtu_hash /* for net or host */
-#define rt_dst rt_rtu.rtu_entry.rtu_dst /* match value */
-#define rt_router rt_rtu.rtu_entry.rtu_router /* who to forward to */
-#define rt_flags rt_rtu.rtu_entry.rtu_flags /* kernel flags */
-#define rt_timer rt_rtu.rtu_entry.rtu_timer /* for invalidation */
-#define rt_state rt_rtu.rtu_entry.rtu_state /* see below */
-#define rt_metric rt_rtu.rtu_entry.rtu_metric /* cost of route */
-#define rt_ifmetric rt_rtu.rtu_entry.rtu_ifmetric /* cost of route if */
-#define rt_ifp rt_rtu.rtu_entry.rtu_ifp /* interface to take */
-
-#define ROUTEHASHSIZ 32 /* must be a power of 2 */
-#define ROUTEHASHMASK (ROUTEHASHSIZ - 1)
-
-/*
- * "State" of routing table entry.
- */
-#define RTS_CHANGED 0x1 /* route has been altered recently */
-#define RTS_EXTERNAL 0x2 /* extern info, not installed or sent */
-#define RTS_INTERNAL 0x4 /* internal route, not installed */
-#define RTS_PASSIVE IFF_PASSIVE /* don't time out route */
-#define RTS_INTERFACE IFF_INTERFACE /* route is for network interface */
-#define RTS_REMOTE IFF_REMOTE /* route is for ``remote'' entity */
-#define RTS_SUBNET IFF_SUBNET /* route is for network subnet */
-
-/*
- * Flags are same as kernel, with this addition for af_rtflags:
- */
-#define RTF_SUBNET 0x80000 /* pseudo: route to subnet */
-
-EXTERN struct rthash nethash[ROUTEHASHSIZ];
-EXTERN struct rthash hosthash[ROUTEHASHSIZ];
-
-struct rt_entry *rtlookup(struct sockaddr *);
-struct rt_entry *rtfind(struct sockaddr *);
-void rtadd(struct sockaddr *, struct sockaddr *, int, int);
-void rtchange(struct rt_entry *, struct sockaddr *, short);
-void rtdelete(struct rt_entry *);
-void rtdeleteall(int);
-void rtdefault(void);
-void rtinit(void);
-int rtioctl(int, struct rtuentry *);
+++ /dev/null
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright (c) 1983, 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following 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.
- *
- * 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.
- *
- * @(#)defs.h 8.1 (Berkeley) 6/5/93
- */
-
-
-/*
- * Routing Table Management Daemon
- */
-#include "defs.h"
-#include <sys/ioctl.h>
-#include <errno.h>
-#include <search.h>
-#include <sys/syslog.h>
-
-#ifndef DEBUG
-#define DEBUG 0
-#endif
-
-#ifdef RTM_ADD
-#define FIXLEN(s) {if ((s)->sa_len == 0) (s)->sa_len = sizeof *(s);}
-#else
-#define FIXLEN(s) { }
-#endif
-
-int install = !DEBUG; /* if 1 call kernel */
-
-/*
- * Lookup dst in the tables for an exact match.
- */
-struct rt_entry *
-rtlookup(dst)
- struct sockaddr *dst;
-{
- register struct rt_entry *rt;
- register struct rthash *rh;
- register u_int hash;
- struct afhash h;
- int doinghost = 1;
-
- if (dst->sa_family >= af_max)
- return (0);
- (*afswitch[dst->sa_family].af_hash)(dst, &h);
- hash = h.afh_hosthash;
- rh = &hosthash[hash & ROUTEHASHMASK];
-again:
- for (rt = rh->rt_forw; rt != (struct rt_entry *)rh; rt = rt->rt_forw) {
- if (rt->rt_hash != hash)
- continue;
- if (equal(&rt->rt_dst, dst))
- return (rt);
- }
- if (doinghost) {
- doinghost = 0;
- hash = h.afh_nethash;
- rh = &nethash[hash & ROUTEHASHMASK];
- goto again;
- }
- return (0);
-}
-
-struct sockaddr wildcard; /* zero valued cookie for wildcard searches */
-
-/*
- * Find a route to dst as the kernel would.
- */
-struct rt_entry *
-rtfind(dst)
- struct sockaddr *dst;
-{
- register struct rt_entry *rt;
- register struct rthash *rh;
- register u_int hash;
- struct afhash h;
- int af = dst->sa_family;
- int doinghost = 1, (*match)() = NULL;
-
- if (af >= af_max)
- return (0);
- (*afswitch[af].af_hash)(dst, &h);
- hash = h.afh_hosthash;
- rh = &hosthash[hash & ROUTEHASHMASK];
-
-again:
- for (rt = rh->rt_forw; rt != (struct rt_entry *)rh; rt = rt->rt_forw) {
- if (rt->rt_hash != hash)
- continue;
- if (doinghost) {
- if (equal(&rt->rt_dst, dst))
- return (rt);
- } else {
- if (rt->rt_dst.sa_family == af &&
- (*match)(&rt->rt_dst, dst))
- return (rt);
- }
- }
- if (doinghost) {
- doinghost = 0;
- hash = h.afh_nethash;
- rh = &nethash[hash & ROUTEHASHMASK];
- match = afswitch[af].af_netmatch;
- goto again;
- }
-#ifdef notyet
- /*
- * Check for wildcard gateway, by convention network 0.
- */
- if (dst != &wildcard) {
- dst = &wildcard, hash = 0;
- goto again;
- }
-#endif
- return (0);
-}
-
-void
-rtadd(dst, gate, metric, state)
- struct sockaddr *dst, *gate;
- int metric, state;
-{
- struct afhash h;
- register struct rt_entry *rt;
- struct rthash *rh;
- int af = dst->sa_family, flags;
- u_int hash;
-
- if (af >= af_max)
- return;
- (*afswitch[af].af_hash)(dst, &h);
- flags = (*afswitch[af].af_rtflags)(dst);
- /*
- * Subnet flag isn't visible to kernel, move to state. XXX
- */
- FIXLEN(dst);
- FIXLEN(gate);
- if (flags & RTF_SUBNET) {
- state |= RTS_SUBNET;
- flags &= ~RTF_SUBNET;
- }
- if (flags & RTF_HOST) {
- hash = h.afh_hosthash;
- rh = &hosthash[hash & ROUTEHASHMASK];
- } else {
- hash = h.afh_nethash;
- rh = &nethash[hash & ROUTEHASHMASK];
- }
- rt = (struct rt_entry *)malloc(sizeof (*rt));
- if (rt == 0)
- return;
- rt->rt_hash = hash;
- rt->rt_dst = *dst;
- rt->rt_router = *gate;
- rt->rt_timer = 0;
- rt->rt_flags = RTF_UP | flags;
- rt->rt_state = state | RTS_CHANGED;
- rt->rt_ifp = if_ifwithdstaddr(&rt->rt_dst);
- if (rt->rt_ifp == 0)
- rt->rt_ifp = if_ifwithnet(&rt->rt_router);
- if ((state & RTS_INTERFACE) == 0)
- rt->rt_flags |= RTF_GATEWAY;
- rt->rt_metric = metric;
- insque(rt, rh);
- TRACE_ACTION("ADD", rt);
- /*
- * If the ioctl fails because the gateway is unreachable
- * from this host, discard the entry. This should only
- * occur because of an incorrect entry in /etc/gateways.
- */
- if ((rt->rt_state & (RTS_INTERNAL | RTS_EXTERNAL)) == 0 &&
- rtioctl(ADD, &rt->rt_rt) < 0) {
- if (errno != EEXIST && gate->sa_family < af_max)
- syslog(LOG_ERR,
- "adding route to net/host %s through gateway %s: %m\n",
- (*afswitch[dst->sa_family].af_format)(dst),
- (*afswitch[gate->sa_family].af_format)(gate));
- perror("ADD ROUTE");
- if (errno == ENETUNREACH) {
- TRACE_ACTION("DELETE", rt);
- remque(rt);
- free((char *)rt);
- }
- }
-}
-
-void
-rtchange(rt, gate, metric)
- struct rt_entry *rt;
- struct sockaddr *gate;
- short metric;
-{
- int add = 0, delete = 0, newgateway = 0;
- struct rtuentry oldroute;
-
- FIXLEN(gate);
- FIXLEN(&(rt->rt_router));
- FIXLEN(&(rt->rt_dst));
- if (!equal(&rt->rt_router, gate)) {
- newgateway++;
- TRACE_ACTION("CHANGE FROM ", rt);
- } else if (metric != rt->rt_metric)
- TRACE_NEWMETRIC(rt, metric);
- if ((rt->rt_state & RTS_INTERNAL) == 0) {
- /*
- * If changing to different router, we need to add
- * new route and delete old one if in the kernel.
- * If the router is the same, we need to delete
- * the route if has become unreachable, or re-add
- * it if it had been unreachable.
- */
- if (newgateway) {
- add++;
- if (rt->rt_metric != HOPCNT_INFINITY)
- delete++;
- } else if (metric == HOPCNT_INFINITY)
- delete++;
- else if (rt->rt_metric == HOPCNT_INFINITY)
- add++;
- }
- if (delete)
- oldroute = rt->rt_rt;
- if ((rt->rt_state & RTS_INTERFACE) && delete) {
- rt->rt_state &= ~RTS_INTERFACE;
- rt->rt_flags |= RTF_GATEWAY;
- if (metric > rt->rt_metric && delete)
- syslog(LOG_ERR, "%s route to interface %s (timed out)",
- add? "changing" : "deleting",
- rt->rt_ifp ? rt->rt_ifp->int_name : "?");
- }
- if (add) {
- rt->rt_router = *gate;
- rt->rt_ifp = if_ifwithdstaddr(&rt->rt_router);
- if (rt->rt_ifp == 0)
- rt->rt_ifp = if_ifwithnet(&rt->rt_router);
- }
- rt->rt_metric = metric;
- rt->rt_state |= RTS_CHANGED;
- if (newgateway)
- TRACE_ACTION("CHANGE TO ", rt);
-#ifndef RTM_ADD
- if (add && rtioctl(ADD, &rt->rt_rt) < 0)
- perror("ADD ROUTE");
- if (delete && rtioctl(DELETE, &oldroute) < 0)
- perror("DELETE ROUTE");
-#else
- if (delete && !add) {
- if (rtioctl(DELETE, &oldroute) < 0)
- perror("DELETE ROUTE");
- } else if (!delete && add) {
- if (rtioctl(ADD, &rt->rt_rt) < 0)
- perror("ADD ROUTE");
- } else if (delete && add) {
- if (rtioctl(CHANGE, &rt->rt_rt) < 0)
- perror("CHANGE ROUTE");
- }
-#endif
-}
-
-void
-rtdelete(rt)
- struct rt_entry *rt;
-{
-
- TRACE_ACTION("DELETE", rt);
- FIXLEN(&(rt->rt_router));
- FIXLEN(&(rt->rt_dst));
- if (rt->rt_metric < HOPCNT_INFINITY) {
- if ((rt->rt_state & (RTS_INTERFACE|RTS_INTERNAL)) == RTS_INTERFACE)
- syslog(LOG_ERR,
- "deleting route to interface %s? (timed out?)",
- rt->rt_ifp->int_name);
- if ((rt->rt_state & (RTS_INTERNAL | RTS_EXTERNAL)) == 0 &&
- rtioctl(DELETE, &rt->rt_rt) < 0)
- perror("rtdelete");
- }
- remque(rt);
- free((char *)rt);
-}
-
-void
-rtdeleteall(sig)
- int sig;
-{
- register struct rthash *rh;
- register struct rt_entry *rt;
- struct rthash *base = hosthash;
- int doinghost = 1;
-
-again:
- for (rh = base; rh < &base[ROUTEHASHSIZ]; rh++) {
- rt = rh->rt_forw;
- for (; rt != (struct rt_entry *)rh; rt = rt->rt_forw) {
- if (rt->rt_state & RTS_INTERFACE ||
- rt->rt_metric >= HOPCNT_INFINITY)
- continue;
- TRACE_ACTION("DELETE", rt);
- if ((rt->rt_state & (RTS_INTERNAL|RTS_EXTERNAL)) == 0 &&
- rtioctl(DELETE, &rt->rt_rt) < 0)
- perror("rtdeleteall");
- }
- }
- if (doinghost) {
- doinghost = 0;
- base = nethash;
- goto again;
- }
- exit(sig);
-}
-
-/*
- * If we have an interface to the wide, wide world,
- * add an entry for an Internet default route (wildcard) to the internal
- * tables and advertise it. This route is not added to the kernel routes,
- * but this entry prevents us from listening to other people's defaults
- * and installing them in the kernel here.
- */
-void
-rtdefault()
-{
- extern struct sockaddr inet_default;
-
- rtadd(&inet_default, &inet_default, 1,
- RTS_CHANGED | RTS_PASSIVE | RTS_INTERNAL);
-}
-
-void
-rtinit()
-{
- register struct rthash *rh;
-
- for (rh = nethash; rh < &nethash[ROUTEHASHSIZ]; rh++)
- rh->rt_forw = rh->rt_back = (struct rt_entry *)rh;
- for (rh = hosthash; rh < &hosthash[ROUTEHASHSIZ]; rh++)
- rh->rt_forw = rh->rt_back = (struct rt_entry *)rh;
-}
-
-int
-rtioctl(action, ort)
- int action;
- struct rtuentry *ort;
-{
-#ifndef RTM_ADD
- if (install == 0)
- return (errno = 0);
- ort->rtu_rtflags = ort->rtu_flags;
- switch (action) {
-
- case ADD:
- return (ioctl(s, SIOCADDRT, (char *)ort));
-
- case DELETE:
- return (ioctl(s, SIOCDELRT, (char *)ort));
-
- default:
- return (-1);
- }
-#else /* RTM_ADD */
- struct {
- struct rt_msghdr w_rtm;
- struct sockaddr_in w_dst;
- struct sockaddr w_gate;
- struct sockaddr_in w_netmask;
- } w;
-#define rtm w.w_rtm
-
- memset(&w, 0, sizeof(w));
- rtm.rtm_msglen = sizeof(w);
- rtm.rtm_version = RTM_VERSION;
- rtm.rtm_type = (action == ADD ? RTM_ADD :
- (action == DELETE ? RTM_DELETE : RTM_CHANGE));
-#undef rt_dst
- rtm.rtm_flags = ort->rtu_flags;
- rtm.rtm_seq = ++seqno;
- rtm.rtm_addrs = RTA_DST|RTA_GATEWAY;
- memmove(&w.w_dst, &ort->rtu_dst, sizeof(w.w_dst));
- memmove(&w.w_gate, &ort->rtu_router, sizeof(w.w_gate));
- w.w_dst.sin_family = AF_INET;
- w.w_dst.sin_len = sizeof(w.w_dst);
- w.w_gate.sa_family = AF_INET;
- w.w_gate.sa_len = sizeof(w.w_gate);
- if (rtm.rtm_flags & RTF_HOST) {
- rtm.rtm_msglen -= sizeof(w.w_netmask);
- } else {
- register char *cp;
- int len;
-
- rtm.rtm_addrs |= RTA_NETMASK;
- w.w_netmask.sin_addr.s_addr =
- inet_maskof(w.w_dst.sin_addr.s_addr);
- for (cp = (char *)(1 + &w.w_netmask.sin_addr);
- --cp > (char *) &w.w_netmask; )
- if (*cp)
- break;
- len = cp - (char *)&w.w_netmask;
- if (len) {
- len++;
- w.w_netmask.sin_len = len;
- len = 1 + ((len - 1) | (sizeof(long) - 1));
- } else
- len = sizeof(long);
- rtm.rtm_msglen -= (sizeof(w.w_netmask) - len);
- }
- errno = 0;
- return (install ? write(r, (char *)&w, rtm.rtm_msglen) : (errno = 0));
-#endif /* RTM_ADD */
-}
+++ /dev/null
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright (c) 1983, 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following 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.
- *
- * 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.
- *
- * @(#)defs.h 8.1 (Berkeley) 6/5/93
- */
-
-
-/*
- * Routing Table Management Daemon
- */
-#include "defs.h"
-
-int faketime;
-
-/*
- * Timer routine. Performs routing information supply
- * duties and manages timers on routing table entries.
- * Management of the RTS_CHANGED bit assumes that we broadcast
- * each time called.
- */
-void
-timer()
-{
- register struct rthash *rh;
- register struct rt_entry *rt;
- struct rthash *base = hosthash;
- int doinghost = 1, timetobroadcast;
-
- (void) gettimeofday(&now, (struct timezone *)NULL);
- faketime += TIMER_RATE;
- if (lookforinterfaces && (faketime % CHECK_INTERVAL) == 0)
- ifinit();
- timetobroadcast = supplier && (faketime % SUPPLY_INTERVAL) == 0;
-again:
- for (rh = base; rh < &base[ROUTEHASHSIZ]; rh++) {
- rt = rh->rt_forw;
- for (; rt != (struct rt_entry *)rh; rt = rt->rt_forw) {
- /*
- * We don't advance time on a routing entry for
- * a passive gateway, or any interface if we're
- * not acting as supplier.
- */
- if (!(rt->rt_state & RTS_PASSIVE) &&
- (supplier || !(rt->rt_state & RTS_INTERFACE)))
- rt->rt_timer += TIMER_RATE;
- if (rt->rt_timer >= GARBAGE_TIME) {
- rt = rt->rt_back;
- rtdelete(rt->rt_forw);
- continue;
- }
- if (rt->rt_timer >= EXPIRE_TIME &&
- rt->rt_metric < HOPCNT_INFINITY)
- rtchange(rt, &rt->rt_router, HOPCNT_INFINITY);
- rt->rt_state &= ~RTS_CHANGED;
- }
- }
- if (doinghost) {
- doinghost = 0;
- base = nethash;
- goto again;
- }
- if (timetobroadcast) {
- toall((int (*)())supply, 0, (struct interface *)NULL);
- lastbcast = now;
- lastfullupdate = now;
- needupdate = 0; /* cancel any pending dynamic update */
- nextbcast.tv_sec = 0;
- }
-}
-
-/*
- * On hangup, let everyone know we're going away.
- */
-void
-hup()
-{
- register struct rthash *rh;
- register struct rt_entry *rt;
- struct rthash *base = hosthash;
- int doinghost = 1;
-
- if (supplier) {
-again:
- for (rh = base; rh < &base[ROUTEHASHSIZ]; rh++) {
- rt = rh->rt_forw;
- for (; rt != (struct rt_entry *)rh; rt = rt->rt_forw)
- rt->rt_metric = HOPCNT_INFINITY;
- }
- if (doinghost) {
- doinghost = 0;
- base = nethash;
- goto again;
- }
- toall((int (*)())supply, 0, (struct interface *)NULL);
- }
- exit(1);
-}
+++ /dev/null
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright (c) 1983, 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following 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.
- *
- * 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.
- *
- * @(#)defs.h 8.1 (Berkeley) 6/5/93
- */
-
-
-/*
- * Routing Table Management Daemon
- */
-#define RIPCMDS
-#include "defs.h"
-#include <sys/stat.h>
-#include <sys/signal.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include "pathnames.h"
-
-#define NRECORDS 50 /* size of circular trace buffer */
-#ifdef DEBUG
-FILE *ftrace = stdout;
-int traceactions = 0;
-#endif
-static struct timeval lastlog;
-static char *savetracename;
-
-static int iftraceinit();
-
-void
-traceinit(ifp)
- register struct interface *ifp;
-{
-
- if (iftraceinit(ifp, &ifp->int_input) &&
- iftraceinit(ifp, &ifp->int_output))
- return;
- tracehistory = 0;
- fprintf(stderr, "traceinit: can't init %s\n", ifp->int_name);
-}
-
-
-static int
-iftraceinit(ifp, ifd)
- struct interface *ifp;
- register struct ifdebug *ifd;
-{
- register struct iftrace *t;
-
- ifd->ifd_records =
- (struct iftrace *)malloc(NRECORDS * sizeof (struct iftrace));
- if (ifd->ifd_records == 0)
- return (0);
- ifd->ifd_front = ifd->ifd_records;
- ifd->ifd_count = 0;
- for (t = ifd->ifd_records; t < ifd->ifd_records + NRECORDS; t++) {
- t->ift_size = 0;
- t->ift_packet = 0;
- }
- ifd->ifd_if = ifp;
- return (1);
-}
-
-void
-traceon(file)
- char *file;
-{
- struct stat stbuf;
-
- if (ftrace != NULL)
- return;
- if (stat(file, &stbuf) >= 0 && (stbuf.st_mode & S_IFMT) != S_IFREG)
- return;
- savetracename = file;
- (void) gettimeofday(&now, (struct timezone *)NULL);
- ftrace = fopen(file, "a");
- if (ftrace == NULL)
- return;
- dup2(fileno(ftrace), 1);
- dup2(fileno(ftrace), 2);
- traceactions = 1;
- fprintf(ftrace, "Tracing enabled %s\n", ctime((time_t *)&now.tv_sec));
-}
-
-void
-traceoff()
-{
- if (!traceactions)
- return;
- if (ftrace != NULL) {
- int fd = open(_PATH_DEVNULL, O_RDWR);
-
- fprintf(ftrace, "Tracing disabled %s\n",
- ctime((time_t *)&now.tv_sec));
- fflush(ftrace);
- (void) dup2(fd, 1);
- (void) dup2(fd, 2);
- (void) close(fd);
- fclose(ftrace);
- ftrace = NULL;
- }
- traceactions = 0;
- tracehistory = 0;
- tracepackets = 0;
- tracecontents = 0;
-}
-
-void
-sigtrace(s)
- int s;
-{
-
- if (s == SIGUSR2)
- traceoff();
- else if (ftrace == NULL && savetracename)
- traceon(savetracename);
- else
- bumploglevel();
-}
-
-/*
- * Move to next higher level of tracing when -t option processed or
- * SIGUSR1 is received. Successive levels are:
- * traceactions
- * traceactions + tracepackets
- * traceactions + tracehistory (packets and contents after change)
- * traceactions + tracepackets + tracecontents
- */
-void
-bumploglevel()
-{
-
- (void) gettimeofday(&now, (struct timezone *)NULL);
- if (traceactions == 0) {
- traceactions++;
- if (ftrace)
- fprintf(ftrace, "Tracing actions started %s\n",
- ctime((time_t *)&now.tv_sec));
- } else if (tracepackets == 0) {
- tracepackets++;
- tracehistory = 0;
- tracecontents = 0;
- if (ftrace)
- fprintf(ftrace, "Tracing packets started %s\n",
- ctime((time_t *)&now.tv_sec));
- } else if (tracehistory == 0) {
- tracehistory++;
- if (ftrace)
- fprintf(ftrace, "Tracing history started %s\n",
- ctime((time_t *)&now.tv_sec));
- } else {
- tracepackets++;
- tracecontents++;
- tracehistory = 0;
- if (ftrace)
- fprintf(ftrace, "Tracing packet contents started %s\n",
- ctime((time_t *)&now.tv_sec));
- }
- if (ftrace)
- fflush(ftrace);
-}
-
-void
-trace(ifd, who, p, len, m)
- register struct ifdebug *ifd;
- struct sockaddr *who;
- char *p;
- int len, m;
-{
- register struct iftrace *t;
-
- if (ifd->ifd_records == 0)
- return;
- t = ifd->ifd_front++;
- if (ifd->ifd_front >= ifd->ifd_records + NRECORDS)
- ifd->ifd_front = ifd->ifd_records;
- if (ifd->ifd_count < NRECORDS)
- ifd->ifd_count++;
- if (t->ift_size > 0 && t->ift_size < len && t->ift_packet) {
- free(t->ift_packet);
- t->ift_packet = 0;
- }
- t->ift_stamp = now;
- t->ift_who = *who;
- if (len > 0 && t->ift_packet == 0) {
- t->ift_packet = malloc(len);
- if (t->ift_packet == 0)
- len = 0;
- }
- if (len > 0)
- memmove(t->ift_packet, p, len);
- t->ift_size = len;
- t->ift_metric = m;
-}
-
-void
-traceaction(fd, action, rt)
- FILE *fd;
- char *action;
- struct rt_entry *rt;
-{
- struct sockaddr_in *dst, *gate;
- static struct bits {
- int t_bits;
- char *t_name;
- } flagbits[] = {
- { RTF_UP, "UP" },
- { RTF_GATEWAY, "GATEWAY" },
- { RTF_HOST, "HOST" },
- { 0 }
- }, statebits[] = {
- { RTS_PASSIVE, "PASSIVE" },
- { RTS_REMOTE, "REMOTE" },
- { RTS_INTERFACE,"INTERFACE" },
- { RTS_CHANGED, "CHANGED" },
- { RTS_INTERNAL, "INTERNAL" },
- { RTS_EXTERNAL, "EXTERNAL" },
- { RTS_SUBNET, "SUBNET" },
- { 0 }
- };
- register struct bits *p;
- register int first;
- char *cp;
-
- if (fd == NULL)
- return;
- if (lastlog.tv_sec != now.tv_sec || lastlog.tv_usec != now.tv_usec) {
- fprintf(fd, "\n%.19s:\n", ctime((time_t *)&now.tv_sec));
- lastlog = now;
- }
- fprintf(fd, "%s ", action);
- dst = (struct sockaddr_in *)&rt->rt_dst;
- gate = (struct sockaddr_in *)&rt->rt_router;
- fprintf(fd, "dst %s, ", inet_ntoa(dst->sin_addr));
- fprintf(fd, "router %s, metric %d, flags",
- inet_ntoa(gate->sin_addr), rt->rt_metric);
- cp = " %s";
- for (first = 1, p = flagbits; p->t_bits > 0; p++) {
- if ((rt->rt_flags & p->t_bits) == 0)
- continue;
- fprintf(fd, cp, p->t_name);
- if (first) {
- cp = "|%s";
- first = 0;
- }
- }
- fprintf(fd, " state");
- cp = " %s";
- for (first = 1, p = statebits; p->t_bits > 0; p++) {
- if ((rt->rt_state & p->t_bits) == 0)
- continue;
- fprintf(fd, cp, p->t_name);
- if (first) {
- cp = "|%s";
- first = 0;
- }
- }
- fprintf(fd, " timer %d\n", rt->rt_timer);
- if (tracehistory && !tracepackets &&
- (rt->rt_state & RTS_PASSIVE) == 0 && rt->rt_ifp)
- dumpif(fd, rt->rt_ifp);
- fflush(fd);
- if (ferror(fd))
- traceoff();
-}
-
-void
-tracenewmetric(fd, rt, newmetric)
- FILE *fd;
- struct rt_entry *rt;
- int newmetric;
-{
- struct sockaddr_in *dst, *gate;
-
- if (fd == NULL)
- return;
- if (lastlog.tv_sec != now.tv_sec || lastlog.tv_usec != now.tv_usec) {
- fprintf(fd, "\n%.19s:\n", ctime((time_t *)&now.tv_sec));
- lastlog = now;
- }
- dst = (struct sockaddr_in *)&rt->rt_dst;
- gate = (struct sockaddr_in *)&rt->rt_router;
- fprintf(fd, "CHANGE metric dst %s, ", inet_ntoa(dst->sin_addr));
- fprintf(fd, "router %s, from %d to %d\n",
- inet_ntoa(gate->sin_addr), rt->rt_metric, newmetric);
- fflush(fd);
- if (ferror(fd))
- traceoff();
-}
-
-void
-dumpif(fd, ifp)
- FILE *fd;
- register struct interface *ifp;
-{
- if (ifp->int_input.ifd_count || ifp->int_output.ifd_count) {
- fprintf(fd, "*** Packet history for interface %s ***\n",
- ifp->int_name);
-#ifdef notneeded
- dumptrace(fd, "to", &ifp->int_output);
-#endif
- dumptrace(fd, "from", &ifp->int_input);
- fprintf(fd, "*** end packet history ***\n");
- }
-}
-
-void
-dumptrace(fd, dir, ifd)
- FILE *fd;
- char *dir;
- register struct ifdebug *ifd;
-{
- register struct iftrace *t;
- char *cp = !strcmp(dir, "to") ? "Output" : "Input";
-
- if (ifd->ifd_front == ifd->ifd_records &&
- ifd->ifd_front->ift_size == 0) {
- fprintf(fd, "%s: no packets.\n", cp);
- fflush(fd);
- return;
- }
- fprintf(fd, "%s trace:\n", cp);
- t = ifd->ifd_front - ifd->ifd_count;
- if (t < ifd->ifd_records)
- t += NRECORDS;
- for ( ; ifd->ifd_count; ifd->ifd_count--, t++) {
- if (t >= ifd->ifd_records + NRECORDS)
- t = ifd->ifd_records;
- if (t->ift_size == 0)
- continue;
- dumppacket(fd, dir, (struct sockaddr_in *)&t->ift_who, t->ift_packet, t->ift_size,
- &t->ift_stamp);
- }
-}
-
-void
-dumppacket(fd, dir, who, cp, size, stamp)
- FILE *fd;
- struct sockaddr_in *who; /* should be sockaddr */
- char *dir, *cp;
- register int size;
- struct timeval *stamp;
-{
- register struct rip *msg = (struct rip *)cp;
- register struct netinfo *n;
-
- if (fd == NULL)
- return;
- if (msg->rip_cmd && msg->rip_cmd < RIPCMD_MAX)
- fprintf(fd, "%s %s %s.%d %.19s:\n", ripcmds[msg->rip_cmd],
- dir, inet_ntoa(who->sin_addr), ntohs(who->sin_port),
- ctime((time_t *)&stamp->tv_sec));
- else {
- fprintf(fd, "Bad cmd 0x%x %s %s.%d\n", msg->rip_cmd,
- dir, inet_ntoa(who->sin_addr), ntohs(who->sin_port));
- fprintf(fd, "size=%d cp=%s packet=%s %.19s\n", size, cp, packet,
- ctime((time_t *)&stamp->tv_sec));
- fflush(fd);
- return;
- }
- if (tracepackets && tracecontents == 0) {
- fflush(fd);
- return;
- }
- switch (msg->rip_cmd) {
-
- case RIPCMD_REQUEST:
- case RIPCMD_RESPONSE:
- size -= 4 * sizeof (char);
- n = msg->rip_nets;
- for (; size > 0; n++, size -= sizeof (struct netinfo)) {
- if (size < sizeof (struct netinfo)) {
- fprintf(fd, "(truncated record, len %d)\n",
- size);
- break;
- }
- if (sizeof(n->rip_dst.sa_family) > 1)
- n->rip_dst.sa_family = ntohs(n->rip_dst.sa_family);
-
- switch ((int)n->rip_dst.sa_family) {
-
- case AF_INET:
- fprintf(fd, "\tdst %s metric %d\n",
-#define satosin(sa) ((struct sockaddr_in *)&sa)
- inet_ntoa(satosin(n->rip_dst)->sin_addr),
- ntohl(n->rip_metric));
- break;
-
- default:
- fprintf(fd, "\taf %d? metric %d\n",
- n->rip_dst.sa_family,
- ntohl(n->rip_metric));
- break;
- }
- }
- break;
-
- case RIPCMD_TRACEON:
- fprintf(fd, "\tfile=%*s\n", size, msg->rip_tracefile);
- break;
-
- case RIPCMD_TRACEOFF:
- break;
- }
- fflush(fd);
- if (ferror(fd))
- traceoff();
-}
+++ /dev/null
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright (c) 1983, 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following 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.
- *
- * 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.
- *
- * @(#)defs.h 8.1 (Berkeley) 6/5/93
- */
-
-/*
- * Routing table management daemon.
- */
-
-/*
- * Trace record format.
- */
-struct iftrace {
- struct timeval ift_stamp; /* time stamp */
- struct sockaddr ift_who; /* from/to */
- char *ift_packet; /* pointer to packet */
- short ift_size; /* size of packet */
- short ift_metric; /* metric on associated metric */
-};
-
-/*
- * Per interface packet tracing buffers. An incoming and
- * outgoing circular buffer of packets is maintained, per
- * interface, for debugging. Buffers are dumped whenever
- * an interface is marked down.
- */
-struct ifdebug {
- struct iftrace *ifd_records; /* array of trace records */
- struct iftrace *ifd_front; /* next empty trace record */
- int ifd_count; /* number of unprinted records */
- struct interface *ifd_if; /* for locating stuff */
-};
-
-/*
- * Packet tracing stuff.
- */
-EXTERN int tracepackets; /* watch packets as they go by */
-EXTERN int tracecontents; /* watch packet contents as they go by */
-EXTERN int traceactions; /* on/off */
-EXTERN int tracehistory; /* on/off */
-EXTERN FILE *ftrace; /* output trace file */
-
-void traceinit(struct interface *);
-void traceon(char *);
-void traceoff(void);
-void sigtrace(int);
-void bumploglevel(void);
-void trace(struct ifdebug *, struct sockaddr *, char *, int, int);
-struct rt_entry; /* forward reference */
-void traceaction(FILE *, char *, struct rt_entry *);
-void tracenewmetric(FILE *, struct rt_entry *, int);
-void dumpif(FILE *, struct interface *);
-void dumptrace(FILE *, char *, struct ifdebug *);
-void dumppacket(FILE *, char *, struct sockaddr_in *, char *, int, struct timeval *);
-
-#define TRACE_ACTION(action, route) { \
- if (traceactions) \
- traceaction(ftrace, action, route); \
- }
-#define TRACE_NEWMETRIC(route, newmetric) { \
- if (traceactions) \
- tracenewmetric(ftrace, route, newmetric); \
- }
-#define TRACE_INPUT(ifp, src, pack, size) { \
- if (tracehistory) { \
- ifp = if_iflookup(src); \
- if (ifp) \
- trace(&ifp->int_input, src, pack, size, \
- ntohl(ifp->int_metric)); \
- } \
- if (tracepackets) \
- dumppacket(ftrace, "from", (struct sockaddr_in *)src, pack, size, &now); \
- }
-#define TRACE_OUTPUT(ifp, dst, size) { \
- if (tracehistory && ifp) \
- trace(&ifp->int_output, dst, packet, size, ifp->int_metric); \
- if (tracepackets) \
- dumppacket(ftrace, "to", (struct sockaddr_in *)dst, packet, size, &now); \
- }
+++ /dev/null
-# @(#)Makefile 8.1 (Berkeley) 6/5/93
-
-PROG= trace
-NOMAN= noman
-
-.include "../../Makefile.inc"
-.include <bsd.prog.mk>
+++ /dev/null
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved
- *
- * Copyright (c) 1983, 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * The NEXTSTEP Software License Agreement specifies the terms
- * and conditions for redistribution.
- *
- */
-
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1983, 1988, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)trace.c 8.2 (Berkeley) 4/28/95";
-#endif /* not lint */
-
-#include <sys/param.h>
-#include <sys/protosw.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <protocols/routed.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-struct sockaddr_in myaddr;
-char packet[MAXPACKETSIZE];
-
-main(argc, argv)
- int argc;
- char **argv;
-{
- int size, s;
- struct sockaddr from;
- struct sockaddr_in router;
- register struct rip *msg = (struct rip *)packet;
- struct hostent *hp;
- struct servent *sp;
-
- if (argc < 3) {
-usage:
- printf("usage: trace cmd machines,\n");
- printf("cmd either \"on filename\", or \"off\"\n");
- exit(1);
- }
- s = socket(AF_INET, SOCK_DGRAM, 0);
- if (s < 0) {
- perror("socket");
- exit(2);
- }
- myaddr.sin_family = AF_INET;
- myaddr.sin_port = htons(IPPORT_RESERVED-1);
- if (bind(s, (struct sockaddr *)&myaddr, sizeof(myaddr)) < 0) {
- perror("bind");
- exit(2);
- }
-
- argv++, argc--;
- msg->rip_cmd = strcmp(*argv, "on") == 0 ?
- RIPCMD_TRACEON : RIPCMD_TRACEOFF;
- msg->rip_vers = RIPVERSION;
- argv++, argc--;
- size = sizeof (int);
- if (msg->rip_cmd == RIPCMD_TRACEON) {
- strcpy(msg->rip_tracefile, *argv);
- size += strlen(*argv);
- argv++, argc--;
- }
- if (argc == 0)
- goto usage;
- memset(&router, 0, sizeof (router));
- router.sin_family = AF_INET;
- sp = getservbyname("router", "udp");
- if (sp == 0) {
- printf("udp/router: service unknown\n");
- exit(1);
- }
- router.sin_port = sp->s_port;
- while (argc > 0) {
- router.sin_family = AF_INET;
- router.sin_addr.s_addr = inet_addr(*argv);
- if (router.sin_addr.s_addr == -1) {
- hp = gethostbyname(*argv);
- if (hp == NULL) {
- fprintf(stderr, "trace: %s: ", *argv);
- herror((char *)NULL);
- continue;
- }
- memmove(&router.sin_addr, hp->h_addr, hp->h_length);
- }
- if (sendto(s, packet, size, 0,
- (struct sockaddr *)&router, sizeof(router)) < 0)
- perror(*argv);
- argv++, argc--;
- }
-}
+++ /dev/null
-Project = rtadvd
-Install_Dir = /usr/sbin
-
-CFILES = advcap.c config.c dump.c if.c rrenum.c rtadvd.c timer.c
-HFILES = advcap.h config.h dump.h if.h pathnames.h rrenum.h rtadvd.h timer.h
-MANPAGES = rtadvd.8 rtadvd.conf.5
-
-Extra_CC_Flags = -mdynamic-no-pic -dead_strip \
- -DINET6 -DHAVE_GETIFADDRS \
- -I$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
-
-# 6to4.conf should be root-writable
-Install_File_Mode = 0644
-
-after_install:
- $(INSTALL_DIRECTORY) -d "$(DSTROOT)"/private/etc
- $(INSTALL_FILE) rtadvd.conf "$(DSTROOT)"/private/etc
#define NEXT_SA(ap) (ap) = (struct sockaddr *) \
((caddr_t)(ap) + ((ap)->sa_len ? ROUNDUP((ap)->sa_len,\
- sizeof(u_long)) :\
- sizeof(u_long)))
+ sizeof(uint32_t)) :\
+ sizeof(uint32_t)))
struct if_msghdr **iflist;
int iflist_init_ok;
{
struct ifaddrs *ifap, *ifa;
struct if_data *ifd;
- u_long mtu = 0;
+ int mtu = 0;
if (getifaddrs(&ifap) < 0)
return(0);
irr->irr_u_uselen = rpu->rpu_uselen;
irr->irr_u_keeplen = rpu->rpu_keeplen;
irr->irr_raf_mask_onlink =
- (rpu->rpu_ramask & ICMP6_RR_PCOUSE_RAFLAGS_ONLINK);
+ (rpu->rpu_ramask & ICMP6_RR_PCOUSE_RAFLAGS_ONLINK) == 0 ? 0 : 1;
irr->irr_raf_mask_auto =
- (rpu->rpu_ramask & ICMP6_RR_PCOUSE_RAFLAGS_AUTO);
+ (rpu->rpu_ramask & ICMP6_RR_PCOUSE_RAFLAGS_AUTO) == 0 ? 0 : 1;
irr->irr_vltime = ntohl(rpu->rpu_vltime);
irr->irr_pltime = ntohl(rpu->rpu_pltime);
irr->irr_raf_onlink =
+++ /dev/null
-Project = rtsol
-Install_Dir = /sbin
-
-CFILES = rtsold.c rtsol.c if.c probe.c dump.c rtsock.c
-HFILES = rtsold.h
-MANPAGES = rtsol.8
-
-Extra_CC_Flags = -mdynamic-no-pic -dead_strip \
- -DINET6 -DHAVE_GETIFADDRS \
- -I$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
-Extra_LD_Flags = -lipsec
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
-
-after_install:
- $(INSTALL_DIRECTORY) "$(DSTROOT)"/usr/sbin
- $(LN) -f "$(DSTROOT)"/sbin/rtsol "$(DSTROOT)"/usr/sbin/rtsold
- $(LN) -f "$(DSTROOT)"/usr/share/man/man8/rtsol.8 \
- "$(DSTROOT)"/usr/share/man/man8/rtsold.8
#define NEXT_SA(ap) (ap) = (struct sockaddr *) \
((caddr_t)(ap) + ((ap)->sa_len ? ROUNDUP((ap)->sa_len,\
- sizeof(u_long)) :\
- sizeof(u_long)))
+ sizeof(uint32_t)) :\
+ sizeof(uint32_t)))
#define ROUNDUP8(a) (1 + (((a) - 1) | 7))
int
#define NEXT_SA(ap) (ap) = (struct sockaddr *) \
((caddr_t)(ap) + \
- ((ap)->sa_len ? ROUNDUP((ap)->sa_len, sizeof(u_long)) \
- : sizeof(u_long)))
+ ((ap)->sa_len ? ROUNDUP((ap)->sa_len, sizeof(uint32_t)) \
+ : sizeof(uint32_t)))
#ifdef RTM_IFANNOUNCE /*NetBSD 1.5 or later*/
static int rtsock_input_ifannounce __P((int, struct rt_msghdr *, char *));
+++ /dev/null
-Project = slattach
-Install_Dir = /sbin
-
-CFILES = slattach.c
-MANPAGES = slattach.8
-
-Extra_CC_Flags = -mdynamic-no-pic -dead_strip
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
-
+++ /dev/null
-.\" Copyright (c) 1986, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)slattach.8 8.2 (Berkeley) 4/1/94
-.\"
-.Dd April 1, 1994
-.Dt SLATTACH 8
-.Os BSD 4.3
-.Sh NAME
-.Nm slattach
-.Nd attach serial lines as network interfaces
-.Sh SYNOPSIS
-.Nm Slattach
-.Ar ttyname Op Ar baudrate
-.Sh DESCRIPTION
-.Nm Slattach
-is used to assign a tty line to a network interface,
-and to define the network source and destination addresses.
-The following operands are supported by
-.Nm slattach :
-.Bl -tag -width Ar
-.It Ar ttyname
-Specifies the name of the tty device.
-.Ar Ttyname
-should be a string of the form
-.Ql ttyXX ,
-or
-.Ql /dev/ttyXX .
-.It Ar baudrate
-Specifies the speed of the connection. If not specified, the
-default of 9600 is used.
-.El
-.Pp
-Only the super-user may attach a network interface.
-.Pp
-To detach the interface, use
-.Dq Li ifconfig interface-name down
-after killing off the
-.Nm slattach
-process.
-.Ar Interface-name
-is the name that is shown by
-.Xr netstat 1
-.Sh EXAMPLES
-.Bd -literal -offset indent -compact
-slattach ttyh8
-slattach /dev/tty01 4800
-.Ed
-.Sh DIAGNOSTICS
-Messages indicating the specified interface does not exit, the
-requested address is unknown, the user is not privileged and
-tried to alter an interface's configuration.
-.Sh SEE ALSO
-.Xr netstat 1 ,
-.Xr netintro 4 ,
-.Xr ifconfig 8 ,
-.Xr rc 8
-.Sh HISTORY
-The
-.Nm
-command appeared in
-.Bx 4.3 .
+++ /dev/null
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Rick Adams.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-
-#include <sys/param.h>
-#include <sgtty.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <net/if.h>
-#include <netdb.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <paths.h>
-
-#define DEFAULT_BAUD 9600
-int slipdisc = SLIPDISC;
-
-__private_extern__
-char dev_name[32] = { '\0' };
-char hostname[MAXHOSTNAMELEN];
-
-int findspeed(int);
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- register int fd;
- register char *dev = argv[1];
- struct sgttyb sgtty;
- int speed;
-
- if (argc < 2 || argc > 3) {
- fprintf(stderr, "usage: %s ttyname [baudrate]\n", argv[0]);
- exit(1);
- }
- speed = argc == 3 ? findspeed(atoi(argv[2])) : findspeed(DEFAULT_BAUD);
- if (speed == 0) {
- fprintf(stderr, "unknown speed %s", argv[2]);
- exit(1);
- }
- if (strncmp(_PATH_DEV, dev, sizeof(_PATH_DEV) - 1)) {
- (void)snprintf(dev_name, sizeof(dev_name),
- "%s%s", _PATH_DEV, dev);
- dev = dev_name;
- }
- if ((fd = open(dev, O_RDWR | O_NDELAY)) < 0) {
- perror(dev);
- exit(1);
- }
- sgtty.sg_flags = RAW | ANYP;
- sgtty.sg_ispeed = sgtty.sg_ospeed = speed;
- if (ioctl(fd, TIOCSETP, &sgtty) < 0) {
- perror("ioctl(TIOCSETP)");
- exit(1);
- }
- if (ioctl(fd, TIOCSETD, &slipdisc) < 0) {
- perror("ioctl(TIOCSETD)");
- exit(1);
- }
-
- if (fork() > 0)
- exit(0);
- for (;;)
- sigpause(0L);
- /* NOTREACHED */
- return 0;
-}
-
-struct sg_spds {
- int sp_val, sp_name;
-} spds[] = {
-#ifdef B50
- { 50, B50 },
-#endif
-#ifdef B75
- { 75, B75 },
-#endif
-#ifdef B110
- { 110, B110 },
-#endif
-#ifdef B150
- { 150, B150 },
-#endif
-#ifdef B200
- { 200, B200 },
-#endif
-#ifdef B300
- { 300, B300 },
-#endif
-#ifdef B600
- { 600, B600 },
-#endif
-#ifdef B1200
- { 1200, B1200 },
-#endif
-#ifdef B1800
- { 1800, B1800 },
-#endif
-#ifdef B2000
- { 2000, B2000 },
-#endif
-#ifdef B2400
- { 2400, B2400 },
-#endif
-#ifdef B3600
- { 3600, B3600 },
-#endif
-#ifdef B4800
- { 4800, B4800 },
-#endif
-#ifdef B7200
- { 7200, B7200 },
-#endif
-#ifdef B9600
- { 9600, B9600 },
-#endif
-#ifdef EXTA
- { 19200, EXTA },
-#endif
-#ifdef EXTB
- { 38400, EXTB },
-#endif
- { 0, 0 }
-};
-
-int
-findspeed(speed)
- register int speed;
-{
- register struct sg_spds *sp;
-
- sp = spds;
- while (sp->sp_val && sp->sp_val != speed)
- sp++;
- return (sp->sp_name);
-}
+++ /dev/null
-Project = spray
-Install_Dir = /usr/sbin
-
-CFILES = spray.c
-RPCFILES = spray.x
-MANPAGES = spray.8
-
-Extra_CC_Flags = -mdynamic-no-pic -dead_strip
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
+++ /dev/null
-Project = traceroute
-Install_Dir = /usr/sbin
-
-CFILES = traceroute.c ifaddrlist.c findsaddr-socket.c version.c
-MANPAGES = traceroute.8
-
-Extra_CC_Flags = -mdynamic-no-pic -dead_strip \
- -DHAVE_SOCKADDR_SA_LEN
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
-
-Install_Program_Mode = 04555
--- /dev/null
+/* $FreeBSD: src/contrib/traceroute/as.c,v 1.1 2008/02/20 23:29:52 rpaulo Exp $ */
+/* $NetBSD: as.c,v 1.1 2001/11/04 23:14:36 atatat Exp $ */
+
+/*
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Brown.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <err.h>
+#include <stdio.h>
+
+#include "as.h"
+
+#define DEFAULT_AS_SERVER "whois.radb.net"
+#undef AS_DEBUG_FILE
+
+struct aslookup {
+ FILE *as_f;
+#ifdef AS_DEBUG_FILE
+ FILE *as_debug;
+#endif /* AS_DEBUG_FILE */
+};
+
+void *
+as_setup(server)
+ char *server;
+{
+ struct aslookup *asn;
+ struct hostent *he = NULL;
+ struct servent *se;
+ struct sockaddr_in in;
+ FILE *f;
+ int s;
+
+ if (server == NULL)
+ server = DEFAULT_AS_SERVER;
+
+ (void)memset(&in, 0, sizeof(in));
+ in.sin_family = AF_INET;
+ in.sin_len = sizeof(in);
+ if ((se = getservbyname("whois", "tcp")) == NULL) {
+ warnx("warning: whois/tcp service not found");
+ in.sin_port = ntohs(43);
+ } else
+ in.sin_port = se->s_port;
+
+ if (inet_aton(server, &in.sin_addr) == 0 &&
+ ((he = gethostbyname(server)) == NULL ||
+ he->h_addr == NULL)) {
+ warnx("%s: %s", server, hstrerror(h_errno));
+ return (NULL);
+ }
+
+ if ((s = socket(PF_INET, SOCK_STREAM, 0)) == -1) {
+ warn("socket");
+ return (NULL);
+ }
+
+ do {
+ if (he != NULL) {
+ memcpy(&in.sin_addr, he->h_addr, he->h_length);
+ he->h_addr_list++;
+ }
+ if (connect(s, (struct sockaddr *)&in, sizeof(in)) == 0)
+ break;
+ if (he == NULL || he->h_addr == NULL) {
+ close(s);
+ s = -1;
+ break;
+ }
+ } while (1);
+
+ if (s == -1) {
+ warn("connect");
+ return (NULL);
+ }
+
+ f = fdopen(s, "r+");
+ (void)fprintf(f, "!!\n");
+ (void)fflush(f);
+
+ asn = malloc(sizeof(struct aslookup));
+ if (asn == NULL)
+ (void)fclose(f);
+ else
+ asn->as_f = f;
+
+#ifdef AS_DEBUG_FILE
+ asn->as_debug = fopen(AS_DEBUG_FILE, "w");
+ if (asn->as_debug) {
+ (void)fprintf(asn->as_debug, ">> !!\n");
+ (void)fflush(asn->as_debug);
+ }
+#endif /* AS_DEBUG_FILE */
+
+ return (asn);
+}
+
+int
+as_lookup(_asn, addr)
+ void *_asn;
+ struct in_addr *addr;
+{
+ struct aslookup *asn = _asn;
+ char buf[1024];
+ int as, rc, dlen;
+
+ as = rc = dlen = 0;
+ (void)fprintf(asn->as_f, "!r%s/32,l\n", inet_ntoa(*addr));
+ (void)fflush(asn->as_f);
+
+#ifdef AS_DEBUG_FILE
+ if (asn->as_debug) {
+ (void)fprintf(asn->as_debug, ">> !r%s/32,l\n",
+ inet_ntoa(*addr));
+ (void)fflush(asn->as_debug);
+ }
+#endif /* AS_DEBUG_FILE */
+
+ while (fgets(buf, sizeof(buf), asn->as_f) != NULL) {
+ buf[sizeof(buf) - 1] = '\0';
+
+#ifdef AS_DEBUG_FILE
+ if (asn->as_debug) {
+ (void)fprintf(asn->as_debug, "<< %s", buf);
+ (void)fflush(asn->as_debug);
+ }
+#endif /* AS_DEBUG_FILE */
+
+ if (rc == 0) {
+ rc = buf[0];
+ switch (rc) {
+ case 'A':
+ /* A - followed by # bytes of answer */
+ sscanf(buf, "A%d\n", &dlen);
+#ifdef AS_DEBUG_FILE
+ if (asn->as_debug) {
+ (void)fprintf(asn->as_debug,
+ "dlen: %d\n", dlen);
+ (void)fflush(asn->as_debug);
+ }
+#endif /* AS_DEBUG_FILE */
+ break;
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F':
+ /* C - no data returned */
+ /* D - key not found */
+ /* E - multiple copies of key */
+ /* F - some other error */
+ break;
+ }
+ if (rc == 'A')
+ /* skip to next input line */
+ continue;
+ }
+
+ if (dlen == 0)
+ /* out of data, next char read is end code */
+ rc = buf[0];
+ if (rc != 'A')
+ /* either an error off the bat, or a done code */
+ break;
+
+ /* data received, thank you */
+ dlen -= strlen(buf);
+
+ /* origin line is the interesting bit */
+ if (as == 0 && strncasecmp(buf, "origin:", 7) == 0) {
+ sscanf(buf + 7, " AS%d", &as);
+#ifdef AS_DEBUG_FILE
+ if (asn->as_debug) {
+ (void)fprintf(asn->as_debug, "as: %d\n", as);
+ (void)fflush(asn->as_debug);
+ }
+#endif /* AS_DEBUG_FILE */
+ }
+ }
+
+ return (as);
+}
+
+void
+as_shutdown(_asn)
+ void *_asn;
+{
+ struct aslookup *asn = _asn;
+
+ (void)fprintf(asn->as_f, "!q\n");
+ (void)fclose(asn->as_f);
+
+#ifdef AS_DEBUG_FILE
+ if (asn->as_debug) {
+ (void)fprintf(asn->as_debug, ">> !q\n");
+ (void)fclose(asn->as_debug);
+ }
+#endif /* AS_DEBUG_FILE */
+
+ free(asn);
+}
--- /dev/null
+/* $FreeBSD: src/contrib/traceroute/as.h,v 1.1 2008/02/20 23:29:52 rpaulo Exp $ */
+/* $NetBSD: as.h,v 1.1 2001/11/04 23:14:36 atatat Exp $ */
+
+/*
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Brown.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+void *as_setup __P((char *));
+int as_lookup __P((void *, struct in_addr *));
+void as_shutdown __P((void *));
}
if (SALEN(sa) == 0)
- cp += sizeof(long);
+ cp += sizeof (u_int32_t);
else
- cp += roundup(SALEN(sa), sizeof(long));
+ cp += roundup(SALEN(sa), sizeof (u_int32_t));
}
return ("failed!");
.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
.\" WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\"
-.Dd September 21, 2000
+.Dd May 29, 2008
.Dt TRACEROUTE 8
.Os BSD 4.3
.Sh NAME
.Nd print the route packets take to network host
.Sh SYNOPSIS
.Nm traceroute
-.Op Fl dFISdNnrvx
+.Op Fl adeFISdNnrvx
+.Op Fl A Ar as_server
.Op Fl f Ar first_ttl
.Op Fl g Ar gateway
.Op Fl i Ar iface
network hardware, connected together by gateways.
Tracking the route one's packets follow (or finding the miscreant
gateway that's discarding your packets) can be difficult.
-.Nm Traceroute
+.Nm
utilizes the IP protocol `time to live' field and attempts to elicit an
.Tn ICMP
.Dv TIME_EXCEEDED
.Pp
Other options are:
.Bl -tag -width Ds
+.It Fl a
+Turn on AS# lookups for each hop encountered.
+.It Fl A Ar as_server
+Turn on AS# lookups and use the given server instead of the
+default.
+.It Fl d
+Enable socket level debugging.
+.It Fl D
+When an ICMP response to our probe datagram is received,
+print the differences between the transmitted packet and
+the packet quoted by the ICMP response.
+A key showing the location of fields within the transmitted packet is printed,
+followed by the original packet in hex,
+followed by the quoted packet in hex.
+Bytes that are unchanged in the quoted packet are shown as underscores.
+Note,
+the IP checksum and the TTL of the quoted packet are not expected to match.
+By default, only one probe per hop is sent with this option.
+.It Fl e
+Firewall evasion mode.
+Use fixed destination ports for UDP and TCP probes.
+The destination port does NOT increment with each packet sent.
.It Fl f Ar first_ttl
Set the initial time-to-live used in the first outgoing probe packet.
.It Fl F
Set the "don't fragment" bit.
-.It Fl d
-Enable socket level debugging.
.It Fl g Ar gateway
Specify a loose source route gateway (8 maximum).
.It Fl i Ar iface
hops (the same default used for
.Tn TCP
connections).
-.It Fl N
-Disables the increment of the destination port (see -p). Useful for using tcpdump through firewalls.
.It Fl n
Print hop addresses numerically rather than symbolically and numerically
(saves a nameserver address-to-name lookup for each gateway found on the
and
.Tn ICMP
Other protocols may also be specified (either by name or by number), though
-.Nm traceroute
+.Nm
does not implement any special knowledge of their packet formats. This
option is useful for determining which router along a path may be
blocking packets based on IP protocol number. But see BUGS below.
sets the base
.Ar port
number used in probes (default is 33434).
-.Nm Traceroute
+.Nm
hopes that nothing is listening on
.Tn UDP
ports
.It Fl w
Set the time (in seconds) to wait for a response to a probe (default 5 sec.).
.It Fl x
-Toggle IP checksums. Normally, this prevents traceroute from calculating
+Toggle IP checksums. Normally, this prevents
+.Nm
+from calculating
IP checksums. In some cases, the operating system can overwrite parts of
the outgoing packet but not recalculate the checksum (so in some cases
the default is to not calculate checksums and using
until we probe with a ttl that's at least twice the path
length. I.e., rip is really only 7 hops away. A reply that
returns with a ttl of 1 is a clue this problem exists.
-.Nm Traceroute
+.Nm
prints a "!" after the time if the ttl is <= 1.
Since vendors ship a lot of obsolete
.Pf ( Tn DEC Ns \'s
(host, network or protocol unreachable),
.Sy !S
(source route failed),
-.Sy !F
+.B !F\-<pmtu>
(fragmentation needed \- the RFC1191 Path MTU Discovery value is displayed),
+.Sy !U
+or
+.Sy !W
+(destination network/host unknown),
+.Sy !I
+(source host is isolated),
+.Sy !A
+(communication with destination network administratively prohibited),
+.Sy !Z
+(communication with destination host administratively prohibited),
+.Sy !Q
+(for this ToS the destination network is unreachable),
+.Sy !T
+(for this ToS the destination host is unreachable),
.Sy !X
(communication administratively prohibited),
.Sy !V
.Sy !<num>
(ICMP unreachable code <num>).
These are defined by RFC1812 (which supersedes RFC1716).
-If almost all the probes result in some kind of unreachable,
-.Nm traceroute
+If almost all the probes result in some kind of unreachable,
+.Nm
will give up and exit.
.Pp
This program is intended for use in network testing, measurement
and management.
It should be used primarily for manual fault isolation.
Because of the load it could impose on the network, it is unwise to use
-.Nm traceroute
+.Nm
during normal operations or from automated scripts.
.Sh AUTHOR
Implemented by Van Jacobson from a suggestion by Steve Deering. Debugged
.Nm
should listen for a RST from the destination host (or an intermediate
router that's filtering packets), but this is not implemented yet.
+.Pp
+The AS number capability reports information that may sometimes be
+inaccurate due to discrepancies between the contents of the
+routing database server and the current state of the Internet.
"@(#)$Id: traceroute.c,v 1.4 2006/02/07 06:22:57 lindak Exp $ (LBL)";
#endif
static const char rcsid[] =
- "$FreeBSD: src/contrib/traceroute/traceroute.c,v 1.26 2004/04/17 18:44:23 pb Exp $";
+ "$FreeBSD: src/contrib/traceroute/traceroute.c,v 1.35 2008/02/20 23:29:52 rpaulo Exp $";
#endif
/*
#include "findsaddr.h"
#include "ifaddrlist.h"
+#include "as.h"
#include "traceroute.h"
/* Maximum number of gateways (include room for one noop) */
struct ip *outip; /* last output ip packet */
u_char *outp; /* last output inner protocol packet */
+struct ip *hip = NULL; /* Quoted IP header */
+int hiplen = 0;
+
/* loose source route gateway list (including room for final destination) */
u_int32_t gwlist[NGATEWAYS + 1];
char *device;
static const char devnull[] = "/dev/null";
-int nprobes = 3;
+int nprobes = -1;
int max_ttl;
int first_ttl = 1;
u_short ident;
int verbose;
int waittime = 5; /* time to wait for response (in seconds) */
int nflag; /* print addresses numerically */
-int disable_seq = 0;
+int as_path; /* print as numbers for each hop */
+char *as_server = NULL;
+void *asn;
#ifdef CANT_HACK_IPCKSUM
int doipcksum = 0; /* don't calculate ip checksums by default */
#else
int doipcksum = 1; /* calculate ip checksums by default */
#endif
int optlen; /* length of ip options */
+int fixedPort = 0; /* Use fixed destination port for TCP and UDP */
+int printdiff = 0; /* Print the difference between sent and quoted */
extern int optind;
extern int opterr;
void tvsub(struct timeval *, struct timeval *);
void usage(void);
int wait_for_reply(int, struct sockaddr_in *, const struct timeval *);
+void pkt_compare(const u_char *, int, const u_char *, int);
#ifndef HAVE_USLEEP
int usleep(u_int);
#endif
/* Descriptor structure for each outgoing protocol we support */
struct outproto {
char *name; /* name of protocol */
+ const char *key; /* An ascii key for the bytes of the header */
u_char num; /* IP protocol number */
u_short hdrlen; /* max size of protocol header */
u_short port; /* default base protocol-specific "port" */
struct outproto protos[] = {
{
"udp",
+ "spt dpt len sum",
IPPROTO_UDP,
sizeof(struct udphdr),
32768 + 666,
},
{
"tcp",
+ "spt dpt seq ack xxflwin sum urp",
IPPROTO_TCP,
sizeof(struct tcphdr),
32768 + 666,
},
{
"gre",
+ "flg pro len clid",
IPPROTO_GRE,
sizeof(struct grehdr),
GRE_PPTP_PROTO,
},
{
"icmp",
+ "typ cod sum ",
IPPROTO_ICMP,
sizeof(struct icmp),
0,
icmp_check
},
{
+ NULL,
NULL,
0,
2 * sizeof(u_short),
};
struct outproto *proto = &protos[0];
+const char *ip_hdr_key = "vhtslen id off tlprsum srcip dstip opts";
+
int
main(int argc, char **argv)
{
prog = argv[0];
opterr = 0;
- while ((op = getopt(argc, argv, "dFInrSvxf:g:i:M:m:P:p:q:s:t:w:z:")) != EOF)
+ while ((op = getopt(argc, argv, "aA:edDFInrSvxf:g:i:M:m:P:p:q:s:t:w:z:")) != EOF)
switch (op) {
-
+ case 'a':
+ as_path = 1;
+ break;
+
+ case 'A':
+ as_path = 1;
+ as_server = optarg;
+ break;
+
case 'd':
options |= SO_DEBUG;
break;
+ case 'D':
+ printdiff = 1;
+ break;
+
+ case 'e':
+ fixedPort = 1;
+ break;
+
case 'f':
case 'M': /* FreeBSD compat. */
first_ttl = str2val(optarg, "first ttl", 1, 255);
max_ttl = str2val(optarg, "max ttl", 1, 255);
break;
- case 'N':
- ++disable_seq;
- break;
-
case 'n':
++nflag;
break;
case 'w':
waittime = str2val(optarg, "wait time",
- 2, 24 * 60 * 60);
+ 1, 24 * 60 * 60);
break;
case 'z':
/* Set requested port, if any, else default for this protocol */
port = (requestPort != -1) ? requestPort : proto->port;
+ if (nprobes == -1)
+ nprobes = printdiff ? 1 : 3;
+
if (first_ttl > max_ttl) {
Fprintf(stderr,
"%s: first ttl (%d) may not be greater than max ttl (%d)\n",
exit (1);
}
+ if (as_path) {
+ asn = as_setup(as_server);
+ if (asn == NULL) {
+ Fprintf(stderr, "%s: as_setup failed, AS# lookups"
+ " disabled\n", prog);
+ (void)fflush(stderr);
+ as_path = 0;
+ }
+ }
+
#if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC)
if (setpolicy(sndsock, "in bypass") < 0)
errx(1, "%s", ipsec_strerror());
if (sentfirst && pausemsecs > 0)
usleep(pausemsecs * 1000);
/* Prepare outgoing data */
- if (disable_seq) {
- outdata.seq = seq;
- } else {
- outdata.seq = ++seq;
- }
+ outdata.seq = ++seq;
outdata.ttl = ttl;
/* Avoid alignment problems by copying bytewise: */
continue;
if (!gotlastaddr ||
from->sin_addr.s_addr != lastaddr) {
+ if (gotlastaddr) printf("\n ");
print(packet, cc, from);
lastaddr = from->sin_addr.s_addr;
++gotlastaddr;
#endif
precis = 3;
Printf(" %.*f ms", precis, T);
+ if (printdiff) {
+ Printf("\n");
+ Printf("%*.*s%s\n",
+ -(outip->ip_hl << 3),
+ outip->ip_hl << 3,
+ ip_hdr_key,
+ proto->key);
+ pkt_compare((void *)outip, packlen,
+ (void *)hip, hiplen);
+ }
if (i == -2) {
#ifndef ARCHAIC
ip = (struct ip *)packet;
Printf(" !S");
break;
+ case ICMP_UNREACH_NET_UNKNOWN:
+ ++unreachable;
+ Printf(" !U");
+ break;
+
+ case ICMP_UNREACH_HOST_UNKNOWN:
+ ++unreachable;
+ Printf(" !W");
+ break;
+
+ case ICMP_UNREACH_ISOLATED:
+ ++unreachable;
+ Printf(" !I");
+ break;
+
+ case ICMP_UNREACH_NET_PROHIB:
+ ++unreachable;
+ Printf(" !A");
+ break;
+
+ case ICMP_UNREACH_HOST_PROHIB:
+ ++unreachable;
+ Printf(" !Z");
+ break;
+
+ case ICMP_UNREACH_TOSNET:
+ ++unreachable;
+ Printf(" !Q");
+ break;
+
+ case ICMP_UNREACH_TOSHOST:
+ ++unreachable;
+ Printf(" !T");
+ break;
+
case ICMP_UNREACH_FILTER_PROHIB:
++unreachable;
Printf(" !X");
(unreachable > 0 && unreachable >= nprobes - 1))
break;
}
+ if (as_path)
+ as_shutdown(asn);
exit(0);
}
return -2;
if ((type == ICMP_TIMXCEED && code == ICMP_TIMXCEED_INTRANS) ||
type == ICMP_UNREACH) {
- struct ip *hip;
u_char *inner;
hip = &icp->icmp_ip;
+ hiplen = ((u_char *)icp + cc) - (u_char *)hip;
hlen = hip->ip_hl << 2;
inner = (u_char *)((u_char *)hip + hlen);
if (hlen + 12 <= cc
{
struct udphdr *const outudp = (struct udphdr *) outp;
- outudp->uh_sport = htons(ident);
- outudp->uh_dport = htons(port + outdata->seq);
+ outudp->uh_sport = htons(ident + (fixedPort ? outdata->seq : 0));
+ outudp->uh_dport = htons(port + (fixedPort ? 0 : outdata->seq));
outudp->uh_ulen = htons((u_short)protlen);
outudp->uh_sum = 0;
if (doipcksum) {
{
struct udphdr *const udp = (struct udphdr *) data;
- return (ntohs(udp->uh_sport) == ident
- && ntohs(udp->uh_dport) == port + seq);
+ return (ntohs(udp->uh_sport) == ident + (fixedPort ? seq : 0) &&
+ ntohs(udp->uh_dport) == port + (fixedPort ? 0 : seq));
}
void
struct tcphdr *const tcp = (struct tcphdr *) outp;
tcp->th_sport = htons(ident);
- tcp->th_dport = htons(port + outdata->seq);
- tcp->th_seq = (tcp->th_sport << 16) | tcp->th_dport;
+ tcp->th_dport = htons(port + (fixedPort ? 0 : outdata->seq));
+ tcp->th_seq = (tcp->th_sport << 16) | (tcp->th_dport +
+ (fixedPort ? outdata->seq : 0));
tcp->th_ack = 0;
tcp->th_off = 5;
tcp->th_flags = TH_SYN;
struct tcphdr *const tcp = (struct tcphdr *) data;
return (ntohs(tcp->th_sport) == ident
- && ntohs(tcp->th_dport) == port + seq);
+ && ntohs(tcp->th_dport) == port + (fixedPort ? 0 : seq))
+ && tcp->th_seq == ((ident << 16) | (port + seq));
}
void
hlen = ip->ip_hl << 2;
cc -= hlen;
+ if (as_path)
+ Printf(" [AS%d]", as_lookup(asn, &from->sin_addr));
+
if (nflag)
Printf(" %s", inet_ntoa(from->sin_addr));
else
{
static struct ipovly ipo;
u_short sumh, sumd;
- u_long sumt;
+ u_int32_t sumt;
ipo.ih_pr = ip->ip_p;
ipo.ih_len = htons(len);
proto = &protos[i];
if (proto->name == NULL) { /* generic handler */
struct protoent *pe;
- u_long pnum;
+ u_int32_t pnum;
/* Determine the IP protocol number */
if ((pe = getprotobyname(pname)) != NULL)
return proto;
}
+void
+pkt_compare(const u_char *a, int la, const u_char *b, int lb) {
+ int l;
+ int i;
+
+ for (i = 0; i < la; i++)
+ Printf("%02x", (unsigned int)a[i]);
+ Printf("\n");
+ l = (la <= lb) ? la : lb;
+ for (i = 0; i < l; i++)
+ if (a[i] == b[i])
+ Printf("__");
+ else
+ Printf("%02x", (unsigned int)b[i]);
+ for (; i < lb; i++)
+ Printf("%02x", (unsigned int)b[i]);
+ Printf("\n");
+}
+
+
void
usage(void)
{
Fprintf(stderr, "Version %s\n", version);
Fprintf(stderr,
- "Usage: %s [-dFINnrSvx] [-g gateway] [-i iface] [-f first_ttl]\n"
- "\t[-m max_ttl] [-p port] [-P proto] [-q nqueries] [-s src_addr]\n"
+ "Usage: %s [-adDeFInrSvx] [-A as_server] [-f first_ttl] [-g gateway] [-i iface]\n"
+ "\t[-M first_ttl] [-m max_ttl] [-p port] [-P proto] [-q nqueries] [-s src_addr]\n"
"\t[-t tos] [-w waittime] [-z pausemsecs] host [packetlen]\n", prog);
exit(1);
}
+++ /dev/null
-Project = traceroute6
-Install_Dir = /usr/sbin
-
-CFILES = traceroute6.c
-MANPAGES = traceroute6.8
-
-Extra_CC_Flags = -mdynamic-no-pic -dead_strip \
- -DINET6 -DIPSEC
-Extra_LD_Flags = -lipsec
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
-
-Install_Program_Mode = 04555
-.\" $KAME: traceroute6.8,v 1.8 2000/06/12 16:29:18 itojun Exp $
+.\" $KAME: traceroute6.8,v 1.10 2004/06/06 12:35:15 suz Exp $
.\"
.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
.\" All rights reserved.
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/usr.sbin/traceroute6/traceroute6.8,v 1.1.2.7 2001/08/16 15:56:37 ru Exp $
+.\" $FreeBSD: src/usr.sbin/traceroute6/traceroute6.8,v 1.17 2008/02/10 21:06:38 dwmalone Exp $
.\"
.Dd May 17, 1998
.Dt TRACEROUTE6 8
.\"
.Sh NAME
.Nm traceroute6
-.Nd "print the route IPv6 packets will take to the destination"
+.Nd "print the route IPv6 packets will take to a network node"
.\"
.Sh SYNOPSIS
.Nm
.Bk -words
-.Op Fl dlnrv
+.Op Fl dIlnNrvU
.Ek
.Bk -words
.Op Fl f Ar firsthop
.Ek
.\"
.Sh DESCRIPTION
+The
+.Nm
+utility
+uses the IPv6 protocol hop limit field to elicit an ICMPv6 TIME_EXCEEDED
+response from each gateway along the path to some host.
+.Pp
+The only mandatory parameter is the destination host name or IPv6 address.
+The default probe datagram carries 12 bytes of payload,
+in addition to the IPv6 header.
+The size of the payload can be specified by giving a length
+(in bytes)
+after the destination host name.
+.Pp
+Other options are:
.Bl -tag -width Ds
.It Fl d
Debug mode.
Specify intermediate gateway
.Nm (
uses routing header).
-.It Fl m Ar hoplimit
-Specify maximum hoplimit.
+.It Fl I
+Use ICMP6 ECHO instead of UDP datagrams.
.It Fl l
Print both host hostnames and numeric addresses.
Normally
is not specified, and only numeric addresses if
.Fl n
is specified.
+.It Fl m Ar hoplimit
+Specify maximum hoplimit, up to 255.
+The default is 30 hops.
.It Fl n
Do not resolve numeric address to hostname.
+.It Fl N
+Use a packet with no upper layer header for the probes,
+instead of UDP datagrams.
.It Fl p Ar port
Set UDP port number to
.Ar port .
Set the number of probe per hop count to
.Ar probes .
.It Fl r
+Bypass the normal routing tables and send directly to a host
+on an attached network.
+If the host is not on a directly-connected network,
+an error is returned.
+This option corresponds to the
+.Dv SO_DONTROUTE
+socket option;
+it can be used to ping a local host through an interface
+that has no route through it
+(e.g., after the interface was dropped by a routing daemon).
.It Fl s Ar src
.Ar Src
specifies the source IPv6 address to be used.
+.It Fl U
+Use UDP datagrams for the probes.
+This is the default.
.It Fl v
Be verbose.
.It Fl w Ar waittime
Specify the delay time between probes.
.El
+.Pp
+This program prints the route to the given destination and the round-trip
+time to each gateway, in the same manner as traceroute.
+.Pp
+Here is a list of possible annotations after the round-trip time for each gateway:
+.Bl -hang -offset indent
+.It !N
+Destination Unreachable - No Route to Host.
+.It !P
+Destination Unreachable - Administratively Prohibited.
+.It !S
+Destination Unreachable - Not a Neighbour.
+.It !A
+Destination Unreachable - Address Unreachable.
+.It !\&
+This is printed if the hop limit is <= 1 on a port unreachable message.
+This means that the packet got to the destination,
+but that the reply had a hop limit that was just large enough to
+allow it to get back to the source of the traceroute6.
+This was more interesting in the IPv4 case,
+where some IP stack bugs could be identified by this behaviour.
+.El
.\"
.Sh RETURN VALUES
The
.Nm
-command will exit with 0 on success, and non-zero on errors.
+utility will exit with 0 on success, and non-zero on errors.
.\"
.Sh SEE ALSO
.Xr ping 8 ,
.Sh HISTORY
The
.Nm
-command first appeared in WIDE hydrangea IPv6 protocol stack kit.
+utility first appeared in WIDE hydrangea IPv6 protocol stack kit.
-/* $KAME: traceroute6.c,v 1.42 2001/05/08 04:36:41 itojun Exp $ */
+/* $KAME: traceroute6.c,v 1.68 2004/01/25 11:16:12 suz Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
static char sccsid[] = "@(#)traceroute.c 8.1 (Berkeley) 6/6/93";
#endif
__unused static const char rcsid[] =
- "$FreeBSD: src/usr.sbin/traceroute6/traceroute6.c,v 1.4.2.4 2001/07/03 11:02:18 ume Exp $";
+ "$FreeBSD: src/usr.sbin/traceroute6/traceroute6.c,v 1.22 2008/02/10 21:06:38 dwmalone Exp $";
#endif /* not lint */
/*
* This program requires a kernel mod that does not appear in any
* system available from Berkeley: A raw ip socket using proto
* IPPROTO_RAW must interpret the data sent as an ip datagram (as
- * opposed to data to be wrapped in a ip datagram). See the README
+ * opposed to data to be wrapped in an ip datagram). See the README
* file that came with the source to this program for a description
* of the mods I made to /sys/netinet/raw_ip.c. Your mileage may
* vary. But, again, ANY 4.x (x < 4) BSD KERNEL WILL HAVE TO BE
#include <sys/uio.h>
#include <sys/file.h>
#include <sys/ioctl.h>
+#include <sys/sysctl.h>
#include <netinet/in.h>
#define DUMMY_PORT 10010
#define MAXPACKET 65535 /* max ip packet size */
-#ifndef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN 64
-#endif
-
-#ifndef FD_SET
-#define NFDBITS (8*sizeof(fd_set))
-#define FD_SETSIZE NFDBITS
-#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
-#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
-#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
-#define FD_ZERO(p) bzero((char *)(p), sizeof(*(p)))
-#endif
-
-#define Fprintf (void)fprintf
-#define Sprintf (void)sprintf
-#define Printf (void)printf
#ifndef HAVE_GETIPNODEBYNAME
#define getipnodebyname(x, y, z, u) gethostbyname2((x), (y))
/*
* format of a (udp) probe packet.
*/
+struct tv32 {
+ u_int32_t tv32_sec;
+ u_int32_t tv32_usec;
+};
+
struct opacket {
u_char seq; /* sequence number of this packet */
u_char hops; /* hop limit of the packet */
- struct timeval tv; /* time packet left */
-};
+ u_char pad[2];
+ struct tv32 tv; /* time packet left */
+} __attribute__((__packed__));
u_char packet[512]; /* last inbound (icmp) packet */
struct opacket *outpacket; /* last output (udp) packet */
-int main __P((int, char *[]));
-int wait_for_reply __P((int, struct msghdr *));
+int main(int, char *[]);
+int wait_for_reply(int, struct msghdr *);
#ifdef IPSEC
#ifdef IPSEC_POLICY_IPSEC
-int setpolicy __P((int so, char *policy));
+int setpolicy(int so, char *policy);
#endif
#endif
-void send_probe __P((int, int));
-struct udphdr *get_udphdr __P((struct ip6_hdr *, u_char *));
-int get_hoplim __P((struct msghdr *));
-double deltaT __P((struct timeval *, struct timeval *));
-char *pr_type __P((int));
-int packet_ok __P((struct msghdr *, int, int));
-void print __P((struct msghdr *, int));
-void tvsub __P((struct timeval *, struct timeval *));
-const char *inetname __P((struct sockaddr *));
-void usage __P((void));
+void send_probe(int, u_long);
+void *get_uphdr(struct ip6_hdr *, u_char *);
+int get_hoplim(struct msghdr *);
+double deltaT(struct timeval *, struct timeval *);
+char *pr_type(int);
+int packet_ok(struct msghdr *, int, int);
+void print(struct msghdr *, int);
+const char *inetname(struct sockaddr *);
+void usage(void);
int rcvsock; /* receive (icmp) socket file descriptor */
int sndsock; /* send (udp) socket file descriptor */
-struct timezone tz; /* leftover */
struct msghdr rcvmhdr;
struct iovec rcviov[2];
struct in6_pktinfo *rcvpktinfo;
struct sockaddr_in6 Src, Dst, Rcv;
-int datalen; /* How much data */
+u_long datalen; /* How much data */
+#define ICMP6ECHOLEN 8
/* XXX: 2064 = 127(max hops in type 0 rthdr) * sizeof(ip6_hdr) + 16(margin) */
char rtbuf[2064];
#ifdef USE_RFC2292BIS
char *source = 0;
char *hostname;
-int nprobes = 3;
-int first_hop = 1;
-int max_hops = 30;
-u_short ident;
-u_short port = 32768+666; /* start udp dest port # for probe packets */
+u_long nprobes = 3;
+u_long first_hop = 1;
+u_long max_hops = 30;
+u_int16_t srcport;
+u_int16_t port = 32768+666; /* start udp dest port # for probe packets */
+u_int16_t ident;
int options; /* socket options */
int verbose;
int waittime = 5; /* time to wait for response (in seconds) */
int nflag; /* print addresses numerically */
+int useproto = IPPROTO_UDP; /* protocol to use to send packet */
int lflag; /* print both numerical address & hostname */
-#ifdef KAME_SCOPEID
-const int niflag = NI_WITHSCOPEID;
-#else
-const int niflag = 0;
-#endif
-
int
main(argc, argv)
int argc;
char *argv[];
{
- struct hostent *hp;
- int error;
+ int mib[4] = { CTL_NET, PF_INET6, IPPROTO_IPV6, IPV6CTL_DEFHLIM };
+ char hbuf[NI_MAXHOST], src0[NI_MAXHOST], *ep;
+ int ch, i, on = 1, seq, rcvcmsglen, error, minlen;
struct addrinfo hints, *res;
- int ch, i, on, probe, seq, hops, rcvcmsglen;
static u_char *rcvcmsgbuf;
- char hbuf[NI_MAXHOST], src0[NI_MAXHOST];
- char *ep;
+ u_long probe, hops, lport;
+ struct hostent *hp;
+ size_t size;
/*
* Receive ICMP
exit(5);
}
- /* revoke privs */
- seteuid(getuid());
- setuid(getuid());
+ size = sizeof(i);
+ (void) sysctl(mib, sizeof(mib)/sizeof(mib[0]), &i, &size, NULL, 0);
+ max_hops = i;
- /* set a minimum set of socket options */
- on = 1;
/* specify to tell receiving interface */
#ifdef IPV6_RECVPKTINFO
if (setsockopt(rcvsock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on,
- sizeof(on)) < 0)
+ sizeof(on)) < 0)
err(1, "setsockopt(IPV6_RECVPKTINFO)");
#else /* old adv. API */
if (setsockopt(rcvsock, IPPROTO_IPV6, IPV6_PKTINFO, &on,
- sizeof(on)) < 0)
+ sizeof(on)) < 0)
err(1, "setsockopt(IPV6_PKTINFO)");
#endif
/* specify to tell value of hoplimit field of received IP6 hdr */
#ifdef IPV6_RECVHOPLIMIT
if (setsockopt(rcvsock, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &on,
- sizeof(on)) < 0)
+ sizeof(on)) < 0)
err(1, "setsockopt(IPV6_RECVHOPLIMIT)");
#else /* old adv. API */
if (setsockopt(rcvsock, IPPROTO_IPV6, IPV6_HOPLIMIT, &on,
- sizeof(on)) < 0)
+ sizeof(on)) < 0)
err(1, "setsockopt(IPV6_HOPLIMIT)");
#endif
seq = 0;
-
- while ((ch = getopt(argc, argv, "df:g:lm:np:q:rs:w:v")) != -1)
- switch(ch) {
+
+ while ((ch = getopt(argc, argv, "df:g:Ilm:nNp:q:rs:Uvw:")) != -1)
+ switch (ch) {
case 'd':
options |= SO_DEBUG;
break;
case 'f':
ep = NULL;
+ errno = 0;
first_hop = strtoul(optarg, &ep, 0);
- if (!*argv || *ep) {
- Fprintf(stderr,
+ if (errno || !*optarg || *ep || first_hop > 255) {
+ fprintf(stderr,
"traceroute6: invalid min hoplimit.\n");
exit(1);
}
- if (first_hop > max_hops) {
- Fprintf(stderr,
- "traceroute6: min hoplimit must be <= %d.\n", max_hops);
- exit(1);
- }
break;
case 'g':
hp = getipnodebyname(optarg, AF_INET6, 0, &h_errno);
if (hp == NULL) {
- Fprintf(stderr,
+ fprintf(stderr,
"traceroute6: unknown host %s\n", optarg);
exit(1);
}
* intermediate nodes yet.
*/
if ((rth = inet6_rth_init((void *)rtbuf,
- sizeof(rtbuf),
- IPV6_RTHDR_TYPE_0,
- 0)) == NULL) {
- Fprintf(stderr,
- "inet6_rth_init failed.\n");
+ sizeof(rtbuf), IPV6_RTHDR_TYPE_0,
+ 0)) == NULL) {
+ fprintf(stderr,
+ "inet6_rth_init failed.\n");
exit(1);
}
}
if (inet6_rth_add((void *)rth,
- (struct in6_addr *)hp->h_addr)) {
- Fprintf(stderr,
- "inet6_rth_add failed for %s\n",
- optarg);
+ (struct in6_addr *)hp->h_addr)) {
+ fprintf(stderr,
+ "inet6_rth_add failed for %s\n",
+ optarg);
exit(1);
}
#else /* old advanced API */
if (cmsg == NULL)
cmsg = inet6_rthdr_init(rtbuf, IPV6_RTHDR_TYPE_0);
- inet6_rthdr_add(cmsg, (struct in6_addr *)hp->h_addr, IPV6_RTHDR_LOOSE);
+ inet6_rthdr_add(cmsg, (struct in6_addr *)hp->h_addr,
+ IPV6_RTHDR_LOOSE);
#endif
freehostent(hp);
break;
+ case 'I':
+ useproto = IPPROTO_ICMPV6;
+ ident = htons(getpid() & 0xffff); /* same as ping6 */
+ break;
case 'l':
lflag++;
break;
case 'm':
ep = NULL;
+ errno = 0;
max_hops = strtoul(optarg, &ep, 0);
- if (!*argv || *ep) {
- Fprintf(stderr,
+ if (errno || !*optarg || *ep || max_hops > 255) {
+ fprintf(stderr,
"traceroute6: invalid max hoplimit.\n");
exit(1);
}
- if (max_hops < first_hop) {
- Fprintf(stderr,
- "traceroute6: max hoplimit must be >= %d.\n", first_hop);
- exit(1);
- }
break;
case 'n':
nflag++;
break;
+ case 'N':
+ useproto = IPPROTO_NONE;
+ break;
case 'p':
ep = NULL;
- port = strtoul(optarg, &ep, 0);
- if (!*argv || *ep) {
- Fprintf(stderr,
- "traceroute6: port.\n");
+ errno = 0;
+ lport = strtoul(optarg, &ep, 0);
+ if (errno || !*optarg || *ep) {
+ fprintf(stderr, "traceroute6: invalid port.\n");
exit(1);
}
- if (port < 1) {
- Fprintf(stderr,
- "traceroute6: port must be >0.\n");
+ if (lport == 0 || lport != (lport & 0xffff)) {
+ fprintf(stderr,
+ "traceroute6: port out of range.\n");
exit(1);
}
+ port = lport & 0xffff;
break;
case 'q':
ep = NULL;
+ errno = 0;
nprobes = strtoul(optarg, &ep, 0);
- if (!*argv || *ep) {
- Fprintf(stderr,
+ if (errno || !*optarg || *ep) {
+ fprintf(stderr,
"traceroute6: invalid nprobes.\n");
exit(1);
}
if (nprobes < 1) {
- Fprintf(stderr,
+ fprintf(stderr,
"traceroute6: nprobes must be >0.\n");
exit(1);
}
case 'v':
verbose++;
break;
+ case 'U':
+ useproto = IPPROTO_UDP;
+ break;
case 'w':
ep = NULL;
+ errno = 0;
waittime = strtoul(optarg, &ep, 0);
- if (!*argv || *ep) {
- Fprintf(stderr,
+ if (errno || !*optarg || *ep) {
+ fprintf(stderr,
"traceroute6: invalid wait time.\n");
exit(1);
}
- if (waittime <= 1) {
- Fprintf(stderr,
- "traceroute6: wait must be >1 sec.\n");
+ if (waittime < 1) {
+ fprintf(stderr,
+ "traceroute6: wait must be >= 1 sec.\n");
exit(1);
}
break;
argc -= optind;
argv += optind;
+ /*
+ * Open socket to send probe packets.
+ */
+ switch (useproto) {
+ case IPPROTO_ICMPV6:
+ sndsock = rcvsock;
+ break;
+ case IPPROTO_UDP:
+ if ((sndsock = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
+ perror("socket(SOCK_DGRAM)");
+ exit(5);
+ }
+ break;
+ case IPPROTO_NONE:
+ if ((sndsock = socket(AF_INET6, SOCK_RAW, IPPROTO_NONE)) < 0) {
+ perror("socket(SOCK_RAW)");
+ exit(5);
+ }
+ break;
+ default:
+ fprintf(stderr, "traceroute6: unknown probe protocol %d",
+ useproto);
+ exit(5);
+ }
+ if (max_hops < first_hop) {
+ fprintf(stderr,
+ "traceroute6: max hoplimit must be larger than first hoplimit.\n");
+ exit(1);
+ }
+
+ /* revoke privs */
+ seteuid(getuid());
+ setuid(getuid());
+
if (argc < 1 || argc > 2)
usage();
#if 1
setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
#else
- setlinebuf (stdout);
+ setlinebuf(stdout);
#endif
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_CANONNAME;
error = getaddrinfo(*argv, NULL, &hints, &res);
if (error) {
- (void)fprintf(stderr,
- "traceroute6: %s\n", gai_strerror(error));
+ fprintf(stderr,
+ "traceroute6: %s\n", gai_strerror(error));
exit(1);
}
if (res->ai_addrlen != sizeof(Dst)) {
- (void)fprintf(stderr,
- "traceroute6: size of sockaddr mismatch\n");
+ fprintf(stderr,
+ "traceroute6: size of sockaddr mismatch\n");
exit(1);
}
memcpy(&Dst, res->ai_addr, res->ai_addrlen);
hostname = res->ai_canonname ? strdup(res->ai_canonname) : *argv;
if (!hostname) {
- (void)fprintf(stderr, "traceroute6: not enough core\n");
+ fprintf(stderr, "traceroute6: not enough core\n");
exit(1);
}
+ if (res->ai_next) {
+ if (getnameinfo(res->ai_addr, res->ai_addrlen, hbuf,
+ sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0)
+ strlcpy(hbuf, "?", sizeof(hbuf));
+ fprintf(stderr, "traceroute6: Warning: %s has multiple "
+ "addresses; using %s\n", hostname, hbuf);
+ }
if (*++argv) {
ep = NULL;
+ errno = 0;
datalen = strtoul(*argv, &ep, 0);
- if (!*argv || *ep) {
- Fprintf(stderr,
+ if (errno || !*argv || *ep) {
+ fprintf(stderr,
"traceroute6: invalid packet length.\n");
exit(1);
}
}
- if (datalen < 0 || datalen >= MAXPACKET - sizeof(struct opacket)) {
- Fprintf(stderr,
- "traceroute6: packet size must be 0 <= s < %ld.\n",
- (long)(MAXPACKET - sizeof(struct opacket)));
+ switch (useproto) {
+ case IPPROTO_ICMPV6:
+ minlen = ICMP6ECHOLEN + sizeof(struct tv32);
+ break;
+ case IPPROTO_UDP:
+ minlen = sizeof(struct opacket);
+ break;
+ case IPPROTO_NONE:
+ minlen = 0;
+ datalen = 0;
+ break;
+ default:
+ fprintf(stderr, "traceroute6: unknown probe protocol %d.\n",
+ useproto);
+ exit(1);
+ }
+ if (datalen < minlen)
+ datalen = minlen;
+ else if (datalen >= MAXPACKET) {
+ fprintf(stderr,
+ "traceroute6: packet size must be %d <= s < %ld.\n",
+ minlen, (long)MAXPACKET);
exit(1);
}
- datalen += sizeof(struct opacket);
outpacket = (struct opacket *)malloc((unsigned)datalen);
- if (! outpacket) {
+ if (!outpacket) {
perror("malloc");
exit(1);
}
rcvmhdr.msg_namelen = sizeof(Rcv);
rcvmhdr.msg_iov = rcviov;
rcvmhdr.msg_iovlen = 1;
- rcvcmsglen = CMSG_SPACE(sizeof(struct in6_pktinfo))
- + CMSG_SPACE(sizeof(int));
+ rcvcmsglen = CMSG_SPACE(sizeof(struct in6_pktinfo)) +
+ CMSG_SPACE(sizeof(int));
if ((rcvcmsgbuf = malloc(rcvcmsglen)) == NULL) {
- Fprintf(stderr, "traceroute6: malloc failed\n");
+ fprintf(stderr, "traceroute6: malloc failed\n");
exit(1);
}
rcvmhdr.msg_control = (caddr_t) rcvcmsgbuf;
if (options & SO_DEBUG)
(void) setsockopt(rcvsock, SOL_SOCKET, SO_DEBUG,
- (char *)&on, sizeof(on));
+ (char *)&on, sizeof(on));
if (options & SO_DONTROUTE)
(void) setsockopt(rcvsock, SOL_SOCKET, SO_DONTROUTE,
- (char *)&on, sizeof(on));
+ (char *)&on, sizeof(on));
#ifdef IPSEC
#ifdef IPSEC_POLICY_IPSEC
/*
int level = IPSEC_LEVEL_NONE;
(void)setsockopt(rcvsock, IPPROTO_IPV6, IPV6_ESP_TRANS_LEVEL, &level,
- sizeof(level));
+ sizeof(level));
(void)setsockopt(rcvsock, IPPROTO_IPV6, IPV6_ESP_NETWORK_LEVEL, &level,
- sizeof(level));
+ sizeof(level));
#ifdef IP_AUTH_TRANS_LEVEL
(void)setsockopt(rcvsock, IPPROTO_IPV6, IPV6_AUTH_TRANS_LEVEL, &level,
- sizeof(level));
+ sizeof(level));
#else
(void)setsockopt(rcvsock, IPPROTO_IPV6, IPV6_AUTH_LEVEL, &level,
- sizeof(level));
+ sizeof(level));
#endif
#ifdef IP_AUTH_NETWORK_LEVEL
(void)setsockopt(rcvsock, IPPROTO_IPV6, IPV6_AUTH_NETWORK_LEVEL, &level,
- sizeof(level));
+ sizeof(level));
#endif
}
#endif /*IPSEC_POLICY_IPSEC*/
#endif /*IPSEC*/
- /*
- * Send UDP
- */
- if ((sndsock = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
- perror("socket(SOCK_DGRAM)");
- exit(5);
- }
#ifdef SO_SNDBUF
- if (setsockopt(sndsock, SOL_SOCKET, SO_SNDBUF, (char *)&datalen,
- sizeof(datalen)) < 0) {
+ i = datalen;
+ if (setsockopt(sndsock, SOL_SOCKET, SO_SNDBUF, (char *)&i,
+ sizeof(i)) < 0 && useproto != IPPROTO_NONE) {
perror("setsockopt(SO_SNDBUF)");
exit(6);
}
#endif /* SO_SNDBUF */
if (options & SO_DEBUG)
(void) setsockopt(sndsock, SOL_SOCKET, SO_DEBUG,
- (char *)&on, sizeof(on));
+ (char *)&on, sizeof(on));
if (options & SO_DONTROUTE)
(void) setsockopt(sndsock, SOL_SOCKET, SO_DONTROUTE,
- (char *)&on, sizeof(on));
+ (char *)&on, sizeof(on));
#ifdef USE_RFC2292BIS
if (rth) {/* XXX: there is no library to finalize the header... */
rth->ip6r_len = rth->ip6r_segleft * 2;
if (setsockopt(sndsock, IPPROTO_IPV6, IPV6_RTHDR,
- (void *)rth, (rth->ip6r_len + 1) << 3)) {
- Fprintf(stderr, "setsockopt(IPV6_RTHDR): %s\n",
- strerror(errno));
+ (void *)rth, (rth->ip6r_len + 1) << 3)) {
+ fprintf(stderr, "setsockopt(IPV6_RTHDR): %s\n",
+ strerror(errno));
exit(1);
}
}
if (cmsg != NULL) {
inet6_rthdr_lasthop(cmsg, IPV6_RTHDR_LOOSE);
if (setsockopt(sndsock, IPPROTO_IPV6, IPV6_PKTOPTIONS,
- rtbuf, cmsg->cmsg_len) < 0) {
- Fprintf(stderr, "setsockopt(IPV6_PKTOPTIONS): %s\n",
- strerror(errno));
+ rtbuf, cmsg->cmsg_len) < 0) {
+ fprintf(stderr, "setsockopt(IPV6_PKTOPTIONS): %s\n",
+ strerror(errno));
exit(1);
}
}
int level = IPSEC_LEVEL_BYPASS;
(void)setsockopt(sndsock, IPPROTO_IPV6, IPV6_ESP_TRANS_LEVEL, &level,
- sizeof(level));
+ sizeof(level));
(void)setsockopt(sndsock, IPPROTO_IPV6, IPV6_ESP_NETWORK_LEVEL, &level,
- sizeof(level));
+ sizeof(level));
#ifdef IP_AUTH_TRANS_LEVEL
(void)setsockopt(sndsock, IPPROTO_IPV6, IPV6_AUTH_TRANS_LEVEL, &level,
- sizeof(level));
+ sizeof(level));
#else
(void)setsockopt(sndsock, IPPROTO_IPV6, IPV6_AUTH_LEVEL, &level,
- sizeof(level));
+ sizeof(level));
#endif
#ifdef IP_AUTH_NETWORK_LEVEL
(void)setsockopt(sndsock, IPPROTO_IPV6, IPV6_AUTH_NETWORK_LEVEL, &level,
- sizeof(level));
+ sizeof(level));
#endif
}
#endif /*IPSEC_POLICY_IPSEC*/
hints.ai_flags = AI_NUMERICHOST;
error = getaddrinfo(source, "0", &hints, &res);
if (error) {
- Printf("traceroute6: %s: %s\n", source,
+ printf("traceroute6: %s: %s\n", source,
gai_strerror(error));
exit(1);
}
if (res->ai_addrlen > sizeof(Src)) {
- Printf("traceroute6: %s: %s\n", source,
+ printf("traceroute6: %s: %s\n", source,
gai_strerror(error));
exit(1);
}
Nxt.sin6_port = htons(DUMMY_PORT);
if (cmsg != NULL)
bcopy(inet6_rthdr_getaddr(cmsg, 1), &Nxt.sin6_addr,
- sizeof(Nxt.sin6_addr));
+ sizeof(Nxt.sin6_addr));
if ((dummy = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
perror("socket");
exit(1);
exit(1);
}
if (getnameinfo((struct sockaddr *)&Src, Src.sin6_len,
- src0, sizeof(src0), NULL, 0,
- NI_NUMERICHOST | niflag)) {
- Fprintf(stderr, "getnameinfo failed for source\n");
+ src0, sizeof(src0), NULL, 0, NI_NUMERICHOST)) {
+ fprintf(stderr, "getnameinfo failed for source\n");
exit(1);
}
source = src0;
close(dummy);
}
-#if 1
- ident = (getpid() & 0xffff) | 0x8000;
-#else
- ident = 0; /*let the kernel pick one*/
-#endif
- Src.sin6_port = htons(ident);
+ Src.sin6_port = htons(0);
if (bind(sndsock, (struct sockaddr *)&Src, Src.sin6_len) < 0) {
perror("bind");
exit(1);
}
- if (ident == 0) {
+ {
socklen_t len;
len = sizeof(Src);
perror("getsockname");
exit(1);
}
- ident = ntohs(Src.sin6_port);
+ srcport = ntohs(Src.sin6_port);
}
/*
* Message to users
*/
if (getnameinfo((struct sockaddr *)&Dst, Dst.sin6_len, hbuf,
- sizeof(hbuf), NULL, 0, NI_NUMERICHOST | niflag))
+ sizeof(hbuf), NULL, 0, NI_NUMERICHOST))
strlcpy(hbuf, "(invalid)", sizeof(hbuf));
- Fprintf(stderr, "traceroute6");
- Fprintf(stderr, " to %s (%s)", hostname, hbuf);
+ fprintf(stderr, "traceroute6");
+ fprintf(stderr, " to %s (%s)", hostname, hbuf);
if (source)
- Fprintf(stderr, " from %s", source);
- Fprintf(stderr,
- ", %d hops max, %d byte packets\n",
- max_hops, datalen);
+ fprintf(stderr, " from %s", source);
+ fprintf(stderr, ", %lu hops max, %lu byte packets\n",
+ max_hops, datalen);
(void) fflush(stderr);
if (first_hop > 1)
- Printf("Skipping %d intermediate hops\n", first_hop - 1);
+ printf("Skipping %lu intermediate hops\n", first_hop - 1);
/*
* Main loop
int got_there = 0;
int unreachable = 0;
- Printf("%2d ", hops);
+ printf("%2lu ", hops);
bzero(&lastaddr, sizeof(lastaddr));
for (probe = 0; probe < nprobes; ++probe) {
int cc;
struct timeval t1, t2;
- struct timezone tz;
- (void) gettimeofday(&t1, &tz);
+ (void) gettimeofday(&t1, NULL);
send_probe(++seq, hops);
while ((cc = wait_for_reply(rcvsock, &rcvmhdr))) {
- (void) gettimeofday(&t2, &tz);
+ (void) gettimeofday(&t2, NULL);
if ((i = packet_ok(&rcvmhdr, cc, seq))) {
- if (! IN6_ARE_ADDR_EQUAL(&Rcv.sin6_addr,
- &lastaddr)) {
+ if (!IN6_ARE_ADDR_EQUAL(&Rcv.sin6_addr,
+ &lastaddr)) {
+ if (probe > 0)
+ fputs("\n ", stdout);
print(&rcvmhdr, cc);
lastaddr = Rcv.sin6_addr;
}
- Printf(" %g ms", deltaT(&t1, &t2));
- switch(i - 1) {
+ printf(" %.3f ms", deltaT(&t1, &t2));
+ switch (i - 1) {
case ICMP6_DST_UNREACH_NOROUTE:
++unreachable;
- Printf(" !N");
+ printf(" !N");
break;
case ICMP6_DST_UNREACH_ADMIN:
++unreachable;
- Printf(" !P");
+ printf(" !P");
break;
case ICMP6_DST_UNREACH_NOTNEIGHBOR:
++unreachable;
- Printf(" !S");
+ printf(" !S");
break;
case ICMP6_DST_UNREACH_ADDR:
++unreachable;
- Printf(" !A");
+ printf(" !A");
break;
case ICMP6_DST_UNREACH_NOPORT:
if (rcvhlim >= 0 &&
rcvhlim <= 1)
- Printf(" !");
+ printf(" !");
++got_there;
break;
}
}
}
if (cc == 0)
- Printf(" *");
+ printf(" *");
(void) fflush(stdout);
}
putchar('\n');
return -1;
}
(void)setsockopt(so, IPPROTO_IPV6, IPV6_IPSEC_POLICY,
- buf, ipsec_get_policylen(buf));
+ buf, ipsec_get_policylen(buf));
free(buf);
void
send_probe(seq, hops)
- int seq, hops;
+ int seq;
+ u_long hops;
{
- struct opacket *op = outpacket;
+ struct icmp6_hdr *icp;
+ struct opacket *op;
+ struct timeval tv;
+ struct tv32 tv32;
int i;
- if(setsockopt(sndsock, IPPROTO_IPV6, IPV6_UNICAST_HOPS,
- (char *)&hops, sizeof(hops)) < 0) {
+ i = hops;
+ if (setsockopt(sndsock, IPPROTO_IPV6, IPV6_UNICAST_HOPS,
+ (char *)&i, sizeof(i)) < 0) {
perror("setsockopt IPV6_UNICAST_HOPS");
}
Dst.sin6_port = htons(port + seq);
+ (void) gettimeofday(&tv, NULL);
+ tv32.tv32_sec = htonl(tv.tv_sec);
+ tv32.tv32_usec = htonl(tv.tv_usec);
+
+ switch (useproto) {
+ case IPPROTO_ICMPV6:
+ icp = (struct icmp6_hdr *)outpacket;
+
+ icp->icmp6_type = ICMP6_ECHO_REQUEST;
+ icp->icmp6_code = 0;
+ icp->icmp6_cksum = 0;
+ icp->icmp6_id = ident;
+ icp->icmp6_seq = htons(seq);
+ bcopy(&tv32, ((u_int8_t *)outpacket + ICMP6ECHOLEN),
+ sizeof(tv32));
+ break;
+ case IPPROTO_UDP:
+ op = outpacket;
- op->seq = seq;
- op->hops = hops;
- (void) gettimeofday(&op->tv, &tz);
+ op->seq = seq;
+ op->hops = hops;
+ bcopy(&tv32, &op->tv, sizeof tv32);
+ break;
+ case IPPROTO_NONE:
+ /* No space for anything. No harm as seq/tv32 are decorative. */
+ break;
+ default:
+ fprintf(stderr, "Unknown probe protocol %d.\n", useproto);
+ exit(1);
+ }
- i = sendto(sndsock, (char *)outpacket, datalen , 0,
- (struct sockaddr *)&Dst, Dst.sin6_len);
+ i = sendto(sndsock, (char *)outpacket, datalen, 0,
+ (struct sockaddr *)&Dst, Dst.sin6_len);
if (i < 0 || i != datalen) {
- if (i<0)
+ if (i < 0)
perror("sendto");
- Printf("traceroute6: wrote %s %d chars, ret=%d\n", hostname,
- datalen, i);
+ printf("traceroute6: wrote %s %lu chars, ret=%d\n",
+ hostname, datalen, i);
(void) fflush(stdout);
}
}
struct cmsghdr *cm;
for (cm = (struct cmsghdr *)CMSG_FIRSTHDR(mhdr); cm;
- cm = (struct cmsghdr *)CMSG_NXTHDR(mhdr, cm)) {
+ cm = (struct cmsghdr *)CMSG_NXTHDR(mhdr, cm)) {
if (cm->cmsg_level == IPPROTO_IPV6 &&
cm->cmsg_type == IPV6_HOPLIMIT &&
cm->cmsg_len == CMSG_LEN(sizeof(int)))
deltaT(t1p, t2p)
struct timeval *t1p, *t2p;
{
- register double dt;
+ double dt;
dt = (double)(t2p->tv_sec - t1p->tv_sec) * 1000.0 +
- (double)(t2p->tv_usec - t1p->tv_usec) / 1000.0;
+ (double)(t2p->tv_usec - t1p->tv_usec) / 1000.0;
return (dt);
}
-
/*
* Convert an ICMP "type" field to a printable string.
*/
cp = "Destination Unreachable";
break;
case ICMP6_PACKET_TOO_BIG:
- cp = "Pakcet Too Big";
+ cp = "Packet Too Big";
break;
case ICMP6_TIME_EXCEEDED:
cp = "Time Exceeded";
return cp;
}
-
int
packet_ok(mhdr, cc, seq)
struct msghdr *mhdr;
int cc;
int seq;
{
- register struct icmp6_hdr *icp;
+ struct icmp6_hdr *icp;
struct sockaddr_in6 *from = (struct sockaddr_in6 *)mhdr->msg_name;
u_char type, code;
char *buf = (char *)mhdr->msg_iov[0].iov_base;
if (cc < hlen + sizeof(struct icmp6_hdr)) {
if (verbose) {
if (getnameinfo((struct sockaddr *)from, from->sin6_len,
- hbuf, sizeof(hbuf), NULL, 0,
- NI_NUMERICHOST | niflag) != 0)
+ hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0)
strlcpy(hbuf, "invalid", sizeof(hbuf));
- Printf("packet too short (%d bytes) from %s\n", cc,
+ printf("packet too short (%d bytes) from %s\n", cc,
hbuf);
}
return (0);
if (cc < sizeof(struct icmp6_hdr)) {
if (verbose) {
if (getnameinfo((struct sockaddr *)from, from->sin6_len,
- hbuf, sizeof(hbuf), NULL, 0,
- NI_NUMERICHOST | niflag) != 0)
+ hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0)
strlcpy(hbuf, "invalid", sizeof(hbuf));
- Printf("data too short (%d bytes) from %s\n", cc, hbuf);
+ printf("data too short (%d bytes) from %s\n", cc, hbuf);
}
return(0);
}
rcvpktinfo = NULL;
hlimp = NULL;
for (cm = (struct cmsghdr *)CMSG_FIRSTHDR(mhdr); cm;
- cm = (struct cmsghdr *)CMSG_NXTHDR(mhdr, cm)) {
+ cm = (struct cmsghdr *)CMSG_NXTHDR(mhdr, cm)) {
if (cm->cmsg_level == IPPROTO_IPV6 &&
cm->cmsg_type == IPV6_PKTINFO &&
cm->cmsg_len ==
type = icp->icmp6_type;
code = icp->icmp6_code;
if ((type == ICMP6_TIME_EXCEEDED && code == ICMP6_TIME_EXCEED_TRANSIT)
- || type == ICMP6_DST_UNREACH) {
+ || type == ICMP6_DST_UNREACH) {
struct ip6_hdr *hip;
- struct udphdr *up;
+ void *up;
hip = (struct ip6_hdr *)(icp + 1);
- if ((up = get_udphdr(hip, (u_char *)(buf + cc))) == NULL) {
+ if ((up = get_uphdr(hip, (u_char *)(buf + cc))) == NULL) {
if (verbose)
warnx("failed to get upper layer header");
return(0);
}
- if (up->uh_sport == htons(ident) &&
- up->uh_dport == htons(port+seq))
- return (type == ICMP6_TIME_EXCEEDED ? -1 : code + 1);
+ switch (useproto) {
+ case IPPROTO_ICMPV6:
+ if (((struct icmp6_hdr *)up)->icmp6_id == ident &&
+ ((struct icmp6_hdr *)up)->icmp6_seq == htons(seq))
+ return (type == ICMP6_TIME_EXCEEDED ?
+ -1 : code + 1);
+ break;
+ case IPPROTO_UDP:
+ if (((struct udphdr *)up)->uh_sport == htons(srcport) &&
+ ((struct udphdr *)up)->uh_dport == htons(port + seq))
+ return (type == ICMP6_TIME_EXCEEDED ?
+ -1 : code + 1);
+ break;
+ case IPPROTO_NONE:
+ return (type == ICMP6_TIME_EXCEEDED ? -1 : code + 1);
+ default:
+ fprintf(stderr, "Unknown probe proto %d.\n", useproto);
+ break;
+ }
+ } else if (useproto == IPPROTO_ICMPV6 && type == ICMP6_ECHO_REPLY) {
+ if (icp->icmp6_id == ident &&
+ icp->icmp6_seq == htons(seq))
+ return (ICMP6_DST_UNREACH_NOPORT + 1);
}
if (verbose) {
- int i;
- u_int8_t *p;
char sbuf[NI_MAXHOST+1], dbuf[INET6_ADDRSTRLEN];
+ u_int8_t *p;
+ int i;
if (getnameinfo((struct sockaddr *)from, from->sin6_len,
- sbuf, sizeof(sbuf), NULL, 0, NI_NUMERICHOST | niflag) != 0)
- strlcpy(sbuf, "invalid", sizeof(hbuf));
- Printf("\n%d bytes from %s to %s", cc, sbuf,
+ sbuf, sizeof(sbuf), NULL, 0, NI_NUMERICHOST) != 0)
+ strlcpy(sbuf, "invalid", sizeof(sbuf));
+ printf("\n%d bytes from %s to %s", cc, sbuf,
rcvpktinfo ? inet_ntop(AF_INET6, &rcvpktinfo->ipi6_addr,
- dbuf, sizeof(dbuf))
- : "?");
- Printf(": icmp type %d (%s) code %d\n", type, pr_type(type),
- icp->icmp6_code);
+ dbuf, sizeof(dbuf)) : "?");
+ printf(": icmp type %d (%s) code %d\n", type, pr_type(type),
+ icp->icmp6_code);
p = (u_int8_t *)(icp + 1);
#define WIDTH 16
for (i = 0; i < cc; i++) {
if (i % WIDTH == 0)
- Printf("%04x:", i);
+ printf("%04x:", i);
if (i % 4 == 0)
- Printf(" ");
- Printf("%02x", p[i]);
+ printf(" ");
+ printf("%02x", p[i]);
if (i % WIDTH == WIDTH - 1)
- Printf("\n");
+ printf("\n");
}
if (cc % WIDTH != 0)
- Printf("\n");
+ printf("\n");
}
return(0);
}
/*
- * Increment pointer until find the UDP header.
+ * Increment pointer until find the UDP or ICMP header.
*/
-struct udphdr *
-get_udphdr(ip6, lim)
+void *
+get_uphdr(ip6, lim)
struct ip6_hdr *ip6;
u_char *lim;
{
u_char *cp = (u_char *)ip6, nh;
int hlen;
+ static u_char none_hdr[1]; /* Fake pointer for IPPROTO_NONE. */
- if (cp + sizeof(*ip6) >= lim)
+ if (cp + sizeof(*ip6) > lim)
return(NULL);
nh = ip6->ip6_nxt;
cp += sizeof(struct ip6_hdr);
- while(lim - cp >= 8) {
- switch(nh) {
- case IPPROTO_ESP:
- case IPPROTO_TCP:
- case IPPROTO_ICMPV6:
- return(NULL);
- case IPPROTO_UDP:
- return((struct udphdr *)cp);
- case IPPROTO_FRAGMENT:
- hlen = sizeof(struct ip6_frag);
- nh = ((struct ip6_frag *)cp)->ip6f_nxt;
- break;
- case IPPROTO_AH:
- hlen = (((struct ip6_ext *)cp)->ip6e_len + 2) << 2;
- nh = ((struct ip6_ext *)cp)->ip6e_nxt;
- break;
- default:
- hlen = (((struct ip6_ext *)cp)->ip6e_len + 1) << 3;
- nh = ((struct ip6_ext *)cp)->ip6e_nxt;
- break;
+ while (lim - cp >= (nh == IPPROTO_NONE ? 0 : 8)) {
+ switch (nh) {
+ case IPPROTO_ESP:
+ case IPPROTO_TCP:
+ return(NULL);
+ case IPPROTO_ICMPV6:
+ return(useproto == nh ? cp : NULL);
+ case IPPROTO_UDP:
+ return(useproto == nh ? cp : NULL);
+ case IPPROTO_NONE:
+ return(useproto == nh ? none_hdr : NULL);
+ case IPPROTO_FRAGMENT:
+ hlen = sizeof(struct ip6_frag);
+ nh = ((struct ip6_frag *)cp)->ip6f_nxt;
+ break;
+ case IPPROTO_AH:
+ hlen = (((struct ip6_ext *)cp)->ip6e_len + 2) << 2;
+ nh = ((struct ip6_ext *)cp)->ip6e_nxt;
+ break;
+ default:
+ hlen = (((struct ip6_ext *)cp)->ip6e_len + 1) << 3;
+ nh = ((struct ip6_ext *)cp)->ip6e_nxt;
+ break;
}
cp += hlen;
char hbuf[NI_MAXHOST];
if (getnameinfo((struct sockaddr *)from, from->sin6_len,
- hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST | niflag) != 0)
+ hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0)
strlcpy(hbuf, "invalid", sizeof(hbuf));
if (nflag)
- Printf(" %s", hbuf);
+ printf(" %s", hbuf);
else if (lflag)
- Printf(" %s (%s)", inetname((struct sockaddr *)from), hbuf);
+ printf(" %s (%s)", inetname((struct sockaddr *)from), hbuf);
else
- Printf(" %s", inetname((struct sockaddr *)from));
+ printf(" %s", inetname((struct sockaddr *)from));
if (verbose) {
#ifdef OLDRAWSOCKET
- Printf(" %d bytes to %s", cc,
+ printf(" %d bytes to %s", cc,
rcvpktinfo ? inet_ntop(AF_INET6, &rcvpktinfo->ipi6_addr,
- hbuf, sizeof(hbuf))
- : "?");
+ hbuf, sizeof(hbuf)) : "?");
#else
- Printf(" %d bytes of data to %s", cc,
+ printf(" %d bytes of data to %s", cc,
rcvpktinfo ? inet_ntop(AF_INET6, &rcvpktinfo->ipi6_addr,
- hbuf, sizeof(hbuf))
- : "?");
+ hbuf, sizeof(hbuf)) : "?");
#endif
}
}
-/*
- * Subtract 2 timeval structs: out = out - in.
- * Out is assumed to be >= in.
- */
-void
-tvsub(out, in)
- register struct timeval *out, *in;
-{
- if ((out->tv_usec -= in->tv_usec) < 0) {
- out->tv_sec--;
- out->tv_usec += 1000000;
- }
- out->tv_sec -= in->tv_sec;
-}
-
-
/*
* Construct an Internet address representation.
* If the nflag has been supplied, give
inetname(sa)
struct sockaddr *sa;
{
- register char *cp;
- static char line[NI_MAXHOST];
- static char domain[MAXHOSTNAMELEN + 1];
+ static char line[NI_MAXHOST], domain[MAXHOSTNAMELEN + 1];
static int first = 1;
+ char *cp;
if (first && !nflag) {
first = 0;
- if (gethostname(domain, MAXHOSTNAMELEN) == 0 &&
- (cp = index(domain, '.')))
+ if (gethostname(domain, sizeof(domain)) == 0 &&
+ (cp = strchr(domain, '.')))
(void) strlcpy(domain, cp + 1, sizeof(domain));
else
domain[0] = 0;
if (!nflag) {
if (getnameinfo(sa, sa->sa_len, line, sizeof(line), NULL, 0,
NI_NAMEREQD) == 0) {
- if ((cp = index(line, '.')) &&
+ if ((cp = strchr(line, '.')) &&
!strcmp(cp + 1, domain))
*cp = 0;
cp = line;
return cp;
if (getnameinfo(sa, sa->sa_len, line, sizeof(line), NULL, 0,
- NI_NUMERICHOST | niflag) != 0)
+ NI_NUMERICHOST) != 0)
strlcpy(line, "invalid", sizeof(line));
return line;
}
void
usage()
{
- (void)fprintf(stderr,
-"usage: traceroute6 [-dlnrv] [-f firsthop] [-g gateway] [-m hoplimit] [-p port]\n"
-" [-q probes] [-s src] [-w waittime] target [datalen]\n");
+
+ fprintf(stderr,
+"usage: traceroute6 [-dIlnNrUv] [-f firsthop] [-g gateway] [-m hoplimit]\n"
+" [-p port] [-q probes] [-s src] [-w waittime] target [datalen]\n");
exit(1);
}
+++ /dev/null
-Project = trpt
-Install_Dir = /usr/sbin
-
-CFILES = trpt.c
-MANPAGES = trpt.8
-
-Extra_CC_Flags = -mdynamic-no-pic -dead_strip \
- -I$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
-Extra_LD_Flags = -lcurses
-
-include $(MAKEFILEPATH)/CoreOS/ReleaseControl/BSDCommon.make
-
-Install_Program_Mode = 02555
-Install_Program_Group = kmem
+++ /dev/null
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)trpt.8 8.2 (Berkeley) 12/11/93
-.\"
-.Dd December 11, 1993
-.Dt TRPT 8
-.Os BSD 4.2
-.Sh NAME
-.Nm trpt
-.Nd transliterate protocol trace
-.Sh SYNOPSIS
-.Nm trpt
-.Op Fl a
-.Op Fl f
-.Op Fl j
-.Op Fl p Ar hex-address
-.Op Fl s
-.Op Fl t
-.Oo
-.Ar system Op Ar core
-.Oc
-.Sh DESCRIPTION
-.Nm Trpt
-interrogates the buffer of
-.Tn TCP
-trace records created
-when a socket is marked for
-.Dq debugging
-(see
-.Xr setsockopt 2 ) ,
-and prints a readable description of these records.
-When no options are supplied,
-.Nm trpt
-prints all the trace records found in the system
-grouped according to
-.Tn TCP
-connection protocol control
-block
-.Pq Tn PCB .
-The following options may be used to
-alter this behavior.
-.Bl -tag -width Ds
-.It Fl a
-In addition to the normal output,
-print the values of the source and destination
-addresses for each packet recorded.
-.It Fl f
-Follow the trace as it occurs, waiting a short time for additional records
-each time the end of the log is reached.
-.It Fl j
-Just give a list of the protocol control block
-addresses for which there are trace records.
-.It Fl p
-Show only trace records associated with the protocol
-control block at the given address
-.Ar hex-address .
-.It Fl s
-In addition to the normal output,
-print a detailed description of the packet
-sequencing information.
-.It Fl t
-in addition to the normal output,
-print the values for all timers at each
-point in the trace.
-.El
-.Pp
-The recommended use of
-.Nm trpt
-is as follows.
-Isolate the problem and enable debugging on the
-socket(s) involved in the connection.
-Find the address of the protocol control blocks
-associated with the sockets using the
-.Fl A
-option to
-.Xr netstat 1 .
-Then run
-.Nm trpt
-with the
-.Fl p
-option, supplying the associated
-protocol control block addresses.
-The
-.Fl f
-option can be used to follow the trace log once the trace is located.
-If there are
-many sockets using the debugging option, the
-.Fl j
-option may be useful in checking to see if
-any trace records are present for the socket in
-question.
-.Pp
-If debugging is being performed on a system or
-core file other than the default, the last two
-arguments may be used to supplant the defaults.
-.Sh FILES
-.Bl -tag -width /dev/kmem -compact
-.It Pa /vmunix
-.It Pa /dev/kmem
-.El
-.Sh SEE ALSO
-.Xr netstat 1 ,
-.Xr setsockopt 2 ,
-.Xr trsp 8
-.Sh DIAGNOSTICS
-.Bl -tag -width Ds
-.It Sy no namelist
-When the system image doesn't
-contain the proper symbols to find the trace buffer;
-others which should be self explanatory.
-.El
-.Sh BUGS
-Should also print the data for each input or output,
-but this is not saved in the race record.
-.Pp
-The output format is inscrutable and should be described
-here.
-.Sh HISTORY
-The
-.Nm
-command appeared in
-.Bx 4.2 .
+++ /dev/null
-/*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
- * Reserved. This file contains Original Code and/or Modifications of
- * Original Code as defined in and that are subject to the Apple Public
- * Source License Version 1.0 (the 'License'). You may not use this file
- * except in compliance with the License. Please obtain a copy of the
- * License at http://www.apple.com/publicsource and read it before using
- * this file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License."
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-/*
- * Copyright (c) 1983, 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-#ifndef lint
-__unused static char copyright[] =
-"@(#) Copyright (c) 1983, 1988, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-__unused static char sccsid[] = "@(#)trpt.c 8.1 (Berkeley) 6/6/93";
-#endif /* not lint */
-
-#include <sys/param.h>
-#if BSD >= 199103
-#define NEWVM
-#endif
-#ifndef NEWVM
-#include <machine/pte.h>
-#include <sys/vmmac.h>
-#endif
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#define PRUREQUESTS
-#include <sys/protosw.h>
-#include <sys/file.h>
-
-#include <net/route.h>
-#include <net/if.h>
-
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#include <netinet/in_pcb.h>
-#include <netinet/ip_var.h>
-#include <netinet/tcp.h>
-#define TCPSTATES
-#include <netinet/tcp_fsm.h>
-#include <netinet/tcp_seq.h>
-#define TCPTIMERS
-#include <netinet/tcp_timer.h>
-#include <netinet/tcp_var.h>
-#include <netinet/tcpip.h>
-#define TANAMES
-#include <netinet/tcp_debug.h>
-
-#include <arpa/inet.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-#include <nlist.h>
-#include <paths.h>
-
-struct tcp_debug tcp_debug[TCP_NDEBUG];
-int tcp_debx;
-
-struct nlist nl[] = {
-#define N_TCP_DEBUG 0
- { "_tcp_debug" },
-#define N_TCP_DEBX 1
- { "_tcp_debx" },
-#ifndef NEWVM
-#define N_SYSMAP 2
- { "_Sysmap" },
-#define N_SYSSIZE 3
- { "_Syssize" },
-#endif
- { "" },
-};
-
-#ifndef NEWVM
-static struct pte *Sysmap;
-#endif
-static caddr_t tcp_pcbs[TCP_NDEBUG];
-static n_time ntime;
-static int aflag, kflag, memf, follow, sflag, tflag;
-
-void klseek(int, off_t, int);
-void dotrace(caddr_t);
-void tcp_trace(short, short, struct tcpcb *, struct tcpcb *, struct tcpiphdr *, int);
-
-int
-main(argc, argv)
- int argc;
- char **argv;
-{
- extern char *optarg;
- extern int optind;
- int ch, i, jflag, npcbs, numeric();
- char *system, *core;
- off_t lseek();
-
- jflag = npcbs = 0;
- while ((ch = getopt(argc, argv, "afjp:st")) != EOF)
- switch (ch) {
- case 'a':
- ++aflag;
- break;
- case 'f':
- ++follow;
- setlinebuf(stdout);
- break;
- case 'j':
- ++jflag;
- break;
- case 'p':
- if (npcbs >= TCP_NDEBUG) {
- fputs("trpt: too many pcb's specified\n",
- stderr);
- exit(1);
- }
- (void)sscanf(optarg, "%x", (int *)&tcp_pcbs[npcbs++]);
- break;
- case 's':
- ++sflag;
- break;
- case 't':
- ++tflag;
- break;
- case '?':
- default:
- (void)fprintf(stderr,
-"usage: trpt [-afjst] [-p hex-address] [system [core]]\n");
- exit(1);
- }
- argc -= optind;
- argv += optind;
-
- core = _PATH_KMEM;
- if (argc > 0) {
- system = *argv;
- argc--, argv++;
- if (argc > 0) {
- core = *argv;
- argc--, argv++;
- ++kflag;
- }
- /*
- * Discard setgid privileges if not the running kernel so that
- * bad guys can't print interesting stuff from kernel memory.
- */
- setgid(getgid());
- }
- else
- system = _PATH_UNIX;
-
- if (nlist(system, nl) < 0 || !nl[0].n_value) {
- fprintf(stderr, "trpt: %s: no namelist\n", system);
- exit(1);
- }
- if ((memf = open(core, O_RDONLY)) < 0) {
- perror(core);
- exit(2);
- }
- if (kflag) {
-#ifdef NEWVM
- fputs("trpt: can't do core files yet\n", stderr);
- exit(1);
-#else
- off_t off;
-
- Sysmap = (struct pte *)
- malloc((u_int)(nl[N_SYSSIZE].n_value * sizeof(struct pte)));
- if (!Sysmap) {
- fputs("trpt: can't get memory for Sysmap.\n", stderr);
- exit(1);
- }
- off = nl[N_SYSMAP].n_value & ~KERNBASE;
- (void)lseek(memf, off, L_SET);
- (void)read(memf, (char *)Sysmap,
- (int)(nl[N_SYSSIZE].n_value * sizeof(struct pte)));
-#endif
- }
- (void)klseek(memf, (off_t)nl[N_TCP_DEBX].n_value, L_SET);
- if (read(memf, (char *)&tcp_debx, sizeof(tcp_debx)) !=
- sizeof(tcp_debx)) {
- perror("trpt: tcp_debx");
- exit(3);
- }
- (void)klseek(memf, (off_t)nl[N_TCP_DEBUG].n_value, L_SET);
- if (read(memf, (char *)tcp_debug, sizeof(tcp_debug)) !=
- sizeof(tcp_debug)) {
- perror("trpt: tcp_debug");
- exit(3);
- }
- /*
- * If no control blocks have been specified, figure
- * out how many distinct one we have and summarize
- * them in tcp_pcbs for sorting the trace records
- * below.
- */
- if (!npcbs) {
- for (i = 0; i < TCP_NDEBUG; i++) {
- register struct tcp_debug *td = &tcp_debug[i];
- register int j;
-
- if (td->td_tcb == 0)
- continue;
- for (j = 0; j < npcbs; j++)
- if (tcp_pcbs[j] == td->td_tcb)
- break;
- if (j >= npcbs)
- tcp_pcbs[npcbs++] = td->td_tcb;
- }
- if (!npcbs)
- exit(0);
- }
- qsort(tcp_pcbs, npcbs, sizeof(caddr_t), numeric);
- if (jflag) {
- for (i = 0;;) {
- printf("%x", (int)tcp_pcbs[i]);
- if (++i == npcbs)
- break;
- fputs(", ", stdout);
- }
- putchar('\n');
- }
- else for (i = 0; i < npcbs; i++) {
- printf("\n%x:\n", (int)tcp_pcbs[i]);
- dotrace(tcp_pcbs[i]);
- }
- exit(0);
-}
-
-void
-dotrace(tcpcb)
- register caddr_t tcpcb;
-{
- register struct tcp_debug *td;
- register int i;
- int prev_debx = tcp_debx;
-
-again: if (--tcp_debx < 0)
- tcp_debx = TCP_NDEBUG - 1;
- for (i = prev_debx % TCP_NDEBUG; i < TCP_NDEBUG; i++) {
- td = &tcp_debug[i];
- if (tcpcb && td->td_tcb != tcpcb)
- continue;
- ntime = ntohl(td->td_time);
- tcp_trace(td->td_act, td->td_ostate, (struct tcpcb *)td->td_tcb, &td->td_cb,
- (struct tcpiphdr *)&td->td_ti.ti_t, td->td_req);
- if (i == tcp_debx)
- goto done;
- }
- for (i = 0; i <= tcp_debx % TCP_NDEBUG; i++) {
- td = &tcp_debug[i];
- if (tcpcb && td->td_tcb != tcpcb)
- continue;
- ntime = ntohl(td->td_time);
- tcp_trace(td->td_act, td->td_ostate, (struct tcpcb *)td->td_tcb, &td->td_cb,
- (struct tcpiphdr *)&td->td_ti.ti_t, td->td_req);
- }
-done: if (follow) {
- prev_debx = tcp_debx + 1;
- if (prev_debx >= TCP_NDEBUG)
- prev_debx = 0;
- do {
- sleep(1);
- (void)klseek(memf, (off_t)nl[N_TCP_DEBX].n_value, L_SET);
- if (read(memf, (char *)&tcp_debx, sizeof(tcp_debx)) !=
- sizeof(tcp_debx)) {
- perror("trpt: tcp_debx");
- exit(3);
- }
- } while (tcp_debx == prev_debx);
- (void)klseek(memf, (off_t)nl[N_TCP_DEBUG].n_value, L_SET);
- if (read(memf, (char *)tcp_debug, sizeof(tcp_debug)) !=
- sizeof(tcp_debug)) {
- perror("trpt: tcp_debug");
- exit(3);
- }
- goto again;
- }
-}
-
-/*
- * Tcp debug routines
- */
-/*ARGSUSED*/
-void
-tcp_trace(act, ostate, atp, tp, ti, req)
- short act, ostate;
- struct tcpcb *atp, *tp;
- struct tcpiphdr *ti;
- int req;
-{
- tcp_seq seq, ack;
- int flags, len, win, timer;
-
- printf("%03u %s:%s ",(ntime/10) % 1000, tcpstates[ostate],
- tanames[act]);
- switch (act) {
- case TA_INPUT:
- case TA_OUTPUT:
- case TA_DROP:
- if (aflag) {
- printf("(src=%s,%u, ",
- inet_ntoa(ti->ti_src), ntohs(ti->ti_sport));
- printf("dst=%s,%u)",
- inet_ntoa(ti->ti_dst), ntohs(ti->ti_dport));
- }
- seq = ti->ti_seq;
- ack = ti->ti_ack;
- len = ti->ti_len;
- win = ti->ti_win;
- if (act == TA_OUTPUT) {
- seq = ntohl(seq);
- ack = ntohl(ack);
- len = ntohs(len);
- win = ntohs(win);
- }
- if (act == TA_OUTPUT)
- len -= sizeof(struct tcphdr);
- if (len)
- printf("[%x..%x)", seq, seq + len);
- else
- printf("%x", seq);
- printf("@%x", ack);
- if (win)
- printf("(win=%x)", win);
- flags = ti->ti_flags;
- if (flags) {
- register char *cp = "<";
-#define pf(flag, string) { \
- if (ti->ti_flags&flag) { \
- (void)printf("%s%s", cp, string); \
- cp = ","; \
- } \
-}
- pf(TH_SYN, "SYN");
- pf(TH_ACK, "ACK");
- pf(TH_FIN, "FIN");
- pf(TH_RST, "RST");
- pf(TH_PUSH, "PUSH");
- pf(TH_URG, "URG");
- printf(">");
- }
- break;
- case TA_USER:
- timer = req >> 8;
- req &= 0xff;
- printf("%s", prurequests[req]);
- if (req == PRU_SLOWTIMO || req == PRU_FASTTIMO)
- printf("<%s>", tcptimers[timer]);
- break;
- }
- printf(" -> %s", tcpstates[tp->t_state]);
- /* print out internal state of tp !?! */
- printf("\n");
- if (sflag) {
- printf("\trcv_nxt %x rcv_wnd %x snd_una %x snd_nxt %x snd_max %x\n",
- tp->rcv_nxt, tp->rcv_wnd, tp->snd_una, tp->snd_nxt,
- tp->snd_max);
- printf("\tsnd_wl1 %x snd_wl2 %x snd_wnd %x\n", tp->snd_wl1,
- tp->snd_wl2, tp->snd_wnd);
- }
- /* print out timers? */
- if (tflag) {
- register char *cp = "\t";
- register int i;
-
- for (i = 0; i < TCPT_NTIMERS; i++) {
- if (tp->t_timer[i] == 0)
- continue;
- printf("%s%s=%d", cp, tcptimers[i], tp->t_timer[i]);
- if (i == TCPT_REXMT)
- printf(" (t_rxtshft=%d)", tp->t_rxtshift);
- cp = ", ";
- }
- if (*cp != '\t')
- putchar('\n');
- }
-}
-
-int
-numeric(c1, c2)
- caddr_t *c1, *c2;
-{
- return(*c1 - *c2);
-}
-
-void
-klseek(fd, base, off)
- int fd, off;
- off_t base;
-{
- off_t lseek();
-
-#ifndef NEWVM
- if (kflag) { /* get kernel pte */
- base &= ~KERNBASE;
- base = ctob(Sysmap[btop(base)].pg_pfnum) + (base & PGOFSET);
- }
-#endif
- (void)lseek(fd, base, off);
-}