da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Copyright (C) 1999-2001, 2003 by Darren Reed.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * See the IPFILTER.LICENCE file for details on licencing.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Use is subject to license terms.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Copyright (c) 2014, Joyent, Inc. All rights reserved.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#if !defined(lint)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstatic const char rcsid[] = "@(#)Id: ipfs.c,v 1.12 2003/12/01 01:56:53 darrenr Exp";
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulknerextern char *index __P((const char *, int));
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chinextern char *optarg;
34f9b3eef6fdadbda0a846aa4d68691ac40eace5Roland Mainz fprintf(stderr, "usage: %s %s[-nv] -l\n", progname, zoneopt);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin fprintf(stderr, "usage: %s %s[-nv] -u\n", progname, zoneopt);
34f9b3eef6fdadbda0a846aa4d68691ac40eace5Roland Mainz fprintf(stderr, "usage: %s %s[-nv] [-d <dir>] -R\n", progname, zoneopt);
34f9b3eef6fdadbda0a846aa4d68691ac40eace5Roland Mainz fprintf(stderr, "usage: %s %s[-nv] [-d <dir>] -W\n", progname, zoneopt);
34f9b3eef6fdadbda0a846aa4d68691ac40eace5Roland Mainz fprintf(stderr, "usage: %s %s[-nv] [-N|-S] [-f <file>] -r\n", progname,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin fprintf(stderr, "usage: %s %s[-nv] [-N|-S] [-f <file>] -w\n", progname,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin fprintf(stderr, "usage: %s %s[-nv] [-N|-S] -f <file> -i <if1>,<if2>\n",
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Change interface names in state information saved out to disk.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *s++ = '\0';
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin for (pos = 0; read(fd, &ips, sizeof(ips)) == sizeof(ips); ) {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (!strncmp(ips.ips_is.is_ifname[0], ifs, olen + 1)) {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (!strncmp(ips.ips_is.is_ifname[1], ifs, olen + 1)) {
34f9b3eef6fdadbda0a846aa4d68691ac40eace5Roland Mainz if (write(fd, &ips, sizeof(ips)) != sizeof(ips)) {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Change interface names in NAT information saved out to disk.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *s++ = '\0';
rw = 0;
int argc;
char *argv[];
usage();
usage();
usage();
usage();
ns = 0;
usage();
rw = 0;
usage();
usage();
lock = 0;
usage();
usage();
if (ifs) {
usage();
if (ns == 0)
if (lock >= 0)
else if (ns >= 0) {
else if (ns == 0)
if (lock >= 0)
else if (rw >= 0) {
if (ns == 0)
if (ns == 0)
return err;
char *ipfdev;
if (!ipfdev)
return fd;
int fd;
int fd;
char *file;
if (!file)
int fd;
char *file;
if (!file)
if (i != sizeof(ips)) {
i, (int)sizeof(ips));
if(!is) {
if (!ipshead)
if (ipstail)
int fd;
char *file;
if (!file)
if (i != sizeof(ipn)) {
i, (int)sizeof(ipn));
if (!in)
if (!ipnhead)
if (ipntail)
int fd;
char *file;
if (!file)
if (!ipnp)
if (!ipnp) {
char *dirname;
if (!dirname)
goto bad;
goto bad;
goto bad;
goto bad;
bad:
char *dirname;
if (!dirname)