Comments (8)
On Apr 2, 2014, at 20:03, hanbaga [email protected] wrote:
ttl is the _MasterReader 's attribute.
but how can I get it.
What are you trying to do? "default TTL" is meaningful only when reading a masterfile, and is set with a $TTL statement in the masterfile.
/Bob
from dnspython.
I want to parse a zone file, and want to know everything of the zone file.
from dnspython.
On Apr 2, 2014, at 20:42, hanbaga [email protected] wrote:
I want to parse a zone file, and want to know everything of the zone file.
After you parse the zone file, all rdatasets in the zone will have TTLs. There is no meaning to "default TTL" once the masterfile has been read.
/Bob
from dnspython.
Another problem is that you can have multiple $TTL values in one master file. What value should be returned as "default"?
However I can see hanbaga's point. I personally do zone file -> LDIF conversions and I will have to solve the same problem in future.
Bob, would you accept a patch adding "default_ttl" attribute to the Zone class?
I would initialize it to None and fill it with an value only if zone file contained $TTL directives with the same value (and set None otherwise). It seems like pretty straightforward patch. I think I can write it...
from dnspython.
On Apr 4, 2014, at 11:35, spacekpe [email protected] wrote:
Another problem is that you can have multiple $TTL values in one master file. What value should be returned as "default"?
However I can see hanbaga's point. I personally do zone file -> LDIF conversions and I will have to solve the same problem in future.
Bob, would you accept a patch adding "default_ttl" attribute to the Zone class?
I would initialize it to None and fill it with an value only if zone file contained $TTL directives with the same value (and set None otherwise). It seems like pretty straightforward patch. I think I can write it..
I've got some issues with it.
As you said, there can be multiple $TTL values in masterfiles, why is one of them "the default TTL" and the others forgotten?
What are you going to do with this information? Use it when adding new RRs to the zone?
I wouldn't recommend using such a value for generating masterfiles as it can cause a subtle problem. Consider:
masterfile 1
$TTL 30
a 30 in a 10.0.0.1
b in a 10.0.0.2
In this masterfile, 'a' has been explicitly given a TTL of 30, and 'b' is given the default TTL (at the time!) which happens to be 30. If we used this "default TTL" value to regenerate the masterfile we'd get
masterfile 2
$TTL 30
a in a 10.0.0.1
b in a 10.0.0.2
which is subtly different. In the first file if someone changes $TTL to 300, then only 'b' is affected, but in the second file both 'a' and 'b' are changed. That may be OK, or it may be bad!
from dnspython.
why is one of them "the default TTL" and the others forgotten?
I propose to return default_ttl if and only if all $TTL values in a master file are equal (which typically means that there is single instance of $TTL). I would return None if multiple conflicting $TTL directives are present.
What are you going to do with this information?
As I said before, I'm converting master files from format defined in RFC 1035 to LDIF format (used for import to LDAP database).
I wouldn't recommend using such a value for generating masterfiles as it can cause a subtle problem.
I agree that it can create interesting problems. However, I'm interested only in reading.
from dnspython.
I'm still concerned about the default_ttl proposal as it doesn't differentiate between "I set the TTL on this record by using the value of $TTL", and "the value of the TTL on this record was explicitly specified but happens to be the same as the current value of $TTL". In the later case, when converting you will say something has the "default value", which potentially destroys information in the target format.
Nevertheless, I'll merge the fix spacekpe proposes if it gets written. I'd request that the comment on the default_ttl zone attribute carefully describes the risks.
from dnspython.
Late to the party here, but it seems as though even the current way it's handled some information is lost about the zone "as-written" even though all the "as-it-functions" information is preserved (obviously the most important part). For a given record, was that the TTL assigned to it, or was it from a previous $TTL directive?
Perhaps each record in in a record set can be marked with "ttl" as it is now (the "effective" TTL), and then the "default_ttl" and the "specified_ttl" if you're interested in the "as-written" information. Still not the whole "as-written" picture, but perhaps more than was captured previously. Perhaps the default_ttl could even be a simple object instead of just the int value so that individual records could be tied back to the actual $TTL directive that commanded them and perhaps be changed as a group. Still might not even capture the whole intent of a given zone file, but theres only so much we can do given the limitations of $TTL as descriptor of the "why".
I'll give it consideration and maybe when I'm done with my current push at work circle around to this.
from dnspython.
Related Issues (20)
- Add an overridable socket_factory to dns.quic (like dns.query has) HOT 3
- dns.query.quic() cert validation with custom verify path broken? HOT 3
- Confusing docstring on dns.Set HOT 4
- License specification is missing HOT 2
- Query for SOA requires TSIG (for Catalog Zones). HOT 3
- Race conditions in dns.quic._asyncio can cause hangs or long closes
- response time while using asyncio is skewed HOT 2
- dnspython 2.x DNS lookup failed with "The DNS operation timed out" error over on Redhat HOT 7
- Question: resolving without chaining?
- Strange Behavior When Unpickling HOT 4
- [asyncio] Blocking call to import_module in rdata.py HOT 5
- Timeout for TXT records that are too large HOT 2
- Issue in Hostname Resolution with multiple Nameservers HOT 2
- Parsing of KEY records HOT 8
- AttributeError: 'NoneType' object has no attribute 'split' on importing dns.query HOT 7
- dns.resolver.override_system_resolver doesnt work in windows HOT 2
- Installing dnspython doesn't work HOT 2
- with `raise_on_no_answer=False`, dns.resolver.Answer objects evaluate inconsistently depending on what sections are present in a reply HOT 2
- New RRTYPE in IANA registry HOT 7
- Wrong A-records results HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dnspython.