예제 #1
0
static void
dump_filter_strict( void ) {
  oxm_matches *match = create_oxm_matches();
  append_oxm_match_in_port( match, 1 );
  append_oxm_match_eth_type( match, 0x0800 );
  append_oxm_match_vlan_vid( match, 0, 0 );
  append_oxm_match_ipv4_src( match, 0x0a000001, 0 );
  append_oxm_match_ipv4_dst( match, 0x0a000002, 0 );
  append_oxm_match_ip_dscp( match, 0 );
  append_oxm_match_ip_ecn( match, 0 );
  append_oxm_match_ip_proto( match, 0x6 );
  append_oxm_match_tcp_src( match, 1024 );
  append_oxm_match_tcp_dst( match, 2048 );

  static handler_data data;
  data.match = match;
  snprintf( data.service_name, sizeof( data.service_name ), "dumper" );
  data.service_name[ sizeof( data.service_name ) - 1 ] = '\0';
  data.strict = true;

  bool ret = dump_packetin_filter( data.match, OFP_HIGH_PRIORITY, data.service_name, data.strict,
                                   dump_filters, &data );
  if ( ret == false ) {
    error( "Failed to dump packetin filters ( ret = %d ).", ret );
  }
  else {
    add_periodic_event_callback( 5, timeout, &data );
  }
}
예제 #2
0
static VALUE
pack_ipv4_src_addr( VALUE self, VALUE actions, VALUE options ) {
  VALUE r_ip_addr = HASH_REF( options, ip_addr );
  if ( rb_obj_is_kind_of( actions, basic_action_eval ) ) {
    append_action_set_field_ipv4_src( openflow_actions_ptr( actions ), ip_addr_to_i( r_ip_addr ) );
  }
  else if ( rb_obj_is_kind_of( actions, flexible_action_eval ) ) {
    append_oxm_match_ipv4_src( oxm_match_ptr( actions ), ip_addr_to_i( r_ip_addr ), 0 ); 
  }

  return self;
}
예제 #3
0
static void
test_map_entry_if_match_set_nw_src() {
  add_all_exact_entry();
  add_all_wildcards_entry();

  oxm_matches *match = create_oxm_matches();
  append_oxm_match_eth_type( match, ETHERTYPE_IP );
  append_oxm_match_ipv4_src( match, 0x0a000101, 0 );
  char *user_data = xstrdup( USER_DATA );
  count = 0;
  map_match_table( match, test_map_entry_if_match_set_nw_src_helper, user_data );
  assert_int_equal( count, 2 );

  XFREE( user_data );

  delete_oxm_matches( match );
}
static void
alloc_MATCH() {
  uint8_t dst_mac[6] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
  uint8_t src_mac[6] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
  uint8_t nomask[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

  MATCH = create_oxm_matches();
  append_oxm_match_in_port( MATCH, 1 );
  append_oxm_match_eth_dst( MATCH, dst_mac, nomask );
  append_oxm_match_eth_src( MATCH, src_mac, nomask );
  append_oxm_match_vlan_vid( MATCH, 1, 0 );
  append_oxm_match_vlan_pcp( MATCH, 1 );
  append_oxm_match_eth_type( MATCH, 0x0800 );
  append_oxm_match_ip_proto( MATCH, 0x6 );
  append_oxm_match_ipv4_src( MATCH, 0x0a090807, 0x00000000 );
  append_oxm_match_ipv4_dst( MATCH, 0x0a090807, 0x00000000 );
  append_oxm_match_tcp_src( MATCH, 1024 );
  append_oxm_match_tcp_dst( MATCH, 2048 );
}
예제 #5
0
static void
set_alice_match_entry( oxm_matches *match ) {
  append_oxm_match_eth_type( match, ETHERTYPE_IP );
  append_oxm_match_ipv4_src( match, 0x0a000101, 0 );
  append_oxm_match_ipv4_dst( match, 0x0a000202, 0 );
}
예제 #6
0
static void
set_carol_wildcards_entry( oxm_matches *match ) {
  append_oxm_match_eth_type( match, ETHERTYPE_IP );
  append_oxm_match_ipv4_src( match, 0x0a000303, 0 );
}
예제 #7
0
static void
set_nw_prefix_28_wildcards_entry( oxm_matches *match ) {
  append_oxm_match_eth_type( match, ETHERTYPE_IP );
  append_oxm_match_ipv4_src( match, 0x0a000200, 0xfffffff0 );
  append_oxm_match_ipv4_dst( match, 0x0a000100, 0xfffffff0 );
}