summaryrefslogtreecommitdiff
path: root/src/conf_mode/service_pppoe-server.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/conf_mode/service_pppoe-server.py')
-rwxr-xr-xsrc/conf_mode/service_pppoe-server.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/conf_mode/service_pppoe-server.py b/src/conf_mode/service_pppoe-server.py
index f0dd3751a..95cb066d8 100755
--- a/src/conf_mode/service_pppoe-server.py
+++ b/src/conf_mode/service_pppoe-server.py
@@ -23,7 +23,7 @@ from sys import exit
from vyos.config import Config
from vyos.template import render
-from vyos.util import call
+from vyos.util import call, get_half_cpus()
from vyos.validate import is_ipv4
from vyos import ConfigError
@@ -78,7 +78,7 @@ default_config_data = {
'radius_dynamic_author': '',
'sesscrtl': 'replace',
'snmp': False,
- 'thread_cnt': '1'
+ 'thread_cnt': get_half_cpus()
}
def get_config():
@@ -90,10 +90,6 @@ def get_config():
conf.set_level(base_path)
pppoe = deepcopy(default_config_data)
- cpu = os.cpu_count()
- if cpu > 1:
- pppoe['thread_cnt'] = int(cpu/2)
-
# general options
if conf.exists(['access-concentrator']):
pppoe['concentrator'] = conf.return_value(['access-concentrator'])
@@ -393,7 +389,7 @@ def verify(pppoe):
for radius in pppoe['radius_server']:
if not radius['key']:
server = radius['server']
- raise ConfigError(f'Missing RADIUS secret key for server "{{ server }}"')
+ raise ConfigError(f'Missing RADIUS secret key for server "{ server }"')
if len(pppoe['wins']) > 2:
raise ConfigError('Not more then two IPv4 WINS name-servers can be configured')
@@ -423,10 +419,10 @@ def generate(pppoe):
if not os.path.exists(dirname):
os.mkdir(dirname)
- render(pppoe_conf, 'accel-ppp/pppoe.config.tmpl', c, trim_blocks=True)
+ render(pppoe_conf, 'accel-ppp/pppoe.config.tmpl', pppoe, trim_blocks=True)
if pppoe['local_users']:
- render(pppoe_chap_secrets, 'accel-ppp/chap-secrets.tmpl', c, trim_blocks=True)
+ render(pppoe_chap_secrets, 'accel-ppp/chap-secrets.tmpl', pppoe, trim_blocks=True)
os.chmod(pppoe_chap_secrets, S_IRUSR | S_IWUSR | S_IRGRP)
else:
if os.path.exists(pppoe_chap_secrets):