AnsweredAssumed Answered

imx28 problem with socket

Question asked by Silvia Gonzalez on Feb 17, 2015
Latest reply on Feb 26, 2015 by alejandrolozano

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.

Outcomes