diff options
author | Steven Barth <cyrus@openwrt.org> | 2014-10-02 19:15:38 +0000 |
---|---|---|
committer | Steven Barth <cyrus@openwrt.org> | 2014-10-02 19:15:38 +0000 |
commit | def69a96e91d70ea3721776c6e9355db3cc31da7 (patch) | |
tree | fcdd283372a6d276b5d62f8220bf11906991e3fd /package/network/ipv6/map/src | |
parent | 2fa8a656a690063e6a2f0ed4f7bcaab5e2edc073 (diff) | |
download | upstream-def69a96e91d70ea3721776c6e9355db3cc31da7.tar.gz upstream-def69a96e91d70ea3721776c6e9355db3cc31da7.tar.bz2 upstream-def69a96e91d70ea3721776c6e9355db3cc31da7.zip |
map: fix portsets starting with 0 and use regular NAT for 1:1 MAP
Signed-off-by: Steven Barth <steven@midlink.org>
SVN-Revision: 42741
Diffstat (limited to 'package/network/ipv6/map/src')
-rw-r--r-- | package/network/ipv6/map/src/mapcalc.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/package/network/ipv6/map/src/mapcalc.c b/package/network/ipv6/map/src/mapcalc.c index 03f8165be0..afce6d24d7 100644 --- a/package/network/ipv6/map/src/mapcalc.c +++ b/package/network/ipv6/map/src/mapcalc.c @@ -343,14 +343,17 @@ int main(int argc, char *argv[]) } - if (psidlen == 0) { - printf("RULE_%d_PORTSETS=0-65535\n", rulecnt); - } else if (psid >= 0) { + if (psidlen > 0 && psid >= 0) { printf("RULE_%d_PORTSETS='", rulecnt); for (int k = (offset) ? 1 : 0; k < (1 << offset); ++k) { int start = (k << (16 - offset)) | (psid >> offset); int end = start + (1 << (16 - offset - psidlen)) - 1; - printf("%d-%d ", start, end); + + if (start == 0) + start = 1; + + if (start <= end) + printf("%d-%d ", start, end); } printf("'\n"); } |