Commit 9aba69a4 by Bach Dániel Committed by Guba Sándor

firewall: remove Vlan.interface

parent 9e15ca03
...@@ -75,11 +75,11 @@ class Firewall: ...@@ -75,11 +75,11 @@ class Firewall:
for vlan in rule.foreign_network.vlans.all(): for vlan in rule.foreign_network.vlans.all():
if rule.direction == '1': # going TO host if rule.direction == '1': # going TO host
self.iptables('-A INPUT -i %s %s %s -g %s' % self.iptables('-A INPUT -i %s %s %s -g %s' %
(vlan.interface, dport_sport, rule.extra, (vlan.name, dport_sport, rule.extra,
'LOG_ACC' if rule.accept else 'LOG_DROP')) 'LOG_ACC' if rule.accept else 'LOG_DROP'))
else: else:
self.iptables('-A OUTPUT -o %s %s %s -g %s' % self.iptables('-A OUTPUT -o %s %s %s -g %s' %
(vlan.interface, dport_sport, rule.extra, (vlan.name, dport_sport, rule.extra,
'LOG_ACC' if rule.accept else 'LOG_DROP')) 'LOG_ACC' if rule.accept else 'LOG_DROP'))
def vlan2vlan(self, l_vlan, rule): def vlan2vlan(self, l_vlan, rule):
...@@ -189,7 +189,7 @@ class Firewall: ...@@ -189,7 +189,7 @@ class Firewall:
for d_vlan in s_vlan.snat_to.all(): for d_vlan in s_vlan.snat_to.all():
self.iptablesnat('-A POSTROUTING -s %s -o %s -j SNAT ' self.iptablesnat('-A POSTROUTING -s %s -o %s -j SNAT '
'--to-source %s' % '--to-source %s' %
(str(s_vlan.network4), d_vlan.interface, (str(s_vlan.network4), d_vlan.name,
s_vlan.snat_ip)) s_vlan.snat_ip))
self.iptablesnat('COMMIT') self.iptablesnat('COMMIT')
...@@ -210,7 +210,7 @@ class Firewall: ...@@ -210,7 +210,7 @@ class Firewall:
for d_vlan in self.vlans: for d_vlan in self.vlans:
self.iptables('-N %s_%s' % (s_vlan, d_vlan)) self.iptables('-N %s_%s' % (s_vlan, d_vlan))
self.iptables('-A FORWARD -i %s -o %s -g %s_%s' % self.iptables('-A FORWARD -i %s -o %s -g %s_%s' %
(s_vlan.interface, d_vlan.interface, s_vlan, (s_vlan.name, d_vlan.name, s_vlan,
d_vlan)) d_vlan))
# hosts' rules # hosts' rules
...@@ -428,7 +428,7 @@ def dhcp(): ...@@ -428,7 +428,7 @@ def dhcp():
'dnsserver': settings['rdns_ip'], 'dnsserver': settings['rdns_ip'],
'extra': ("range %s" % i_vlan.dhcp_pool 'extra': ("range %s" % i_vlan.dhcp_pool
if m else "deny unknown-clients"), if m else "deny unknown-clients"),
'interface': i_vlan.interface, 'interface': i_vlan.name,
'name': i_vlan.name, 'name': i_vlan.name,
'tftp': i_vlan.ipv4 'tftp': i_vlan.ipv4
}) })
......
...@@ -175,11 +175,6 @@ class Vlan(models.Model): ...@@ -175,11 +175,6 @@ class Vlan(models.Model):
verbose_name=_('Name'), verbose_name=_('Name'),
help_text=_('The short name of the subnet.'), help_text=_('The short name of the subnet.'),
validators=[val_alfanum]) validators=[val_alfanum])
interface = models.CharField(max_length=20, unique=True,
verbose_name=_('interface'), help_text=_(
'The name of network interface the '
'gateway should serve this network on. '
'For example vlan0004 or eth2.'))
network4 = IPNetworkField(unique=False, network4 = IPNetworkField(unique=False,
version=4, version=4,
verbose_name=_('IPv4 address/prefix'), verbose_name=_('IPv4 address/prefix'),
......
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