summaryrefslogtreecommitdiff
path: root/usr/src/cmd/ipf
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/cmd/ipf')
-rw-r--r--usr/src/cmd/ipf/lib/common/load_hash.c9
-rw-r--r--usr/src/cmd/ipf/lib/common/load_hashnode.c9
-rw-r--r--usr/src/cmd/ipf/lib/common/load_pool.c9
-rw-r--r--usr/src/cmd/ipf/lib/common/load_poolnode.c7
-rw-r--r--usr/src/cmd/ipf/tools/ipf.c33
-rw-r--r--usr/src/cmd/ipf/tools/ipfs.c14
-rw-r--r--usr/src/cmd/ipf/tools/ipfstat.c24
-rw-r--r--usr/src/cmd/ipf/tools/ipfzone.c46
-rw-r--r--usr/src/cmd/ipf/tools/ipmon.c28
-rw-r--r--usr/src/cmd/ipf/tools/ipnat.c16
-rw-r--r--usr/src/cmd/ipf/tools/ippool.c68
11 files changed, 72 insertions, 191 deletions
diff --git a/usr/src/cmd/ipf/lib/common/load_hash.c b/usr/src/cmd/ipf/lib/common/load_hash.c
index d91a831f44..ef65c26b75 100644
--- a/usr/src/cmd/ipf/lib/common/load_hash.c
+++ b/usr/src/cmd/ipf/lib/common/load_hash.c
@@ -8,20 +8,15 @@
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2014, Joyent, Inc. All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <fcntl.h>
#include <sys/ioctl.h>
#include "ipf.h"
#include "netinet/ip_lookup.h"
#include "netinet/ip_htable.h"
-
-#if SOLARIS
#include "ipfzone.h"
-#endif
static int hashfd = -1;
@@ -41,12 +36,10 @@ ioctlfunc_t iocfunc;
hashfd = open(IPLOOKUP_NAME, O_RDWR);
if ((hashfd == -1) && ((opts & OPT_DONOTHING) == 0))
return -1;
-#if SOLARIS
if (setzone(hashfd) != 0) {
close(hashfd);
return -1;
}
-#endif
for (n = 0, a = list; a != NULL; a = a->ipe_next)
n++;
diff --git a/usr/src/cmd/ipf/lib/common/load_hashnode.c b/usr/src/cmd/ipf/lib/common/load_hashnode.c
index dd343f3ab1..d408d511c2 100644
--- a/usr/src/cmd/ipf/lib/common/load_hashnode.c
+++ b/usr/src/cmd/ipf/lib/common/load_hashnode.c
@@ -8,20 +8,15 @@
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2014, Joyent, Inc. All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <fcntl.h>
#include <sys/ioctl.h>
#include "ipf.h"
#include "netinet/ip_lookup.h"
#include "netinet/ip_htable.h"
-
-#if SOLARIS
#include "ipfzone.h"
-#endif
static int hashfd = -1;
@@ -40,12 +35,10 @@ ioctlfunc_t iocfunc;
hashfd = open(IPLOOKUP_NAME, O_RDWR);
if ((hashfd == -1) && ((opts & OPT_DONOTHING) == 0))
return -1;
-#if SOLARIS
if (setzone(hashfd) != 0) {
close(hashfd);
return -1;
}
-#endif
op.iplo_type = IPLT_HASH;
op.iplo_unit = unit;
diff --git a/usr/src/cmd/ipf/lib/common/load_pool.c b/usr/src/cmd/ipf/lib/common/load_pool.c
index e09f77f6b4..ba246bb449 100644
--- a/usr/src/cmd/ipf/lib/common/load_pool.c
+++ b/usr/src/cmd/ipf/lib/common/load_pool.c
@@ -8,20 +8,15 @@
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2014, Joyent, Inc. All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <fcntl.h>
#include <sys/ioctl.h>
#include "ipf.h"
#include "netinet/ip_lookup.h"
#include "netinet/ip_pool.h"
-
-#if SOLARIS
#include "ipfzone.h"
-#endif
static int poolfd = -1;
@@ -38,12 +33,10 @@ ioctlfunc_t iocfunc;
poolfd = open(IPLOOKUP_NAME, O_RDWR);
if ((poolfd == -1) && ((opts & OPT_DONOTHING) == 0))
return -1;
-#if SOLARIS
if (setzone(poolfd) != 0) {
close(poolfd);
return -1;
}
-#endif
op.iplo_unit = plp->ipo_unit;
op.iplo_type = IPLT_POOL;
diff --git a/usr/src/cmd/ipf/lib/common/load_poolnode.c b/usr/src/cmd/ipf/lib/common/load_poolnode.c
index 37c7ef861e..4203f0faa5 100644
--- a/usr/src/cmd/ipf/lib/common/load_poolnode.c
+++ b/usr/src/cmd/ipf/lib/common/load_poolnode.c
@@ -5,7 +5,7 @@
*
* $Id: load_poolnode.c,v 1.3.2.1 2004/03/06 14:33:29 darrenr Exp $
*
- * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2014, Joyent, Inc. All rights reserved.
*/
#include <fcntl.h>
@@ -13,10 +13,7 @@
#include "ipf.h"
#include "netinet/ip_lookup.h"
#include "netinet/ip_pool.h"
-
-#if SOLARIS
#include "ipfzone.h"
-#endif
static int poolfd = -1;
@@ -35,12 +32,10 @@ ioctlfunc_t iocfunc;
poolfd = open(IPLOOKUP_NAME, O_RDWR);
if ((poolfd == -1) && ((opts & OPT_DONOTHING) == 0))
return -1;
-#if SOLARIS
if (setzone(poolfd) != 0) {
close(poolfd);
return -1;
}
-#endif
op.iplo_unit = role;
op.iplo_type = IPLT_POOL;
diff --git a/usr/src/cmd/ipf/tools/ipf.c b/usr/src/cmd/ipf/tools/ipf.c
index 97bee67b26..7a664c80e6 100644
--- a/usr/src/cmd/ipf/tools/ipf.c
+++ b/usr/src/cmd/ipf/tools/ipf.c
@@ -6,7 +6,7 @@
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2014, Joyent, Inc. All rights reserved.
*/
#ifdef __FreeBSD__
@@ -22,10 +22,7 @@
#include <fcntl.h>
#include <sys/ioctl.h>
#include "netinet/ipl.h"
-
-#ifdef SOLARIS
#include "ipfzone.h"
-#endif
#if !defined(lint)
static const char sccsid[] = "@(#)ipf.c 1.23 6/5/96 (C) 1993-2000 Darren Reed";
@@ -70,12 +67,7 @@ static void usage()
{
fprintf(stderr, "usage: ipf [-6AdDEGInoPrRsvVyzZ] %s %s %s",
"[-l block|pass|nomatch|state|nat]", "[-cc] [-F i|o|a|s|S|u]",
- "[-f filename] [-T <tuneopts>]");
-#if SOLARIS
- fprintf(stderr, " [zonename]\n");
-#else
- fprintf(stderr, "\n");
-#endif
+ "[-f filename] [-T <tuneopts>] [zonename]\n");
exit(1);
}
@@ -90,13 +82,14 @@ char *argv[];
if (argc < 2)
usage();
-#if SOLARIS
/*
* We need to set the zone name before calling the functions
- * in the switch statement below
+ * in the switch statement below. Note that ipf.c differs from the other
+ * tools in the ipfilter suite: the zone name is specified as the
+ * last argument, while the other tools use the -z option. ipf
+ * already has a -z option, so the last argument is used instead.
*/
getzonearg(argc, argv, optstr);
-#endif
while ((c = getopt(argc, argv, optstr)) != -1) {
switch (c)
@@ -131,6 +124,9 @@ char *argv[];
case 'F' :
flushfilter(optarg);
break;
+ case 'G' :
+ /* Already handled by getzonearg() above */
+ break;
case 'I' :
opts ^= OPT_INACTIVE;
break;
@@ -208,12 +204,10 @@ int check;
if ((fd = open(ipfdev, O_RDONLY)) == -1)
perror("open device");
-#if SOLARIS
if (setzone(fd) != 0) {
close(fd);
- return -1;
+ return -2;
}
-#endif
return fd;
}
@@ -335,12 +329,10 @@ char *opt;
if (opts & OPT_VERBOSE)
printf("set state log flag\n");
xfd = open(IPSTATE_NAME, O_RDWR);
-#if SOLARIS
if (xfd >= 0 && setzone(xfd) != 0) {
close(xfd);
xfd = -1;
}
-#endif
if (xfd >= 0) {
logopt = 0;
@@ -359,12 +351,10 @@ char *opt;
if (opts & OPT_VERBOSE)
printf("set nat log flag\n");
xfd = open(IPNAT_NAME, O_RDWR);
-#if SOLARIS
if (xfd >= 0 && setzone(xfd) != 0) {
close(xfd);
xfd = -1;
}
-#endif
if (xfd >= 0) {
logopt = 0;
@@ -558,13 +548,10 @@ static int showversion()
return 1;
}
-#if SOLARIS
if (setzone(vfd) != 0) {
close(vfd);
return 1;
}
-#endif
-
if (ioctl(vfd, SIOCGETFS, &ipfo)) {
perror("ioctl(SIOCGETFS)");
diff --git a/usr/src/cmd/ipf/tools/ipfs.c b/usr/src/cmd/ipf/tools/ipfs.c
index 72296a09d0..e84168e25d 100644
--- a/usr/src/cmd/ipf/tools/ipfs.c
+++ b/usr/src/cmd/ipf/tools/ipfs.c
@@ -6,7 +6,7 @@
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2014, Joyent, Inc. All rights reserved.
*/
#ifdef __FreeBSD__
@@ -46,9 +46,7 @@
#include <resolv.h>
#include "ipf.h"
#include "netinet/ipl.h"
-#if SOLARIS
#include "ipfzone.h"
-#endif
#if !defined(lint)
static const char rcsid[] = "@(#)Id: ipfs.c,v 1.12 2003/12/01 01:56:53 darrenr Exp";
@@ -91,11 +89,7 @@ char *progname;
void usage()
{
-#if SOLARIS
const char *zoneopt = "[-G|-z zonename] ";
-#else
- const char *zoneopt = "";
-#endif
fprintf(stderr, "usage: %s %s[-nv] -l\n", progname, zoneopt);
fprintf(stderr, "usage: %s %s[-nv] -u\n", progname, zoneopt);
fprintf(stderr, "usage: %s %s[-nv] [-d <dir>] -R\n", progname, zoneopt);
@@ -245,11 +239,9 @@ char *argv[];
else
usage();
break;
-#if SOLARIS
case 'G' :
setzonename_global(optarg);
break;
-#endif
case 'i' :
ifs = optarg;
set = 1;
@@ -304,11 +296,9 @@ char *argv[];
rw = 3;
set = 1;
break;
-#if SOLARIS
case 'z' :
setzonename(optarg);
break;
-#endif
case '?' :
default :
usage();
@@ -378,12 +368,10 @@ char *ipfdev;
if ((fd = open(ipfdev, O_RDONLY)) == -1)
perror("open device");
-#if SOLARIS
if (setzone(fd) != 0) {
close(fd);
fd = -1;
}
-#endif
return fd;
}
diff --git a/usr/src/cmd/ipf/tools/ipfstat.c b/usr/src/cmd/ipf/tools/ipfstat.c
index 49ee7cd23d..f50b722bde 100644
--- a/usr/src/cmd/ipf/tools/ipfstat.c
+++ b/usr/src/cmd/ipf/tools/ipfstat.c
@@ -6,7 +6,7 @@
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2014, Joyent, Inc. All rights reserved.
*/
#ifdef __FreeBSD__
@@ -73,6 +73,7 @@
#if defined(__NetBSD__) || (__OpenBSD__)
# include <paths.h>
#endif
+#include "ipfzone.h"
#if !defined(lint)
static const char sccsid[] = "@(#)fils.c 1.21 4/20/96 (C) 1993-2000 Darren Reed";
@@ -183,9 +184,7 @@ char *name;
#else
fprintf(stderr, " %s -t [-C] ", name);
#endif
-#ifdef SOLARIS
fprintf(stderr, "[-G|-z zonename] ");
-#endif
fprintf(stderr, "[-D destination address] [-P protocol] [-S source address] [-T refresh time]\n");
exit(1);
}
@@ -240,11 +239,7 @@ char *argv[];
switch (c)
{
case 'G' :
-#if SOLARIS
setzonename_global(optarg);
-#else
- usage(argv[0]);
-#endif
break;
case 'M' :
memf = optarg;
@@ -255,11 +250,7 @@ char *argv[];
live_kernel = 0;
break;
case 'z' :
-#if SOLARIS
setzonename(optarg);
-#else
- usage(argv[0]);
-#endif
break;
}
}
@@ -270,23 +261,22 @@ char *argv[];
perror("open(IPSTATE_NAME)");
exit(-1);
}
-#if SOLARIS
+
if (setzone(state_fd) != 0) {
close(state_fd);
exit(-1);
}
-#endif
+
if ((ipf_fd = open(device, O_RDONLY)) == -1) {
fprintf(stderr, "open(%s)", device);
perror("");
exit(-1);
}
-#if SOLARIS
+
if (setzone(ipf_fd) != 0) {
close(ipf_fd);
exit(-1);
}
-#endif
}
if (kern != NULL || memf != NULL) {
@@ -334,6 +324,7 @@ char *argv[];
opts |= OPT_GROUPS;
break;
case 'G' :
+ /* Already handled by getzoneopt() above */
break;
case 'h' :
opts |= OPT_HITS;
@@ -398,6 +389,7 @@ char *argv[];
opts |= OPT_UNDEF;
break;
case 'z' :
+ /* Already handled by getzoneopt() above */
break;
default :
usage(argv[0]);
@@ -521,12 +513,10 @@ u_32_t *frfp;
exit(-1);
}
-#if SOLARIS
if (setzone(ipf_fd) != 0) {
close(ipf_fd);
exit(-1);
}
-#endif
bzero((caddr_t)&ipfo, sizeof(ipfo));
ipfo.ipfo_rev = IPFILTER_VERSION;
diff --git a/usr/src/cmd/ipf/tools/ipfzone.c b/usr/src/cmd/ipf/tools/ipfzone.c
index c52b3e879d..d4e1bb8427 100644
--- a/usr/src/cmd/ipf/tools/ipfzone.c
+++ b/usr/src/cmd/ipf/tools/ipfzone.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013 Joyent, Inc. All rights reserved.
+ * Copyright (c) 2014 Joyent, Inc. All rights reserved.
* Use is subject to license terms.
*
* See the IPFILTER.LICENCE file for details on licensing.
@@ -21,12 +21,14 @@ static boolean_t do_setzone = 0;
static int num_setzones = 0;
extern int errno;
+extern int opterr;
extern int optind;
extern char *optarg;
/*
* Get the zonename if it's the last argument and set the zonename
- * in ipfzo to it
+ * in ipfzo to it. This is used by ipf(1m) only - all of the other tools
+ * specify the zone with the -z option, and therefore use getzoneopt() below.
*/
void
getzonearg(int argc, char *argv[], const char *optstr)
@@ -34,6 +36,12 @@ getzonearg(int argc, char *argv[], const char *optstr)
int c;
/*
+ * Don't warn about unknown options - let subsequent calls to
+ * getopt() handle this.
+ */
+ opterr = 0;
+
+ /*
* getopt is also used here to set optind so that we can
* determine if the last argument belongs to a flag or is
* actually a zonename.
@@ -47,10 +55,11 @@ getzonearg(int argc, char *argv[], const char *optstr)
setzonename(argv[optind]);
/*
- * Reset optind so the next getopt call will go through all of argv
- * again.
+ * Reset optind and opterr so the next getopt call will go through all
+ * of argv again and warn about unknown options.
*/
optind = 1;
+ opterr = 1;
}
/*
@@ -61,6 +70,12 @@ getzoneopt(int argc, char *argv[], const char *optstr)
{
int c;
+ /*
+ * Don't warn about unknown options - let subsequent calls to
+ * getopt() handle this.
+ */
+ opterr = 0;
+
while ((c = getopt(argc, argv, optstr)) != -1) {
if (c == 'G')
setzonename_global(optarg);
@@ -70,14 +85,16 @@ getzoneopt(int argc, char *argv[], const char *optstr)
}
/*
- * Reset optind so the next getopt call will go through all of argv
- * again.
+ * Reset optind and opterr so the next getopt call will go through all
+ * of argv again and warn about unknown options.
*/
optind = 1;
+ opterr = 1;
}
/*
- * Set the zonename in ipfzo to the given string
+ * Set the zonename in ipfzo to the given string: this is the zone all further
+ * ioctls will act on.
*/
void
setzonename(const char *zonename)
@@ -88,8 +105,8 @@ setzonename(const char *zonename)
}
/*
- * Set the zonename in ipfo, and the gz flag to indicate that we want to
- * act on the GZ-controlled stack
+ * Set the zonename in ipfo, and the gz flag. This indicates that we want all
+ * further ioctls to act on the GZ-controlled stack for that zone.
*/
void
setzonename_global(const char *zonename)
@@ -99,7 +116,9 @@ setzonename_global(const char *zonename)
}
/*
- * Set the zone that all further ioctls will operate on
+ * Set the zone that all further ioctls will operate on. See the "GZ-controlled
+ * and per-zone stacks" note at the top of ip_fil_solaris.c for further
+ * explanation.
*/
int
setzone(int fd)
@@ -113,6 +132,13 @@ setzone(int fd)
return (-1);
}
+ if (ipzo.ipfz_gz == 1 &&
+ getzoneidbyname(ipzo.ipfz_zonename) == GLOBAL_ZONEID) {
+ (void) fprintf(stderr,
+ "-G cannot be used with the global zone\n");
+ return (-1);
+ }
+
if (ioctl(fd, SIOCIPFZONESET, &ipzo) == -1) {
switch (errno) {
case ENODEV:
diff --git a/usr/src/cmd/ipf/tools/ipmon.c b/usr/src/cmd/ipf/tools/ipmon.c
index 07d3d40be2..a91e23237a 100644
--- a/usr/src/cmd/ipf/tools/ipmon.c
+++ b/usr/src/cmd/ipf/tools/ipmon.c
@@ -6,7 +6,7 @@
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2014, Joyent, Inc. All rights reserved.
*/
@@ -80,9 +80,7 @@
#include "netinet/ip_state.h"
#include "netinet/ip_proxy.h"
#include "ipmon.h"
-#if SOLARIS
#include "ipfzone.h"
-#endif
#if !defined(lint)
static const char sccsid[] = "@(#)ipmon.c 1.21 6/5/96 (C)1993-2000 Darren Reed";
@@ -1345,15 +1343,10 @@ printipflog:
static void usage(prog)
char *prog;
{
-#if SOLARIS
- const char *zoneopt = " [-G|-z zonename]";
-#else
- const char *zoneopt = "";
-#endif
- fprintf(stderr, "%s: [-abDFhnpstvxX]%s %s %s %s %s %s %s\n",
- prog, zoneopt, "[-N device]", "[ [-o [NSI]] [-O [NSI]]",
- "[-P pidfile]", "[-S device]", "[-f device]",
- "filename");
+ fprintf(stderr, "%s: [-abDFhnpstvxX] %s %s %s %s %s %s %s\n",
+ prog, "[-G|-z zonename]", "[-N device]",
+ "[ [-o [NSI]] [-O [NSI]]", "[-P pidfile]", "[-S device]",
+ "[-f device]", "filename");
exit(1);
}
@@ -1390,12 +1383,10 @@ FILE *log;
exit(1);
}
-#if SOLARIS
if (setzone(fd) != 0) {
close(fd);
exit(1);
}
-#endif
if (ioctl(fd, SIOCIPFFB, &flushed) == 0) {
printf("%d bytes flushed from log buffer\n",
@@ -1469,13 +1460,11 @@ char *argv[];
iplfile[1] = IPNAT_NAME;
iplfile[2] = IPSTATE_NAME;
-#if SOLARIS
/*
* We need to set the zone name before calling openlog in
* the switch statement below
*/
getzoneopt(argc, argv, optstr);
-#endif
while ((c = getopt(argc, argv, optstr)) != -1)
switch (c)
@@ -1509,11 +1498,9 @@ char *argv[];
flushlogs(iplfile[1], log);
flushlogs(iplfile[2], log);
break;
-#if SOLARIS
case 'G' :
/* Already handled by getzoneopt() above */
break;
-#endif
case 'n' :
opts |= OPT_RESOLVE;
break;
@@ -1566,11 +1553,9 @@ char *argv[];
case 'X' :
opts |= OPT_HEXHDR;
break;
-#if SOLARIS
case 'z' :
/* Already handled by getzoneopt() above */
break;
-#endif
default :
case 'h' :
case '?' :
@@ -1608,12 +1593,11 @@ char *argv[];
/* NOTREACHED */
}
-#if SOLARIS
if (setzone(fd[i]) != 0) {
close(fd[i]);
exit(1);
}
-#endif
+
if (!(regular[i] = !S_ISCHR(sb.st_mode)))
devices++;
}
diff --git a/usr/src/cmd/ipf/tools/ipnat.c b/usr/src/cmd/ipf/tools/ipnat.c
index a7e37b0295..3a2610a235 100644
--- a/usr/src/cmd/ipf/tools/ipnat.c
+++ b/usr/src/cmd/ipf/tools/ipnat.c
@@ -8,7 +8,7 @@
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2014, Joyent, Inc. All rights reserved.
*/
#include <stdio.h>
@@ -57,10 +57,7 @@
#include "ipf.h"
#include "netinet/ipl.h"
#include "kmem.h"
-
-#if SOLARIS
#include "ipfzone.h"
-#endif
#ifdef __hpux
# define nlist nlist64
@@ -102,11 +99,7 @@ void usage(name)
char *name;
{
fprintf(stderr, "Usage: %s [-CdFhlnrRsv] [-f filename]", name);
-#if SOLARIS
fprintf(stderr, " [-G|-z zonename]\n");
-#else
- fprintf(stderr, "\n");
-#endif
exit(1);
}
@@ -143,11 +136,9 @@ char *argv[];
case 'F' :
opts |= OPT_FLUSH;
break;
-#if SOLARIS
case 'G' :
setzonename_global(optarg);
break;
-#endif
case 'h' :
opts |=OPT_HITS;
break;
@@ -178,11 +169,9 @@ char *argv[];
case 'v' :
opts |= OPT_VERBOSE;
break;
-#if SOLARIS
case 'z' :
setzonename(optarg);
break;
-#endif
default :
usage(argv[0]);
}
@@ -215,12 +204,11 @@ char *argv[];
STRERROR(errno));
exit(1);
}
-#if SOLARIS
+
if (setzone(fd) != 0) {
close(fd);
exit(1);
}
-#endif
bzero((char *)&obj, sizeof(obj));
obj.ipfo_rev = IPFILTER_VERSION;
diff --git a/usr/src/cmd/ipf/tools/ippool.c b/usr/src/cmd/ipf/tools/ippool.c
index 3eca3e1776..d0296139a8 100644
--- a/usr/src/cmd/ipf/tools/ippool.c
+++ b/usr/src/cmd/ipf/tools/ippool.c
@@ -6,11 +6,9 @@
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2014, Joyent, Inc. All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <sys/time.h>
#include <sys/param.h>
@@ -43,10 +41,7 @@
#include "netinet/ip_pool.h"
#include "netinet/ip_htable.h"
#include "kmem.h"
-
-#if SOLARIS
#include "ipfzone.h"
-#endif
extern int ippool_yyparse __P((void));
extern int ippool_yydebug;
@@ -77,11 +72,7 @@ int use_inet6 = 0;
void usage(prog)
char *prog;
{
-#if SOLARIS
const char *zoneopt = "[-G|-z zonename] ";
-#else
- const char *zoneopt = "";
-#endif
fprintf(stderr, "Usage:\t%s\n", prog);
fprintf(stderr, "\t\t\t-a [-dnv] %s[-m <name>] [-o <role>] -i <ipaddr>[/netmask]\n",
zoneopt);
@@ -164,11 +155,7 @@ char *argv[];
ippool_yydebug++;
break;
case 'G' :
-#if SOLARIS
setzonename_global(optarg);
-#else
- usage(argv[0]);
-#endif
break;
case 'i' :
s = strchr(optarg, '/');
@@ -206,11 +193,7 @@ char *argv[];
opts |= OPT_VERBOSE;
break;
case 'z' :
-#if SOLARIS
setzonename(optarg);
-#else
- usage(argv[0]);
-#endif
break;
}
@@ -257,11 +240,8 @@ char *argv[];
ippool_yydebug++;
break;
case 'G' :
-#if SOLARIS
setzonename_global(optarg);
-#else
- usage(argv[0]);
-#endif
+ break;
case 'm' :
poolname = optarg;
break;
@@ -292,11 +272,7 @@ char *argv[];
opts |= OPT_VERBOSE;
break;
case 'z' :
-#if SOLARIS
setzonename(optarg);
-#else
- usage(argv[0]);
-#endif
break;
}
@@ -359,11 +335,7 @@ char *argv[], *infile;
ippool_yydebug++;
break;
case 'G' :
-#if SOLARIS
setzonename_global(optarg);
-#else
- usage(argv[0]);
-#endif
break;
case 'n' :
opts |= OPT_DONOTHING;
@@ -378,11 +350,7 @@ char *argv[], *infile;
opts |= OPT_VERBOSE;
break;
case 'z' :
-#if SOLARIS
setzonename(optarg);
-#else
- usage(argv[0]);
-#endif
break;
}
@@ -395,12 +363,11 @@ char *argv[], *infile;
perror("open(IPLOOKUP_NAME)");
exit(1);
}
-#if SOLARIS
+
if (setzone(fd) != 0) {
close(fd);
exit(1);
}
-#endif
}
if (ippool_parsefile(fd, infile, ioctl) != 0)
@@ -435,11 +402,7 @@ char *argv[];
opts |= OPT_DEBUG;
break;
case 'G' :
-#if SOLARIS
setzonename_global(optarg);
-#else
- usage(argv[0]);
-#endif
break;
case 'm' :
poolname = optarg;
@@ -473,11 +436,7 @@ char *argv[];
opts |= OPT_VERBOSE;
break;
case 'z' :
-#if SOLARIS
setzonename(optarg);
-#else
- usage(argv[0]);
-#endif
break;
}
@@ -490,12 +449,11 @@ char *argv[];
perror("open(IPLOOKUP_NAME)");
exit(1);
}
-#if SOLARIS
+
if (setzone(fd) != 0) {
close(fd);
exit(1);
}
-#endif
}
bzero((char *)&op, sizeof(op));
@@ -705,11 +663,7 @@ char *argv[];
opts |= OPT_DEBUG;
break;
case 'G' :
-#if SOLARIS
setzonename_global(optarg);
-#else
- usage(argv[0]);
-#endif
break;
case 'M' :
live_kernel = 0;
@@ -738,11 +692,7 @@ char *argv[];
opts |= OPT_VERBOSE;
break;
case 'z' :
-#if SOLARIS
setzonename(optarg);
-#else
- usage(argv[0]);
-#endif
break;
}
@@ -755,12 +705,11 @@ char *argv[];
perror("open(IPLOOKUP_NAME)");
exit(1);
}
-#if SOLARIS
+
if (setzone(fd) != 0) {
close(fd);
exit(1);
}
-#endif
}
if (type == IPLT_ALL || type == IPLT_POOL) {
@@ -832,11 +781,7 @@ char *argv[];
opts |= OPT_VERBOSE;
break;
case 'z' :
-#if SOLARIS
setzonename(optarg);
-#else
- usage(argv[0]);
-#endif
break;
}
@@ -849,12 +794,11 @@ char *argv[];
perror("open(IPLOOKUP_NAME)");
exit(1);
}
-#if SOLARIS
+
if (setzone(fd) != 0) {
close(fd);
exit(1);
}
-#endif
}
bzero((char *)&flush, sizeof(flush));