summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorwatanabe.fumitaka <watanabe.fumitaka@nttcom.co.jp>2013-07-31 19:42:37 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2013-07-31 19:42:37 +0900
commitf57a550e397e6c6e1928eefc6217b1b83660dbaa (patch)
tree5c5b77178f8af5a54cf68b36f6db32813e4028d4
parenta7499bb1b10a86e15e2823d1b5ff85e1841f932b (diff)
link to LLC sub layer
Signed-off-by: WATANABE Fumitaka <watanabe.fumitaka@nttcom.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/lib/packet/ethernet.py12
-rw-r--r--ryu/lib/packet/vlan.py14
-rw-r--r--ryu/ofproto/ether.py1
3 files changed, 27 insertions, 0 deletions
diff --git a/ryu/lib/packet/ethernet.py b/ryu/lib/packet/ethernet.py
index 3db0e163..83cc1d63 100644
--- a/ryu/lib/packet/ethernet.py
+++ b/ryu/lib/packet/ethernet.py
@@ -54,6 +54,18 @@ class ethernet(packet_base.PacketBase):
return struct.pack(ethernet._PACK_STR, self.dst, self.src,
self.ethertype)
+ @classmethod
+ def get_packet_type(cls, type_):
+ """Override method for the ethernet IEEE802.3 Length/Type
+ field (self.ethertype).
+
+ If the value of Length/Type field is less than or equal to
+ 1500 decimal(05DC hexadecimal), it means Length interpretation
+ and be passed to the LLC sublayer."""
+ if type_ <= ether.ETH_TYPE_IEEE802_3:
+ type_ = ether.ETH_TYPE_IEEE802_3
+ return cls._TYPES.get(type_)
+
# copy vlan _TYPES
ethernet._TYPES = vlan.vlan._TYPES
diff --git a/ryu/lib/packet/vlan.py b/ryu/lib/packet/vlan.py
index cbd63968..477b8eef 100644
--- a/ryu/lib/packet/vlan.py
+++ b/ryu/lib/packet/vlan.py
@@ -20,6 +20,7 @@ from . import ipv4
from . import ipv6
from . import lldp
from . import slow
+from . import llc
from ryu.ofproto import ether
from ryu.ofproto.ofproto_parser import msg_pack_into
@@ -52,6 +53,18 @@ class vlan(packet_base.PacketBase):
self.ethertype = ethertype
@classmethod
+ def get_packet_type(cls, type_):
+ """Override method for the Length/Type field (self.ethertype).
+ The Length/Type field means Length or Type interpretation,
+ same as ethernet IEEE802.3.
+ If the value of Length/Type field is less than or equal to
+ 1500 decimal(05DC hexadecimal), it means Length interpretation
+ and be passed to the LLC sublayer."""
+ if type_ <= ether.ETH_TYPE_IEEE802_3:
+ type_ = ether.ETH_TYPE_IEEE802_3
+ return cls._TYPES.get(type_)
+
+ @classmethod
def parser(cls, buf):
tci, ethertype = struct.unpack_from(cls._PACK_STR, buf)
pcp = tci >> 13
@@ -69,3 +82,4 @@ vlan.register_packet_type(ipv4.ipv4, ether.ETH_TYPE_IP)
vlan.register_packet_type(ipv6.ipv6, ether.ETH_TYPE_IPV6)
vlan.register_packet_type(lldp.lldp, ether.ETH_TYPE_LLDP)
vlan.register_packet_type(slow.slow, ether.ETH_TYPE_SLOW)
+vlan.register_packet_type(llc.llc, ether.ETH_TYPE_IEEE802_3)
diff --git a/ryu/ofproto/ether.py b/ryu/ofproto/ether.py
index a4f55255..f4883a39 100644
--- a/ryu/ofproto/ether.py
+++ b/ryu/ofproto/ether.py
@@ -21,3 +21,4 @@ ETH_TYPE_IPV6 = 0x86dd
ETH_TYPE_MPLS = 0x8847
ETH_TYPE_SLOW = 0x8809
ETH_TYPE_LLDP = 0x88cc
+ETH_TYPE_IEEE802_3 = 0x05dc