Beispiel #1
0
// FIXME: Copy & Paste from hello_switch.c
static void
handle_hello( uint32_t xid, uint8_t version, void *user_data ) {
    UNUSED( version );
    UNUSED( user_data );

    switch_send_openflow_message( create_hello( xid ) );
}
Beispiel #2
0
/*-----------------------------------------------------------------------------------*/
void
sec_arp_init(void)
{
	uint8_t sum, i;
	uint8_t temp_buf[KEY_SIZE*3];

	/* Read security data from Flash mem */
	xmem_pread(temp_buf, (KEY_SIZE*3), MAC_SECURITY_DATA);

	/* Check if we have a network key */
	sum = 0;
	for(i=KEY_SIZE; i>0; i--) {sum |= temp_buf[i-1];}
	if(!(sum))	{
		/* Init slip connection */
		slip_arch_init(BAUD2UBR(115200));
		PRINTF("sec-arp: Start slip process\n");
		process_start(&slip_process, NULL);
		slip_set_input_callback(slip_input_callback);

		/* Send hello packet */
		create_hello();
	} else {
		PRINTF("sec-arp: Key OK\n");
#if DEBUG
		PRINTF("sec-arp: buf ");
		for(i=0; i<(KEY_SIZE*3); i++) PRINTF("%02x ", temp_buf[i]);
		PRINTF("\n");
#endif
		/* Set security data */
		set_security_data(temp_buf);
	}
}
Beispiel #3
0
static void
send_hello( uint64_t datapath_id, void *count ) {
  for ( int i = 0; i < *( ( int * ) count ); i++ ) {
    buffer *hello = create_hello( get_transaction_id(), NULL );
    bool ret = send_openflow_message( datapath_id, hello );
    if ( !ret ) {
      error( "Failed to send an hello message to the switch with datapath ID = %#" PRIx64 ".", datapath_id );
    }
    free_buffer( hello );
  }
}
Beispiel #4
0
int
ofpmsg_send_hello( struct switch_info *sw_info ) {
  int ret;
  buffer *buf;

  buf = create_hello( generate_xid() );

  ret = send_to_secure_channel( sw_info, buf );
  if ( ret == 0 ) {
    debug( "Send 'hello' to a switch. fd:%d", sw_info->secure_channel_fd );
  }

  return ret;
}