imx28 problem with socket

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

imx28 problem with socket

1,111 次查看
silviagonzalez
Contributor II

Hi.

We have two imx28 with linux kernel 3.10. we make a network device driver (eth2) to send message by the spi bus. The problems begins when We receive a message.

The driver works fine. We know that the protocol number of the messagte is htons(ETH_P_IPV6), because te skb->protocol=0x86dd.

struct sk_buff *skb;

  skb->protocol = eth_type_trans(skb, dev);


In one imx28 We create a socket to send message:

    sock = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)

    memset(&client, 0, sizeof(client)); 

    client.sin6_family = AF_INET6;           

    client.sin6_addr = in6addr_any;

    client.sin6_port = htons(20000); 

    client.sin6_scope_id=if_nametoindex("eth2");

//From

    memset(&from, 0, sizeof(from));  

    from.sin6_family = AF_INET6;  

    inet_pton(AF_INET6,"ff02::2",(void*)&from.sin6_addr.s6_addr);

    from.sin6_port = htons(15118);

//bind

    bind(sockEnvio,(struct sockaddr *)&client,sizeof(client));

//send

    sendto(sockEnvio, data, localIPLen, 0, (struct sockaddr *) &from, sizeof(from)) ;

In the other imx28 We create a socket to receive the message

    sock = socket(AF_INET6, SOCK_DGRAM, htons(ETH_P_IPV6))) < 0)

    memset(&client, 0, sizeof(client)); 

    client.sin6_family = AF_INET6;           

    client.sin6_addr = in6addr_any;

    client.sin6_port = htons(20000); 

    client.sin6_scope_id=if_nametoindex("eth2");

//bind

    bind(sockEnvio,(struct sockaddr *)&client,sizeof(client));

//send

    recvfrom(sockEnvio,buffer, BUFFER_SIZE , 0 , (struct sockaddr *) &from , &from_size);

When We change the type of the socket to socket(AF_PACKET , SOCK_RAW , htons(ETH_P_IPV6))) < 0) We receive the message.

Are we missing anything? Could you help us, please?

Thanks in advance for your help.

标签 (2)
标记 (1)
0 项奖励
回复
1 回复

950 次查看
alejandrolozan1
NXP Employee
NXP Employee

Hi,

Did you change the socket type in only one board?

Is it possible that you share your code so we can test it?

Best Regards,

Alejadro

0 项奖励
回复