MINOR: protocol: report the file and line number for binding/listening errors

Binding errors and late socket errors provide no information about
the file and line where the problem occurs. These are all done by
protocol_bind_all() and they only report "Starting proxy blah". Let's
change this a little bit so that:
  - the file name and line number of the faulty bind line is alwas mentioned
  - early binding errors are indicated with "Binding" instead of "Starting".

Now we can for example have this:
  [WARNING]  (18580) : Binding [binderr.cfg:10] for proxy http: cannot bind receiver to device 'eth2' (No such device) [0.0.0.0:1080]
This commit is contained in:
Willy Tarreau 2021-10-14 11:55:48 +02:00
parent f78b52eb7d
commit 37de553f1d

View File

@ -81,10 +81,12 @@ int protocol_bind_all(int verbose)
struct proxy *px = listener->bind_conf->frontend; struct proxy *px = listener->bind_conf->frontend;
if (lerr & ERR_ALERT) if (lerr & ERR_ALERT)
ha_alert("Starting %s %s: %s\n", ha_alert("Binding [%s:%d] for %s %s: %s\n",
listener->bind_conf->file, listener->bind_conf->line,
proxy_type_str(px), px->id, errmsg); proxy_type_str(px), px->id, errmsg);
else if (lerr & ERR_WARN) else if (lerr & ERR_WARN)
ha_warning("Starting %s %s: %s\n", ha_warning("Binding [%s:%d] for %s %s: %s\n",
listener->bind_conf->file, listener->bind_conf->line,
proxy_type_str(px), px->id, errmsg); proxy_type_str(px), px->id, errmsg);
ha_free(&errmsg); ha_free(&errmsg);
} }
@ -103,10 +105,12 @@ int protocol_bind_all(int verbose)
struct proxy *px = listener->bind_conf->frontend; struct proxy *px = listener->bind_conf->frontend;
if (lerr & ERR_ALERT) if (lerr & ERR_ALERT)
ha_alert("Starting %s %s: %s\n", ha_alert("Starting [%s:%d] for %s %s: %s\n",
listener->bind_conf->file, listener->bind_conf->line,
proxy_type_str(px), px->id, msg); proxy_type_str(px), px->id, msg);
else if (lerr & ERR_WARN) else if (lerr & ERR_WARN)
ha_warning("Starting %s %s: %s\n", ha_warning("Starting [%s:%d] for %s %s: %s\n",
listener->bind_conf->file, listener->bind_conf->line,
proxy_type_str(px), px->id, msg); proxy_type_str(px), px->id, msg);
} }
if (lerr & ERR_ABORT) if (lerr & ERR_ABORT)