r1396 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Wed May 9 14:08:41 CEST 2007


Author: phk
Date: 2007-05-09 14:08:41 +0200 (Wed, 09 May 2007)
New Revision: 1396

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_acceptor.c
   trunk/varnish-cache/bin/varnishd/cache_vrt.c
   trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c
Log:
Use struct sockaddr_storage instead of our own homegrown hack.


Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2007-05-09 11:07:59 UTC (rev 1395)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2007-05-09 12:08:41 UTC (rev 1396)
@@ -256,9 +256,9 @@
 	struct worker		*wrk;
 
 	unsigned		sockaddrlen;
-	struct sockaddr		sockaddr[2];
+	struct sockaddr_storage	sockaddr[1];
 	unsigned		mysockaddrlen;
-	struct sockaddr		mysockaddr[2];
+	struct sockaddr_storage	mysockaddr[1];
 
 	/* formatted ascii client address */
 	char			addr[TCP_ADDRBUFSIZE];

Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_acceptor.c	2007-05-09 11:07:59 UTC (rev 1395)
+++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c	2007-05-09 12:08:41 UTC (rev 1396)
@@ -113,7 +113,7 @@
 VCA_Prep(struct sess *sp)
 {
 
-	TCP_name(sp->sockaddr, sp->sockaddrlen,
+	TCP_name((struct sockaddr *)sp->sockaddr, sp->sockaddrlen,
 	    sp->addr, sizeof sp->addr, sp->port, sizeof sp->port);
 	VSL(SLT_SessionOpen, sp->fd, "%s %s", sp->addr, sp->port);
 	sp->acct.first = sp->t_open.tv_sec;

Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt.c	2007-05-09 11:07:59 UTC (rev 1395)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt.c	2007-05-09 12:08:41 UTC (rev 1396)
@@ -256,7 +256,7 @@
 struct sockaddr *
 VRT_r_client_ip(struct sess *sp)
 {
-	return (sp->sockaddr);
+	return ((struct sockaddr *)sp->sockaddr);
 }
 
 struct sockaddr *
@@ -266,9 +266,10 @@
 
 	if (sp->mysockaddrlen == 0) {
 		l = sizeof sp->mysockaddr;
-		AZ(getsockname(sp->fd, sp->mysockaddr, &l));
+		AZ(getsockname(sp->fd,
+		    (struct sockaddr*)sp->mysockaddr, &l));
 		sp->mysockaddrlen = l;
 	}
 
-	return (sp->mysockaddr);
+	return ((struct sockaddr*)sp->mysockaddr);
 }

Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c	2007-05-09 11:07:59 UTC (rev 1395)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c	2007-05-09 12:08:41 UTC (rev 1396)
@@ -104,7 +104,7 @@
 		for (a1 = ap->priv; a1 != NULL; a1 = a1->ai_next) {
 
 			/* only match the right family */
-			if (a1->ai_family != sp->sockaddr->sa_family)
+			if (a1->ai_family != sp->sockaddr->ss_family)
 				continue;
 
 			if (a1->ai_family == AF_INET) {




More information about the varnish-commit mailing list