| 55 | |
| 56 | |
| 57 | class 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 | |
| 74 | send_icmp6ndoptscls = {11: ICMPv6NDOptCGA, |
nothing calls this directly
no test coverage detected