mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Merge remote branch 'origin/topic/robin/work'
* origin/topic/robin/work: Smarter way to increase the parent/child pipe's socket buffer. (Craig Leres). Fixing bug with defining bro_int_t and bro_uint_t as 64-bit in some platforms.
This commit is contained in:
commit
abc365e38f
5 changed files with 49 additions and 24 deletions
8
CHANGES
8
CHANGES
|
@ -1,3 +1,11 @@
|
|||
1.6-dev.41 Mon Feb 7 13:43:56 PST 2011
|
||||
|
||||
- Smarter way to increase the parent/child pipe's socket buffer.
|
||||
(Craig Leres).
|
||||
|
||||
- Fixing bug with defining bro_int_t and bro_uint_t to be 64 bits wide
|
||||
on some platforms. (Robin Sommer)
|
||||
|
||||
1.6-dev.39 Mon Jan 31 16:42:23 PST 2011
|
||||
|
||||
- Login's confused messages now go through weird.bro. (Robin Sommer)
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.6-dev.39
|
||||
1.6-dev.41
|
||||
|
|
|
@ -544,6 +544,36 @@ void RemoteSerializer::Init()
|
|||
initialized = 1;
|
||||
}
|
||||
|
||||
void RemoteSerializer::SetSocketBufferSize(int fd, int opt, const char *what, int size, int verbose)
|
||||
{
|
||||
int defsize = 0;
|
||||
socklen_t len = sizeof(defsize);
|
||||
|
||||
if ( getsockopt(fd, SOL_SOCKET, opt, (void *)&defsize, &len) < 0 )
|
||||
{
|
||||
if ( verbose )
|
||||
Log(LogInfo, fmt("warning: cannot get socket buffer size (%s): %s", what, strerror(errno)));
|
||||
return;
|
||||
}
|
||||
|
||||
for ( int trysize = size; trysize > defsize; trysize -= 1024 )
|
||||
{
|
||||
if ( setsockopt(fd, SOL_SOCKET, opt, &trysize, sizeof(trysize)) >= 0 )
|
||||
{
|
||||
if ( verbose )
|
||||
{
|
||||
if ( trysize == size )
|
||||
Log(LogInfo, fmt("raised pipe's socket buffer size from %dK to %dK", defsize / 1024, trysize / 1024));
|
||||
else
|
||||
Log(LogInfo, fmt("raised pipe's socket buffer size from %dK to %dK (%dK was requested)", defsize / 1024, trysize / 1024, size / 1024));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Log(LogInfo, fmt("warning: cannot increase %s socket buffer size from %dK (%dK was requested)", what, defsize / 1024, size / 1024));
|
||||
}
|
||||
|
||||
void RemoteSerializer::Fork()
|
||||
{
|
||||
if ( child_pid )
|
||||
|
@ -562,25 +592,11 @@ void RemoteSerializer::Fork()
|
|||
return;
|
||||
}
|
||||
|
||||
int bufsize;
|
||||
socklen_t len = sizeof(bufsize);
|
||||
|
||||
if ( getsockopt(pipe[0], SOL_SOCKET, SO_SNDBUF, &bufsize, &len ) < 0 )
|
||||
Log(LogInfo, fmt("warning: cannot get socket buffer size: %s", strerror(errno)));
|
||||
else
|
||||
Log(LogInfo, fmt("pipe's socket buffer size is %d, setting to %d", bufsize, SOCKBUF_SIZE));
|
||||
|
||||
bufsize = SOCKBUF_SIZE;
|
||||
|
||||
if ( setsockopt(pipe[0], SOL_SOCKET, SO_SNDBUF,
|
||||
&bufsize, sizeof(bufsize) ) < 0 ||
|
||||
setsockopt(pipe[0], SOL_SOCKET, SO_RCVBUF,
|
||||
&bufsize, sizeof(bufsize) ) < 0 ||
|
||||
setsockopt(pipe[1], SOL_SOCKET, SO_SNDBUF,
|
||||
&bufsize, sizeof(bufsize) ) < 0 ||
|
||||
setsockopt(pipe[1], SOL_SOCKET, SO_RCVBUF,
|
||||
&bufsize, sizeof(bufsize) ) < 0 )
|
||||
Log(LogInfo, fmt("warning: cannot set socket buffer size to %dK: %s", bufsize / 1024, strerror(errno)));
|
||||
// Try to increase the size of the socket send and receive buffers.
|
||||
SetSocketBufferSize(pipe[0], SO_SNDBUF, "SO_SNDBUF", SOCKBUF_SIZE, 1);
|
||||
SetSocketBufferSize(pipe[0], SO_RCVBUF, "SO_RCVBUF", SOCKBUF_SIZE, 0);
|
||||
SetSocketBufferSize(pipe[1], SO_SNDBUF, "SO_SNDBUF", SOCKBUF_SIZE, 0);
|
||||
SetSocketBufferSize(pipe[1], SO_RCVBUF, "SO_RCVBUF", SOCKBUF_SIZE, 0);
|
||||
|
||||
child_pid = 0;
|
||||
|
||||
|
|
|
@ -297,6 +297,8 @@ protected:
|
|||
bool SendToChild(char type, Peer* peer, int nargs, ...); // can send uints32 only
|
||||
bool SendToChild(ChunkedIO::Chunk* c);
|
||||
|
||||
void SetSocketBufferSize(int fd, int opt, const char *what, int size, int verbose);
|
||||
|
||||
private:
|
||||
enum { TYPE, ARGS } msgstate; // current state of reading comm.
|
||||
Peer* current_peer;
|
||||
|
|
|
@ -39,13 +39,9 @@
|
|||
extern HeapLeakChecker* heap_checker;
|
||||
#endif
|
||||
|
||||
typedef unsigned long long int uint64;
|
||||
typedef unsigned int uint32;
|
||||
typedef unsigned short uint16;
|
||||
typedef unsigned char uint8;
|
||||
typedef long long int int64;
|
||||
typedef int64 bro_int_t;
|
||||
typedef uint64 bro_uint_t;
|
||||
|
||||
#if SIZEOF_LONG_LONG == 8
|
||||
typedef unsigned long long uint64;
|
||||
|
@ -57,6 +53,9 @@ typedef long int int64;
|
|||
# error "Couldn't reliably identify 64-bit type. Please report to bro@bro-ids.org."
|
||||
#endif
|
||||
|
||||
typedef int64 bro_int_t;
|
||||
typedef uint64 bro_uint_t;
|
||||
|
||||
// "ptr_compat_uint" and "ptr_compat_int" are (un)signed integers of
|
||||
// pointer size. They can be cast safely to a pointer, e.g. in Lists,
|
||||
// which represent their entities as void* pointers.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue