diff options
author | Robert Watson <rwatson@FreeBSD.org> | 2004-09-21 03:10:28 +0000 |
---|---|---|
committer | Robert Watson <rwatson@FreeBSD.org> | 2004-09-21 03:10:28 +0000 |
commit | 98da5dfbb226d631fef17748faae83e59fefed62 (patch) | |
tree | da4d8eab9f3d58c791ea9a7dbc00b355158fe9ce /tools | |
parent | 78366bad6cc41c28cb84190e00cc4065cca56238 (diff) | |
download | src-98da5dfbb226d631fef17748faae83e59fefed62.tar.gz src-98da5dfbb226d631fef17748faae83e59fefed62.zip |
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.
Notes
Notes:
svn path=/head/; revision=135536
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 e3fecc548e76..4a3a6f6c3ae8 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); |