using linux raw socket with vconfig interface -


i want use socket transmit packet untouched tried using raw socket this.

static int raw_sock = 0; static struct sockaddr_ll saddr; static struct ifreq ifr; static int ifindex; raw_sock = socket(pf_packet, sock_raw, htons(eth_p_all)); memset(&ifr,0,sizeof(ifr)); memset(&saddr,0,sizeof(saddr)); strcpy(ifr.ifr_name,"eth0"); ioctl(raw_sock,siocgifindex,&ifr); ifindex = ifr.ifr_ifindex; saddr.sll_family = af_packet; saddr.sll_ifindex = ifindex; saddr.sll_protocol = eth_p_all; sendto(raw_sock,pkt.buffer,pkt.pkt_len,0,(struct sockaddr *)&saddr,sizeof(saddr)); 

everything work correctly want after added vlan interface using

vconfig add eth0 4000 

the above code not work before. automatically add vlan tag 0x81 0x00 0x00 0x00 packet transmitted out. has solution this. want send packet untouched. thank you.

try sending vlan0, instead of eth0.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -