diff options
author | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 1999-08-25 15:36:58 +0000 |
---|---|---|
committer | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 1999-08-25 15:36:58 +0000 |
commit | 7048f112bdb366c217d62ea571a65b4a736d9b24 (patch) | |
tree | f68c0480f3080e9611bde1600d7ca87e1749b427 | |
parent | 49e7f1690954c67141c3c1842da2c425596d4675 (diff) |
Fix usage message, fix flow logic.
-rw-r--r-- | sbin/ipsecadm/ipsecadm.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sbin/ipsecadm/ipsecadm.c b/sbin/ipsecadm/ipsecadm.c index c728c614fd1..f69f84d4d61 100644 --- a/sbin/ipsecadm/ipsecadm.c +++ b/sbin/ipsecadm/ipsecadm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipsecadm.c,v 1.22 1999/08/05 22:02:04 ho Exp $ */ +/* $OpenBSD: ipsecadm.c,v 1.23 1999/08/25 15:36:57 angelos Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -197,6 +197,8 @@ usage() "\t -addr <ip> <net> <ip> <net>\t subnets for flow\n" "\t -delete\t\t\t delete specified flow\n" "\t -local\t\t\t also create a local flow\n" + "\t -sport\t\t\t source port for flow\n" + "\t -dport\t\t\t destination port for flow\n" "\t -[ah|esp|oldah|oldesp|ip4]\t to flush a particular protocol\n" "\talso: dst2, spi2, proto2\n" ); @@ -207,7 +209,7 @@ main(int argc, char **argv) { int auth = 0, enc = 0, klen = 0, alen = 0, mode = ESP_NEW, i = 0; int proto = IPPROTO_ESP, proto2 = IPPROTO_AH; - int dport = -1, sport = -1, tproto = -1; + int dport = -1, sport = -1, tproto = -1, setmask = 0; u_int32_t spi = SPI_RESERVED_MIN, spi2 = SPI_RESERVED_MIN; union sockaddr_union src, dst, dst2, osrc, odst, osmask, odmask, proxy; int srcset = 0, dstset = 0, dst2set = 0; @@ -634,7 +636,8 @@ main(int argc, char **argv) osrc.sin.sin_len = odst.sin.sin_len = sizeof(struct sockaddr_in); osmask.sin.sin_len = sizeof(struct sockaddr_in); odmask.sin.sin_len = sizeof(struct sockaddr_in); - + setmask = 1; + if (!inet_aton(argv[i + 1], &osrc.sin.sin_addr)) { fprintf(stderr, "%s: source address %s is not valid\n", argv[0], argv[i + 1]); @@ -970,10 +973,7 @@ main(int argc, char **argv) exit(1); } - if (iscmd(mode, FLOW) && (odst.sin.sin_addr.s_addr == 0 && - odmask.sin.sin_addr.s_addr == 0 && - osrc.sin.sin_addr.s_addr == 0 && - osmask.sin.sin_addr.s_addr == 0)) + if (iscmd(mode, FLOW) && !setmask) { fprintf(stderr, "%s: no subnets for flow specified\n", argv[0]); exit(1); |