Skip to content

Commit

Permalink
[radv] Support multiple ipv6 prefixes per vlan interface (#9934) (#10253
Browse files Browse the repository at this point in the history
)

Why I did it
Radvd.conf.j2 template creates two copies of the vlan interface when there are more than one ipv6 address assigned to a single vlan interface. Changed the format to add prefixes under the same vlan interface block.

How I did it
Modifies radvd.conf.j2 and added unit tests

How to verify it
Configure multiple ipv6 address to the same vlan, start radvd
Unit test will check if radvd.conf with multiple ipv6 addresses is formed correctly
  • Loading branch information
kellyyeh authored Mar 21, 2022
1 parent dfb53d8 commit adaec63
Show file tree
Hide file tree
Showing 5 changed files with 673 additions and 4 deletions.
20 changes: 16 additions & 4 deletions dockers/docker-router-advertiser/radvd.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,21 @@

{# If our configuration has VLAN interfaces... #}
{% if VLAN_INTERFACE %}
{% for (name, prefix) in VLAN_INTERFACE|pfx_filter %}
{# If this VLAN has an IPv6 address... #}
{% set vlan_list = dict() %}
{% for (name,prefix) in VLAN_INTERFACE|pfx_filter %}
{% if name is not in vlan_list and prefix | ipv6 %}
{% set prefix_list = [] %}
{% set _ = vlan_list.update({name: prefix_list}) %}
{% endif %}
{% if prefix | ipv6 %}
{# If our configuration has VLAN interfaces... #}
{% set prefix_list = vlan_list.get(name) %}
{% set _ = prefix_list.append(prefix) %}
{% set _ = vlan_list.update({name: prefix_list}) %}
{% endif %}
{% endfor %}
{% endif %}
{% for name, prefixes in vlan_list.items() %}
interface {{ name }}
{
IgnoreIfMissing on;
Expand All @@ -23,15 +35,15 @@ interface {{ name }}
AdvOtherConfigFlag off;
AdvLinkMTU 9100;
AdvHomeAgentFlag off;
{% for prefix in prefixes %}
prefix {{ prefix | network }}/{{ prefix | prefixlen }} {
AdvOnLink on;
AdvAutonomous off;
AdvRouterAddr off;
AdvValidLifetime infinity;
AdvPreferredLifetime infinity;
};
{% endfor %}
};

{% endif %}
{% endfor %}
{% endif %}
Loading

0 comments on commit adaec63

Please sign in to comment.