Merge "Call iptables without absolute path."
This commit is contained in:
commit
70f5a25af8
@ -269,7 +269,7 @@ class IptablesManager(object):
|
|||||||
rules. This happens atomically, thanks to iptables-restore.
|
rules. This happens atomically, thanks to iptables-restore.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
s = [('/sbin/iptables', self.ipv4)]
|
s = [('iptables', self.ipv4)]
|
||||||
if self.use_ipv6:
|
if self.use_ipv6:
|
||||||
s += [('ip6tables', self.ipv6)]
|
s += [('ip6tables', self.ipv6)]
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class IptablesManagerStateFulTestCase(unittest.TestCase):
|
|||||||
|
|
||||||
def test_add_and_remove_chain(self):
|
def test_add_and_remove_chain(self):
|
||||||
bn = iptables_manager.binary_name
|
bn = iptables_manager.binary_name
|
||||||
self.iptables.execute(['/sbin/iptables-save', '-t', 'filter'],
|
self.iptables.execute(['iptables-save', '-t', 'filter'],
|
||||||
root_helper=self.root_helper).AndReturn('')
|
root_helper=self.root_helper).AndReturn('')
|
||||||
|
|
||||||
nat_dump = (':%s-OUTPUT - [0:0]\n:%s-snat - [0:0]\n:%s-PREROUTING -'
|
nat_dump = (':%s-OUTPUT - [0:0]\n:%s-snat - [0:0]\n:%s-PREROUTING -'
|
||||||
@ -56,7 +56,7 @@ class IptablesManagerStateFulTestCase(unittest.TestCase):
|
|||||||
'%s-snat -j %s-float-snat\n' % (bn, bn, bn, bn, bn, bn,
|
'%s-snat -j %s-float-snat\n' % (bn, bn, bn, bn, bn, bn,
|
||||||
bn, bn, bn, bn, bn))
|
bn, bn, bn, bn, bn))
|
||||||
|
|
||||||
self.iptables.execute(['/sbin/iptables-restore'],
|
self.iptables.execute(['iptables-restore'],
|
||||||
process_input=(':%s-FORWARD - [0:0]\n:%s-INPUT'
|
process_input=(':%s-FORWARD - [0:0]\n:%s-INPUT'
|
||||||
' - [0:0]\n:%s-local - [0:0]\n:%s-filter - [0:'
|
' - [0:0]\n:%s-local - [0:0]\n:%s-filter - [0:'
|
||||||
'0]\n:%s-OUTPUT - [0:0]\n:quantum-filter-top -'
|
'0]\n:%s-OUTPUT - [0:0]\n:quantum-filter-top -'
|
||||||
@ -67,17 +67,17 @@ class IptablesManagerStateFulTestCase(unittest.TestCase):
|
|||||||
'\n' % (bn, bn, bn, bn, bn, bn, bn, bn, bn)
|
'\n' % (bn, bn, bn, bn, bn, bn, bn, bn, bn)
|
||||||
), root_helper=self.root_helper).AndReturn(None)
|
), root_helper=self.root_helper).AndReturn(None)
|
||||||
|
|
||||||
self.iptables.execute(['/sbin/iptables-save', '-t', 'nat'],
|
self.iptables.execute(['iptables-save', '-t', 'nat'],
|
||||||
root_helper=self.root_helper).AndReturn('')
|
root_helper=self.root_helper).AndReturn('')
|
||||||
|
|
||||||
self.iptables.execute(['/sbin/iptables-restore'],
|
self.iptables.execute(['iptables-restore'],
|
||||||
process_input=nat_dump,
|
process_input=nat_dump,
|
||||||
root_helper=self.root_helper).AndReturn(None)
|
root_helper=self.root_helper).AndReturn(None)
|
||||||
|
|
||||||
self.iptables.execute(['/sbin/iptables-save', '-t', 'filter'],
|
self.iptables.execute(['iptables-save', '-t', 'filter'],
|
||||||
root_helper=self.root_helper).AndReturn('')
|
root_helper=self.root_helper).AndReturn('')
|
||||||
|
|
||||||
self.iptables.execute(['/sbin/iptables-restore'],
|
self.iptables.execute(['iptables-restore'],
|
||||||
process_input=(':%s-FORWARD - [0:0]\n:%s-INPUT'
|
process_input=(':%s-FORWARD - [0:0]\n:%s-INPUT'
|
||||||
' - [0:0]\n:%s-local - [0:0]\n:%s-OUTPUT - [0:'
|
' - [0:0]\n:%s-local - [0:0]\n:%s-OUTPUT - [0:'
|
||||||
'0]\n:quantum-filter-top - [0:0]\n-A FORWARD -'
|
'0]\n:quantum-filter-top - [0:0]\n-A FORWARD -'
|
||||||
@ -88,10 +88,10 @@ class IptablesManagerStateFulTestCase(unittest.TestCase):
|
|||||||
bn, bn, bn, bn)), root_helper=self.root_helper
|
bn, bn, bn, bn)), root_helper=self.root_helper
|
||||||
).AndReturn(None)
|
).AndReturn(None)
|
||||||
|
|
||||||
self.iptables.execute(['/sbin/iptables-save', '-t', 'nat'],
|
self.iptables.execute(['iptables-save', '-t', 'nat'],
|
||||||
root_helper=self.root_helper).AndReturn('')
|
root_helper=self.root_helper).AndReturn('')
|
||||||
|
|
||||||
self.iptables.execute(['/sbin/iptables-restore'],
|
self.iptables.execute(['iptables-restore'],
|
||||||
process_input=nat_dump,
|
process_input=nat_dump,
|
||||||
root_helper=self.root_helper).AndReturn(None)
|
root_helper=self.root_helper).AndReturn(None)
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ class IptablesManagerStateFulTestCase(unittest.TestCase):
|
|||||||
|
|
||||||
def test_add_filter_rule(self):
|
def test_add_filter_rule(self):
|
||||||
bn = iptables_manager.binary_name
|
bn = iptables_manager.binary_name
|
||||||
self.iptables.execute(['/sbin/iptables-save', '-t', 'filter'],
|
self.iptables.execute(['iptables-save', '-t', 'filter'],
|
||||||
root_helper=self.root_helper).AndReturn('')
|
root_helper=self.root_helper).AndReturn('')
|
||||||
|
|
||||||
nat_dump = (':%s-OUTPUT - [0:0]\n:%s-snat - [0:0]\n:%s-PREROUTING -'
|
nat_dump = (':%s-OUTPUT - [0:0]\n:%s-snat - [0:0]\n:%s-PREROUTING -'
|
||||||
@ -119,7 +119,7 @@ class IptablesManagerStateFulTestCase(unittest.TestCase):
|
|||||||
'%s-snat -j %s-float-snat\n' % (bn, bn, bn, bn, bn, bn,
|
'%s-snat -j %s-float-snat\n' % (bn, bn, bn, bn, bn, bn,
|
||||||
bn, bn, bn, bn, bn))
|
bn, bn, bn, bn, bn))
|
||||||
|
|
||||||
self.iptables.execute(['/sbin/iptables-restore'],
|
self.iptables.execute(['iptables-restore'],
|
||||||
process_input=(':%s-FORWARD - [0:0]\n:%s-INPUT'
|
process_input=(':%s-FORWARD - [0:0]\n:%s-INPUT'
|
||||||
' - [0:0]\n:%s-local - [0:0]\n:%s-filter - [0:'
|
' - [0:0]\n:%s-local - [0:0]\n:%s-filter - [0:'
|
||||||
'0]\n:%s-OUTPUT - [0:0]\n:quantum-filter-top -'
|
'0]\n:%s-OUTPUT - [0:0]\n:quantum-filter-top -'
|
||||||
@ -132,17 +132,17 @@ class IptablesManagerStateFulTestCase(unittest.TestCase):
|
|||||||
bn, bn, bn, bn, bn, bn, bn, bn)),
|
bn, bn, bn, bn, bn, bn, bn, bn)),
|
||||||
root_helper=self.root_helper).AndReturn(None)
|
root_helper=self.root_helper).AndReturn(None)
|
||||||
|
|
||||||
self.iptables.execute(['/sbin/iptables-save', '-t', 'nat'],
|
self.iptables.execute(['iptables-save', '-t', 'nat'],
|
||||||
root_helper=self.root_helper).AndReturn('')
|
root_helper=self.root_helper).AndReturn('')
|
||||||
|
|
||||||
self.iptables.execute(['/sbin/iptables-restore'],
|
self.iptables.execute(['iptables-restore'],
|
||||||
process_input=nat_dump,
|
process_input=nat_dump,
|
||||||
root_helper=self.root_helper).AndReturn(None)
|
root_helper=self.root_helper).AndReturn(None)
|
||||||
|
|
||||||
self.iptables.execute(['/sbin/iptables-save', '-t', 'filter'],
|
self.iptables.execute(['iptables-save', '-t', 'filter'],
|
||||||
root_helper=self.root_helper).AndReturn('')
|
root_helper=self.root_helper).AndReturn('')
|
||||||
|
|
||||||
self.iptables.execute(['/sbin/iptables-restore'],
|
self.iptables.execute(['iptables-restore'],
|
||||||
process_input=(':%s-FORWARD - [0:0]\n:%s-INPUT -'
|
process_input=(':%s-FORWARD - [0:0]\n:%s-INPUT -'
|
||||||
' [0:0]\n:%s-local - [0:0]\n:%s-OUTPUT - [0:0]\n'
|
' [0:0]\n:%s-local - [0:0]\n:%s-OUTPUT - [0:0]\n'
|
||||||
':quantum-filter-top - [0:0]\n-A FORWARD -j quan'
|
':quantum-filter-top - [0:0]\n-A FORWARD -j quan'
|
||||||
@ -153,10 +153,10 @@ class IptablesManagerStateFulTestCase(unittest.TestCase):
|
|||||||
bn)), root_helper=self.root_helper
|
bn)), root_helper=self.root_helper
|
||||||
).AndReturn(None)
|
).AndReturn(None)
|
||||||
|
|
||||||
self.iptables.execute(['/sbin/iptables-save', '-t', 'nat'],
|
self.iptables.execute(['iptables-save', '-t', 'nat'],
|
||||||
root_helper=self.root_helper).AndReturn('')
|
root_helper=self.root_helper).AndReturn('')
|
||||||
|
|
||||||
self.iptables.execute(['/sbin/iptables-restore'],
|
self.iptables.execute(['iptables-restore'],
|
||||||
process_input=nat_dump,
|
process_input=nat_dump,
|
||||||
root_helper=self.root_helper).AndReturn(None)
|
root_helper=self.root_helper).AndReturn(None)
|
||||||
|
|
||||||
@ -192,17 +192,17 @@ class IptablesManagerStateFulTestCase(unittest.TestCase):
|
|||||||
'ORWARD -j %s-FORWARD\n' % (bn, bn, bn, bn, bn,
|
'ORWARD -j %s-FORWARD\n' % (bn, bn, bn, bn, bn,
|
||||||
bn, bn, bn))
|
bn, bn, bn))
|
||||||
|
|
||||||
self.iptables.execute(['/sbin/iptables-save', '-t', 'filter'],
|
self.iptables.execute(['iptables-save', '-t', 'filter'],
|
||||||
root_helper=self.root_helper).AndReturn('')
|
root_helper=self.root_helper).AndReturn('')
|
||||||
|
|
||||||
self.iptables.execute(['/sbin/iptables-restore'],
|
self.iptables.execute(['iptables-restore'],
|
||||||
process_input=filter_dump,
|
process_input=filter_dump,
|
||||||
root_helper=self.root_helper).AndReturn(None)
|
root_helper=self.root_helper).AndReturn(None)
|
||||||
|
|
||||||
self.iptables.execute(['/sbin/iptables-save', '-t', 'nat'],
|
self.iptables.execute(['iptables-save', '-t', 'nat'],
|
||||||
root_helper=self.root_helper).AndReturn('')
|
root_helper=self.root_helper).AndReturn('')
|
||||||
|
|
||||||
self.iptables.execute(['/sbin/iptables-restore'],
|
self.iptables.execute(['iptables-restore'],
|
||||||
process_input=(':%s-float-snat - [0:0]\n:%s-POS'
|
process_input=(':%s-float-snat - [0:0]\n:%s-POS'
|
||||||
'TROUTING - [0:0]\n:%s-PREROUTING - [0:0]\n:%s-'
|
'TROUTING - [0:0]\n:%s-PREROUTING - [0:0]\n:%s-'
|
||||||
'nat - [0:0]\n:%s-OUTPUT - [0:0]\n:%s-snat - [0'
|
'nat - [0:0]\n:%s-OUTPUT - [0:0]\n:%s-snat - [0'
|
||||||
@ -217,17 +217,17 @@ class IptablesManagerStateFulTestCase(unittest.TestCase):
|
|||||||
bn, bn, bn, bn, bn, bn, bn, bn, bn, bn, bn)),
|
bn, bn, bn, bn, bn, bn, bn, bn, bn, bn, bn)),
|
||||||
root_helper=self.root_helper).AndReturn(None)
|
root_helper=self.root_helper).AndReturn(None)
|
||||||
|
|
||||||
self.iptables.execute(['/sbin/iptables-save', '-t', 'filter'],
|
self.iptables.execute(['iptables-save', '-t', 'filter'],
|
||||||
root_helper=self.root_helper).AndReturn('')
|
root_helper=self.root_helper).AndReturn('')
|
||||||
|
|
||||||
self.iptables.execute(['/sbin/iptables-restore'],
|
self.iptables.execute(['iptables-restore'],
|
||||||
process_input=filter_dump,
|
process_input=filter_dump,
|
||||||
root_helper=self.root_helper).AndReturn(None)
|
root_helper=self.root_helper).AndReturn(None)
|
||||||
|
|
||||||
self.iptables.execute(['/sbin/iptables-save', '-t', 'nat'],
|
self.iptables.execute(['iptables-save', '-t', 'nat'],
|
||||||
root_helper=self.root_helper).AndReturn('')
|
root_helper=self.root_helper).AndReturn('')
|
||||||
|
|
||||||
self.iptables.execute(['/sbin/iptables-restore'],
|
self.iptables.execute(['iptables-restore'],
|
||||||
process_input=(':%s-float-snat - [0:0]\n:%s-POST'
|
process_input=(':%s-float-snat - [0:0]\n:%s-POST'
|
||||||
'ROUTING - [0:0]\n:%s-PREROUTING - [0:0]\n:%s-OU'
|
'ROUTING - [0:0]\n:%s-PREROUTING - [0:0]\n:%s-OU'
|
||||||
'TPUT - [0:0]\n:%s-snat - [0:0]\n:quantum-postro'
|
'TPUT - [0:0]\n:%s-snat - [0:0]\n:quantum-postro'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user