Index: ipfw.c =================================================================== RCS file: /home/ncvs/src/sbin/ipfw/ipfw.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- ipfw.c 1996/06/18 01:46:34 1.26 +++ ipfw.c 1996/06/23 20:47:51 1.27 @@ -16,7 +16,7 @@ * * NEW command line interface for IP firewall facility * - * $Id: ipfw.c,v 1.26 1996/06/18 01:46:34 alex Exp $ + * $Id: ipfw.c,v 1.27 1996/06/23 20:47:51 alex Exp $ * */ @@ -256,7 +256,7 @@ } if (chain->fw_flg & IP_FW_F_FRAG) - printf("frag "); + printf(" frag "); if (chain->fw_ipopt || chain->fw_ipnopt) { int _opt_printed = 0; @@ -408,12 +408,23 @@ if (lookup_host(*av,ipno) != 0) show_usage("ip number\n"); - if (md == ':' && !inet_aton(p,mask)) - show_usage("ip number\n"); - else if (md == '/') - mask->s_addr = htonl(0xffffffff << (32 - atoi(p))); - else - mask->s_addr = htonl(0xffffffff); + switch (md) { + case ':': + if (!inet_aton(p,mask)) + show_usage("ip number\n"); + break; + case '/': + if (atoi(p) == 0) { + mask->s_addr = 0; + } else { + mask->s_addr = htonl(0xffffffff << (32 - atoi(p))); + } + break; + default: + mask->s_addr = htonl(0xffffffff); + break; + } + ipno->s_addr &= mask->s_addr; av++; ac--; } @@ -788,10 +799,9 @@ break; case 'N': do_resolv=1; - break; - case '?': - default: - show_usage("Unrecognised switch"); + break; + default: + show_usage("Unrecognised switch"); } ac -= optind; @@ -818,7 +828,7 @@ } else { show_usage("Bad arguments"); } - return 0; + return 0; } int