| Fix some errors without messages. |
| Ported from IP Filter Rivoreo fork commit 4c0cbe5. |
| |
| diff -ru --exclude-from freebsd-src-diff-exclude-names /var/tmp/freebsd-10.3-src/usr/src/contrib/ipfilter/man/ippool.8 freebsd-10.3/usr/src/contrib/ipfilter/man/ippool.8 |
| --- /var/tmp/freebsd-10.3-src/usr/src/contrib/ipfilter/man/ippool.8 2016-03-25 09:10:56.000000000 +0800 |
| +++ freebsd-10.3/usr/src/contrib/ipfilter/man/ippool.8 2019-06-25 18:14:15.887215312 +0800 |
| @@ -6,10 +6,10 @@ |
| .SH SYNOPSIS |
| .br |
| .B ippool |
| --a [-dnv] [-m <name>] [-o <role>] [-t <type>] [-T ttl] -i <ipaddr>[/<netmask>] |
| +-a [-dnv] -m <name> [-o <role>] [-t <type>] [-T <ttl>] -i <ipaddr>[/<netmask>] |
| .br |
| .B ippool |
| --A [-dnv] [-m <name>] [-o <role>] [-S <seed>] [-t <type>] |
| +-A [-dnv] -m <name> [-o <role>] [-S <seed>] [-t <type>] |
| .br |
| .B ippool |
| -f <file> [-dnuv] |
| @@ -21,7 +21,7 @@ |
| -l [-dv] [-m <name>] [-t <type>] |
| .br |
| .B ippool |
| --r [-dnv] [-m <name>] [-o <role>] [-t <type>] -i <ipaddr>[/<netmask>] |
| +-r [-dnv] -m <name> [-o <role>] [-t <type>] -i <ipaddr>[/<netmask>] |
| .br |
| .B ippool |
| -R [-dnv] [-m <name>] [-o <role>] [-t <type>] |
| diff -ru --exclude-from freebsd-src-diff-exclude-names /var/tmp/freebsd-10.3-src/usr/src/contrib/ipfilter/tools/ippool.c freebsd-10.3/usr/src/contrib/ipfilter/tools/ippool.c |
| --- /var/tmp/freebsd-10.3-src/usr/src/contrib/ipfilter/tools/ippool.c 2016-03-25 09:10:55.000000000 +0800 |
| +++ freebsd-10.3/usr/src/contrib/ipfilter/tools/ippool.c 2019-06-25 18:12:57.762575373 +0800 |
| @@ -78,12 +78,12 @@ |
| char *prog; |
| { |
| fprintf(stderr, "Usage:\t%s\n", prog); |
| - fprintf(stderr, "\t-a [-dnv] [-m <name>] [-o <role>] [-t type] [-T ttl] -i <ipaddr>[/netmask]\n"); |
| - fprintf(stderr, "\t-A [-dnv] [-m <name>] [-o <role>] [-S <seed>] [-t <type>]\n"); |
| + fprintf(stderr, "\t-a [-dnv] -m <name> [-o <role>] [-t <type>] [-T <ttl>] -i <ipaddr>[/<netmask>]\n"); |
| + fprintf(stderr, "\t-A [-dnv] -m <name> [-o <role>] [-S <seed>] [-t <type>]\n"); |
| fprintf(stderr, "\t-f <file> [-dnuv]\n"); |
| fprintf(stderr, "\t-F [-dv] [-o <role>] [-t <type>]\n"); |
| fprintf(stderr, "\t-l [-dv] [-m <name>] [-t <type>] [-O <fields>]\n"); |
| - fprintf(stderr, "\t-r [-dnv] [-m <name>] [-o <role>] [-t type] -i <ipaddr>[/netmask]\n"); |
| + fprintf(stderr, "\t-r [-dnv] -m <name> [-o <role>] [-t type] -i <ipaddr>[/<netmask>]\n"); |
| fprintf(stderr, "\t-R [-dnv] [-m <name>] [-o <role>] [-t <type>]\n"); |
| fprintf(stderr, "\t-s [-dtv] [-M <core>] [-N <namelist>]\n"); |
| exit(1); |
| @@ -184,8 +184,10 @@ |
| return -1; |
| } |
| role = getrole(optarg); |
| - if (role == IPL_LOGNONE) |
| + if (role == IPL_LOGNONE) { |
| + fprintf(stderr, "unknown role '%s'\n", optarg); |
| return -1; |
| + } |
| break; |
| case 'R' : |
| opts |= OPT_NORESOLVE; |
| @@ -241,19 +243,21 @@ |
| |
| switch (type) { |
| case IPLT_POOL : |
| - if (remove == 0) |
| - err = load_poolnode(role, poolname, &pnode, ttl, ioctl); |
| - else |
| - err = remove_poolnode(role, poolname, &pnode, ioctl); |
| + err = remove ? remove_poolnode(role, poolname, &pnode, ioctl) : |
| + load_poolnode(role, poolname, &pnode, ttl, ioctl); |
| break; |
| case IPLT_HASH : |
| - if (remove == 0) |
| - err = load_hashnode(role, poolname, &hnode, ttl, ioctl); |
| - else |
| - err = remove_hashnode(role, poolname, &hnode, ioctl); |
| + err = remove ? remove_hashnode(role, poolname, &hnode, ioctl) : |
| + load_hashnode(role, poolname, &hnode, ttl, ioctl); |
| break; |
| default : |
| - break; |
| + fprintf(stderr, "impossible pool type %d!\n", type); |
| + return -1; |
| + } |
| + if(err) { |
| + int e = errno; |
| + fprintf(stderr, "cannot %s node: %s\n", remove ? "remove" : "add", |
| + e ? strerror(e) : "Unknown error"); |
| } |
| return err; |
| } |
| @@ -602,7 +606,7 @@ |
| |
| if (!strcasecmp(rolename, "ipf")) { |
| role = IPL_LOGIPF; |
| -#if 0 |
| +#if 1 |
| } else if (!strcasecmp(rolename, "nat")) { |
| role = IPL_LOGNAT; |
| } else if (!strcasecmp(rolename, "state")) { |