UNIX Socket FAQ

A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

  • Index
  • » Networking
  • » Sending VLAN Packet using Socket and Impacket Python 2.7

#1 2015-02-10 08:13 AM

justin777
Member
Registered: 2015-02-10
Posts: 6

Sending VLAN Packet using Socket and Impacket Python 2.7

Offline

#2 2015-02-10 01:09 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,847
Website

Re: Sending VLAN Packet using Socket and Impacket Python 2.7

Well, I'm rusty on my Python, and am totally unfamiliar with this "Impacket" package...  But, I can tell you that in C, on Linux, if you were trying to send raw Ethernet frames, you'd want to be using an AF_PACKET socket, not an AF_INET*/SOCK_RAW socket...  (Or, alternatively an AF_INET*/SOCK_PACKET socket for older systems...)  So, I have to suspect that's your main problem...  By using AF_INET6/SOCK_RAW, it's expecting you to send out an IPv6 packet with all its headers; but, it's NOT expecting you to be sending any Ethernet headers!

Offline

#3 2015-02-10 03:47 PM

justin777
Member
Registered: 2015-02-10
Posts: 6

Re: Sending VLAN Packet using Socket and Impacket Python 2.7

So normally if you will send a packet with VLAN you should not use (socket.AF_INET6, socket.SOCK_RAW, socket.IPPROTO_ICMPV6) ?

Let say in C, what are the parameters you will need like socket.socket(socket.AF_PACKET...) and what else should I keep in mind.

I can test your proposal solution tomorrow so I'm asking if I need to look out for more errors in my part

Offline

#4 2015-02-10 10:03 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,847
Website

Re: Sending VLAN Packet using Socket and Impacket Python 2.7

sock = socket (AF_PACKET, SOCK_RAW, htons(ETH_P_IP));

Offline

  • Index
  • » Networking
  • » Sending VLAN Packet using Socket and Impacket Python 2.7

Board footer

Powered by FluxBB