+
+ switch( r->gwtype )
+ {
+ case CGW_TYPE_CONFIG:
+ listen( 0, *(struct in_addr*)nla_data( tb[CGW_LISTEN_IP] ),
+ *(u16*)nla_data( tb[CGW_LISTEN_PORT] ) );
+ break;
+ case CGW_TYPE_CAN_ETH_UDP:
+ printk( KERN_INFO "can:%d\n", *(int*)nla_data( tb[CGW_CAN_IF] ) );
+ printk( KERN_INFO "eth addr:%x\n", *(u32*)nla_data( tb[CGW_ETH_IP] ) );
+ printk( KERN_INFO "eth port:%hu\n", *(u16*)nla_data( tb[CGW_ETH_PORT] ) );
+ cethgw = kmalloc( sizeof(struct can_eth_gw), GFP_KERNEL );
+ if( cethgw == NULL )
+ {
+ printk( KERN_ERR "error: kmalloc\n" );
+ break;
+ }
+ cethgw->src_if_idx = *(int*)nla_data( tb[CGW_CAN_IF] );
+ cethgw->dst_addr = *(struct in_addr*)nla_data( tb[CGW_ETH_IP] );
+ cethgw->dst_port = *(u16*)nla_data( tb[CGW_ETH_PORT] );
+
+ hlist_add_head_rcu( &cethgw->list, &can_eth_job );
+ break;
+ case CGW_TYPE_ETH_CAN_UDP:
+ printk( KERN_INFO "can:%d\n", *(int*)nla_data( tb[CGW_CAN_IF] ) );
+ ecangw = kmalloc( sizeof(struct eth_can_gw), GFP_KERNEL );
+ if( ecangw == NULL )
+ {
+ printk( KERN_ERR "error: kmalloc\n" );
+ break;
+ }
+ ecangw->dst_if_idx = *(int*)nla_data( tb[CGW_CAN_IF] );
+ hlist_add_head_rcu( &ecangw->list, ð_can_job );
+ break;
+ default:
+ printk( "default" );
+ /* ToDo undef operation */
+ break;
+ }
+
+ return 0;
+}
+
+static int listen( int can_ifidx, struct in_addr eth_addr, u16 eth_port )
+{
+ struct sockaddr_in udp_addr;
+ struct sockaddr_can can_addr;
+ struct socket* tmp;
+
+ printk( KERN_INFO "listen called\n" );
+
+ if( sock_create_kern( PF_INET, SOCK_DGRAM, IPPROTO_UDP, &tmp) != 0 )