MCPcopy Index your code
hub / github.com/secdev/scapy / ICMPv6NDOptCGA

Class ICMPv6NDOptCGA

scapy/contrib/send.py:57–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55
56
57class ICMPv6NDOptCGA(_ICMPv6NDGuessPayload, Packet):
58 name = "ICMPv6NDOptCGA"
59 fields_desc = [ByteField("type", 11),
60 FieldLenField("len", None, length_of="CGA_PARAMS", fmt="B", adjust=lambda pkt, x: (x + pkt.padlength + 4) // 8), # noqa: E501
61 FieldLenField("padlength", 0, length_of="padding", fmt="B"),
62 ByteField("reserved", 0),
63 PacketLenField("CGA_PARAMS", "", CGA_Params, length_from=lambda pkt: pkt.len * 8 - pkt.padlength - 4), # noqa: E501
64 StrLenField("padding", "", length_from=lambda pkt: pkt.padlength)] # noqa: E501
65
66 def post_build(self, p, pay):
67 l_ = len(self.CGA_PARAMS)
68 tmp_len = -(4 + l_) % 8 # Pad to 8 bytes
69 p = p[:1] + chb((4 + l_ + tmp_len) // 8) + chb(tmp_len) + p[3:4 + l_]
70 p += b"\x00" * tmp_len + pay
71 return p
72
73
74send_icmp6ndoptscls = {11: ICMPv6NDOptCGA,

Callers

nothing calls this directly

Calls 4

ByteFieldClass · 0.90
FieldLenFieldClass · 0.90
PacketLenFieldClass · 0.90
StrLenFieldClass · 0.90

Tested by

no test coverage detected