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>
This commit is contained in:
parent
a7499bb1b1
commit
f57a550e39
@ -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
|
||||
|
@ -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
|
||||
|
||||
@ -51,6 +52,18 @@ class vlan(packet_base.PacketBase):
|
||||
self.vid = vid
|
||||
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)
|
||||
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user