[pox-dev] Constructing 802.1q ethernet frames with POX's library

Lucas Brasilino lucas.brasilino at gmail.com
Wed Nov 20 12:49:37 PST 2013


Hi!

I'm about to develop a POX component that will deal with:

1) VLAN related header field (adding/removing/changing VLAN ID/PCP/EtherType)

2) Some bytes within L2 protocol payload (adding/removing/changing),
but before L3 payload.

By now I'm looking around item #1, using pox.lib.packet direct. I
could not realise how can I set such VLAN's field. I did (from pox
directory) using python interactively:

>>> import pox.lib.packet as pkt

>>> eth=pkt.ethernet(src="00:00:00:00:00:01",dst="00:00:00:00:00:02",type=pkt.ethernet.VLAN_TYPE)

>>> vlan=pkt.vlan(id=10)

>>> vlan.dump()
'[VLAN vlan=10 pcp=0 ether=802.3/0000]'

>>> ip=pkt.ipv4(srcip=IPAddr("10.0.0.1"),dstip=IPAddr("10.0.0.2"),protocol=pkt.ipv4.TCP_PROTOCOL)

>>> eth.payload=ip
>>> eth.dump()
'[00:00:00:00:00:01>00:00:00:00:00:02 VLAN][IP+TCP 10.0.0.1>10.0.0.2
(cs:00 v:4 hl:5 l:20 t:64)][0 bytes]'

So, I'm not sure if this is the right path, but how can I 'add' vlan
header object ('vlan' object) to the ethernet packet object ('eth'
object)?

By the way, is item #2 feasible ? How ?

Thanks a lot in advance

regards
Lucas Brasilino


More information about the pox-dev mailing list