clock_gettime(CLOCK_MONOTONIC, &now);
return (now.tv_sec - sp->obj->lru_stamp);
}
+
+/*--------------------------------------------------------------------*/
+
+char *
+VRT_IP_string(struct sess *sp, struct sockaddr *sa)
+{
+ char h[64], p[8], *q;
+
+ TCP_name(sa, sa->sa_len, h, sizeof h, p, sizeof p);
+ q = WS_Alloc(sp->http->ws, strlen(h) + strlen(p) + 2);
+ AN(q);
+ strcpy(q, h);
+ strcat(q, ":");
+ strcat(q, p);
+ return (q);
+}
void VRT_free_backends(struct VCL_conf *cp);
void VRT_fini_backend(struct backend *be);
+char *VRT_IP_string(struct sess *sp, struct sockaddr *sa);
#define VRT_done(sp, hand) \
do { \
vsb_cat(sb, "void VRT_free_backends(struct VCL_conf *cp);\n");
vsb_cat(sb, "void VRT_fini_backend(struct backend *be);\n");
vsb_cat(sb, "\n");
+ vsb_cat(sb, "char *VRT_IP_string(struct sess *sp, struct sockaddr *sa);\n");
vsb_cat(sb, "\n");
vsb_cat(sb, "#define VRT_done(sp, hand) \\\n");
vsb_cat(sb, " do { \\\n");
case STRING:
Fb(tl, 0, "%s", vp->rname);
break;
+ case IP:
+ Fb(tl, 0, "VRT_IP_string(sp, %s)", vp->rname);
+ break;
default:
vsb_printf(tl->sb,
"String representation of '%s' not implemented yet.\n",