REORG/MEDIUM: replace stream interface protocol functions by a proto pointer
The stream interface now makes use of the socket protocol pointer instead
of the direct functions.
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 8bfa4b2..e4ee9a0 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -1266,6 +1266,15 @@
goto out;
}
newpeer->addr = *sk;
+ newpeer->proto = protocol_by_family(newpeer->addr.ss_family);
+
+ if (!sk) {
+ Alert("parsing [%s:%d] : Unknown protocol family %d '%s'\n",
+ file, linenum, newpeer->addr.ss_family, args[2]);
+ err_code |= ERR_ALERT | ERR_FATAL;
+ goto out;
+ }
+
set_host_port(&newpeer->addr, realport);
if (strcmp(newpeer->id, localpeer) == 0) {
@@ -4080,6 +4089,14 @@
goto out;
}
newsrv->addr = *sk;
+ newsrv->proto = protocol_by_family(newsrv->addr.ss_family);
+
+ if (!sk) {
+ Alert("parsing [%s:%d] : Unknown protocol family %d '%s'\n",
+ file, linenum, newsrv->addr.ss_family, args[2]);
+ err_code |= ERR_ALERT | ERR_FATAL;
+ goto out;
+ }
set_host_port(&newsrv->addr, realport);
newsrv->check_port = curproxy->defsrv.check_port;