Answer the question
In order to leave comments, you need to log in
Why is SO_SNDBUF socket size set in traceroute sources?
Good afternoon!
I understand the sources of the open source traceroute ( https://github.com/openbsd/src/blob/master/usr.sbi... ). Traceroute alternately sends udp packets with increasing ttl. The code (line 830) sets the size of the outgoing socket buffer (from which udp packets will be sent) equal to the size of the sent udp packet (38 bytes). I can not understand - why is this even necessary? And can the buffer be so small (what is its minimum value anyway)?
Answer the question
In order to leave comments, you need to log in
The code (line 830) sets the size of the outgoing socket buffer (from which udp packets will be sent) equal to the size of the sent udp packet (38 bytes). I can not understand - why is this even necessary?
man 7 socket
says the following:SO_SNDBUF
Sets or gets the maximum socket send buffer in bytes. The kernel doubles this value
(to allow space for bookkeeping overhead) when it is set using setsockopt(2), and this
doubled value is returned by getsockopt(2). The default value is set by the
/proc/sys/net/core/wmem_default file and the maximum allowed value is set by the
/proc/sys/net/core/wmem_max file. The minimum (doubled) value for this option is 2048.
To save memory, obviously. It may have been relevant at some point in time, judging by the rest of the comments in this file.
And what kind of memory? This does not affect the size of generated udp packets, but only limits the maximum allowable size of sent packets. Or are we talking about saving on the buffers themselves?
The minimum (doubled) value for this option is 2048 the minimum value of 2048 is still set.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question