[Spread-cvs] commit: r672 - trunk/daemon
jschultz at spread.org
jschultz at spread.org
Wed Jan 22 01:24:58 EST 2014
Author: jschultz
Date: 2014-01-22 01:24:57 -0500 (Wed, 22 Jan 2014)
New Revision: 672
Modified:
trunk/daemon/membership.c
trunk/daemon/net_types.h
trunk/daemon/network.c
trunk/daemon/protocol.c
Log:
Add membership id to EVS/OP token. Further bugfix to prevent getting tokens from weirdos.
Modified: trunk/daemon/membership.c
===================================================================
--- trunk/daemon/membership.c 2014-01-22 06:17:58 UTC (rev 671)
+++ trunk/daemon/membership.c 2014-01-22 06:24:57 UTC (rev 672)
@@ -2206,6 +2206,7 @@
send_scat.num_elements = 1;
form_token->type = 0;
+ form_token->memb_id = Future_membership_id;
form_token->seq = 0;
form_token->aru = INT32_MAX; /* leader will lower to his My_aru */
form_token->aru_last_id = -1; /* leader will set to My.id */
Modified: trunk/daemon/net_types.h
===================================================================
--- trunk/daemon/net_types.h 2014-01-22 06:17:58 UTC (rev 671)
+++ trunk/daemon/net_types.h 2014-01-22 06:24:57 UTC (rev 672)
@@ -130,8 +130,9 @@
typedef struct dummy_token_header {
int32 type;
int32 transmiter_id;
+ int32 proc_id;
+ membership_id memb_id;
int32 seq;
- int32 proc_id;
int32 aru;
int32 aru_last_id;
int16 flow_control;
Modified: trunk/daemon/network.c
===================================================================
--- trunk/daemon/network.c 2014-01-22 06:17:58 UTC (rev 671)
+++ trunk/daemon/network.c 2014-01-22 06:24:57 UTC (rev 672)
@@ -644,13 +644,15 @@
void Flip_token( token_header *token_ptr )
{
- token_ptr->type = Flip_int32( token_ptr->type );
- token_ptr->transmiter_id = Flip_int32( token_ptr->transmiter_id );
- token_ptr->seq = Flip_int32( token_ptr->seq );
- token_ptr->proc_id = Flip_int32( token_ptr->proc_id );
- token_ptr->aru = Flip_int32( token_ptr->aru );
- token_ptr->aru_last_id = Flip_int32( token_ptr->aru_last_id );
- token_ptr->flow_control = Flip_int16( token_ptr->flow_control );
- token_ptr->rtr_len = Flip_int16( token_ptr->rtr_len );
- token_ptr->conf_hash = Flip_int32( token_ptr->conf_hash );
+ token_ptr->type = Flip_int32( token_ptr->type );
+ token_ptr->transmiter_id = Flip_int32( token_ptr->transmiter_id );
+ token_ptr->proc_id = Flip_int32( token_ptr->proc_id );
+ token_ptr->memb_id.proc_id = Flip_int32( token_ptr->memb_id.proc_id );
+ token_ptr->memb_id.time = Flip_int32( token_ptr->memb_id.time );
+ token_ptr->seq = Flip_int32( token_ptr->seq );
+ token_ptr->aru = Flip_int32( token_ptr->aru );
+ token_ptr->aru_last_id = Flip_int32( token_ptr->aru_last_id );
+ token_ptr->flow_control = Flip_int16( token_ptr->flow_control );
+ token_ptr->rtr_len = Flip_int16( token_ptr->rtr_len );
+ token_ptr->conf_hash = Flip_int32( token_ptr->conf_hash );
}
Modified: trunk/daemon/protocol.c
===================================================================
--- trunk/daemon/protocol.c 2014-01-22 06:17:58 UTC (rev 671)
+++ trunk/daemon/protocol.c 2014-01-22 06:24:57 UTC (rev 672)
@@ -489,19 +489,19 @@
int num_bcast, num_token;
channel *bcast_channels;
channel *token_channels;
+ membership_id memb_id;
/* int r1,r2;*/
ret = Net_recv_token( fd, &New_token );
- /* from another monitor component */
- if( ret == 0 ) return;
+ if( ret <= 0 ) return;
+
/* delete random
r1 = ((-My.id)%17)+3;
r2 = get_rand() % (r1+3 );
if ( r2 == 0 ) return; */
- /* check if it is a regular token */
if( Is_form( Token->type ) )
{
Alarmp( SPLOG_INFO, PROTOCOL, "Prot_handle_token: it is a Form Token.\n" );
@@ -519,6 +519,12 @@
goto END;
}
+ if ( !Memb_is_equal( Token->memb_id, ( memb_id = Memb_active_id() ) ) ) {
+ Alarmp( SPLOG_INFO, PROTOCOL, "Prot_handle_token: received token for wrong memb id (%d, %d)! Should be (%d, %d)\n",
+ Token->memb_id.proc_id, Token->memb_id.time, memb_id.proc_id, memb_id.time );
+ goto END;
+ }
+
if ( Token->transmiter_id != (rtr_proc_id = Conf_previous( Memb_active_ptr() ) ) ) {
Alarmp( SPLOG_INFO, PROTOCOL, "Prot_handle_token: Received token from unexpected transmitter! Should be 0x%08X\n", rtr_proc_id );
goto END;
More information about the Spread-cvs
mailing list