diff options
author | HIYAMA Manabu <hiyama.manabu@po.ntts.co.jp> | 2012-09-26 13:09:29 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2012-09-26 13:11:16 +0900 |
commit | 19c205b897aa7cc74a68bfc077937481ea1a5936 (patch) | |
tree | 6362424a4d221fa3573ca88a7df223b6e3a633de | |
parent | 79e7d09cf04f313555a7a838eebd463a45def43c (diff) |
packet lib: fix vlan pcp bitshift
Signed-off-by: HIYAMA Manabu <hiyama.manabu@po.ntts.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/lib/packet/vlan.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ryu/lib/packet/vlan.py b/ryu/lib/packet/vlan.py index 4fb93a19..dfd09341 100644 --- a/ryu/lib/packet/vlan.py +++ b/ryu/lib/packet/vlan.py @@ -36,13 +36,13 @@ class vlan(packet_base.PacketBase): @classmethod def parser(cls, buf): tci, ethertype = struct.unpack_from(cls._PACK_STR, buf) - pcp = tci >> 15 + pcp = tci >> 13 cfi = (tci >> 12) & 1 vid = tci & ((1 << 12) - 1) return cls(pcp, cfi, vid, ethertype), vlan.get_packet_type(ethertype) def serialize(self, payload, prev): - tci = self.pcp << 15 | self.cfi << 12 | self.vid + tci = self.pcp << 13 | self.cfi << 12 | self.vid return struct.pack(vlan._PACK_STR, tci, self.ethertype) vlan.register_packet_type(arp.arp, ether.ETH_TYPE_ARP) |