Commit 63d66674 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Move suckaddr all the way through backends (I think...)

parent 33f38803
......@@ -108,7 +108,7 @@ VBE_ReleaseConn(struct vbc *vc)
static int
vbe_TryConnect(const struct busyobj *bo, int pf,
const struct sockaddr_storage *sa, const struct vdi_simple *vs)
const struct suckaddr *sa, const struct vdi_simple *vs)
{
int s, i, tmo;
double tmod;
......
......@@ -113,8 +113,8 @@ struct backend {
char *ipv6_addr;
char *port;
struct sockaddr_storage *ipv4;
struct sockaddr_storage *ipv6;
struct suckaddr *ipv4;
struct suckaddr *ipv6;
unsigned n_conn;
VTAILQ_HEAD(, vbc) connlist;
......@@ -139,7 +139,7 @@ struct vbc {
struct vsl_log *vsl;
int fd;
struct sockaddr_storage *addr;
struct suckaddr *addr;
uint8_t recycled;
......
......@@ -151,13 +151,13 @@ VBE_DropRefConn(struct backend *b)
*/
static void
copy_sockaddr(struct sockaddr_storage **sa, const void *src)
copy_sockaddr(struct suckaddr **sa, const struct suckaddr *src)
{
assert(VSA_Sane(src));
*sa = calloc(sizeof **sa, 1);
*sa = calloc(1, vsa_suckaddr_len);
XXXAN(*sa);
memcpy(*sa, src, VSA_Len(src));
memcpy(*sa, src, vsa_suckaddr_len);
assert(VSA_Sane(*sa));
}
......
......@@ -105,7 +105,7 @@ static struct lock vbp_mtx;
*/
static int
vbp_connect(int pf, const struct sockaddr_storage *sa, int tmo)
vbp_connect(int pf, const struct suckaddr *sa, int tmo)
{
int s, i;
......
......@@ -36,7 +36,7 @@ extern const int vsa_suckaddr_len;
int VSA_Sane(const void *);
socklen_t VSA_Len(const void *);
unsigned VSA_Port(const void *);
int VSA_Compare(const void *, const void *);
int VSA_Compare(const struct suckaddr *, const struct suckaddr *);
struct suckaddr *VSA_Malloc(const void *s, unsigned sal);
......
......@@ -28,6 +28,8 @@
*
*/
struct suckaddr;
/* from libvarnish/tcp.c */
/* NI_MAXHOST and NI_MAXSERV are ridiculously long for numeric format */
#define VTCP_ADDRBUFSIZE 64
......@@ -67,7 +69,7 @@ int VTCP_check_hup(int sock);
#ifdef SOL_SOCKET
void VTCP_name(const struct sockaddr_storage *addr, unsigned l, char *abuf,
unsigned alen, char *pbuf, unsigned plen);
int VTCP_connect(int s, const struct sockaddr_storage *name, int msec);
int VTCP_connect(int s, const struct suckaddr *name, int msec);
void VTCP_close(int *s);
void VTCP_set_read_timeout(int s, double seconds);
#endif
......@@ -259,17 +259,11 @@ VSA_Len(const void *s)
}
int
VSA_Compare(const void *s1, const void *s2)
VSA_Compare(const struct suckaddr *s1, const struct suckaddr *s2)
{
const struct sockaddr *sa = s1;
switch(sa->sa_family) {
case PF_INET:
case PF_INET6:
return (memcmp(s1, s2, VSA_Len(s1)));
default:
return (-1);
}
AN(s1);
AN(s2);
return (memcmp(s1, s2, vsa_suckaddr_len));
}
unsigned
......
......@@ -195,7 +195,7 @@ VTCP_nonblocking(int sock)
*/
int
VTCP_connect(int s, const struct sockaddr_storage *name, int msec)
VTCP_connect(int s, const struct suckaddr *name, int msec)
{
int i, k;
socklen_t l;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment