def extract_padding(self, data):
        """Extract the IPv6 payload"""

        if self.plen == 0 and self.nh == 0 and len(data) >= 8:
            # Extract Hop-by-Hop extension length
            hbh_len = orb(data[1])
            hbh_len = 8 + hbh_len * 8

            # Extract length from the Jumbogram option
            # Note: the following algorithm take advantage of the Jumbo option
            #        mandatory alignment (4n + 2, RFC2675 Section 2)
            jumbo_len = None
            idx = 0
            offset = 4 * idx + 2
            while offset <= len(data):
                opt_type = orb(data[offset])
                if opt_type == 0xc2:  # Jumbo option
                    jumbo_len = struct.unpack("I", data[offset + 2:offset + 2 + 4])[0]  # noqa: E501
                    break
                offset = 4 * idx + 2
                idx += 1

            if jumbo_len is None:
                warning("Scapy did not find a Jumbo option")
                jumbo_len = 0

            tmp_len = hbh_len + jumbo_len
        else:
            tmp_len = self.plen

        return data[:tmp_len], data[tmp_len:]
def extract_padding ( self , data ) : if self . plen == 0 and self . nh == 0 and len ( data ) >= 8 : hbh_len = orb ( data [ 1 ] ) hbh_len = 8 + hbh_len * 8 jumbo_len = None idx = 0 offset = 4 * idx + 2 while offset <= len ( data ) : opt_type = orb ( data [ offset ] ) if opt_type == 0xc2 : jumbo_len = struct . unpack ( "I" , data [ offset + 2 : offset + 2 + 4 ] ) [ 0 ] break offset = 4 * idx + 2 idx += 1 if jumbo_len is None : warning ( "Scapy did not find a Jumbo option" ) jumbo_len = 0 tmp_len = hbh_len + jumbo_len else : tmp_len = self . plen return data [ : tmp_len ] , data [ tmp_len : ]
Extract the IPv6 payload