Skip to content

Commit

Permalink
Merge pull request #3167 from aapostoliuk/T6150-equuleus
Browse files Browse the repository at this point in the history
T6150: Fixed setting a static IP address by Radius in IPoE
  • Loading branch information
dmbaturin authored Apr 1, 2024
2 parents 4999f60 + 9d34c48 commit ae96118
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 10 deletions.
29 changes: 19 additions & 10 deletions data/templates/accel-ppp/ipoe.config.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,29 @@ interface={{ ifname }},shared={{ interface.shared }},mode={{ interface.mode }},i
{% endfor %}
{% if auth_mode == 'noauth' %}
noauth=1
{% if client_named_ip_pool %}
{% for pool in client_named_ip_pool %}
{% if pool.subnet is defined %}
ip-pool={{ pool.name }}
{% endif %}
{% if pool.gateway_address is defined %}
gw-ip-address={{ pool.gateway_address }}/{{ pool.subnet.split('/')[1] }}
{% endif %}
{% endfor%}
{% endif %}
{% elif auth_mode == 'local' %}
username=ifname
password=csid
{% elif auth_mode == 'radius' %}
attr-dhcp-client-ip=Framed-IP-Address
attr-dhcp-mask=Framed-IP-Netmask
{% endif %}
{% if gateway_address %}
{% for gw in gateway_address %}
gw-ip-address={{ gw }}
{% endfor %}
{% endif %}
{% if client_named_ip_pool %}
{% for pool in client_named_ip_pool %}
{% if pool.subnet is defined %}
ip-pool={{ pool.name }}
{% endif %}
{% if pool.gateway_address is defined %}
gw-ip-address={{ pool.gateway_address }}/{{ pool.subnet.split('/')[1] }}
{% endif %}
{% endfor%}
{% endif %}

proxy-arp=1

{% for interface in interfaces %}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!-- include start from accel-ppp/gateway-address-multi.xml.i -->
<leafNode name="gateway-address">
<properties>
<help>Gateway IP address</help>
<constraintErrorMessage>invalid IPv4 address</constraintErrorMessage>
<valueHelp>
<format>ipv4net</format>
<description>Default Gateway, mask send to the client</description>
</valueHelp>
<constraint>
<validator name="ipv4-prefix"/>
<validator name="ipv4-host"/>
</constraint>
<multi/>
</properties>
</leafNode>
<!-- include end -->
1 change: 1 addition & 0 deletions interface-definitions/service_ipoe-server.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
</children>
</node>
#include <include/accel-ppp/client-ipv6-pool.xml.i>
#include <include/accel-ppp/gateway-address-multi.xml.i>
<node name="authentication">
<properties>
<help>Client authentication methods</help>
Expand Down
13 changes: 13 additions & 0 deletions src/conf_mode/service_ipoe-server.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
'client_named_ip_pool': [],
'client_ipv6_pool': [],
'client_ipv6_delegate_prefix': [],
'gateway_address':[],
'radius_server': [],
'radius_acct_inter_jitter': '',
'radius_acct_tmo': '3',
Expand Down Expand Up @@ -275,9 +276,14 @@ def get_config(config=None):

ipoe['client_ipv6_delegate_prefix'].append(tmp)

if conf.exists(['gateway-address']):
for gw in conf.return_values(['gateway-address']):
ipoe['gateway_address'].append(gw)

return ipoe



def verify(ipoe):
if not ipoe:
return None
Expand All @@ -303,6 +309,13 @@ def verify(ipoe):
if ipoe['client_ipv6_delegate_prefix'] and not ipoe['client_ipv6_pool']:
raise ConfigError('IPoE IPv6 deletate-prefix requires IPv6 prefix to be configured!')

if ipoe['gateway_address']:
if ipoe['client_named_ip_pool']:
ipoe_gateways = ' '.join(ipoe['gateway_address'])
for pool in ipoe['client_named_ip_pool']:
if f'{pool["gateway_address"]}/' in ipoe_gateways:
raise ConfigError(
'IPoE "gateway-address" exists in IPoE "client-ip-pool"!')
return None


Expand Down

0 comments on commit ae96118

Please sign in to comment.