diff options
author | rwatson <rwatson@FreeBSD.org> | 2004-09-21 03:10:28 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2004-09-21 03:10:28 +0000 |
commit | 362f547d94ad5ef11ad99b154efdd7f64695adbe (patch) | |
tree | da4d8eab9f3d58c791ea9a7dbc00b355158fe9ce /tools | |
parent | a9e73707f3f2982981b3a5da3cadbdc761f987ef (diff) | |
download | FreeBSD-src-362f547d94ad5ef11ad99b154efdd7f64695adbe.zip FreeBSD-src-362f547d94ad5ef11ad99b154efdd7f64695adbe.tar.gz |
Set default socket size for netreceive to 128k to reduce the chances
of the buffer overflowing before netreceive can be scheduled to read
the packets from the socket.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/tools/netrate/netreceive/netreceive.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/tools/netrate/netreceive/netreceive.c b/tools/tools/netrate/netreceive/netreceive.c index e3fecc5..4a3a6f6 100644 --- a/tools/tools/netrate/netreceive/netreceive.c +++ b/tools/tools/netrate/netreceive/netreceive.c @@ -52,7 +52,7 @@ main(int argc, char *argv[]) struct sockaddr_in sin; char *dummy, *packet; long port; - int s; + int s, v; if (argc != 2) usage(); @@ -80,6 +80,12 @@ main(int argc, char *argv[]) return (-1); } + v = 128 * 1024; + if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, &v, sizeof(v)) < 0) { + perror("SO_RCVBUF"); + return (-1); + } + if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { perror("bind"); return (-1); |