mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 18:18:19 +00:00
Add support to Bro for connecting with peers over IPv6.
- Communication::listen_ipv6 needs to be redef'd to true in order for IPv6 listening sockets to be opened. - Added Communication::listen_retry option as an interval at which to retry binding to socket addresses that were already in use. - Added some explicit baselines to check in the istate.events and istate.events-ssl tests -- the SSL test was incorrectly passing because it compared two empty files. (The files being empty because "http/base" was given as an argument to Bro which it couldn't handle because that script doesn't exist anymore).
This commit is contained in:
parent
ed9801db98
commit
1e66fe905a
20 changed files with 480 additions and 174 deletions
|
@ -10,8 +10,7 @@
|
|||
#include "Stats.h"
|
||||
#include "File.h"
|
||||
|
||||
// All IP arguments are in host byte-order.
|
||||
// FIXME: Change this to network byte order
|
||||
#include <vector>
|
||||
|
||||
class IncrementalSendTimer;
|
||||
|
||||
|
@ -63,7 +62,8 @@ public:
|
|||
bool CompleteHandshake(PeerID peer);
|
||||
|
||||
// Start to listen.
|
||||
bool Listen(const IPAddr& ip, uint16 port, bool expect_ssl);
|
||||
bool Listen(const IPAddr& ip, uint16 port, bool expect_ssl, bool ipv6,
|
||||
double retry);
|
||||
|
||||
// Stop it.
|
||||
bool StopListening();
|
||||
|
@ -179,9 +179,7 @@ protected:
|
|||
struct Peer {
|
||||
PeerID id; // Unique ID (non-zero) per peer.
|
||||
|
||||
// ### Fix: currently, we only work for IPv4.
|
||||
// addr_type ip;
|
||||
uint32 ip;
|
||||
IPAddr ip;
|
||||
|
||||
uint16 port;
|
||||
handler_list handlers;
|
||||
|
@ -277,7 +275,7 @@ protected:
|
|||
bool ProcessLogWrite();
|
||||
bool ProcessRequestLogs();
|
||||
|
||||
Peer* AddPeer(uint32 ip, uint16 port, PeerID id = PEER_NONE);
|
||||
Peer* AddPeer(const IPAddr& ip, uint16 port, PeerID id = PEER_NONE);
|
||||
Peer* LookupPeer(PeerID id, bool only_if_connected);
|
||||
void RemovePeer(Peer* peer);
|
||||
bool IsConnectedPeer(PeerID id);
|
||||
|
@ -412,7 +410,6 @@ protected:
|
|||
{
|
||||
id = 0;
|
||||
io = 0;
|
||||
ip = 0;
|
||||
port = 0;
|
||||
state = 0;
|
||||
connected = false;
|
||||
|
@ -424,7 +421,7 @@ protected:
|
|||
|
||||
RemoteSerializer::PeerID id;
|
||||
ChunkedIO* io;
|
||||
uint32 ip;
|
||||
IPAddr ip;
|
||||
uint16 port;
|
||||
char state;
|
||||
bool connected;
|
||||
|
@ -437,7 +434,7 @@ protected:
|
|||
bool compressor;
|
||||
};
|
||||
|
||||
bool Listen(uint32 ip, uint16 port, bool expect_ssl);
|
||||
bool Listen();
|
||||
bool AcceptConnection(int listen_fd);
|
||||
bool Connect(Peer* peer);
|
||||
bool CloseConnection(Peer* peer, bool reconnect);
|
||||
|
@ -482,6 +479,9 @@ protected:
|
|||
bool ForwardChunkToPeer();
|
||||
const char* MakeLogString(const char* msg, Peer *peer);
|
||||
|
||||
// Closes all file descriptors associated with listening sockets.
|
||||
void CloseListenFDs();
|
||||
|
||||
// Peers we are communicating with:
|
||||
declare(PList, Peer);
|
||||
typedef PList(Peer) peer_list;
|
||||
|
@ -498,14 +498,15 @@ protected:
|
|||
char parent_msgtype;
|
||||
ChunkedIO::Chunk* parent_args;
|
||||
|
||||
int listen_fd_clear;
|
||||
int listen_fd_ssl;
|
||||
vector<int> listen_fds;
|
||||
|
||||
// If the port we're trying to bind to is already in use, we will retry
|
||||
// it regularly.
|
||||
uint32 listen_if; // Fix: only supports IPv4
|
||||
IPAddr listen_if;
|
||||
uint16 listen_port;
|
||||
bool listen_ssl;
|
||||
bool enable_ipv6; // allow IPv6 listen sockets
|
||||
uint32 bind_retry_interval;
|
||||
time_t listen_next_try;
|
||||
bool shutting_conns_down;
|
||||
bool terminating;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue