diff options
author | jim-p <jimp@pfsense.org> | 2013-10-24 16:32:12 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2013-10-24 16:34:38 -0400 |
commit | 53c5407e646028a003b2765a87dd3316b21a9497 (patch) | |
tree | 4ea3c400bf6ad68af3a6686765452b4828612063 /etc | |
parent | 785158c6c48e4e1842791d3b33d9b0395332991d (diff) | |
download | pfsense-53c5407e646028a003b2765a87dd3316b21a9497.zip pfsense-53c5407e646028a003b2765a87dd3316b21a9497.tar.gz |
Add source address selection to syslog settings, so it can work more effectively over a VPN. Fixes #355
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/system.inc | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/etc/inc/system.inc b/etc/inc/system.inc index 2104790..f828c61 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -710,7 +710,23 @@ EOD; if (!is_dir("{$g['dhcpd_chroot_path']}/var/run")) exec("/bin/mkdir -p {$g['dhcpd_chroot_path']}/var/run"); - $retval = mwexec_bg("/usr/sbin/syslogd -s -c -c -l {$g['dhcpd_chroot_path']}/var/run/log -f {$g['varetc_path']}/syslog.conf"); + $sourceip = ""; + if (!empty($syslogcfg['sourceip'])) { + if ($syslogcfg['ipproto'] == "ipv6") { + $ifaddr = is_ipaddr($syslogcfg['sourceip']) ? $syslogcfg['sourceip'] : get_interface_ipv6($syslogcfg['sourceip']); + if (!is_ipaddr($ifaddr)) + $ifaddr = get_interface_ip($syslogcfg['sourceip']); + } else { + $ifaddr = is_ipaddr($syslogcfg['sourceip']) ? $syslogcfg['sourceip'] : get_interface_ip($syslogcfg['sourceip']); + if (!is_ipaddr($ifaddr)) + $ifaddr = get_interface_ipv6($syslogcfg['sourceip']); + } + if (is_ipaddr($ifaddr)) { + $sourceip = "-b {$ifaddr}"; + } + } + + $retval = mwexec_bg("/usr/sbin/syslogd -s -c -c -l {$g['dhcpd_chroot_path']}/var/run/log -f {$g['varetc_path']}/syslog.conf {$sourceip}"); } else { $retval = mwexec_bg("/usr/sbin/syslogd -s -c -c -l {$g['dhcpd_chroot_path']}/var/run/log"); |