summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Brown2012-02-28 23:27:48 +0100
committerMichael Brown2012-02-29 00:10:01 +0100
commitc72b8969e2fed31c7be6f70fdec107f92c1c03e8 (patch)
treea7674cd01035533d7b1d34360f9d9564c63c2192 /src
parent[http] Allow for HTTPS-only builds (diff)
downloadipxe-c72b8969e2fed31c7be6f70fdec107f92c1c03e8.tar.gz
ipxe-c72b8969e2fed31c7be6f70fdec107f92c1c03e8.tar.xz
ipxe-c72b8969e2fed31c7be6f70fdec107f92c1c03e8.zip
[syslog] Disable console when no syslog server is defined
Explicitly disable the syslog console when no syslog server is defined, rather than (ab)using the socket family address as an equivalent console-enabled flag. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src')
-rw-r--r--src/net/udp/syslog.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/net/udp/syslog.c b/src/net/udp/syslog.c
index 6d9fc2165..775e3f4af 100644
--- a/src/net/udp/syslog.c
+++ b/src/net/udp/syslog.c
@@ -37,6 +37,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
/** The syslog server */
static struct sockaddr_tcpip logserver = {
+ .st_family = AF_INET,
.st_port = htons ( SYSLOG_PORT ),
};
@@ -84,10 +85,6 @@ static struct ansiesc_context syslog_ansiesc_ctx = {
static void syslog_putchar ( int character ) {
int rc;
- /* Do nothing if we have no log server */
- if ( ! logserver.st_family )
- return;
-
/* Ignore if we are already mid-logging */
if ( syslog_entered )
return;
@@ -136,6 +133,7 @@ static void syslog_putchar ( int character ) {
/** Syslog console driver */
struct console_driver syslog_console __console_driver = {
.putchar = syslog_putchar,
+ .disabled = 1,
};
/******************************************************************************
@@ -166,11 +164,11 @@ static int apply_syslog_settings ( void ) {
int rc;
/* Fetch log server */
+ syslog_console.disabled = 1;
old_addr.s_addr = sin_logserver->sin_addr.s_addr;
- logserver.st_family = 0;
if ( ( len = fetch_ipv4_setting ( NULL, &syslog_setting,
&sin_logserver->sin_addr ) ) >= 0 ) {
- sin_logserver->sin_family = AF_INET;
+ syslog_console.disabled = 0;
}
/* Do nothing unless log server has changed */
@@ -181,7 +179,7 @@ static int apply_syslog_settings ( void ) {
intf_restart ( &syslogger, 0 );
/* Do nothing unless we have a log server */
- if ( ! logserver.st_family ) {
+ if ( syslog_console.disabled ) {
DBG ( "SYSLOG has no log server\n" );
return 0;
}