Commit 043efb0d authored by Adam Wujek's avatar Adam Wujek 💬

lib/netconsole: fix wrpc hangs during reboot of a switch

During reboot of a switch, WRPC tries to print messages like:
Warning: tx not terminated infinite mcr=0x1001500
Warning: tx timestamp never became available
Warning: tx timestamp never became available
Warning: tx not terminated infinite mcr=0x1001500
Warning: tx timestamp never became available
Warning: tx timestamp never became available
Warning: tx timestamp never became available

The pp_printf in network functions caused netconsole_write_string to be called
recursively. This caused hangs of wrpc.
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 5de57d52
......@@ -52,14 +52,19 @@ int netconsole_write_string(const char *s)
static int len = 0;
const uint8_t *p;
static uint8_t *d = NULL;
static int rec_level = 0;
if (netconsole_status != NETCONSOLE_ENABLED)
return 0;
/* Prevent recursive calls when net verbose configured.
* NOTE: Even with the following if, NET_IS_VERBOSE does not work
* with netconsole */
if (NET_IS_VERBOSE)
netconsole_status = NETCONSOLE_DISABLED;
if (rec_level > 0)
return 0;
rec_level++;
p = (uint8_t *)s;
while (1) {
if (!d) {
......@@ -94,8 +99,7 @@ int netconsole_write_string(const char *s)
d++;
}
if (NET_IS_VERBOSE)
netconsole_status = NETCONSOLE_ENABLED;
rec_level--;
return 0;
}
......
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