Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/Conn.cc b/src/Conn.cc
- index bc2e7fb..dfa2eb8 100644
- --- a/src/Conn.cc
- +++ b/src/Conn.cc
- @@ -160,6 +160,7 @@ Connection::Connection(NetSessions* s, HashKey* k, double t, const ConnID* id,
- conn_timer_mgr = tag ? new TimerMgr::Tag(*tag) : 0;
- uid = 0; // Will set later.
- + uid2 = 0;
- if ( arg_encap )
- encapsulation = new EncapsulationStack(*arg_encap);
- @@ -378,11 +379,15 @@ RecordVal* Connection::BuildConnVal()
- conn_val->Assign(7, new Val(0, TYPE_COUNT)); // hot
- conn_val->Assign(8, new StringVal("")); // history
- - if ( ! uid )
- + if ( ! uid ) {
- uid = calculate_unique_id();
- + uid2 = calculate_unique_id();
- + }
- - char tmp[20];
- - conn_val->Assign(9, new StringVal(uitoa_n(uid, tmp, sizeof(tmp), 62)));
- + char tmp[40];
- + char tmp2[40];
- + uitoa_n(uid2, tmp2, sizeof(tmp2), 62);
- + conn_val->Assign(9, new StringVal(uitoa_n(uid, tmp, sizeof(tmp), 62, tmp2)));
- if ( encapsulation && encapsulation->Depth() > 0 )
- conn_val->Assign(10, encapsulation->GetVectorVal());
- diff --git a/src/Conn.h b/src/Conn.h
- index 782d41a..8f2345b 100644
- --- a/src/Conn.h
- +++ b/src/Conn.h
- @@ -318,6 +318,7 @@ protected:
- PIA* primary_PIA;
- uint64 uid; // Globally unique connection ID.
- + uint64 uid2; // Globally unique connection ID 2.
- };
- class ConnectionTimer : public Timer {
- diff --git a/src/bro.bif b/src/bro.bif
- index 26fe16d..2e9d5ac 100644
- --- a/src/bro.bif
- +++ b/src/bro.bif
- @@ -974,9 +974,12 @@ function entropy_test_finish%(handle: opaque of entropy%): entropy_test_result
- ## .. bro:see:: unique_id_from
- function unique_id%(prefix: string%) : string
- %{
- - char tmp[20];
- + char tmp[40];
- + char tmp2[40];
- uint64 uid = calculate_unique_id(UID_POOL_DEFAULT_SCRIPT);
- - return new StringVal(uitoa_n(uid, tmp, sizeof(tmp), 62, prefix->CheckString()));
- + uint64 uid2 = calculate_unique_id(UID_POOL_DEFAULT_SCRIPT);
- + uitoa_n(uid2, tmp2, sizeof(tmp2), 62, prefix->CheckString());
- + return new StringVal(uitoa_n(uid, tmp, sizeof(tmp), 62, tmp2));
- %}
- ## Creates an identifier that is unique with high probability.
- @@ -990,9 +993,12 @@ function unique_id_from%(pool: int, prefix: string%) : string
- %{
- pool += UID_POOL_CUSTOM_SCRIPT; // Make sure we don't conflict with internal pool.
- - char tmp[20];
- + char tmp[40];
- + char tmp2[40];
- uint64 uid = calculate_unique_id(pool);
- - return new StringVal(uitoa_n(uid, tmp, sizeof(tmp), 62, prefix->CheckString()));
- + uint64 uid2 = calculate_unique_id(pool);
- + uitoa_n(uid2, tmp2, sizeof(tmp2), 62, prefix->CheckString());
- + return new StringVal(uitoa_n(uid, tmp, sizeof(tmp), 62, tmp2));
- %}
- # ===========================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement