Live data from Hacker News

A year of Rust and DNS

bluejekyll.github.io

41–50 of 109 posts

Re: A year of Rust and DNS

#41

Love the idea of reimplementing DNS in Rust. Would love to see more efforts like this so that we have secure-by-design language implementation of core security services. But BIND isn't just failing because "it's written in C", it's failing because it's written in terrible C. That said, "terrible C" is probably most every C routine written by someone with less than 10 years of solid low level experience, so "writing g…

> But BIND isn't just failing because "it's written in C", it's failing because it's written in terrible C. That said, "terrible C" is probably most every C routine written by someone with less than 10 years of solid low level experience, so "writing good C code" is not very scalable.

Please do remember that many of these codebases are ancient.

If you rewrote many of these in C today, they would be much better--especially if you also added a test suite around them.

I'm happy to see this in Rust as I'd like Rust to get some real, hostile-environment usage to see what breaks.

Re: A year of Rust and DNS

#42
The only technical comment I have is that it continues to be amazing to me that destructuring binary data is so stupidly verbose in so many languages. I think C and Erlang are the only two languages that got this right.

Re: A year of Rust and DNS

#43
post #38

Earlier quoted context omitted.

The generalizations about the quality of C code is interesting...It is easy to criticize code that has been developed over years, multiple hands, etc. C code doesn't have to be terrible. And "terrible" often is in the eye of the beholder. I've heard people decry OpenSSL and it's various warts (it has many), but as a code base, it's worked well for years across an incredible range of platforms. Some claim the architec…

> C code doesn't have to be terrible. True, but I hardly have seen any codebase at enterprise level that isn't so. C doesn't scale when you have projects where modules are written all the time by different people that got hired to work just on piece A and then leave. They hardly can keep on their head all the nuances of memory management and UB of the company's codebase they have been asked to develop the feature A f…

> C doesn't scale when you have projects where modules are written all the time by different people that got hired to work just on piece A and then leave.

That is true for any language, C, Java, Rust, Go. Continuity from team members is important.

Re: A year of Rust and DNS

#44

I don't know if you're aware of this or not, but when implementing standards with dozens of haphazard extensions, often the best way to keep track of all of the extensions is via the IANA assignments (see http://www.iana.org/protocols ). For DNS, the main page seems to be here: http://www.iana.org/assignments/dns-parameters/dns-parameter...

Yes, I am very familiar with that page, but thanks for posting it! I've used it for double checking many of the record type assignments and the current sets of crypto graphic assignments.

Re: A year of Rust and DNS

#45

Earlier quoted context omitted.

If r_z_ad_cd_rcod is of type u8, then 0b1000_0000 & r_z_ad_cd_rcod is also of type u8, containing the value 0 or 128. It is (by design) not possible to simply cast a number to a bool in Rust; comparing it with some value is the way you are required to do this. You can do this with `== 0b1000_0000` if you want, or `!= 0` would do just as well. Rust is deliberately explicit about conversions between types; it’s less er…

This seems like a good use case for a bit mask query function. I see Rust has a bitflags crate: https://doc.rust-lang.org/bitflags/bitflags/index.html

I found that after I had already written a lot of that code. I haven't had much reason to go back and change it, but any PR's if someone wants to do it, would be accepted.

Re: A year of Rust and DNS

#46
post #38

Earlier quoted context omitted.

> C code doesn't have to be terrible. True, but I hardly have seen any codebase at enterprise level that isn't so. C doesn't scale when you have projects where modules are written all the time by different people that got hired to work just on piece A and then leave. They hardly can keep on their head all the nuances of memory management and UB of the company's codebase they have been asked to develop the feature A f…

> C doesn't scale when you have projects where modules are written all the time by different people that got hired to work just on piece A and then leave. That is true for any language, C, Java, Rust, Go. Continuity from team members is important.

No, because some languages make it easier to deal with developers as if they were cogs (even if I hate how things are nowadays).

For example, the use of automatic memory management or bounds checking, not only allows to remove an whole class of errors they remove the need to have a deep understanding of memory allocation patterns in the code.

Similarly the way one can make use of strong type definitions like in Ada, ML languages to only allow the code to compile if certain rules are followed.

We all hate to be dealt as cogs, but that is how the enterprise world works, the majority of the jobs are consulting gigs for specific features in short to mid term projects.

Re: A year of Rust and DNS

#48
post #42

The only technical comment I have is that it continues to be amazing to me that destructuring binary data is so stupidly verbose in so many languages. I think C and Erlang are the only two languages that got this right.

[deleted]

Re: A year of Rust and DNS

#49

As a ring [1] contributor, would be curious to hear if it could satisfy your crypto requirements. Using it could maybe help with your "(oh-my-dear-god I can not unsee what I saw in there, the C, not Rust)" experience. [1] https://github.com/briansmith/ring

Funny you should ask, I was just looking at that last week to try and answer that question.

I was also thinking of getting my feet wet in ring with some of the easy issues on the github page.

Re: A year of Rust and DNS

#50
post #46

Earlier quoted context omitted.

> C doesn't scale when you have projects where modules are written all the time by different people that got hired to work just on piece A and then leave. That is true for any language, C, Java, Rust, Go. Continuity from team members is important.

No, because some languages make it easier to deal with developers as if they were cogs (even if I hate how things are nowadays). For example, the use of automatic memory management or bounds checking, not only allows to remove an whole class of errors they remove the need to have a deep understanding of memory allocation patterns in the code. Similarly the way one can make use of strong type definitions like in Ada,…

Perhaps, but being a cog in the software team at entreprise level does not preclude problems such as understanding the design decisions made or system limitations that are placed on the software design etc. Sometimes the inscalabity of a design is language independent. The problems are probably emphasised when consultants are engaged to do the job.
Post reply on HN