diff options
| author | Christian Breunig <christian@breunig.cc> | 2023-02-10 07:54:45 +0100 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-10 07:54:45 +0100 | 
| commit | 7000d33d3dd275796cf0d9ac450a3af88168c907 (patch) | |
| tree | 16f1fddcd4814ca7210f92f9229832910faf5309 | |
| parent | 078faa6718c2afb918031f52430d586a006dd050 (diff) | |
| parent | 3f4aee7a34463594b8b3164f472dc4ff35eac322 (diff) | |
| download | vyos-1x-7000d33d3dd275796cf0d9ac450a3af88168c907.tar.gz vyos-1x-7000d33d3dd275796cf0d9ac450a3af88168c907.zip | |
Merge pull request #1808 from sever-sever/T1993
T1993: PPPoE-server add section shaper and fwmark option
4 files changed, 37 insertions, 3 deletions
| diff --git a/data/templates/accel-ppp/config_shaper_radius.j2 b/data/templates/accel-ppp/config_shaper_radius.j2 index 942cdf132..0cf6a6a92 100644 --- a/data/templates/accel-ppp/config_shaper_radius.j2 +++ b/data/templates/accel-ppp/config_shaper_radius.j2 @@ -1,7 +1,7 @@ -{% if authentication.mode is vyos_defined('radius') %} -{%     if authentication.radius.rate_limit.enable is vyos_defined %} +{% if authentication.mode is vyos_defined('radius') or shaper is vyos_defined %}  [shaper]  verbose=1 +{%     if authentication.radius.rate_limit.enable is vyos_defined %}  attr={{ authentication.radius.rate_limit.attribute }}  {%         if authentication.radius.rate_limit.vendor is vyos_defined %}  vendor={{ authentication.radius.rate_limit.vendor }} @@ -10,4 +10,10 @@ vendor={{ authentication.radius.rate_limit.vendor }}  rate-multiplier={{ authentication.radius.rate_limit.multiplier }}  {%         endif %}  {%     endif %} -{% endif %} +{%     if shaper is vyos_defined %} +{%         if shaper.fwmark is vyos_defined %} +fwmark={{ shaper.fwmark }} +down-limiter=htb +{%         endif %} +{%     endif %} +{% endif %}
\ No newline at end of file diff --git a/interface-definitions/include/accel-ppp/shaper.xml.i b/interface-definitions/include/accel-ppp/shaper.xml.i new file mode 100644 index 000000000..b4f9536d2 --- /dev/null +++ b/interface-definitions/include/accel-ppp/shaper.xml.i @@ -0,0 +1,21 @@ +<!-- include start from accel-ppp/shaper.xml.i --> +<node name="shaper"> +  <properties> +    <help>Traffic shaper bandwidth parameters</help> +  </properties> +  <children> +    <leafNode name="fwmark"> +      <properties> +        <help>Firewall mark value for traffic that excludes from shaping</help> +        <valueHelp> +          <format>u32:1-2147483647</format> +          <description>Match firewall mark value</description> +        </valueHelp> +        <constraint> +          <validator name="numeric" argument="--range 1-2147483647"/> +        </constraint> +      </properties> +    </leafNode> +  </children> +</node> +<!-- include end --> diff --git a/interface-definitions/service-pppoe-server.xml.in b/interface-definitions/service-pppoe-server.xml.in index 47f60d27d..3fde07019 100644 --- a/interface-definitions/service-pppoe-server.xml.in +++ b/interface-definitions/service-pppoe-server.xml.in @@ -228,6 +228,7 @@              </properties>              <defaultValue>replace</defaultValue>            </leafNode> +          #include <include/accel-ppp/shaper.xml.i>            <node name="snmp">              <properties>                <help>Enable SNMP</help> diff --git a/smoketest/scripts/cli/test_service_pppoe-server.py b/smoketest/scripts/cli/test_service_pppoe-server.py index 53c14c5b0..4f9181704 100755 --- a/smoketest/scripts/cli/test_service_pppoe-server.py +++ b/smoketest/scripts/cli/test_service_pppoe-server.py @@ -143,6 +143,9 @@ class TestServicePPPoEServer(BasicAccelPPPTest.TestCase):          self.basic_config()          subnet = '172.18.0.0/24' +        fwmark = '223' +        limiter = 'htb' +          self.set(['client-ip-pool', 'subnet', subnet])          start = '192.0.2.10' @@ -151,6 +154,7 @@ class TestServicePPPoEServer(BasicAccelPPPTest.TestCase):          start_stop = f'{start}-{stop_octet}'          self.set(['client-ip-pool', 'start', start])          self.set(['client-ip-pool', 'stop', stop]) +        self.set(['shaper', 'fwmark', fwmark])          # commit changes          self.cli_commit() @@ -163,6 +167,8 @@ class TestServicePPPoEServer(BasicAccelPPPTest.TestCase):          self.assertEqual(conf['ip-pool'][subnet], None)          self.assertEqual(conf['ip-pool'][start_stop], None)          self.assertEqual(conf['ip-pool']['gw-ip-address'], self._gateway) +        self.assertEqual(conf['shaper']['fwmark'], fwmark) +        self.assertEqual(conf['shaper']['down-limiter'], limiter)      def test_pppoe_server_client_ip_pool_name(self): | 
