
On Sun, Aug 10, 2025 at 7:04 PM Tom Beecher <beecher@beecher.cc> wrote:
With these data structures you can:
header = (struct ipv4_header*) byte_buffer; printf ("Don't fragment bit is: %s\n", header->dont_fragment?"set":"unset");
Not only is that code simple, the amount of work the CPU has to do to execute that code is trivial.
df_status = s.getsockopt(socket.IPPROTO_IP, socket.IP_DONTFRAG) print(f"Don't Fragment flag status: {df_status}")
Hi Tom, We're not talking about the same thing. I'm talking about parsing network packets. You're talking about the socket interface to getsockopt(), long after the network stack has parsed them. If your DNS needs are satisfied with getaddrinfo() you can do it as easily and effectively in Python as C. Such use moves into the territory where Python's advantages make it a good choice of programming language. Regards, Bill Herrin -- William Herrin bill@herrin.us https://bill.herrin.us/