This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Raw socket + 802.1Q (NDK and DM6437)

Hi all,
I'm trying to send raw packets on a specific VLAN.

I have 3 interace: eth0, eth0:1 (vlan id 1), eth0:2 (vlan id 2).
I try to "bind" the socket to eth0:2 to send all the packets with vlan id 2 using:

setsockopt(socket, SOL_SOCKET, SO_IFDEVICE, &index_of_eth02, sizeof(index_of_eth02));

It's difficult to debug on my infrastructure but it seems that the packets have sent without tag.
Is my socket configuration correct?
Do I have to write also the 802.1Q header in the raw buffer?

Thank you in advance for your helps,
Simone Cilli

Here my code snippet:
socket = socket(AF_RAWETH, SOCK_RAWETH, 0x1);
index_of_eth02 = my_getInterfaceIndex("eth0:2", socket);
setsockopt(socket, SOL_SOCKET, SO_IFDEVICE, &index_of_eth02 , sizeof(index_of_eth02 ));
// set SO_PRIORITY, SO_RCVBUF, SO_SNDBUF
//Init buf: DESTMAC(6Bytes) + SRCMAC(6Bytes) + LEN802.3(2Bytes) + LLC(3Bytes) + DATA
send(socket, buf, len, 0);

Here my system specifics

  • NDK 2.0
  • DSP/BIOS 5.31.02
  • DM6437
  • Code Composer Studio 3.3.38.2