Can some one clarify me regarding maximum frame length supported by raw socket sendto call with vlan.

I use a PF raw socket to send out triple tag packet from application module to kernel module. But excluding triple tag length, only frame length of 1504 bytes were transmitted successfully by the socket. As per my understanding, socket tx sendto call should support max of 1518 for untag frames and 1526 for tagged frames.

Please correct me if iam wrong. Would there be any way i can increase the tx frame size of tagged frames to 1526 in socket sendto call.

Thanks in advance

code snippet:

//create socket interface
const int ETH_PROT_RAW_SOCK_FILTER = 0x8100
const int maxFrameSize = 1526;
const int maxUntagSize = 1518;
const char InterfaceName[] = "eth2.4090";

unsigned char SockRxBuffer[maxFrameSize];
unsigned char SockTxBuff[maxFrameSize];


//Get the interface number for a given interface name
if( ioctl(RawSockID, SIOCGIFINDEX, &InterfaceRequest) == -1)

//Now use the Interface ID to bind the raw socket to a specific device
memset(&RawSockAddrInfo, 0, sizeof(struct sockaddr_ll));
RawSockAddrInfo.sll_family = AF_PACKET;
RawSockAddrInfo.sll_ifindex = InterfaceRequest.ifr_ifindex;
RawSockAddrInfo.sll_protocol = htons(ETH_PROT_RAW_SOCK_FILTER);
if (bind(RawSockID, (struct sockaddr *) &RawSockAddrInfo, sizeof(struct sockaddr_ll)) < 0)

//Set the socket to non-blocking
if(fcntl(RawSockID, F_SETFL,O_NONBLOCK) == -1)

//Finally init the last variable to be used by the sendto()/recvfrom() socket APIs
RawSockAddrInfoLength = sizeof(struct sockaddr_ll);

//rcv single tag frames
if((NumRxBytes = recvfrom(RawSockID,
maxFrameSize, 0,
(struct sockaddr *) &RawSockAddrInfo,
(socklen_t *)&RawSockAddrInfoLength) )== -1 )

//Tx the packet - with tripple tag - add 4090/tag1/tag2, max frame size supported 1516(with all 3 tags)
NumTxBytes, 0,
(struct sockaddr *) &RawSockAddrInfo,
RawSockAddrInfoLength) == -1)