Commit 59af5705 by Bach Dániel

firewall: remove hardcoded prefix

parent eb9047bb
...@@ -278,6 +278,12 @@ class Vlan(AclBase, models.Model): ...@@ -278,6 +278,12 @@ class Vlan(AclBase, models.Model):
'valid address of the subnet, ' 'valid address of the subnet, '
'for example ' 'for example '
'10.4.255.254/16 for 10.4.0.0/16.')) '10.4.255.254/16 for 10.4.0.0/16.'))
host_ipv6_prefixlen = models.IntegerField(
verbose_name=_('IPv6 prefixlen/host'),
help_text=_('The prefix length of the subnet assigned to a host. '
'For example /112 = 65536 addresses/host.'),
default=112,
validators=[MinValueValidator(1), MaxValueValidator(128)])
network6 = IPNetworkField(unique=False, network6 = IPNetworkField(unique=False,
version=6, version=6,
null=True, null=True,
...@@ -511,7 +517,7 @@ class Host(models.Model): ...@@ -511,7 +517,7 @@ class Host(models.Model):
def ipv6_with_prefixlen(self): def ipv6_with_prefixlen(self):
try: try:
net = IPNetwork(self.ipv6) net = IPNetwork(self.ipv6)
net.prefixlen = 112 net.prefixlen = self.vlan.host_ipv6_prefixlen
return net return net
except TypeError: except TypeError:
return None return None
......
...@@ -234,6 +234,7 @@ class VlanForm(ModelForm): ...@@ -234,6 +234,7 @@ class VlanForm(ModelForm):
'IPv6', 'IPv6',
'network6', 'network6',
'ipv6_template', 'ipv6_template',
'host_ipv6_prefixlen',
), ),
Fieldset( Fieldset(
'Domain name service', 'Domain name service',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment