Exemple #1
0
    def post_build(self, pkt, pay):
        # calculating checksum if requested
        pdu = pkt + pay
        checksumInfo = self[1].checksum_info(self.hdrlen)

        if checksumInfo is not None:
            (cbegin, cpos) = checksumInfo
            checkbytes = fletcher16_checkbytes(pdu[cbegin:], (cpos - cbegin))
            pdu = pdu[:cpos] + checkbytes + pdu[cpos + 2:]

        return pdu
Exemple #2
0
    def post_build(self, pkt, pay):
        # calculating checksum if requested
        pdu = pkt + pay
        checksumInfo = self[1].checksum_info(self.hdrlen)

        if checksumInfo is not None:
            (cbegin, cpos) = checksumInfo
            checkbytes = fletcher16_checkbytes(pdu[cbegin:], (cpos - cbegin))
            pdu = pdu[:cpos] + checkbytes + pdu[cpos+2:]

        return pdu
Exemple #3
0
def ospf_lsa_checksum(lsa):
    return fletcher16_checkbytes(b"\x00\x00" + lsa[2:], 16)  # leave out age
Exemple #4
0
def ospf_lsa_checksum(lsa):
    return fletcher16_checkbytes(b"\x00\x00" + lsa[2:], 16)  # leave out age