From 9b4447f039655b9e24187302b9c4d9bb2116aa99 Mon Sep 17 00:00:00 2001 From: hagbard Date: Mon, 17 Jun 2019 08:38:37 -0700 Subject: [pppoe-server] T1408 - improve verify() function to enable IPv6 only deployments --- src/conf_mode/accel_pppoe.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/conf_mode/accel_pppoe.py b/src/conf_mode/accel_pppoe.py index 7a9878a1d..9d2efb0bc 100755 --- a/src/conf_mode/accel_pppoe.py +++ b/src/conf_mode/accel_pppoe.py @@ -83,17 +83,19 @@ master=1 [client-ip-range] disable +{% if ppp_gw %} [ip-pool] gw-ip-address={{ppp_gw}} {% if client_ip_pool %} {{client_ip_pool}} -{% endif %} +{% endif -%} {% if client_ip_subnets %} {% for sn in client_ip_subnets %} {{sn}} {% endfor %} {% endif %} +{% endif -%} {% if client_ipv6_pool %} [ipv6-pool] @@ -550,18 +552,14 @@ def verify(c): if c['authentication']['radiussrv'][rsrv]['secret'] == None: raise ConfigError('radius server ' + rsrv + ' needs a secret configured') - ### local ippool and gateway settings - - if not c['ppp_gw']: - raise ConfigError('pppoe-server local-ip required') - - if not c['client_ip_subnets'] and not c['client_ip_pool']: - print ("Warning: No pppoe client IP pool defined") + ### local ippool and gateway settings config checks - ### activate as soon as it is clear what to do migrate or depricate. - #if c['client_ip_pool']: - # print ("Warning: client-ip-pool (start|stop) is depricated, please use client-ip-pool subnet") - # sl.syslog(sl.LOG_NOTICE, "client-ip-pool start stop is depricated, please use client-ip-pool subnet") + if c['client_ip_subnets'] or c['client_ip_pool']: + if not c['ppp_gw']: + raise ConfigError('pppoe-server local-ip required') + + if c['ppp_gw'] and not c['client_ip_subnets'] and not c['client_ip_pool']: + print ("Warning: No pppoe client IPv4 pool defined") def generate(c): if c == None: -- cgit v1.2.3 From 0f354688d7bd63b63fb91faf17a38c77fb05f660 Mon Sep 17 00:00:00 2001 From: hagbard Date: Mon, 17 Jun 2019 11:10:33 -0700 Subject: [syslog/hostname.py] T1394 - syslog systemd and host_name.py race condition - checking if the hostname has changed, otherwise the script and systemd try to restart rsyslogd at the same time, at the end it's not started at all. --- src/conf_mode/host_name.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/conf_mode/host_name.py b/src/conf_mode/host_name.py index 621ccd7e0..0d03fd41c 100755 --- a/src/conf_mode/host_name.py +++ b/src/conf_mode/host_name.py @@ -248,10 +248,15 @@ def apply(config): if config['domain_name']: fqdn += '.' + config['domain_name'] + # rsyslog runs into a race condition at boot time with systemd + # restart rsyslog only if the hostname changed. + hn = subprocess.check_output(['hostnamectl','--static']).decode().strip() + os.system("hostnamectl set-hostname --static {0}".format(fqdn.rstrip('.'))) # Restart services that use the hostname - os.system("systemctl restart rsyslog.service") + if hn != fqdn: + os.system("systemctl restart rsyslog.service") # If SNMP is running, restart it too if os.system("pgrep snmpd > /dev/null") == 0: -- cgit v1.2.3