Browse code

- fixed 2 parse_via ipv6 reference parsing bugs: - replies didn't include terminatig ']' (thanks Jens): this was due to not including [] in the hostname; now they are included (hopefully no other piece of code relies on not having them :-)) - ipv6 references starting with : where not parsed (e.g.: [::1]).

Andrei Pelinescu-Onciul authored on 09/07/2003 17:59:50
Showing 3 changed files
... ...
@@ -40,7 +40,7 @@ export makefile_defs
40 40
 VERSION = 0
41 41
 PATCHLEVEL = 8
42 42
 SUBLEVEL =   12
43
-EXTRAVERSION = dev-t09
43
+EXTRAVERSION = dev-t10
44 44
 
45 45
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
46 46
 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")
... ...
@@ -3,6 +3,7 @@ $Id$
3 3
 ( - todo, x - done)
4 4
 
5 5
 release:
6
+- check via ipv6 fixes and backport to stable
6 7
 x fix kill(0, SIGTERM) on startup error (will kill also the launching shell
7 8
  if non-interactive)
8 9
 - fix modules destroy (some modules will try to free uninitialized resources
... ...
@@ -67,7 +67,7 @@ enum {
67 67
 	L_PARAM, F_PARAM, P_PARAM,
68 68
 	L_VIA, F_VIA,
69 69
 	F_COMMENT, P_COMMENT,
70
-	F_IP6HOST, P_IP6HOST,
70
+	F_IP6HOST, P_IP6HOST, 
71 71
 	F_CRLF,
72 72
 	F_LF,
73 73
 	F_CR,
... ...
@@ -1332,13 +1332,10 @@ parse_again:
1332 1332
 					case F_COMMENT:
1333 1333
 					case P_COMMENT:
1334 1334
 						break;
1335
-					case F_IP6HOST: /*eat the spaces*/
1336
-						break;
1335
+					case F_IP6HOST: /*no spaces allowed*/
1337 1336
 					case P_IP6HOST:
1338
-						/*mark end of host*/
1339
-						vb->host.len=tmp-vb->host.s;
1340
-						state=L_PORT; 
1341
-						break;
1337
+						LOG(L_ERR, "ERROR:parse_via: bad ipv6 reference\n");
1338
+						goto error;
1342 1339
 					case F_CRLF:
1343 1340
 					case F_LF:
1344 1341
 					case F_CR:
... ...
@@ -1446,9 +1443,8 @@ parse_again:
1446 1443
 				switch(state){
1447 1444
 					case F_HOST:
1448 1445
 					case F_IP6HOST:
1449
-						LOG(L_ERR,"ERROR:parse_via:"
1450
-							" no host found\n");
1451
-						goto error;
1446
+						state=P_IP6HOST;
1447
+						break;
1452 1448
 					case P_IP6HOST:
1453 1449
 						break;
1454 1450
 					case P_HOST:
... ...
@@ -1712,6 +1708,7 @@ parse_again:
1712 1708
 			case '[':
1713 1709
 				switch(state){
1714 1710
 					case F_HOST:
1711
+						vb->host.s=tmp; /* mark start here (include [])*/
1715 1712
 						state=F_IP6HOST;
1716 1713
 						break;
1717 1714
 					case F_COMMENT:/*everything is allowed in a comment*/
... ...
@@ -1736,7 +1733,7 @@ parse_again:
1736 1733
 				switch(state){
1737 1734
 					case P_IP6HOST:
1738 1735
 						/*mark the end*/
1739
-						vb->host.len=tmp-vb->host.s;
1736
+						vb->host.len=(tmp-vb->host.s)+1; /* include "]" */
1740 1737
 						state=L_PORT;
1741 1738
 						break;
1742 1739
 					case F_CRLF:
... ...
@@ -1851,7 +1848,6 @@ parse_again:
1851 1848
 						break;
1852 1849
 					case F_IP6HOST:
1853 1850
 						state=P_IP6HOST;
1854
-						vb->host.s=tmp;
1855 1851
 						break;
1856 1852
 					case P_IP6HOST:
1857 1853
 						break;