Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 390f88e5 authored by IMBERT Matthieu's avatar IMBERT Matthieu
Browse files

[gen] shorten ipv6 format when possible

parent 22279b4b
Branches
No related tags found
No related merge requests found
...@@ -124,8 +124,12 @@ def add_ipv6(h) ...@@ -124,8 +124,12 @@ def add_ipv6(h)
ip6 = '2001:660:4406:' ip6 = '2001:660:4406:'
ip6 += '%x' % h['ipv6']['site-indexes'][site_uid] ip6 += '%x' % h['ipv6']['site-indexes'][site_uid]
ip6 += '00:' ip6 += '00:'
ip6 += '%x:' % ((ip4.split('.')[2].to_i & 0b1111) + 1) ip6 += '%x' % ((ip4.split('.')[2].to_i & 0b1111) + 1)
ip6 += '%x::' % idx if idx > 0
ip6 += ':%x::' % idx
else
ip6 += '::'
end
ip6 += '%x' % (ip4.split('.')[3].to_i) ip6 += '%x' % (ip4.split('.')[3].to_i)
nah['ip6'] = ip6 nah['ip6'] = ip6
end end
...@@ -157,8 +161,12 @@ def add_kavlan_ipv6s(h) ...@@ -157,8 +161,12 @@ def add_kavlan_ipv6s(h)
ip6 = '2001:660:4406:' ip6 = '2001:660:4406:'
ip6 += '%x' % h['ipv6']['site-indexes'][site_uid] ip6 += '%x' % h['ipv6']['site-indexes'][site_uid]
ip6 += '%x:' % (kvl_id + 0x80) ip6 += '%x:' % (kvl_id + 0x80)
ip6 += '%x:' % ((ip4.split('.')[2].to_i & 0b1111) + 1) ip6 += '%x' % ((ip4.split('.')[2].to_i & 0b1111) + 1)
ip6 += '%x::' % idx if idx > 0
ip6 += ':%x::' % idx
else
ip6 += '::'
end
ip6 += '%x' % (ip4.split('.')[3].to_i) ip6 += '%x' % (ip4.split('.')[3].to_i)
hn['kavlan6'][iface][kvl_id] = ip6 hn['kavlan6'][iface][kvl_id] = ip6
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment