Skip to content

Commit a5ca24a

Browse files
committed
accel-ppp: T5688: Standardized pool configuration in accel-ppp
Standardized pool configuration for all accel-ppp services. 1. Only named pools are used now. 2. Allows all services to use range in x.x.x.x/mask and x.x.x.x-x.x.x.y format 3. next-pool can be used in all services 2. Allows to use in ipoe gw-ip-address without pool configuration which allows to use Fraimed-IP-Address attribute by radius. 3. Default pool name should be explicidly configured with default-pool. 4. In ipoe netmask and range subnet can be different.
1 parent 2e587c8 commit a5ca24a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1379
-672
lines changed

data/templates/accel-ppp/config_chap_secrets_radius.j2

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,16 @@ dae-server={{ authentication.radius.dynamic_author.server }}:{{ authentication.r
3030
{% endif %}
3131
{% endif %}
3232
{# Both chap-secrets and radius block required the gw-ip-address #}
33-
{% if gateway_address is vyos_defined %}
33+
{% if authentication.mode is vyos_defined('local') or authentication.mode is vyos_defined('radius') %}
34+
{% if gateway_address is vyos_defined %}
35+
{% if server_type == 'ipoe' %}
36+
{% for gw in gateway_address %}
37+
{% set host_address, _ = gw.split('/') %}
38+
gw-ip-address={{ host_address }}
39+
{% endfor %}
40+
{% else %}
3441
gw-ip-address={{ gateway_address }}
42+
{% endif %}
43+
{% endif %}
3544
{% endif %}
3645

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
1-
{% if client_ip_pool is vyos_defined %}
1+
{% if ordered_named_pools is vyos_defined %}
22
[ip-pool]
33
{% if gateway_address is vyos_defined %}
4+
{% if server_type == 'ipoe' %}
5+
{% for gw in gateway_address %}
6+
{% set host_address, _ = gw.split('/') %}
7+
gw-ip-address={{ host_address }}
8+
{% endfor %}
9+
{% else %}
410
gw-ip-address={{ gateway_address }}
11+
{% endif %}
512
{% endif %}
6-
{% if client_ip_pool.start is vyos_defined and client_ip_pool.stop is vyos_defined %}
7-
{{ client_ip_pool.start }}-{{ client_ip_pool.stop.split('.')[3] }}
8-
{% endif %}
9-
{% if client_ip_pool.subnet is vyos_defined %}
10-
{% for subnet in client_ip_pool.subnet %}
11-
{{ subnet }}
12-
{% endfor %}
13-
{% endif %}
14-
{% if client_ip_pool.name is vyos_defined %}
15-
{% for pool, pool_config in client_ip_pool.name.items() %}
16-
{% if pool_config.subnet is vyos_defined %}
17-
{{ pool_config.subnet }},name={{ pool }}
18-
{% endif %}
19-
{% if pool_config.gateway_address is vyos_defined %}
20-
gw-ip-address={{ pool_config.gateway_address }}
13+
{% for pool in ordered_named_pools %}
14+
{% for pool_name, pool_config in pool.items() %}
15+
{% if pool_config.next_pool is vyos_defined %}
16+
{{ pool_config.range }},name={{ pool_name }},next={{ pool_config.next_pool }}
17+
{% else %}
18+
{{ pool_config.range }},name={{ pool_name }}
2119
{% endif %}
2220
{% endfor %}
23-
{% endif %}
21+
{% endfor %}
2422
{% endif %}

data/templates/accel-ppp/ipoe.config.j2

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -55,38 +55,18 @@ noauth=1
5555
username=ifname
5656
password=csid
5757
{% endif %}
58-
{% if client_ip_pool.name is vyos_defined %}
59-
{% if first_named_pool is vyos_defined %}
60-
ip-pool={{ first_named_pool }}
61-
{% else %}
62-
{% for pool, pool_options in client_ip_pool.name.items() %}
63-
{% if pool_options.subnet is vyos_defined %}
64-
ip-pool={{ pool }}
65-
{% endif %}
66-
{% endfor %}
67-
{% endif %}
68-
{% for pool, pool_options in client_ip_pool.name.items() %}
69-
{% if pool_options.gateway_address is vyos_defined %}
70-
gw-ip-address={{ pool_options.gateway_address }}/{{ pool_options.subnet.split('/')[1] }}
71-
{% endif %}
58+
{% if default_pool is vyos_defined %}
59+
ip-pool={{ default_pool }}
60+
{% endif %}
61+
{% if gateway_address is vyos_defined %}
62+
{% for gw_addr in gateway_address %}
63+
gw-ip-address={{ gw_addr }}
7264
{% endfor %}
7365
{% endif %}
7466
proxy-arp=1
7567

76-
{% if ordered_named_pools is vyos_defined %}
77-
[ip-pool]
78-
{% for p in ordered_named_pools %}
79-
{% for pool, pool_options in p.items() %}
80-
{% set next_named_pool = ',next=' ~ pool_options.next_pool if pool_options.next_pool is vyos_defined else '' %}
81-
{{ pool_options.subnet }},name={{ pool }}{{ next_named_pool }}
82-
{% endfor %}
83-
{% endfor %}
84-
{% for p in ordered_named_pools %}
85-
{% for pool, pool_options in p.items() %}
86-
gw-ip-address={{ pool_options.gateway_address }}/{{ pool_options.subnet.split('/')[1] }}
87-
{% endfor %}
88-
{% endfor %}
89-
{% endif %}
68+
{# Common IP pool definitions #}
69+
{% include 'accel-ppp/config_ip_pool.j2' %}
9070

9171
{# Common IPv6 pool definitions #}
9272
{% include 'accel-ppp/config_ipv6_pool.j2' %}

data/templates/accel-ppp/l2tp.config.j2

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ chap-secrets
66
{% for proto in auth_proto %}
77
{{ proto }}
88
{% endfor %}
9-
109
{% if auth_mode == 'radius' %}
1110
radius
1211
{% endif %}
13-
1412
ippool
1513
shaper
1614
ipv6pool
@@ -65,24 +63,15 @@ secret={{ lns_shared_secret }}
6563
{% if lns_host_name %}
6664
host-name={{ lns_host_name }}
6765
{% endif %}
66+
{% if default_pool is vyos_defined %}
67+
ip-pool={{ default_pool }}
68+
{% endif %}
6869

6970
[client-ip-range]
7071
0.0.0.0/0
7172

72-
{% if client_ip_pool or client_ip_subnets %}
73-
[ip-pool]
74-
{% if client_ip_pool %}
75-
{{ client_ip_pool }}
76-
{% endif %}
77-
{% if client_ip_subnets %}
78-
{% for sn in client_ip_subnets %}
79-
{{ sn }}
80-
{% endfor %}
81-
{% endif %}
82-
{% endif %}
83-
{% if gateway_address %}
84-
gw-ip-address={{ gateway_address }}
85-
{% endif %}
73+
{# Common IP pool definitions #}
74+
{% include 'accel-ppp/config_ip_pool.j2' %}
8675

8776
{% if auth_mode == 'local' %}
8877
[chap-secrets]
@@ -115,7 +104,7 @@ nas-ip-address={{ radius_nas_ip }}
115104
bind={{ radius_source_address }}
116105
{% endif %}
117106
{% endif %}
118-
{% if gateway_address %}
107+
{% if gateway_address is vyos_defined %}
119108
gw-ip-address={{ gateway_address }}
120109
{% endif %}
121110

data/templates/accel-ppp/pppoe.config.j2

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ unit-cache={{ ppp_options.interface_cache }}
108108
[pppoe]
109109
verbose=1
110110
ac-name={{ access_concentrator }}
111-
112111
{% if interface is vyos_defined %}
113112
{% for iface, iface_config in interface.items() %}
114113
{% if iface_config.vlan is not vyos_defined %}
@@ -121,11 +120,9 @@ vlan-mon={{ iface }},{{ iface_config.vlan | join(',') }}
121120
{% endif %}
122121
{% endfor %}
123122
{% endif %}
124-
125123
{% if service_name %}
126124
service-name={{ service_name | join(',') }}
127125
{% endif %}
128-
129126
{% if pado_delay %}
130127
{% set pado_delay_param = namespace(value='0') %}
131128
{% for delay in pado_delay | sort(attribute='0') %}
@@ -140,21 +137,11 @@ pado-delay={{ pado_delay_param.value }}
140137
{% if authentication.radius.called_sid_format is vyos_defined %}
141138
called-sid={{ authentication.radius.called_sid_format }}
142139
{% endif %}
143-
144-
{% if authentication.mode is vyos_defined("local") or authentication.mode is vyos_defined("noauth") %}
145-
{% if authentication.mode is vyos_defined("noauth") %}
140+
{% if authentication.mode is vyos_defined("noauth") %}
146141
noauth=1
147-
{% endif %}
148-
{% if client_ip_pool.name is vyos_defined %}
149-
{% for pool, pool_config in client_ip_pool.name.items() %}
150-
{% if pool_config.subnet is vyos_defined %}
151-
ip-pool={{ pool }}
152-
{% endif %}
153-
{% if pool_config.gateway_address is vyos_defined %}
154-
gw-ip-address={{ pool_config.gateway_address }}/{{ pool_config.subnet.split('/')[1] }}
155-
{% endif %}
156-
{% endfor %}
157-
{% endif %}
142+
{% endif %}
143+
{% if default_pool is vyos_defined %}
144+
ip-pool={{ default_pool }}
158145
{% endif %}
159146

160147
{% if limits is vyos_defined %}

data/templates/accel-ppp/pptp.config.j2

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,15 @@ ppp-max-mtu={{ mtu }}
5151
mppe={{ ppp_mppe }}
5252
echo-interval=10
5353
echo-failure=3
54-
54+
{% if default_pool is vyos_defined %}
55+
ip-pool={{ default_pool }}
56+
{% endif %}
5557

5658
[client-ip-range]
5759
0.0.0.0/0
5860

59-
[ip-pool]
60-
tunnel={{ client_ip_pool }}
61-
gw-ip-address={{ gw_ip }}
61+
{# Common IP pool definitions #}
62+
{% include 'accel-ppp/config_ip_pool.j2' %}
6263

6364
[ppp]
6465
verbose=5
@@ -74,18 +75,15 @@ verbose=1
7475
{% for r in radius_server %}
7576
server={{ r.server }},{{ r.key }},auth-port={{ r.port }},acct-port={{ r.acct_port }},req-limit=0,fail-time={{ r.fail_time }}
7677
{% endfor %}
77-
7878
{% if radius_acct_interim_interval is vyos_defined %}
7979
acct-interim-interval={{ radius_acct_interim_interval }}
8080
{% endif %}
8181
{% if radius_acct_inter_jitter %}
8282
acct-interim-jitter={{ radius_acct_inter_jitter }}
8383
{% endif %}
84-
8584
acct-timeout={{ radius_acct_tmo }}
8685
timeout={{ radius_timeout }}
8786
max-try={{ radius_max_try }}
88-
8987
{% if radius_nas_id %}
9088
nas-identifier={{ radius_nas_id }}
9189
{% endif %}
@@ -97,8 +95,8 @@ bind={{ radius_source_address }}
9795
{% endif %}
9896
{% endif %}
9997
{# Both chap-secrets and radius block required the gw-ip-address #}
100-
{% if gw_ip is defined and gw_ip is not none %}
101-
gw-ip-address={{ gw_ip }}
98+
{% if gateway_address is vyos_defined %}
99+
gw-ip-address={{ gateway_address }}
102100
{% endif %}
103101

104102
{% if radius_shaper_enable %}

data/templates/accel-ppp/sstp.config.j2

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ accept=ssl
3636
ssl-ca-file=/run/accel-pppd/sstp-ca.pem
3737
ssl-pemfile=/run/accel-pppd/sstp-cert.pem
3838
ssl-keyfile=/run/accel-pppd/sstp-cert.key
39+
{% if default_pool is vyos_defined %}
40+
ip-pool={{ default_pool }}
41+
{% endif %}
3942

4043
{# Common IP pool definitions #}
4144
{% include 'accel-ppp/config_ip_pool.j2' %}
@@ -56,7 +59,6 @@ check-ip=1
5659
mtu={{ mtu }}
5760
ipv6={{ 'allow' if ppp_options.ipv6 is vyos_defined("deny") and client_ipv6_pool is vyos_defined else ppp_options.ipv6 }}
5861
ipv4={{ ppp_options.ipv4 }}
59-
6062
mppe={{ ppp_options.mppe }}
6163
lcp-echo-interval={{ ppp_options.lcp_echo_interval }}
6264
lcp-echo-timeout={{ ppp_options.lcp_echo_timeout }}

interface-definitions/include/accel-ppp/client-ip-pool-name.xml.i

Lines changed: 0 additions & 30 deletions
This file was deleted.

interface-definitions/include/accel-ppp/client-ip-pool-start-stop.xml.i

Lines changed: 0 additions & 18 deletions
This file was deleted.

interface-definitions/include/accel-ppp/client-ip-pool-subnet-single.xml.i

Lines changed: 0 additions & 16 deletions
This file was deleted.

interface-definitions/include/accel-ppp/client-ip-pool-subnet.xml.i

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)