changeset 2873:121998eaf59a

6476429 ipnat once again does not allow rdr rules to specify a 0/0 destination (Regression) 6476724 parsing error with ipnat and extended port matching has returned (Regression) 6477791 IPfilter does not display all IPv6 addresses correctly after "Code Merge" (Regression)
author jojemann
date Fri, 06 Oct 2006 07:15:35 -0700
parents ef6b1a8f4b3d
children ef6ddc19af4e
files usr/src/cmd/ipf/lib/common/print_toif.c usr/src/cmd/ipf/lib/common/printnat.c usr/src/cmd/ipf/tools/ipnat_y.y
diffstat 3 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/ipf/lib/common/print_toif.c	Fri Oct 06 04:03:44 2006 -0700
+++ b/usr/src/cmd/ipf/lib/common/print_toif.c	Fri Oct 06 07:15:35 2006 -0700
@@ -28,7 +28,7 @@
 		char ipv6addr[INET6_ADDRSTRLEN];
 
 		inet_ntop(AF_INET6, &fdp->fd_ip6, ipv6addr,
-			  sizeof(fdp->fd_ip6));
+			  sizeof(ipv6addr));
 		printf(":%s", ipv6addr);
 	} else
 #endif
--- a/usr/src/cmd/ipf/lib/common/printnat.c	Fri Oct 06 04:03:44 2006 -0700
+++ b/usr/src/cmd/ipf/lib/common/printnat.c	Fri Oct 06 07:15:35 2006 -0700
@@ -103,6 +103,10 @@
 		printf(" -> %s", inet_ntoa(np->in_in[0].in4));
 		if (np->in_flags & IPN_SPLIT)
 			printf(",%s", inet_ntoa(np->in_in[1].in4));
+		if (np->in_inip == 0) {
+			bits = count4bits(np->in_inmsk);
+			printf("/%d", bits);
+		}
 		if (np->in_flags & IPN_TCPUDP) {
 			if ((np->in_flags & IPN_FIXEDDPORT) != 0)
 				printf(" port = %d", ntohs(np->in_pnext));
--- a/usr/src/cmd/ipf/tools/ipnat_y.y	Fri Oct 06 04:03:44 2006 -0700
+++ b/usr/src/cmd/ipf/tools/ipnat_y.y	Fri Oct 06 07:15:35 2006 -0700
@@ -316,6 +316,11 @@
 dip:
 	hostname			{ nat->in_inip = $1.s_addr;
 					  nat->in_inmsk = 0xffffffff; }
+	| hostname '/' YY_NUMBER        { nat->in_inip = $1.s_addr;
+					  if (nat->in_inip != 0 ||
+					      ($3 != 0 && $3 != 32))
+						yyerror("Invalid mask for dip");
+					  ntomask(4, $3, &nat->in_inmsk); }
 	| hostname ',' hostname		{ nat->in_flags |= IPN_SPLIT;
 					  nat->in_inip = $1.s_addr;
 					  nat->in_inmsk = $3.s_addr; }
@@ -481,7 +486,7 @@
 
 portstuff:
 	compare portspec		{ $$.pc = $1; $$.p1 = $2; }
-	| portspec range portspec	{ $$.pc = $2; $$.p1 = $1; $$.p1 = $3; }
+	| portspec range portspec	{ $$.pc = $2; $$.p1 = $1; $$.p2 = $3; }
 	;
 
 mapoptions: