Making code better with reviews
Jul 2, 2014John Graham-Cumming3 min read
Opens blog.cloudflare.comWhat the post covers
This post details a specific code improvement within Cloudflare's DNS server related to filtering invalid DNS packet flags.
- The author initially added a comment to explain a bitmask check (`0x86` and `0x4f`).
- A code review led to a refactoring that replaced the magic numbers with named constants (`QR`, `AA`, `TC`, `Z`, `RCODE`) and a more explicit bitwise OR operation, significantly improving code readability and maintainability.
- This demonstrates the impact of code reviews on improving code quality and security.
More from the DNS Infrastructure & Naming Conventions trail
The keys to the Internet change on October 11, 2026. Are you ready?
1.1.1.1 now supports post-quantum DNSSEC, all 2,420 bytes of it
How we saved 100 terabytes of memory by optimizing 1.1.1.1’s DNS cache
BGP ORIGIN attribute manipulation and its impact on the Internet
A broken DNSSEC rollover took down .AL. Now 1.1.1.1 tells you when validation is bypassed