mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-09 06:16:10 +02:00
packet lib: icmp support time exceeded type
Used mainly for traceroute. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
e89eb36465
commit
d33ef49213
@ -24,6 +24,7 @@ ICMP_DEST_UNREACH = 3
|
||||
ICMP_SRC_QUENCH = 4
|
||||
ICMP_REDIRECT = 5
|
||||
ICMP_ECHO_REQUEST = 8
|
||||
ICMP_TIME_EXCEEDED = 11
|
||||
|
||||
|
||||
class icmp(packet_base.PacketBase):
|
||||
@ -146,3 +147,20 @@ class echo(object):
|
||||
hdr += self.data
|
||||
|
||||
return hdr
|
||||
|
||||
|
||||
@icmp.register_icmp_type(ICMP_TIME_EXCEEDED)
|
||||
class TimeExceeded(object):
|
||||
_PACK_STR = '!4x'
|
||||
_MIN_LEN = struct.calcsize(_PACK_STR)
|
||||
|
||||
def __init__(self, data=None):
|
||||
self.data = data
|
||||
|
||||
def serialize(self):
|
||||
hdr = bytearray(TimeExceeded._MIN_LEN)
|
||||
|
||||
if self.data is not None:
|
||||
hdr += self.data
|
||||
|
||||
return hdr
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user