-
Notifications
You must be signed in to change notification settings - Fork 522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EDNS option backwards compatibility #1143
Comments
I honestly didn't think about this aspect of backwards compatibility, so sorry! Though this is kind of an inherent problem with new options and new rdata types. And while we could maybe hack things by letting data refer to raw bytes, I think code would still be fragile (e.g. if we output the proper rdata text format for a new type and something expected generic format). So I'm not sure how to spare code that is supporting types before dnspython does, though we could certainly make the working-around easier. E.g. just deleting the specific implementation from the table dnspython uses for EDNS options would fix all instances in an application. |
It's probably too late for this specific case, but would adding an equivalent to With that, if you're writing code using a generic option whose implementation might one day be replaced with a custom class, you could unconditionally call |
No worries. I'm not exactly a prime example of software engineering and versioning, so... 🥴 And anyway, how can I complain about free software. Thanks for all your work on dnspython!
Yes, I suppose so. But part of me sort of expected it to "just work" because I assumed (without looking closely at the code) that the new types were and would be subclasses of |
Right, for these two cases ( As far as I can tell, this is really only an issue when creating messages from wire or text or something, not when instantiating messages using the constructor. |
I just wanted to point out one other related/supporting issue: From
If this |
I'm not sure if such a parameter would make sense. Either it would be:
|
This is probably overly complicated, but... along the lines of "some sort of specification of which options should be parsed as generic, and which should not", there could be a library global that was the "dnspython generic version level". This would default to the current version, as in general I think applications would want to get non-generic classes. But more complicated applications could set a version level, e.g. DNSPYTHON_VERSION_2_6, and then all types added after DNSPYTHON_VERSION_2_6 would be forced to generic. This would stop the more complicated applications from breaking. |
That could work at least for my purposes. That would allow the developer to use generic options indefinitely (except for version 2.7, and to some extent 2.6; still trying to figure out what to do with those). But to Brian's point, I think it's perfectly reasonable for it to be an all-or-none (generic or not) choice. So maybe it doesn't need to include which dnspython version, which could actually be overly complicated; maybe it's just a global USE_GENERIC_OPTIONS. Is it really just message parsing from text and wire that this affects? |
I merged #1145, which is all I want to do at the current time, as the other things seem excessively complex now that we have a way to ensure generic if you need it. |
Thanks for dnspython! I like the addition of the new EDNS option classes, like
CookieOption
andNSIDOption
. However, code that uses earlier versions of dnspython relied onGenericOption
and thus used thedata
member. With the introduction of the more specific option classes, messages now are populated with these more specific options, and there is nodata
member, so the code fails. For example, consider the following "legacy" code:When I run it with dnspython < 2.6, it runs just fine. But when I run it with dnspython >= 2.6, this is what happens:
See dnsviz/dnsviz#151 and dnsviz/dnsviz#134
I'm having to hack these up with code like this:
So does it make sense to leave some backwards compatibility, and/or was this part of the design? What do you recommend?
The text was updated successfully, but these errors were encountered: