Commit 1bbe7018 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

[1294] changed ixfr_disabled to use_ixfr

and reversed its interpretation
also removed the additional None check (it was checked twice)
parent d7711ce2
......@@ -1304,13 +1304,13 @@ TODO
<section>
<title>Enabling IXFR</title>
<para>
As noted above, <command>b10-xfrin</command> uses AXFR for
zone transfers by default. To enable IXFR for zone transfers
for a particular zone, set the <userinput>ixfr_disabled</userinput>
configuration parameter to <userinput>true</userinput>.
In the above example of configuration sequence, you'll need
to add the following before performing <userinput>commit</userinput>:
<screen>&gt; <userinput>config set Xfrin/zones[0]/ixfr_disabled true</userinput></screen>
As noted above, <command>b10-xfrin</command> uses AXFR for
zone transfers by default. To enable IXFR for zone transfers
for a particular zone, set the <userinput>use_ixfr</userinput>
configuration parameter to <userinput>true</userinput>.
In the above example of configuration sequence, you'll need
to add the following before performing <userinput>commit</userinput>:
<screen>&gt; <userinput>config set Xfrin/zones[0]/use_ixfr true</userinput></screen>
</para>
<note><simpara>
......
......@@ -110,7 +110,7 @@ in separate zonemgr process.
<varname>class</varname> (defaults to <quote>IN</quote>),
<varname>master_addr</varname> (the zone master to transfer from),
<varname>master_port</varname> (defaults to 53),
<varname>ixfr_disabled</varname> (defaults to true), and
<varname>use_ixfr</varname> (defaults to false), and
<varname>tsig_key</varname> (optional TSIG key to use).
The <varname>tsig_key</varname> is specified using a full string
colon-delimited name:key:algorithm representation (e.g.
......@@ -158,7 +158,7 @@ in separate zonemgr process.
according to the SOA's REFRESH time
to tell <command>b10-xfrin</command> that the zone needs to do
a zone refresh.
This is an internal command and not exposed to the administrator.
This is an internal command and not exposed to the administrator.
<!-- not defined in spec -->
</para>
......@@ -208,7 +208,7 @@ add a usage example of xfrin -->
</para></note>
<!-- TODO:
it can handle more than one XFR in now,
it can handle more than one XFR in now,
but the problem is If SQLITE3 datasource part support multiple write
operation
-->
......
......@@ -1937,12 +1937,12 @@ class TestXfrin(unittest.TestCase):
self.assertEqual(zone_info.tsig_key.to_text(), TSIGKey(zone_config['tsig_key']).to_text())
else:
self.assertIsNone(zone_info.tsig_key)
if 'ixfr_disabled' in zone_config and\
zone_config.get('ixfr_disabled'):
self.assertTrue(zone_info.ixfr_disabled)
if 'use_ixfr' in zone_config and\
zone_config.get('use_ixfr'):
self.assertTrue(zone_info.use_ixfr)
else:
# if not set, should default to False
self.assertFalse(zone_info.ixfr_disabled)
self.assertFalse(zone_info.use_ixfr)
def test_command_handler_zones(self):
config1 = { 'transfers_in': 3,
......@@ -1950,7 +1950,7 @@ class TestXfrin(unittest.TestCase):
{ 'name': 'test.example.',
'master_addr': '192.0.2.1',
'master_port': 53,
'ixfr_disabled': False
'use_ixfr': False
}
]}
self.assertEqual(self.xfr.config_handler(config1)['result'][0], 0)
......@@ -1962,7 +1962,7 @@ class TestXfrin(unittest.TestCase):
'master_addr': '192.0.2.2',
'master_port': 53,
'tsig_key': "example.com:SFuWd/q99SzF8Yzd1QbB9g==",
'ixfr_disabled': True
'use_ixfr': True
}
]}
self.assertEqual(self.xfr.config_handler(config2)['result'][0], 0)
......@@ -2072,37 +2072,37 @@ class TestXfrin(unittest.TestCase):
# since this has failed, we should still have the previous config
self._check_zones_config(config2)
def common_ixfr_setup(self, xfr_mode, ixfr_disabled):
def common_ixfr_setup(self, xfr_mode, use_ixfr):
# This helper method explicitly sets up a zone configuration with
# ixfr_disabled, and invokes either retransfer or refresh.
# use_ixfr, and invokes either retransfer or refresh.
# Shared by some of the following test cases.
config = {'zones': [
{'name': 'example.com.',
'master_addr': '192.0.2.1',
'ixfr_disabled': ixfr_disabled}]}
'use_ixfr': use_ixfr}]}
self.assertEqual(self.xfr.config_handler(config)['result'][0], 0)
self.assertEqual(self.xfr.command_handler(xfr_mode,
self.args)['result'][0], 0)
def test_command_handler_retransfer_ixfr_enabled(self):
# If IXFR is explicitly enabled in config, IXFR will be used
self.common_ixfr_setup('retransfer', False)
self.common_ixfr_setup('retransfer', True)
self.assertEqual(RRType.IXFR(), self.xfr.xfrin_started_request_type)
def test_command_handler_refresh_ixfr_enabled(self):
# Same for refresh
self.common_ixfr_setup('refresh', False)
self.common_ixfr_setup('refresh', True)
self.assertEqual(RRType.IXFR(), self.xfr.xfrin_started_request_type)
def test_command_handler_retransfer_ixfr_disabled(self):
# Similar to the previous case, but explicitly disabled. AXFR should
# be used.
self.common_ixfr_setup('retransfer', True)
self.common_ixfr_setup('retransfer', False)
self.assertEqual(RRType.AXFR(), self.xfr.xfrin_started_request_type)
def test_command_handler_refresh_ixfr_disabled(self):
# Same for refresh
self.common_ixfr_setup('refresh', True)
self.common_ixfr_setup('refresh', False)
self.assertEqual(RRType.AXFR(), self.xfr.xfrin_started_request_type)
def raise_interrupt():
......
......@@ -876,12 +876,8 @@ class ZoneInfo:
self.set_master_port(config_data.get('master_port'))
self.set_zone_class(config_data.get('class'))
self.set_tsig_key(config_data.get('tsig_key'))
# XXX: hardcode the default for ixfr_disabled. We should retrieve
# it from the
ixfr_disabled = config_data.get('ixfr_disabled')
if ixfr_disabled is None:
ixfr_disabled = True
self.set_ixfr_disabled(ixfr_disabled)
use_ixfr = config_data.get('use_ixfr')
self.set_use_ixfr(use_ixfr)
def set_name(self, name_str):
"""Set the name for this zone given a name string.
......@@ -956,15 +952,15 @@ class ZoneInfo:
errmsg = "bad TSIG key string: " + tsig_key_str
raise XfrinZoneInfoException(errmsg)
def set_ixfr_disabled(self, ixfr_disabled):
"""Set ixfr_disabled. If set to False, it will use
IXFR for incoming transfers. If set to True, it will use AXFR.
def set_use_ixfr(self, use_ixfr):
"""Set use_ixfr. If set to True, it will use
IXFR for incoming transfers. If set to False, it will use AXFR.
At this moment there is no automatic fallback"""
if ixfr_disabled is None:
self.ixfr_disabled = \
self._module_cc.get_default_value("zones/ixfr_disabled")
if use_ixfr is None:
self.use_ixfr = \
self._module_cc.get_default_value("zones/use_ixfr")
else:
self.ixfr_disabled = ixfr_disabled
self.use_ixfr = use_ixfr
def get_master_addr_info(self):
return (self.master_addr.family, socket.SOCK_STREAM,
......@@ -1091,7 +1087,7 @@ class Xfrin:
request_type = RRType.AXFR()
if zone_info:
tsig_key = zone_info.tsig_key
if not zone_info.ixfr_disabled:
if zone_info.use_ixfr:
request_type = RRType.IXFR()
db_file = args.get('db_file') or self._get_db_file()
ret = self.xfrin_start(zone_name,
......
......@@ -44,10 +44,10 @@
"item_type": "string",
"item_optional": true
},
{ "item_name": "ixfr_disabled",
{ "item_name": "use_ixfr",
"item_type": "boolean",
"item_optional": false,
"item_default": true
"item_default": false
}
]
}
......
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 to comment