def compute_checksum(self): self.header_checksum.val = 0 packet = self.raw_val(parents=False) self.header_checksum.val = utils.cksum(packet) return self.header_checksum.val
def compute_checksum(self): self.checksum.val = 0 ipv4_pseudo_header = '%s%s\x00%s%s' % ( self._parent.saddr.raw_val(), self._parent.daddr.raw_val(), self._parent.protocol.raw_val('B'), fields.Int(self.length.val).raw_val('!H'), ) self.checksum.val = utils.cksum(ipv4_pseudo_header + self.raw_val(parents=False) + self.payload) return self.checksum.val
def compute_checksum(self): self.checksum = fields.HexIntClass(0, 4) packet = self.raw_val(parents=False) + self.payload self.checksum.val = utils.cksum(packet) return self.checksum